delano-rye 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -7,6 +7,15 @@ TODO
7
7
  * Add S3 support for Rye::Box.upload / download
8
8
 
9
9
 
10
+ #### 0.7.4 (2009-06-04) #############################
11
+
12
+ * FIXED: Bug in Rye::Box#interactive_ssh related to instance variable renaming from 0.7.0.
13
+ * FIXED: Bug in Rye::Cmd#file_append which tried to download files that didn't exist
14
+ * CHANGE: Removed error message, "EC2 instances generate new SSH keys on first boot"
15
+ * ADDED: Rye::Cmd#remove_method
16
+ * ADDED: Rye::Rap#> and Rye::Rap#>> methods to emulate shell redirect to file
17
+
18
+
10
19
  #### 0.7.3 (2009-06-03) #############################
11
20
 
12
21
  * ADDED: enable_safe_mode and disable_safe_mode methods
@@ -37,7 +46,6 @@ TODO
37
46
  instance variables in batch command blocks.
38
47
  * ADDED: Rye::Box#file_append
39
48
 
40
-
41
49
  #### 0.6.6 (2009-05-21) #############################
42
50
 
43
51
  * CHANGE: Key management is handled by ssh-agent again (instead of Net::SSH)
data/lib/rye/box.rb CHANGED
@@ -205,7 +205,7 @@ module Rye
205
205
  def interactive_ssh(run=true)
206
206
  debug "interactive_ssh with keys: #{Rye.keys.inspect}"
207
207
  run = false unless STDIN.tty?
208
- cmd = Rye.prepare_command("ssh", "#{@rye_opts[:user]}@rye_#{@rye_host}")
208
+ cmd = Rye.prepare_command("ssh", "#{@rye_opts[:user]}@#{@rye_host}")
209
209
  return cmd unless run
210
210
  system(cmd)
211
211
  end
@@ -531,7 +531,6 @@ module Rye
531
531
  @rye_ssh = Net::SSH.start(@rye_host, @rye_opts[:user], @rye_opts || {})
532
532
  rescue Net::SSH::HostKeyMismatch => ex
533
533
  STDERR.puts ex.message
534
- STDERR.puts "NOTE: EC2 instances generate new SSH keys on first boot."
535
534
  print "\a" if @rye_info # Ring the bell
536
535
  if highline.ask("Continue? ").strip.match(/\Ay|yes|sure|ya\z/i)
537
536
  @rye_opts[:paranoid] = false
data/lib/rye/cmd.rb CHANGED
@@ -110,11 +110,11 @@ module Rye;
110
110
  # it will be created. If +backup+ is specified, +filepath+ will be
111
111
  # copied to +filepath-previous+ before appending.
112
112
  def file_append(filepath, newcontent, backup=false)
113
- if self.file_exists?(filepath) && backup
114
- self.cp filepath, "#{filepath}-previous"
113
+ if self.file_exists?(filepath)
114
+ self.cp filepath, "#{filepath}-previous" if backup
115
+ file_content = self.download filepath
115
116
  end
116
117
 
117
- file_content = self.download filepath
118
118
  file_content ||= StringIO.new
119
119
  if newcontent.is_a?(StringIO)
120
120
  newcontent.rewind
@@ -216,7 +216,12 @@ module Rye;
216
216
  end
217
217
  end
218
218
 
219
-
219
+ # A helper for removing a command from Rye::Cmd.
220
+ # * +meth+ the method name
221
+ def Cmd.remove_command(meth)
222
+ remove_method(meth)
223
+ end
224
+
220
225
  #--
221
226
  # * Consider a lock-down mode using method_added
222
227
  # * Consider Rye.sysinfo.os == :unix
data/lib/rye/rap.rb CHANGED
@@ -94,6 +94,29 @@ module Rye;
94
94
  self
95
95
  end
96
96
 
97
+ # Output STDOUT content to (remote) +path+
98
+ # This works like a shell redirect so the file contents are
99
+ # cleared before outputting.
100
+ #
101
+ # rbox.ps('aux') > 'processes.log'
102
+ #
103
+ def >(path)
104
+ self.obj.unsafely { rm path }
105
+ self.obj.file_append(path, self)
106
+ end
107
+
108
+ # Output STDOUT content to (remote) +path+
109
+ # This works like a shell redirect so if the target file
110
+ # exists the STDOUT content will be appended.
111
+ #
112
+ # rbox.ps('aux') >> 'processes.log'
113
+ #
114
+ def >>(path)
115
+ self.obj.file_append(path, self)
116
+ end
117
+
118
+
119
+
97
120
  # NOTE: This is broken!
98
121
  #def grep *args
99
122
  # self.select do |boxrap|
@@ -103,10 +126,6 @@ module Rye;
103
126
  #end
104
127
 
105
128
 
106
- #def >>(*other)
107
- # p other
108
- #end
109
-
110
129
  #---
111
130
  # If Box's shell methods return Rap objects, then
112
131
  # we can do stuff like this
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.3"
4
+ s.version = "0.7.4"
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: delano-rye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum