geordi 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -4
- data/bin/console-for +3 -3
- data/bin/shell-for +12 -11
- data/lib/geordi/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -30,11 +30,21 @@ Runs the given command under `bundle exec` if a `Gemfile` is present in your wor
|
|
30
30
|
More information at http://makandra.com/notes/684-automatically-run-bundle-exec-if-required
|
31
31
|
|
32
32
|
|
33
|
+
console-for
|
34
|
+
-----------
|
35
|
+
|
36
|
+
Opens a rails console remotely:
|
37
|
+
|
38
|
+
console-for staging
|
39
|
+
|
40
|
+
More information at http://makandra.com/notes/1338-console-for-opens-a-rails-console-remotely-on-a-capistrano-deployment-target
|
41
|
+
|
42
|
+
|
33
43
|
|
34
44
|
cuc
|
35
45
|
-----
|
36
46
|
|
37
|
-
Runs Cucumber with the arguments you want
|
47
|
+
Runs Cucumber with the arguments you want: bundle exec, cucumber_spinner detection, etc.:
|
38
48
|
|
39
49
|
cuc features/users.feature
|
40
50
|
|
@@ -55,7 +65,7 @@ More information at http://makandra.com/notes/951-shell-script-to-clean-up-a-pro
|
|
55
65
|
dump-for
|
56
66
|
--------
|
57
67
|
|
58
|
-
Dumps the database on your server for a given [Capistrano multistage](https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension) deployment target
|
68
|
+
Dumps the database on your server for a given [Capistrano multistage](https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension) deployment target.
|
59
69
|
|
60
70
|
dump-for production
|
61
71
|
|
@@ -126,7 +136,7 @@ More information at http://makandra.com/notes/659-recursively-remove-unnecessary
|
|
126
136
|
rs
|
127
137
|
-----
|
128
138
|
|
129
|
-
Runs RSpec with the arguments you want
|
139
|
+
Runs RSpec with the arguments you want: RSpec 1/2 detection, bundle exec, rspec_spinner detection, etc.:
|
130
140
|
|
131
141
|
rs spec/models/user_spec.rb
|
132
142
|
|
@@ -140,13 +150,17 @@ Opens an SSH shell on the given [Capistrano multistage](https://github.com/capis
|
|
140
150
|
|
141
151
|
shell-for production
|
142
152
|
|
153
|
+
Now it can also be called with any command to be remotely executed before loading the bash. `--no-bash` skips the bash.
|
154
|
+
|
155
|
+
shell-for staging --no-bash top
|
156
|
+
|
143
157
|
More information at http://makandra.com/notes/1209-script-to-open-an-ssh-shell-to-a-capistrano-deployment-target
|
144
158
|
|
145
159
|
|
146
160
|
tests
|
147
161
|
--------------
|
148
162
|
|
149
|
-
Runs both `rs` and `
|
163
|
+
Runs both `rs` and `cuc`. Call from any project directory:
|
150
164
|
|
151
165
|
tests
|
152
166
|
|
data/bin/console-for
CHANGED
@@ -14,10 +14,10 @@ begin
|
|
14
14
|
stage = ARGV.shift
|
15
15
|
root = find_project_root or raise 'Call me from inside a Rails project!'
|
16
16
|
|
17
|
-
if File.exists? "#{root}/script/console"
|
18
|
-
exec "shell-for #{stage} script/console #{stage}"
|
17
|
+
if File.exists? "#{root}/script/console" # => Rails 2
|
18
|
+
exec "shell-for #{stage} --no-bash script/console #{stage}"
|
19
19
|
else
|
20
|
-
exec "shell-for #{stage} bundle exec rails console #{stage}"
|
20
|
+
exec "shell-for #{stage} --no-bash bundle exec rails console #{stage}"
|
21
21
|
end
|
22
22
|
rescue Exception => e
|
23
23
|
$stderr.puts e.message
|
data/bin/shell-for
CHANGED
@@ -14,25 +14,26 @@ def find_project_root
|
|
14
14
|
return nil if current == Dir.pwd
|
15
15
|
current = Dir.pwd
|
16
16
|
end
|
17
|
-
current
|
17
|
+
@project_root = current
|
18
18
|
end
|
19
19
|
|
20
20
|
begin
|
21
21
|
stage = ARGV.shift
|
22
|
+
no_bash = ARGV.shift if ARGV.first == '--no-bash'
|
22
23
|
remote_command = ARGV.join(' ').strip
|
23
24
|
|
24
25
|
find_project_root or raise 'Call me from inside a Rails project!'
|
25
26
|
|
26
27
|
data = if stage
|
27
|
-
deploy_file = Dir[
|
28
|
+
deploy_file = Dir["#{@project_root}/config/deploy/*.rb"].find do |file|
|
28
29
|
file.match(/\/#{stage}.rb$/)
|
29
30
|
end
|
30
|
-
deploy_file or raise "
|
31
|
+
deploy_file or raise "Stage does not exist: #{stage}"
|
31
32
|
|
32
33
|
File.open(deploy_file).readlines
|
33
34
|
else
|
34
35
|
[]
|
35
|
-
end + File.open("config/deploy.rb").readlines
|
36
|
+
end + File.open("#{@project_root}/config/deploy.rb").readlines
|
36
37
|
|
37
38
|
user = unquote data.find{ |line| line =~ /^set :user, /}
|
38
39
|
server = unquote data.find{ |line| line =~ /^server / }
|
@@ -42,20 +43,20 @@ begin
|
|
42
43
|
|
43
44
|
path = deploy_to + "/current"
|
44
45
|
ssh = %(ssh #{user}@#{server})
|
45
|
-
|
46
|
+
|
47
|
+
commands = []
|
46
48
|
if path.match /#\{.*\}/
|
47
49
|
puts %(NOTE: "#{path}" is not a valid path.)
|
48
50
|
puts %(NOTE: Connecting to deploy user home.)
|
49
|
-
puts
|
50
51
|
sleep 2
|
51
|
-
|
52
|
-
exec ssh
|
53
52
|
else
|
54
|
-
|
55
|
-
|
56
|
-
exec ssh + %( -t "cd #{path} && #{command}")
|
53
|
+
commands << "cd #{path}"
|
57
54
|
end
|
55
|
+
commands << remote_command unless remote_command.empty?
|
56
|
+
commands << "bash --login" unless no_bash
|
58
57
|
|
58
|
+
exec ssh + %( -t "#{commands.join(' && ')}")
|
59
|
+
|
59
60
|
rescue Exception => e
|
60
61
|
$stderr.puts e.message
|
61
62
|
exit 1
|
data/lib/geordi/version.rb
CHANGED
metadata
CHANGED