ruby - task in Capistrano 3 cannot find RVM -


i have been using capistrano 3 deploy php app several months , works great. recently, decided start using sass stylesheets , trying deploy these changes.

i trying write task runs after rest of deploy stuff finished converts scss file css using sass gem.

namespace :deploy    after :finished, :assets     on roles(:app), in: :sequence, wait: 5       within release_path         # process sass files css         execute "sass #{release_path}/styles/test.scss #{release_path}/styles/test.css"       end     end   end  end 

i using rvm on server , have sass gem installed in specific gemset. there .rvmrc file in project root loads correct gemset when cd 'current' directory capistrano creates.

when deploy, fails on new task saying cannot find sass.

stderr: bash: sass: command not found 

i can log server same user used deploy capistrano , cd 'current' directory , run same command in task (substituting #{release_path} actual path) , works fine.

things have tried:

  1. rewriting execute command following:

rvm use 2.1.5@deployer && sass #{release_path}/styles/test.scss #{release_path}/styles/test.css

  1. writing bash script accessible deployer user loads gemset runs sass command (works when run new script while logged sever in directory, not work when called capistrano task)

  2. using capistrano-rvm plugin (adding gemfile, requiring in capfile) set rvm gemset - hoping load gemset before running commands.

i have used capistrano many times deploying rails apps , use asset plugin handles precompiling , whatnot... first project have used deploying php app , maybe first time have tried manually run capistrano task uses rubygem installed on server rvm.

is possible run task depends on specific gem/gemset... without using default rails plugins?

any appreciated.

thanks, jd

figured 1 out requiring capistrano/bundler command, see how capistrano runs bundle default... copied bundler command logged during deploy, modified work trying , removed bundler plugin not need deploy bundle anything.

without using capistrano plugins, can preface capistrano task execute command location of gemset so:

after :finished, :assets   on roles(:app), in: :sequence, wait: 5     within release_path       execute "~/.rvm/bin/rvm ruby-2.1.5@deployer sass #{release_path}/styles/sass/screen.scss #{release_path}/styles/screen.css"     end   end end 

the key difference following snippet prefaces actual command trying initially:

~/.rvm/bin/rvm ruby-2.1.5@deployer .... 

obviously, use whatever command requiring gemset specified want (instead of sass command using).


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -