continuous integration - TeamCity cannot find rspec command -


i'm trying teamcity run tests on rails app, doesn't see rspec

rspec: command not found 

i have created "command line" build step containing following:

rspec spec/ 

if open terminal @ generated directory, after build step fails, can run tests without problem, suggests me it's i'm doing wrong in teamcity environment setup (as opposed project code).

i believe problem is failing switch correct version of ruby (i'm using rvm ruby version management). demonstrate debugging i've done far, have changed "command line" build step following:

echo '#do rspec spec/'     rspec spec/     echo '#which rspec?'     echo `which rspec`     echo '#do bundle update'     bundle update     echo '#which ruby using?'     echo `which ruby`     echo '#which ruby want?'     echo `more gemfile | grep "ruby "`     echo '#which bundle using?'     echo `which bundle`     echo '#available rubies?'     echo `rvm list`     echo '#switch right ruby: ruby-2.1.1'     rvm use ruby-2.1.1     echo '#try making rvm function'     source "$home/.rvm/scripts/rvm" &&     echo "rvm sourced."     echo '#try switching again'     rvm use ruby-2.1.1     

and resulting output is:

#do rspec spec/ /users/tom/desktop/teamcity/buildagent/temp/agenttmp/custom_script8352199801919263311: line 2: rspec: command not found #which rspec?  #do bundle update ruby version 2.1.2, gemfile specified 2.1.1 #which ruby using? /users/tom/.rvm/rubies/ruby-2.1.2/bin/ruby #which ruby want? ruby "2.1.1" #which bundle using? /users/tom/.rvm/gems/ruby-2.1.2@global/bin/bundle #available rubies? rvm rubies ruby-2.1.1 [ x86_64 ] =* ruby-2.1.2 [ x86_64 ] # => - current # =* - current && default # gemfile gemfile.lock guardfile procfile readme.rdoc rakefile app bin config config.ru db docs latest.dump lib log public scripts spec ssl vendor - default #switch right ruby: ruby-2.1.1 rvm not function, selecting rubies 'rvm use ...' not work.  need change terminal emulator preferences allow login shell. required use `/bin/bash --login` command. please visit https://rvm.io/integration/gnome-terminal/ example.  #try making rvm function rvm sourced. #try switching again rvm not function, selecting rubies 'rvm use ...' not work.  need change terminal emulator preferences allow login shell. required use `/bin/bash --login` command. please visit https://rvm.io/integration/gnome-terminal/ example.  process exited code 0 

i've read dozens of stackoverflow answers , blogs, still no luck. ideas can try next? (i haven't found way make teamcity use login shell).

here 3 options:

  • you can sidestep problem using rake runner instead of command line runner. rake runner has specific support rvm. set "ruby interpreter" "mode" rvm , can specify interpreter , gemset. easiest.

  • you command line runner work setting command executable full path rspec executable in ruby interpreter want (in ~/.rvm), , setting path, gem_home, gem_path , bundle_path environment variables point interpreter. details here: https://rvm.io/integration/teamcity more work.

  • you might command line runner work setting command executable 'bash' , command parameters '--login -c "rvm use 2.1.1; rspec spec"'. haven't tried though.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -