Ruby-on-Rails
在 TeamCity 中建構時捆綁安裝
我正在嘗試在 TeamCity 中執行建構。我試圖為單元測試建構的應用程序是用 Ruby on Rails 編碼的。
在複製建構失敗後,我將 VCS 根配置為從我的儲存庫獲取。這裡是:
Bundler::GemNotFound: Could not find gem 'devise (= 2.1.0) ruby' in the gems available on this machine. Stacktrace: /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:287:in `resolve' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:346:in `block in resolve_requirement' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:344:in `catch' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:344:in `resolve_requirement' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:295:in `block in resolve' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:294:in `reverse_each' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:294:in `resolve' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:161:in `start' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:128:in `block in resolve' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:127:in `catch' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/resolver.rb:127:in `resolve' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/definition.rb:192:in `resolve' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/definition.rb:127:in `specs' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/definition.rb:172:in `specs_for' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/definition.rb:161:in `requested_specs' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/environment.rb:23:in `requested_specs' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:11:in `setup' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler.rb:107:in `setup' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.1.4/lib/bundler/setup.rb:17:in `<top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require' /root/TeamCity/buildAgent/work/a85b8d8560bb396b/config/boot.rb:10:in `<top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /root/TeamCity/buildAgent/work/a85b8d8560bb396b/config/application.rb:1:in `<top (required)>' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' /root/TeamCity/buildAgent/work/a85b8d8560bb396b/Rakefile:5:in `<top (required)>' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile' /root/TeamCity/buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:314:in `standard_exception_handling' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run' /root/TeamCity/buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:314:in `standard_exception_handling' /usr/local/rvm/gems/ruby-1.9.2-p320@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' /root/TeamCity/buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:179:in `run' /root/TeamCity/buildAgent/plugins/rake-runner/rb/runner/rakerunner.rb:40:in `<main>' Source: /root/TeamCity/buildAgent/work/a85b8d8560bb396b/Rakefile:5:in `<top (required)>'
似乎它需要先執行 bundle install ,但是如何在配置中以及在哪裡可以在 TeamCity 上執行此操作?
在*“配置步驟 3”->“建構步驟”的建構配置設置下,第一步添加一個呼叫bundle install的**“命令行”*步驟。
不要忘記通過添加*“建構功能”並選擇“Ruby 環境配置器”來設置 Ruby 環境(如上面的**“配置步驟 3”->“建構步驟”* ) 。然後,您可以選擇您的 rvm ruby 版本和 gemset。查看您的堆棧跟踪,這將是 ruby-1.9.2-p320 作為解釋器名稱和 global 作為 gemset。