rye 0.7.1 → 0.7.2
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.
- data/CHANGES.txt +3 -1
- data/lib/rye/box.rb +22 -9
- data/lib/rye/cmd.rb +7 -4
- data/rye.gemspec +1 -1
- metadata +2 -2
data/CHANGES.txt
CHANGED
@@ -7,10 +7,12 @@ TODO
|
|
7
7
|
* Add S3 support for Rye::Box.upload / download
|
8
8
|
|
9
9
|
|
10
|
-
#### 0.7.1 (2009-
|
10
|
+
#### 0.7.1 (2009-06-01) #############################
|
11
11
|
|
12
12
|
* CHANGE: Removed broken grep method from Rye::Rap
|
13
|
+
* FIXED: Bug which prevented setting relative paths in non-home directory
|
13
14
|
* ADDED: Rye::Cmd#add_command helper for adding new command methods.
|
15
|
+
* ADDED: pre-command-hook now sends the hostname to the block
|
14
16
|
|
15
17
|
|
16
18
|
#### 0.7.0 (2009-05-30) #############################
|
data/lib/rye/box.rb
CHANGED
@@ -32,7 +32,8 @@ module Rye
|
|
32
32
|
def host; @rye_host; end
|
33
33
|
def opts; @rye_opts; end
|
34
34
|
def safe; @rye_safe; end
|
35
|
-
|
35
|
+
def user; (@rye_opts || {})[:user]; end
|
36
|
+
|
36
37
|
def host=(val); @rye_host = val; end
|
37
38
|
def opts=(val); @rye_opts = val; end
|
38
39
|
def safe=(val); @rye_safe = val; end
|
@@ -137,14 +138,26 @@ module Rye
|
|
137
138
|
# rbox.pwd # => /usr/bin ($ cd /usr/bin && pwd)
|
138
139
|
#
|
139
140
|
def [](key=nil)
|
140
|
-
|
141
|
+
if key.nil? || key.index('/') == 0
|
142
|
+
@rye_current_working_directory = key
|
143
|
+
else
|
144
|
+
# Append to non-absolute paths
|
145
|
+
newpath = File.join(@rye_current_working_directory, key)
|
146
|
+
@rye_current_working_directory = File.expand_path(newpath)
|
147
|
+
end
|
141
148
|
self
|
142
149
|
end
|
143
150
|
# Like [] except it returns an empty Rye::Rap object to mimick
|
144
151
|
# a regular command method. Call with nil key (or no arg) to
|
145
152
|
# reset.
|
146
153
|
def cd(key=nil)
|
147
|
-
|
154
|
+
if key.nil? || key.index('/') == 0
|
155
|
+
@rye_current_working_directory = key
|
156
|
+
else
|
157
|
+
# Append to non-absolute paths
|
158
|
+
newpath = File.join(@rye_current_working_directory, key)
|
159
|
+
@rye_current_working_directory = File.expand_path(newpath)
|
160
|
+
end
|
148
161
|
ret = Rye::Rap.new(self)
|
149
162
|
end
|
150
163
|
|
@@ -308,9 +321,6 @@ module Rye
|
|
308
321
|
end
|
309
322
|
alias :add_env :setenv # deprecated?
|
310
323
|
|
311
|
-
# The name of the user that opened the SSH connection
|
312
|
-
def user; (@rye_opts || {})[:user]; end
|
313
|
-
|
314
324
|
# See Rye.keys
|
315
325
|
def keys; Rye.keys; end
|
316
326
|
|
@@ -473,8 +483,11 @@ module Rye
|
|
473
483
|
|
474
484
|
|
475
485
|
# Supply a block to be called before every command. It's called
|
476
|
-
# with three arguments: command name, an Array of arguments, user name
|
477
|
-
#
|
486
|
+
# with three arguments: command name, an Array of arguments, user name, hostname
|
487
|
+
# e.g.
|
488
|
+
# rbox.pre_command_hook do |cmd,args,user,host|
|
489
|
+
# ...
|
490
|
+
# end
|
478
491
|
def pre_command_hook(&block)
|
479
492
|
@rye_pre_command_hook = block if block
|
480
493
|
@rye_pre_command_hook
|
@@ -591,7 +604,7 @@ module Rye
|
|
591
604
|
debug "Executing: %s" % cmd_clean
|
592
605
|
|
593
606
|
if @rye_pre_command_hook.is_a?(Proc)
|
594
|
-
@rye_pre_command_hook.call(cmd, args,
|
607
|
+
@rye_pre_command_hook.call(cmd, args, user, host)
|
595
608
|
end
|
596
609
|
|
597
610
|
## NOTE: Do not raise a CommandNotFound exception in this method.
|
data/lib/rye/cmd.rb
CHANGED
@@ -155,17 +155,20 @@ module Rye;
|
|
155
155
|
# An optional block can be provided which will be called instead
|
156
156
|
# of calling a system command.
|
157
157
|
def Cmd.add_command(meth, path=nil, *hard_args, &block)
|
158
|
+
|
158
159
|
path ||= meth.to_s
|
159
160
|
if block
|
160
161
|
hard_args.unshift(path) unless path.nil? # Don't lose an argument
|
161
162
|
define_method(meth) do |*args|
|
162
|
-
|
163
|
-
|
163
|
+
local_args = hard_args.clone
|
164
|
+
local_args += args
|
165
|
+
block.call(*local_args)
|
164
166
|
end
|
165
167
|
else
|
166
168
|
define_method(meth) do |*args|
|
167
|
-
|
168
|
-
|
169
|
+
local_args = hard_args.clone
|
170
|
+
local_args += args
|
171
|
+
cmd(path, *local_args)
|
169
172
|
end
|
170
173
|
end
|
171
174
|
end
|
data/rye.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "rye"
|
3
3
|
s.rubyforge_project = "rye"
|
4
|
-
s.version = "0.7.
|
4
|
+
s.version = "0.7.2"
|
5
5
|
s.summary = "Rye: Safely run SSH commands on a bunch of machines at the same time (from Ruby)."
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rye
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-01 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|