delano-rye 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/CHANGES.txt +5 -0
  2. data/bin/rye +4 -3
  3. data/lib/rye.rb +2 -1
  4. data/lib/rye/box.rb +16 -5
  5. data/rye.gemspec +2 -2
  6. metadata +2 -2
@@ -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.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
@@ -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
@@ -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"
@@ -16,7 +16,7 @@
16
16
  s.add_dependency 'sysinfo', '>= 0.7.0'
17
17
 
18
18
  s.add_dependency 'highline', '>= 1.5.1'
19
- s.add_dependency 'net-ssh', '>= 2.0.11'
19
+ s.add_dependency 'net-ssh', '>= 2.0.13'
20
20
  s.add_dependency 'net-scp', '>= 1.0.2'
21
21
  #s.add_dependency 'net-ssh-gateway'
22
22
  #s.add_dependency 'net-ssh-multi'
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.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 2.0.11
73
+ version: 2.0.13
74
74
  version:
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: net-scp