Skip to content

Commit

Permalink
added a bash exec to the rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
agmcleod committed Nov 10, 2012
1 parent 201555b commit 037fb0f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/torquebox/rake/tasks/remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
namespace :torquebox do
namespace :remote do

desc "Execute bash commands in the environment"
task :bash, [:cmd] do |t, args|
cmd = args[:cmd]
archive_name = TorqueBox::RemoteDeployUtils.archive_name
TorqueBox::RemoteDeployUtils.exec_bash(archive_name, cmd)
end

desc "Upload this application to the remote server as an archive file"
task :stage do
archive_name = TorqueBox::RemoteDeployUtils.archive_name
Expand Down
12 changes: 12 additions & 0 deletions lib/torquebox/remote_deploy_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ def undeploy(archive_file)
end
end

def exec_bash(archive_file, cmd)
with_config(archive_file) do |config, app_name|
unless config.local
ssh_exec(config, "cd #{config.torquebox_home}/stage/#{app_name}",
"export PATH=#{config.jruby_home}/bin:$PATH",
"export RAILS_ENV=#{config.rack_env}",
"export RACK_ENV=#{config.rack_env}",
cmd)
end
end
end

def exec_ruby(archive_file, cmd)
with_config(archive_file) do |config, app_name|
unless config.local
Expand Down

0 comments on commit 037fb0f

Please sign in to comment.