I have a Jenkins CI server and when I run following build script I get errors:
rdoc spec
Here is the errors:
/usr/bin/ruby1.9.1 -S rspec spec/requests/home_spec.rb
/home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find json-1.6.5 in any of the sources (Bundler::GemNotFound)
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler.rb:117:in `setup'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /var/lib/jenkins/jobs/App1/workspace/config/boot.rb:10:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /var/lib/jenkins/jobs/App1/workspace/spec/spec_helper.rb:11:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /var/lib/jenkins/jobs/App1/workspace/spec/requests/home_spec.rb:1:in `<top (required)>'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!
Here is the my Rakefile:
require 'rdoc/task'
require 'rspec/core/rake_task'
desc 'Generate test result'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
end
And here is the my Gemfile:
source :rubygems
# Required gems
gem 'sinatra', '>= 1.3.2'
gem 'rdoc', '>= 3.12'
gem 'rake'
gem 'json', '>= 1.6.5'
group :test do
gem 'rspec', '>= 2.9.0'
gem 'rack-test'
gem 'simplecov', '>= 0.6.1', require: false
end
I don't have any idea. Please help me. I'm using Ruby 1.9.3 with RVM.
Thank you for every advise. Sorry for poor English :)
Probably the reason is that environment where Jenkins is running your build is different than the environment where you run the build.
Usually the difference is caused by an environment variable which is set for you but not for Jenkins
You can check your environment variables by running the command env. You can check Jenkins' environment at Manage Jenkins -> System Information.
If you need to set some environment variables, you can do it at Manage Jenkins -> Configure System.
Related
I am using Jekyll for quite a while now to generate my blog (source). Today, without having changed anything in the generation process, I got
[...]
jekyll build --config _config_prod.yml
Configuration file: _config_prod.yml
/home/moose/GitHub/MartinThoma.github.io/_plugins/caption_tag.rb:23:in `require': cannot load such file -- dimensions (LoadError)
from /home/moose/GitHub/MartinThoma.github.io/_plugins/caption_tag.rb:23:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:74:in `require'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:74:in `block (2 levels) in require_plugin_files'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:73:in `each'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:73:in `block in require_plugin_files'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:72:in `each'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:72:in `require_plugin_files'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/plugin_manager.rb:18:in `conscientious_require'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:79:in `setup'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/site.rb:41:in `initialize'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:29:in `new'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:29:in `process'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
from /usr/lib/ruby/vendor_ruby/mercenary/command.rb:220:in `call'
from /usr/lib/ruby/vendor_ruby/mercenary/command.rb:220:in `block in execute'
from /usr/lib/ruby/vendor_ruby/mercenary/command.rb:220:in `each'
from /usr/lib/ruby/vendor_ruby/mercenary/command.rb:220:in `execute'
from /usr/lib/ruby/vendor_ruby/mercenary/program.rb:42:in `go'
from /usr/lib/ruby/vendor_ruby/mercenary.rb:19:in `program'
from /var/lib/gems/2.1.0/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'
Makefile:35: recipe for target 'deploy' failed
make: *** [deploy] Error 1
I am not a Ruby developer, but I guess the problem is require 'dimensions'? However, when I execute this line in irb it only shows => true.
What is the problem and how can I fix it?
Diagnostic information
$ jekyll --version
jekyll 2.5.3
$ head -1 `which irb`
#!/usr/bin/ruby2.1
$ head -1 `which jekyll`
#!/usr/bin/ruby2.1
Executing RUBY_VERSION in irb gives => "2.1.5".
The problem was fixed by adding gem 'dimensions' to the file Gemfile. It now looks like this:
source "https://rubygems.org"
# see https://github.com/paulrobertlloyd/paulrobertlloyd.com/blob/master/Gemfile
# Guard (automates development tasks)
# Jekyll (generates static files)
gem 'jekyll'
group :jekyll_plugins do
gem 'jekyll-paginate'
gem 'dimensions'
gem 'rmagick'
end
# Rake (manages build tasks)
gem 'rake'
I am using capistrano through Magentify. I am using RVM as a regular user on archlinux. I have it using Ruby 2.0.0 and I ran gem install magentify in a gemset I defined for this purpose. It installed Capistrano 3.0.1 and a about 9 other gems. When I set the recipe, I tried
cap -T
and it writes
cap aborted!
undefined method `map' for :except:Symbol
/home/dirtymikeandtheboys/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:24:in `block in <top (required)>'
I also tried cap deploy with the same result (not sure what I expected.) How do I get started trying to fix this?
Edit: ran --trace with command cap -T:
cap aborted!
undefined method `map' for :except:Symbol
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:304:in `set_arg_names'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task_manager.rb:29:in `define_task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task.rb:360:in `define_task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/dsl_definition.rb:32:in `task'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:24:in `block in <top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/task_manager.rb:196:in `in_namespace'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/dsl_definition.rb:104:in `namespace'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/nonrails.rb:7:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/mage.rb:1:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/magentify-0.0.6/lib/mage.rb:1:in `<top (required)>'
/home/dirtymike/public_html/project/Capfile:3:in `load'
/home/dirtymike/public_html/project/Capfile:3:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:637:in `raw_load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:94:in `block in load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:93:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/lib/capistrano/application.rb:22:in `load_rakefile'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:77:in `block in run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/lib/capistrano/application.rb:12:in `run'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/gems/capistrano-3.0.1/bin/cap:3:in `<top (required)>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/cap:23:in `load'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/cap:23:in `<main>'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
/home/dirtymike/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>'
EDIT
This is fixed in version 0.0.7 of the Gem. I submitted a patch and it now forces to Capistrano 2.X, which is the only compatible version. The original answer was wrong, the problem was not with Rake.
Original Answer
It seems that the problem is with Rake and not with Capistrano. You may need to, either use an older version of rake (possibly 0.9.6), or update the Magentify gem to work with rake 10. Maybe you can open an issue on that repo.
EDIT
Confirmed: It works with rake 0.9.6.
You can add this Gemfile to your project:
source 'http://rubygems.org'
gem 'rake', '~> 0.9'
gem 'magentify'
and then running it like bundle exec cap -T
I was trying to setup facebook app locally, using ruby and sinatra, in Kubuntu 12.04.
I have included following gems in my gemfile. I have postgresql installed in my system and I am able to run the postgresql command line and run basic commands as createdb, create table etc.
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"
gem "pg"
gem "activerecord"
gem "sinatra-activerecord"
And in my app.rb file added these files,
require "rubygems"
require "sinatra"
require "sinatra/activerecord"
require "koala"
require "./config/environment" #database configuration
Running
rake -T
in my terminal gives me the following error.
rake aborted!
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:39:in `database_file='
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1033:in `set'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:50:in `registered'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1317:in `block in register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `each'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1648:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1688:in `register'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:76:in `<module:Sinatra>'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:6:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/app.rb:3:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/Rakefile:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Could any one please help. Thank you.
As #iain mentioned, this is due to a parse error in your config/database.yml file.
Check that it is valid syntax, and replace any tabs with spaces.
I added the composite_primary_keys gem in my Gemfile. On local environment it runs fine, but on a centos machine it breaks with the following error. Ruby version is 1.9.2p290 and rubygems version is 1.3.7 on both environments. Does anyone know why that could be?
bundle exec rake db:create --trace
no such file to load -- active_record/associations/has_and_belongs_to_many_association
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/var/tmp/jenkins/gem_cache/myapp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/var/tmp/jenkins/gem_cache/myapp/gems/composite_primary_keys-4.1.2/lib/composite_primary_keys.rb:40:in `<top (required)>'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
/opt/ruby/1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
The same error can occur when trying to use the composite_primary_keys gem with Active Record 4.1.0:
.../vendor/cache/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- active_record/associations/has_and_belongs_to_many_association (LoadError)
from .../vendor/cache/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
from .../vendor/cache/ruby/1.9.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
...
This is because the current release of composite_primary_keys (version 6.0.1 as of 17 April 2014) doesn't include support for Active Record 4.1.0, which apparently removed the file in question.
The problem is fixed in the ar_4.1.x branch of the gem's source code, however. If your project uses Bundler, a solution is to edit its Gemfile and replace the line
gem 'composite_primary_keys'
with
gem 'composite_primary_keys', {
:git => 'git://github.com/composite-primary-keys/composite_primary_keys.git',
:branch => 'ar_4.1.x'
}
then run bundle install from your project's root folder.
Cleaning the shared gems list on the jenkins machine fixed the issue.
Update your Gemfile:
gem 'composite_primary_keys', '~> 7.0'
I decided to go through the tutorial. After I create a new app and add new user:string email:string and then perform rake db:migrate in the app directory, I get this output:
rake aborted!
undefined method `task' for #<DemoApp::Application:0x00000100e49e08>
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p180#rails3tutorial/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
/Users/zigloo99/rails_projects/demo_app/Rakefile:7:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:78:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:77:in `load_rakefile'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:61:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/lib/rake/application.rb:59:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.0/bin/rake:31:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `<main>'
I am using RVM too ruby 1.9.2 and rails 3.0.7 as in the tutorial.
Any thoughts?
This is happening because the latest version of Rake (0.9.0) is broken on Rails 3.0 applications and we are currently awaiting a solid fix.
Right now, a way around this error is to add this line above the load_tasks line in your application's Rakefile:
<AppName>::Application.send :include, ::Rake::DSL if defined?(::Rake::DSL)
Another solution is to require rake 0.8.7 in your Gemfile before starting a new rails project.
# Gemfile
gem 'rake', '0.8.7', :require => 'rake'
then run bundle install