I'm trying to setup continuous integration with codeship. Our project is a Rails API with an angular app which, for now, is in public directory. In order to work, grunt needs to find compass executable.
I would say that setup commands should be:
rvm use 2.1.3 --install
bundle install
export RAILS_ENV=test
bundle exec rake db:schema:load
bundle exec rake db:migrate
bundle exec rake db:test:prepare
# We need compass in frontend
gem install compass
nvm install 0.10.25
nvm use 0.10.25
npm install
npm install -g grunt-cli
And test pipeline:
bundle exec rspec
cd public && grunt test
However, it seems that codeship doesn't like gem install compass line and it complains with:
Running "concurrent:test" (concurrent) task Warning: /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.4.2 in any of the sources
(Bundler::GemNotFound) from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler/spec_set.rb:85:in `map!'
from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler/spec_set.rb:85:in `materialize'
from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler/definition.rb:132:in `specs' from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler/definition.rb:177:in `specs_for' from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler/runtime.rb:13:in `setup'
from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler.rb:129:in `setup' from /home/rof/.rvm/gems/ruby-2.1.3/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
from /home/rof/.rvm/gems/ruby-2.1.3/gems/compass-1.0.3/bin/compass:26:in `<top (required)>'
from /home/rof/.rvm/gems/ruby-2.1.3/bin/compass:23:in `load'
from /home/rof/.rvm/gems/ruby-2.1.3/bin/compass:23:in `<main>'
from /home/rof/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
from /home/rof/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
Use --force to continue.
And it gives me a hint I'm not sure to understand:
Please make sure the gem wasn't yanked from http://www.rubygems.org
However, if I remove gem install compass line and, instead, I add compass to my Rails app Gemfile, it works. But I really feel ugly and bad about adding compass to my Gemfile. It has nothing to do with it. My Rails app is a REST API so it doesn't want to know anything about compass, css or anything like that.
Thanks.
I had the same issue today and this is how I solved it:
I edited the Setup Commands on Project Settings > Test.
This way you can run the command gem install compass before run the grunt task(s).
This is how it looks:
Setup Commands screenshot
I hope this works for you too
Related
I want to create a Minitest example that uses ActiveRecord. I am installing required gems with bundler/inline:
# activerecord_bug_test.rb
require "bundler/inline"
gemfile(true) do
source "http://rubygems.org"
gem "activerecord", "6.0.2.2"
gem "sqlite3", "1.4.2"
end
# test code
When I run bundle exec ruby activerecord_bug_test.rb it fails with
/Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/installer/parallel_installer.rb:197:in `handle_error': Gem::Ext::BuildError: ERROR: Failed to build gem native extension. (Bundler::InstallError)
current directory: /Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3
/Users/hirurg103/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20200324-11504-1f7q6pd.rb extconf.rb
/Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/definition.rb:32:in `build': /Users/hirurg103/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.2/ext/sqlite3/Gemfile not found (Bundler::GemfileNotFound)
...
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'` succeeds before bundling.
When I install sqlite3 with
gem install sqlite3 -v '1.4.2' --source 'http://rubygems.org/'
it goes without errors
Do you have any ideas how to fix this? Thank you
Removing bundle exec prefix fixed the error for me:
ruby activerecord_bug_test.rb
So I am using rails 6.0.1 and trying to use Action text.
So I run the command rails action_text:install
and add the gem image_processing
and finally run rails db:migrate
When I launch my app I got this error message:
Sprockets::FileNotFound in Hotels#index
Showing /myapp/app/views/layouts/application.html.erb where line #8 raised:
couldn't find file 'trix/dist/trix' with type 'text/css'
Checked in these paths:
/myapp/app/assets/config
/myapp/app/assets/images
/myapp/app/assets/javascripts
/myapp/app/assets/stylesheets
/usr/local/bundle/gems/cloudinary-1.13.1/vendor/assets/html
/usr/local/bundle/gems/cloudinary-1.13.1/vendor/assets/javascripts
/usr/local/bundle/gems/activeadmin-2.5.0/app/assets/javascripts
/usr/local/bundle/gems/activeadmin-2.5.0/app/assets/stylesheets
/usr/local/bundle/gems/activeadmin-2.5.0/vendor/assets/javascripts
/usr/local/bundle/gems/jquery-rails-4.3.5/vendor/assets/javascripts
/usr/local/bundle/gems/formtastic-3.1.5/app/assets/stylesheets
/usr/local/bundle/gems/actioncable-6.0.1/app/assets/javascripts
/usr/local/bundle/gems/activestorage-6.0.1/app/assets/javascripts
/usr/local/bundle/gems/actionview-6.0.1/lib/assets/compiled
/usr/local/bundle/gems/turbolinks-source-5.2.0/lib/assets/javascripts
/myapp/node_modules
under assets/config/stylesheets/actiontext.scss I have:
//= require trix/dist/trix
and config/initiliazers/assets.rb:
Rails.application.config.assets.paths << Rails.root.join('node_modules')
Any idea how I could solve this?
I actually find the solution.
I had to run
yarn install --check-files
then reinstall action_text:
rails action_text:install
and then it fixed the issue.
The issue arises while setting up your Rails 6 app for the first time on your PC. You need to install the JS dependencies. Run these lines of code
bundle install
yarn install --check-files
rails action_text:install
I was getting this same error in my CI pipeline in Github Actions, with a Rails 7 app. The above solutions did not help. It turned out I needed to add yarn builds to my action:
# .github/workflows/verify.yml
- name: Compile assets
run: |
yarn build
yarn build:css
I'm trying to build the chosen plugin using grunt. I was able to run the build yesterday, but when I tried it today it ran into errors!
I don't know what I have done or what goes wrong. only this error message:
D:\git\chosen>grunt build
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/project.rb:18:in `open': No such file or directory - repos (Errno::ENOENT)
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/project.rb:18:in `entries'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/project.rb:18:in `generate_files'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/server.rb:13:in `block in <class:Server>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sinatra-1.4.3/lib/sinatra/base.rb:1385:in `configure'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/server.rb:13:in `<class:Server>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/server.rb:2:in `<module:Grunt>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/lib/grunt/server.rb:1:in `<top (required)>'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/grunt-0.0.6/bin/grunt:5:in`<top (required)>'
from C:/Ruby200-x64/bin/grunt:23:in `load'
from C:/Ruby200-x64/bin/grunt:23:in `<main>'
How can I get it to work? or at least where do i begin to fix the problem?
Looks like you have the grunt ruby gem installed which conflicts with your task runner grunt. Just uninstall the Ruby gem with: gem uninstall grunt.
I'm trying to package compass/sass into a self-contained jar so that I can use compass without installing jruby.
I installed jruby and warbler on a Windows7 machine, running Java 1.6.0_37
I created a folder, named it jrcompass, then installed compass into it, i.e.
jruby -S gem install compass -i .
then I ran in it:
jruby -S warble
which created a file named jrcompass.jar of about ~20MB in size. so far so good.
problem is that when I try to execute the jar I get an error message (below). it seemed from the error that jruby.home was not set, so I passed it as a property in the command line and that worked, but it defeats the purpose of having a self-contained jar.
if I try to pass . as jruby.home then I get an error that it can't find rubygems
any help would be appreciated. TIA.
C:\Apps\test\jrcompass>java -jar jrcompass.jar
Gem::LoadError: Could not find compass (>= 0) amongst [rake-0.9.2.2]
to_specs at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:247
to_spec at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:256
gem at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:1231
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/jrcompass/bin/compass:22
load at org/jruby/RubyKernel.java:1046
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
require at org/jruby/RubyKernel.java:1027
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
(root) at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1
When i try to run Ruby on Rails application.... i facing the following error
symbol lookup error: /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
I don't know whats the error exactly. can any one please help me out this......
I had the same issue this morning after upgrading sqlite3-ruby to 1.3.0. A quick fix is to uninstall 1.3.0 and ensure 1.2.5 is installed:
gem uninstall sqlite3-ruby --version 1.3.0
gem install sqlite3-ruby --version 1.2.5
The better option is to set your gem config to ignore 1.3.0. For Rails 2.x, in config/environment.rb:
config.gem 'sqlite3-ruby', :lib => 'sqlite3', :version => '!= 1.3.0'
or if you want it play it really safe, explicitly pull in 1.2.5:
config.gem 'sqlite3-ruby', :lib => 'sqlite3', :version => '1.2.5'
If you lock your gemfile to sqlite3-ruby you will have problems starting your application on recent Rails versions since Rails wants to have the gem named "sqlite3". The real solution to this problem is to ensure that the .bundle file that the gem creates indeed links to the right sqlite3 libraries.
By default, sqlite3 gem will link to a nonexisting library in your /usr/lib. This is NOT right. What you need to do is set the compliation options straight for your system and reinstall the sqlite3 gem, and you can easily do this using
$bundle config
Their manpage specifies what it does, but this is the command that I needed to do (I have a roll-your-own SQLite install from their site, not via brew or macports).
$bundle config build.sqlite3 --with-sqlite3-include=/usr/local/include --with-sqlite3-lib=/usr/local/lib
This will always feed the right options to the gem when you try to "bundle install" it and your gem will build properly.
Note that this problem is kinda sneaky in that it will not occur on Ruby 1.9 - apparently rbconfig there has been updated and does better library lookup. But when you are going for 1.8 compatibility - use this bundle configuration and you will be all set.
I'm had the same issue on my Dreamhost server:
> bundle exec rails c
ruby: symbol lookup error: /home/user/settings/installs/rubygems/gems/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
I downloaded and installed SQLite3 manually in my home directory, and added LD_LIBRARY_PATH to my .bashrc. This fixed the Rails console issue.
However, I still haven't gotten the app to launch in passenger yet, I'm still working on it.
Ruby Enterprise Edition installs the sqlite3 gem automatically, and 1.3.0 seems to be the problem.
If your Rails app doesn't need sqlite3, try uninstalling the gem and restarting your app.
sudo gem uninstall sqlite3