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 +8 -8
- data/bin/console-for +4 -2
- data/bin/dump-for +4 -4
- data/bin/shell-for +3 -1
- data/lib/geordi/capistrano.rb +13 -16
- data/lib/geordi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzljZjY4Y2MxYjM3NmY0NTIyOWRkYjRjMjcwMmM4ZGJhZjNhYTQ0Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmU3M2RhMTllYmU2YWRkMzYzODYzODE2MmY1YmZlMDczY2ZjNTIzZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjBmNjgzN2E2MDhmMjMzOTA2MGU2MjU4OWE4ZThlZTRmMmRmY2I2MWVjNDcz
|
10
|
+
MmNlMjhlZjNhYTY5MGI2NDIxYmRmYjRjZTI3ZDNhNTk3MTczNmJkMzAwMTgy
|
11
|
+
OGFlNjBiNmQ4NGQ5ZjAwMWQ0NDUxNzdlNDBjYWVjZTM5NGMyNjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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.
|
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
data/lib/geordi/capistrano.rb
CHANGED
@@ -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(
|
94
|
-
|
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
|
-
|
102
|
-
|
103
|
-
|
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',
|
107
|
+
args = [ 'ssh', %(#{config.user}@#{server}), '-t', remote_commands.join(' ') ]
|
111
108
|
if options.fetch(:exec, true)
|
112
109
|
exec(*args)
|
113
110
|
else
|
data/lib/geordi/version.rb
CHANGED