rye 0.9.1 → 0.9.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 CHANGED
@@ -1,5 +1,12 @@
1
1
  RYE, CHANGES
2
2
 
3
+ #### 0.9.2 (2010-10-25) #############################
4
+
5
+ * FIXED: add_keys stores key paths for Rye::Box and Rye::Set
6
+ * ADDED: remove_keys method for Rye::Box and Rye::Set
7
+ * ADDED: interactive_ssh adds private paths to ssh command
8
+
9
+
3
10
  #### 0.9.1 (2010-10-18) #############################
4
11
 
5
12
  * CHANGE: Don't add keys to ssh-agent in Rye::Box and Rye::Set
data/lib/rye.rb CHANGED
@@ -42,7 +42,7 @@ require 'esc'
42
42
  module Rye
43
43
  extend self
44
44
 
45
- VERSION = "0.9.1".freeze unless defined?(VERSION)
45
+ VERSION = "0.9.2".freeze unless defined?(VERSION)
46
46
 
47
47
  @@sysinfo = nil
48
48
  @@agent_env = Hash.new # holds ssh-agent env vars
data/lib/rye/box.rb CHANGED
@@ -260,34 +260,38 @@ module Rye
260
260
  #
261
261
  # TODO: refactor to use net_ssh_exec! in 0.9
262
262
  def interactive_ssh(run=true)
263
- debug "interactive_ssh with keys: #{Rye.keys.inspect}"
264
- run = false unless STDIN.tty?
265
- cmd = Rye.prepare_command("ssh", "#{@rye_user}@#{@rye_host}")
263
+ debug "interactive_ssh with keys: #{@rye_opts[:keys].inspect}"
264
+ run = false unless STDIN.tty?
265
+ args = []
266
+ @rye_opts[:keys].each { |key| args.push *[:i, key] }
267
+ args << "#{@rye_user}@#{@rye_host}"
268
+ cmd = Rye.prepare_command("ssh", args)
266
269
  return cmd unless run
267
270
  system(cmd)
268
271
  end
269
272
 
270
- # Add one or more private keys to the SSH Agent.
271
- # * +additional_keys+ is a list of file paths to private keys
273
+ # Add one or more private keys to the list of key paths.
274
+ # * +keys+ is a list of file paths to private keys
272
275
  # Returns the instance of Box
273
- def add_keys(*additional_keys)
274
- if Rye.sysinfo.os == :windows
275
- @rye_opts[:keys] ||= []
276
- @rye_opts[:keys] += additional_keys.flatten
277
- return @rye_opts[:keys]
278
- end
279
- additional_keys = [additional_keys].flatten.compact || []
280
- return if additional_keys.empty?
281
- #ret = Rye.add_keys(additional_keys)
282
- #if ret.is_a?(Rye::Rap)
283
- # debug "ssh-add exit_status: #{ret.exit_status}"
284
- # debug "ssh-add stdout: #{ret.stdout}"
285
- # debug "ssh-add stderr: #{ret.stderr}"
286
- #end
276
+ def add_keys(*keys)
277
+ @rye_opts[:keys] ||= []
278
+ @rye_opts[:keys] += keys.flatten.compact
279
+ @rye_opts[:keys].uniq!
287
280
  self # MUST RETURN self
288
281
  end
289
282
  alias :add_key :add_keys
290
283
 
284
+ # Remove one or more private keys fromt he list of key paths.
285
+ # * +keys+ is a list of file paths to private keys
286
+ # Returns the instance of Box
287
+ def remove_keys(*keys)
288
+ @rye_opts[:keys] ||= []
289
+ @rye_opts[:keys] -= keys.flatten.compact
290
+ @rye_opts[:keys].uniq!
291
+ self # MUST RETURN self
292
+ end
293
+ alias :remove_key :remove_keys
294
+
291
295
  # Return the value of uname in lowercase
292
296
  # This is a temporary fix. We can use SysInfo for this, upload
293
297
  # it, execute it directly, parse the output.
data/lib/rye/set.rb CHANGED
@@ -66,20 +66,31 @@ module Rye
66
66
  end
67
67
  alias :add_boxes :add_box
68
68
 
69
- # Add one or more private keys to the SSH Agent.
69
+ # Add one or more private keys to each box. Also stores key paths
70
+ # in the set so when new boxes are added they will get the same keys,
70
71
  # * +additional_keys+ is a list of file paths to private keys
71
72
  # Returns the instance of Rye::Set
72
- def add_key(*additional_keys)
73
- if Rye.sysinfo.os == :windows
74
- @opts[:keys] ||= []
75
- @opts[:keys] += additional_keys.flatten
76
- return @opts[:keys]
73
+ def add_keys(*additional_keys)
74
+ additional_keys = additional_keys.flatten.compact
75
+ @opts[:keys] ||= []
76
+ @opts[:keys] += additional_keys
77
+ @opts[:keys].uniq!
78
+ @boxes.each do |box|
79
+ box.add_keys *additional_keys
77
80
  end
78
- additional_keys = [additional_keys].flatten.compact || []
79
- #Rye.add_keys(additional_keys)
80
81
  self
81
82
  end
82
- alias :add_keys :add_key
83
+ alias :add_key :add_keys
84
+
85
+ def remove_keys(*keys)
86
+ @opts[:keys] ||= []
87
+ @opts[:keys] -= keys.flatten.compact
88
+ @boxes.each do |box|
89
+ box.remove_keys keys.flatten.compact
90
+ end
91
+ self
92
+ end
93
+ alias :remove_key :remove_keys
83
94
 
84
95
  # Add an environment variable. +n+ and +v+ are the name and value.
85
96
  # Returns the instance of Rye::Set
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.9.1"
4
+ s.version = "0.9.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,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rye
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 1
10
- version: 0.9.1
9
+ - 2
10
+ version: 0.9.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Delano Mandelbaum
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-18 00:00:00 -04:00
18
+ date: 2010-10-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency