capssh 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/capssh +4 -0
  2. data/lib/capssh/version.rb +1 -1
  3. data/lib/capssh.rb +13 -1
  4. metadata +1 -1
data/bin/capssh CHANGED
@@ -29,6 +29,10 @@ OptionParser.new do |opts|
29
29
  options[:role] = role
30
30
  end
31
31
 
32
+ opts.on("-c", "--console", "Fire up a rails console in the project's deployment directory after connecting to the machine.") do
33
+ options[:console] = true
34
+ end
35
+
32
36
  opts.on_tail("-h", "--help", "Show this message") do
33
37
  puts opts
34
38
  exit
@@ -1,3 +1,3 @@
1
1
  module Capssh
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/capssh.rb CHANGED
@@ -24,7 +24,19 @@ module Capssh
24
24
  user = config[:user] || ENV['USER']
25
25
  server = servers.first
26
26
  puts "Connecting to #{environment} #{role} at #{user}@#{server}..."
27
- exec "ssh #{user}@#{server}"
27
+
28
+ command = nil
29
+ if options[:console]
30
+ command = "cd #{config[:deploy_to]}/current; bundle exec rails console #{config[:rails_env]}"
31
+ end
32
+
33
+ ssh_command = "ssh #{user}@#{server}"
34
+ if command
35
+ puts "Running command: #{command}"
36
+ ssh_command += " -t \"#{command}\""
37
+ end
38
+
39
+ exec ssh_command
28
40
  end
29
41
 
30
42
  def display_error_and_exit(error)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: