geordi 0.16.2 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWZhZWY3ZTUwZTllY2QyMjNkNGQxNTE5NDcxNjNlZTVmYzM3NzE5Yw==
4
+ MzljZjY4Y2MxYjM3NmY0NTIyOWRkYjRjMjcwMmM4ZGJhZjNhYTQ0Yw==
5
5
  data.tar.gz: !binary |-
6
- NWY4MjI5NWJiNWU1ODg1Yzg1NzY1MTQ3ZTkzMWMxZjdiMDk1MWUwNA==
6
+ MmU3M2RhMTllYmU2YWRkMzYzODYzODE2MmY1YmZlMDczY2ZjNTIzZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjMzOGEyNjY4MWNjOGUyNjU1ZGM3ODhmMDNjOTcwMTE0OGU2MTZkMzYyN2Jh
10
- NDQ2MGEyOGFjZGNkZTJmMjBjMDkyZjdiYzQ3YWYzNDM1MDMxY2Q2MTJlOGJk
11
- MTllZGUxNmFjMTgzZWQ4ZDM3MDVkZjQwMTI1MjAwNjY0YzYwYzg=
9
+ YjBmNjgzN2E2MDhmMjMzOTA2MGU2MjU4OWE4ZThlZTRmMmRmY2I2MWVjNDcz
10
+ MmNlMjhlZjNhYTY5MGI2NDIxYmRmYjRjZTI3ZDNhNTk3MTczNmJkMzAwMTgy
11
+ OGFlNjBiNmQ4NGQ5ZjAwMWQ0NDUxNzdlNDBjYWVjZTM5NGMyNjY=
12
12
  data.tar.gz: !binary |-
13
- YmU1Njk4ZGZhMzk3MGFjN2ZjZDg3NzZiZjAxMzQ4MmFlOWQ3Mjc3OWY1ZGE5
14
- MTkyYzkwN2ExMTNhZTEzNmIzOTU0MjQzZDMyMDQ5N2MwNTI5MDgzYWZlYjRm
15
- MDcxYmExNmM0OWQ2N2E4ZmI5YjI3ZDlhYjZjZTg2MDMzZjUyMWQ=
13
+ NDU4ZmUyZmRhZGU3MGQzZDZiZTUwM2U5YjQ0M2I4NjEzMmQ2ZTZmODA4MTAy
14
+ ZmVmOGUzNmMzNjcxMzU2M2FmYjk0ZjI5ZmI5OGJiODg0OWU2NThjZWE5ZDk3
15
+ ZGZlNjc2NTA0NDFjZWU4MjI2Njk1OGUxMTFhODZiYzRhNzVkZWU=
data/bin/console-for CHANGED
@@ -4,9 +4,11 @@ include Geordi::Capistrano
4
4
 
5
5
  catching_errors do
6
6
  self.stage = ARGV.shift
7
+ options = { :select_server => true }
8
+
7
9
  if File.exists? "#{config.root}/script/console" # => Rails 2
8
- shell_for("script/console #{config.env}")
10
+ shell_for("script/console #{config.env}", options)
9
11
  else
10
- shell_for("bundle exec rails console #{config.env}")
12
+ shell_for("bundle exec rails console #{config.env}", options)
11
13
  end
12
14
  end
data/bin/dump-for CHANGED
@@ -14,13 +14,13 @@ catching_errors do
14
14
  system "mkdir -p #{destination_directory}" # Ensure the destination directory exists
15
15
  destination_path = "#{destination_directory}/#{stage}.dump"
16
16
 
17
- puts "Downloading dump_for_download..."
18
- system "scp #{config.user}@#{config.server}:#{source_path} #{destination_path}"
19
- puts
20
- puts "Dumped the #{stage.upcase} database to: #{File.basename config.root}/tmp/#{stage}.dump"
17
+ puts "Downloading dump_for_download ..."
18
+ system "scp #{config.user}@#{config.primary_server}:#{source_path} #{destination_path}"
19
+ puts "Dumped the #{stage.upcase} database to RAILS_ROOT/tmp/#{stage}.dump"
21
20
 
22
21
  # source dump if option was given
23
22
  if ARGV.include?("-s")
23
+ puts
24
24
  puts "Sourcing dump into development database..."
25
25
  success = DumpLoader.new([destination_path]).execute
26
26
  if success
data/bin/shell-for CHANGED
@@ -4,5 +4,7 @@ include Geordi::Capistrano
4
4
 
5
5
  catching_errors do
6
6
  self.stage = ARGV.shift
7
- shell_for(ARGV)
7
+ command = ARGV.any? ? ARGV.join(' ') : nil
8
+
9
+ shell_for(command, :select_server => true)
8
10
  end
@@ -24,6 +24,10 @@ module Geordi
24
24
  def servers
25
25
  @capistrano_config.find_servers(:roles => [:app])
26
26
  end
27
+
28
+ def primary_server
29
+ @capistrano_config.find_servers(:roles => [:app], :only => { :primary => true }).first
30
+ end
27
31
 
28
32
  def path
29
33
  @capistrano_config.fetch(:deploy_to) + '/current'
@@ -85,29 +89,22 @@ module Geordi
85
89
  config.servers.each do |server|
86
90
  menu.choice(server) { server }
87
91
  end
92
+
93
+ # Default to the first listed server (by convention, the first server
94
+ # in the deploy files is the primary one).
88
95
  menu.default = '1'
89
96
  menu.prompt = 'Connect to [1]: '
90
97
  end
91
98
  end
92
99
 
93
- def shell_for(*args)
94
- options = {}
95
- if args.last.is_a?(Hash)
96
- options = args.pop
97
- end
98
-
99
- remote_command = args.join(' ').strip
100
+ def shell_for(command, options = {})
101
+ server = options[:select_server] ? select_server : config.primary_server
100
102
 
101
- login = %(#{config.user}@#{select_server})
102
-
103
- commands = [ "cd #{config.path}" ]
104
- if remote_command == ''
105
- commands << config.shell
106
- else
107
- commands << %{#{config.shell} -c '#{remote_command}'}
108
- end
103
+ remote_commands = [ 'cd', config.path ]
104
+ remote_commands << '&&' << config.shell
105
+ remote_commands << "-c '#{command}'" if command
109
106
 
110
- args = ['ssh', login, '-t', commands.join(' && ')]
107
+ args = [ 'ssh', %(#{config.user}@#{server}), '-t', remote_commands.join(' ') ]
111
108
  if options.fetch(:exec, true)
112
109
  exec(*args)
113
110
  else
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '0.16.2'
2
+ VERSION = '0.16.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.2
4
+ version: 0.16.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch