lib/rubber/vagrant/provisioner.rb in rubber-2.8.0 vs lib/rubber/vagrant/provisioner.rb in rubber-2.8.1

- old
+ new

@@ -37,13 +37,13 @@ def create if config.use_vagrant_ruby script = "RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} ALIAS=#{machine.name} ROLES='#{config.roles}' EXTERNAL_IP=#{private_ip} INTERNAL_IP=#{private_ip} RUBBER_SSH_KEY=#{rubber_ssh_keys} #{internal_cap_command} rubber:create -S initial_ssh_user=#{ssh_info[:username]}" else script = <<-ENDSCRIPT - unset GEM_HOME; - unset GEM_PATH; - PATH=#{ENV['PATH'].split(':')[1..-1].join(':')} RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} ALIAS=#{machine.name} ROLES='#{config.roles}' EXTERNAL_IP=#{private_ip} INTERNAL_IP=#{private_ip} RUBBER_SSH_KEY=#{rubber_ssh_keys} bash -c '#{rvm_prefix} bundle exec cap rubber:create -S initial_ssh_user=#{ssh_info[:username]}' + #{clear_vagrant_environment} + + RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} ALIAS=#{machine.name} ROLES='#{config.roles}' EXTERNAL_IP=#{private_ip} INTERNAL_IP=#{private_ip} RUBBER_SSH_KEY=#{rubber_ssh_keys} bash -c '#{rvm_prefix} bundle exec cap rubber:create -S initial_ssh_user=#{ssh_info[:username]}' ENDSCRIPT end system(script) end @@ -51,13 +51,13 @@ def destroy if config.use_vagrant_ruby script = "RUN_FROM_VAGRANT=true FORCE=true RUBBER_ENV=#{config.rubber_env} ALIAS=#{machine.name} #{internal_cap_command} rubber:destroy" else script = <<-ENDSCRIPT - unset GEM_HOME; - unset GEM_PATH; - PATH=#{ENV['PATH'].split(':')[1..-1].join(':')} RUN_FROM_VAGRANT=true FORCE=true RUBBER_ENV=#{config.rubber_env} ALIAS=#{machine.name} bash -c '#{rvm_prefix} bundle exec cap rubber:destroy' + #{clear_vagrant_environment} + + RUN_FROM_VAGRANT=true FORCE=true RUBBER_ENV=#{config.rubber_env} ALIAS=#{machine.name} bash -c '#{rvm_prefix} bundle exec cap rubber:destroy' ENDSCRIPT end system(script) end @@ -65,13 +65,13 @@ def refresh if config.use_vagrant_ruby script = "RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} ALIAS=#{machine.name} EXTERNAL_IP=#{private_ip} INTERNAL_IP=#{private_ip} #{internal_cap_command} rubber:refresh -S initial_ssh_user=#{ssh_info[:username]}" else script = <<-ENDSCRIPT - unset GEM_HOME; - unset GEM_PATH; - PATH=#{ENV['PATH'].split(':')[1..-1].join(':')} RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} ALIAS=#{machine.name} EXTERNAL_IP=#{private_ip} INTERNAL_IP=#{private_ip} bash -c '#{rvm_prefix} bundle exec cap rubber:refresh -S initial_ssh_user=#{ssh_info[:username]}' + #{clear_vagrant_environment} + + RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} ALIAS=#{machine.name} EXTERNAL_IP=#{private_ip} INTERNAL_IP=#{private_ip} bash -c '#{rvm_prefix} bundle exec cap rubber:refresh -S initial_ssh_user=#{ssh_info[:username]}' ENDSCRIPT end system(script) end @@ -79,13 +79,13 @@ def bootstrap if config.use_vagrant_ruby script = "RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} FILTER=#{machine.name} #{internal_cap_command} rubber:bootstrap" else script = <<-ENDSCRIPT - unset GEM_HOME; - unset GEM_PATH; - PATH=#{ENV['PATH'].split(':')[1..-1].join(':')} RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} FILTER=#{machine.name} bash -c '#{rvm_prefix} bundle exec cap rubber:bootstrap' + #{clear_vagrant_environment} + + RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} FILTER=#{machine.name} bash -c '#{rvm_prefix} bundle exec cap rubber:bootstrap' ENDSCRIPT end system(script) end @@ -93,13 +93,13 @@ def deploy_migrations if config.use_vagrant_ruby script = "RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} FILTER=#{machine.name} #{internal_cap_command} deploy:migrations" else script = <<-ENDSCRIPT - unset GEM_HOME; - unset GEM_PATH; - PATH=#{ENV['PATH'].split(':')[1..-1].join(':')} RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} FILTER=#{machine.name} bash -c '#{rvm_prefix} bundle exec cap deploy:migrations' + #{clear_vagrant_environment} + + RUN_FROM_VAGRANT=true RUBBER_ENV=#{config.rubber_env} RUBBER_SSH_KEY=#{rubber_ssh_keys} FILTER=#{machine.name} bash -c '#{rvm_prefix} bundle exec cap deploy:migrations' ENDSCRIPT end system(script) end @@ -108,9 +108,24 @@ "ruby -e \"require 'capistrano/cli'; Capistrano::CLI.execute\"" end def rvm_prefix config.rvm_ruby_version ? "rvm #{config.rvm_ruby_version} do" : '' + end + + def clear_vagrant_environment + <<-ENDSCRIPT + unset GEM_HOME; + unset GEM_PATH; + unset RUBYOPT; + unset GEMRC; + unset BUNDLE_GEMFILE; + unset BUNDLE_BIN_PATH; + unset RUBYLIB; + unset BUNDLE_APP_CONFIG; + + export PATH=#{ENV['PATH'].split(':').reject { |entry| entry =~ /vagrant/i }.join(':')}; + ENDSCRIPT end end end end