ssh-forever 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,8 @@
1
+ == 0.2.1 2009-09-03
2
+
3
+ === New Features
4
+ * Ability to specify a port number when connecting. (Jonas Grimfelt)
5
+
6
+ === Changed Features
7
+ * Better feedback when you enter no hostname or an invalid hostname to connect to. (Matt Wynne)
8
+
data/README.markdown CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  Simple command to give you password-less SSH login on remote servers:
4
4
 
5
- ssh-forever username@yourserver.com
5
+ ssh-forever username@yourserver.com [-p port]
6
6
 
7
- == Installation
7
+ ## Installation
8
8
 
9
9
  gem sources --add http://gemcutter.org
10
10
  gem install ssh-forever
11
11
 
12
- == Example:
12
+ ## Example:
13
13
 
14
- [matt@bowie ssh-forever (master)]$ ./bin/ssh-forever mattwynne@mattwynne.net
14
+ [matt@bowie ssh-forever (master)]$ ssh-forever mattwynne@mattwynne.net
15
15
  You do not appear to have a public key. I expected to find one at /Users/matt/.ssh/id_rsa.pub
16
16
  Would you like me to generate one? [Y/n]y
17
17
  Copying your public key to the remote server. Prepare to enter your password for the last time.
@@ -28,9 +28,13 @@ Simple command to give you password-less SSH login on remote servers:
28
28
  Any malicious and/or unauthorized activity is strictly forbidden.
29
29
  All activity may be logged by DreamHost Web Hosting.
30
30
 
31
- Last login: Sat Aug 15 17:24:17 2009 from 212.69.58.104
31
+ Last login: Sat Aug 15 17:24:17 2009
32
32
  [broncos]$
33
33
 
34
- == Copyright
34
+ ## Why
35
+
36
+ Because I can never remember how to do it by hand. Now I don't have to, and nor do you.
37
+
38
+ ## Copyright
35
39
 
36
40
  Copyright (c) 2009 Matt Wynne. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/bin/ssh-forever CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
4
  require 'ssh-forever'
5
+ require 'optparse'
6
+
7
+ help = 'Usage: ssh-forever username@yourserver.com [-p port]'
8
+
9
+ options = {}
10
+ OptionParser.new do |opts|
11
+ opts.banner = help
12
+
13
+ opts.on('-p', '--port [PORT]', 'port') do |port|
14
+ options[:port] = port
15
+ end
16
+ end.parse!
5
17
 
6
18
  login = ARGV[0]
7
- SecureShellForever.run(login)
19
+
20
+ if login.nil?
21
+ puts help
22
+ exit 1
23
+ end
24
+
25
+ SecureShellForever.run(login, options)
data/lib/ssh-forever.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module SecureShellForever
2
2
  class << self
3
- def run(login)
3
+ def run(login, options = {})
4
4
  unless File.exists?(public_key_path)
5
5
  STDERR.puts "You do not appear to have a public key. I expected to find one at #{public_key_path}\n"
6
6
  STDERR.print "Would you like me to generate one? [Y/n]"
@@ -10,10 +10,18 @@ module SecureShellForever
10
10
  end
11
11
  generate_public_key
12
12
  end
13
+
14
+ args = [
15
+ ' ',
16
+ ("-p #{options[:port]}" if options[:port] =~ /^\d+$/)
17
+ ].compact.join(' ')
18
+
13
19
  puts "Copying your public key to the remote server. Prepare to enter your password for the last time."
14
- `ssh #{login} "#{remote_command}"`
20
+ `ssh #{login}#{args} "#{remote_command}"`
21
+ exit 1 unless $?.exitstatus == 0
22
+
15
23
  puts "Success. From now on you can just use plain old 'ssh'. Logging you in..."
16
- exec "ssh #{login}"
24
+ exec "ssh #{login}#{args}"
17
25
  end
18
26
 
19
27
  def remote_command
data/ssh-forever.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ssh-forever}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Wynne"]
12
- s.date = %q{2009-08-16}
12
+ s.date = %q{2009-09-03}
13
13
  s.default_executable = %q{ssh-forever}
14
14
  s.description = %q{Provides a replacement for the SSH command which automatically copies your public key while logging in}
15
15
  s.email = %q{matt@mattwynne.net}
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  ]
21
21
  s.files = [
22
22
  ".gitignore",
23
+ "History.txt",
23
24
  "LICENSE",
24
25
  "README.markdown",
25
26
  "Rakefile",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh-forever
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wynne
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-16 00:00:00 +01:00
12
+ date: 2009-09-03 00:00:00 +01:00
13
13
  default_executable: ssh-forever
14
14
  dependencies: []
15
15
 
@@ -24,6 +24,7 @@ extra_rdoc_files:
24
24
  - README.markdown
25
25
  files:
26
26
  - .gitignore
27
+ - History.txt
27
28
  - LICENSE
28
29
  - README.markdown
29
30
  - Rakefile