lib/rubber/vagrant/provisioner.rb in rubber-2.5.4 vs lib/rubber/vagrant/provisioner.rb in rubber-2.5.5

- old
+ new

@@ -21,19 +21,37 @@ create || refresh bootstrap && deploy_migrations end + def cleanup + destroy + end + private 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=#{ssh_info[:private_key_path]} #{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=#{ssh_info[:private_key_path]} bash -c '#{rvm_prefix} bundle exec cap rubber:create -S initial_ssh_user=#{ssh_info[:username]}' + ENDSCRIPT + end + + system(script) + end + + 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' ENDSCRIPT end system(script) end