rye 0.7.0 → 0.7.1

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.
@@ -7,6 +7,12 @@ TODO
7
7
  * Add S3 support for Rye::Box.upload / download
8
8
 
9
9
 
10
+ #### 0.7.1 (2009-05-31) #############################
11
+
12
+ * CHANGE: Removed broken grep method from Rye::Rap
13
+ * ADDED: Rye::Cmd#add_command helper for adding new command methods.
14
+
15
+
10
16
  #### 0.7.0 (2009-05-30) #############################
11
17
 
12
18
  * CHANGE: Rye::Box now uses unique instance variable names to encourage using
@@ -98,7 +98,9 @@ module Rye;
98
98
  # NOTE: Changes to current working directory with +cd+ or +[]+ are ignored.
99
99
  def download(*files); net_scp_transfer!(:download, *files); end
100
100
 
101
-
101
+ # Append +newcontent+ to remote +filepath+. If the file doesn't exist
102
+ # it will be created. If +backup+ is specified, +filepath+ will be
103
+ # copied to +filepath-previous+ before appending.
102
104
  def file_append(filepath, newcontent, backup=false)
103
105
  if self.file_exists?(filepath) && backup
104
106
  self.cp filepath, "#{filepath}-previous"
@@ -145,6 +147,30 @@ module Rye;
145
147
  instance_methods.member?(meth)
146
148
  end
147
149
 
150
+ # A helper for adding a command to Rye::Cmd.
151
+ # * +meth+ the method name
152
+ # * +path+ (optional) filesystem path for the given method
153
+ # * +hard_args+ (optional) hardcoded arguments which are prepended to the
154
+ # argument list every time the method is called
155
+ # An optional block can be provided which will be called instead
156
+ # of calling a system command.
157
+ def Cmd.add_command(meth, path=nil, *hard_args, &block)
158
+ path ||= meth.to_s
159
+ if block
160
+ hard_args.unshift(path) unless path.nil? # Don't lose an argument
161
+ define_method(meth) do |*args|
162
+ hard_args += args
163
+ block.call(*hard_args)
164
+ end
165
+ else
166
+ define_method(meth) do |*args|
167
+ hard_args += args
168
+ cmd(path, *hard_args)
169
+ end
170
+ end
171
+ end
172
+
173
+
148
174
  #--
149
175
  # * Consider a lock-down mode using method_added
150
176
  # * Consider Rye.sysinfo.os == :unix
@@ -95,12 +95,12 @@ module Rye;
95
95
  end
96
96
 
97
97
  # NOTE: This is broken!
98
- def grep *args
99
- self.select do |boxrap|
100
- b = boxrap.grep(*args)
101
- b.empty? ? false : b
102
- end
103
- end
98
+ #def grep *args
99
+ # self.select do |boxrap|
100
+ # b = boxrap.grep(*args)
101
+ # b.empty? ? false : b
102
+ # end
103
+ #end
104
104
 
105
105
 
106
106
  #def >>(*other)
@@ -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.0"
4
+ s.version = "0.7.1"
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.0
4
+ version: 0.7.1
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-05-30 00:00:00 -04:00
12
+ date: 2009-05-31 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency