lib/ors/helpers.rb in ors-0.2.9 vs lib/ors/helpers.rb in ors-0.2.10
- old
+ new
@@ -14,11 +14,11 @@
end
def setup_ruby server
info "[#{server}] installing ruby and gems..."
- execute_command server, prepare_environment,
+ execute_command server, prepare_initial_environment,
%(gem install rubygems-update),
%(gem update --system),
%(gem install bundler),
%(bundle install --without development test osx_development > bundler.log)
end
@@ -124,9 +124,21 @@
%(ssh #{quiet_ssh}#{psuedo_tty}#{gateway} 'ssh #{quiet_ssh}#{psuedo_tty}#{deploy_user}@#{server} "#{commands}"')
else
%(ssh #{quiet_ssh}#{psuedo_tty}#{deploy_user}@#{server} "#{commands}")
end
end
+ end
+
+ def prepare_initial_environment
+ # We do 2 cd's and a git checkout here because the master
+ # branch may not always contain the proper rvmrc/Gemfile
+ # we need when setting up the rest of the deploy
+ prepare_environment + [
+ %(git checkout -q -f origin/#{environment}),
+ %(git reset --hard),
+ %(cd ../),
+ %(cd #{deploy_directory})
+ ]
end
def prepare_environment
[%(source ~/.rvm/scripts/rvm),
%({ cd #{deploy_directory} > /dev/null; })] # Silence RVM's "Using... gemset..."