Sha256: 3fbaecc3d097daf21dbf6920b613640700ff240e32c2854630b7f441f8ad4f86

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

desc 'SSH connection with server'
task :ssh do
  on roles(:app) do |host|
    run_locally do
      run_in host, ""
    end
  end
end

desc 'Opens a remote Rails console'
task :c do
  on roles(:app) do |host|
    run_locally do
      run_in host, "cd #{current_path} && RAILS_ENV=#{fetch(:stage)} bundle exec rails c"
    end
  end
end

desc 'Tails the environment log or the log passed as argument: cap log[thin.3000.log]'
task :log, :file do |task, args|
  on roles(:app) do
    file = args[:file]? args[:file] : "*"
    execute "tail -f #{shared_path}/log/#{file}"
  end
end

desc "Runs a command in server: cap production x['free -m']"
task :x, :command do |task, args|
  on roles(:app) do |host|
    run_locally do
      run_in host, args[:command]
    end
  end
end

def run_in(host, cmd)
  exec "ssh #{host.user}@#{host.hostname} -p #{host.port || '22'} -tt '#{cmd}'"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prun-ops-0.1.1 lib/capistrano/diagnosis.rake
prun-ops-0.1.0 lib/capistrano/diagnosis.rake