rye 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,6 +1,11 @@
1
1
  RYE, CHANGES
2
2
 
3
3
 
4
+ #### 0.8.9 (2009-08-26) #############################
5
+
6
+ * FIXED: authorize-local for Windows
7
+
8
+
4
9
  #### 0.8.8 (2009-08-25) #############################
5
10
 
6
11
  * FIXED: Rye::Box#guess_user_home for Windows SSH support
data/bin/rye CHANGED
@@ -79,10 +79,11 @@ command :authorize_local do |obj|
79
79
  user = Rye.sysinfo.user
80
80
 
81
81
  puts "Authorizing #{user}@localhost"
82
- rbox = Rye::Box.new('localhost')
82
+ rbox = Rye::Box.new('localhost', :debug => false)
83
83
  puts "Added public keys for: ", rbox.authorize_keys_local
84
- puts "Now try: " << "ssh #{user}@localhost"
85
-
84
+ unless Rye.sysinfo.os == :windows
85
+ puts "Now try: " << "ssh #{user}@localhost"
86
+ end
86
87
  end
87
88
  command_alias :local_authorize, :local_authorise
88
89
 
data/lib/rye/box.rb CHANGED
@@ -224,7 +224,7 @@ module Rye
224
224
  # * +additional_keys+ is a list of file paths to private keys
225
225
  # Returns the instance of Box
226
226
  def add_keys(*additional_keys)
227
- if Rye.sysinfo.os == :win32
227
+ if Rye.sysinfo.os == :windows
228
228
  @rye_opts[:keys] ||= []
229
229
  @rye_opts[:keys] += additional_keys.flatten
230
230
  return @rye_opts[:keys]
@@ -348,7 +348,7 @@ module Rye
348
348
  user_defaults['HOME'] = '/export/home'
349
349
  elsif ostmp == "darwin"
350
350
  user_defaults['HOME'] = '/Users'
351
- elsif ostmp == "win32"
351
+ elsif ostmp == "windows"
352
352
  user_defaults['HOME'] = 'C:/Documents and Settings'
353
353
  else
354
354
  raw = self.quietly { useradd(:D) } rescue ["HOME=/home"]
@@ -425,19 +425,30 @@ module Rye
425
425
  rap.add_exit_code(0)
426
426
  rap
427
427
  end
428
-
428
+ require 'fileutils'
429
429
  # Authorize the current user to login to the local machine via
430
430
  # SSH without a password. This is the same functionality as
431
431
  # authorize_keys_remote except run with local shell commands.
432
432
  def authorize_keys_local
433
433
  added_keys = []
434
+ ssh_dir = File.join(Rye.sysinfo.home, '.ssh')
434
435
  Rye.keys.each do |path|
435
436
  debug "# Public key for #{path}"
436
437
  k = Rye::Key.from_file(path).public_key.to_ssh2
437
- Rye.shell(:mkdir, :p, :m, '700', '$HOME/.ssh') # Silently create dir if it doesn't exist
438
- Rye.shell(:echo, "'#{k}' >> $HOME/.ssh/authorized_keys")
439
- Rye.shell(:echo, "'#{k}' >> $HOME/.ssh/authorized_keys2")
440
- Rye.shell(:chmod, '-R', '0600', '$HOME/.ssh/authorized_keys*')
438
+ FileUtils.mkdir ssh_dir unless File.exists? ssh_dir
439
+
440
+ authkeys_file = File.join(ssh_dir, 'authorized_keys')
441
+
442
+ debug "Writing to #{authkeys_file}"
443
+ File.open(authkeys_file, 'a') {|f| f.write("#{$/}#{k}") }
444
+ File.open("#{authkeys_file}2", 'a') {|f| f.write("#{$/}#{k}") }
445
+
446
+ unless Rye.sysinfo.os == :windows
447
+ Rye.shell(:chmod, '700', ssh_dir)
448
+ Rye.shell(:chmod, '0600', authkeys_file)
449
+ Rye.shell(:chmod, '0600', "#{authkeys_file}2")
450
+ end
451
+
441
452
  added_keys << path
442
453
  end
443
454
  added_keys
data/lib/rye/set.rb CHANGED
@@ -69,7 +69,7 @@ module Rye
69
69
  # * +additional_keys+ is a list of file paths to private keys
70
70
  # Returns the instance of Rye::Set
71
71
  def add_key(*additional_keys)
72
- if Rye.sysinfo.os == :win32
72
+ if Rye.sysinfo.os == :windows
73
73
  @opts[:keys] ||= []
74
74
  @opts[:keys] += additional_keys.flatten
75
75
  return @opts[:keys]
data/lib/rye.rb CHANGED
@@ -43,7 +43,7 @@ module Rye
43
43
  extend self
44
44
 
45
45
  unless defined?(SYSINFO)
46
- VERSION = "0.8.8".freeze
46
+ VERSION = "0.8.9".freeze
47
47
  SYSINFO = SysInfo.new.freeze
48
48
  end
49
49
 
@@ -184,6 +184,7 @@ module Rye
184
184
  # Returns the absolute path if found in PATH otherwise nil.
185
185
  def which(executable)
186
186
  return unless executable.is_a?(String)
187
+ return executable if Rye.sysinfo.os == :windows
187
188
  #return executable if File.exists?(executable) # SHOULD WORK, MUST TEST
188
189
  shortname = File.basename(executable)
189
190
  dir = Rye.sysinfo.paths.select do |path| # dir contains all of the
@@ -315,7 +316,7 @@ module Rye
315
316
 
316
317
  Rye.reload
317
318
 
318
- unless Rye.sysinfo.os == :win32
319
+ unless Rye.sysinfo.os == :windows
319
320
  begin
320
321
  @@mutex.synchronize { # One thread only
321
322
  start_sshagent_environment # Run this now
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.8.8"
4
+ s.version = "0.8.9"
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"
@@ -13,9 +13,10 @@
13
13
  s.add_dependency 'drydock'
14
14
  s.add_dependency 'sysinfo'
15
15
  s.add_dependency 'storable'
16
+ s.add_dependency 'sysinfo', '>= 0.7.0'
16
17
 
17
18
  s.add_dependency 'highline', '>= 1.5.1'
18
- s.add_dependency 'net-ssh', '>= 2.0.11'
19
+ s.add_dependency 'net-ssh', '>= 2.0.13'
19
20
  s.add_dependency 'net-scp', '>= 1.0.2'
20
21
  #s.add_dependency 'net-ssh-gateway'
21
22
  #s.add_dependency 'net-ssh-multi'
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.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -42,6 +42,16 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: "0"
44
44
  version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: sysinfo
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.7.0
54
+ version:
45
55
  - !ruby/object:Gem::Dependency
46
56
  name: highline
47
57
  type: :runtime
@@ -60,7 +70,7 @@ dependencies:
60
70
  requirements:
61
71
  - - ">="
62
72
  - !ruby/object:Gem::Version
63
- version: 2.0.11
73
+ version: 2.0.13
64
74
  version:
65
75
  - !ruby/object:Gem::Dependency
66
76
  name: net-scp