pairkit 0.1.4 → 0.1.5

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/ssh_keys.rb +29 -28
  3. data/pairkit.gemspec +2 -2
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -4,33 +4,6 @@
4
4
  #
5
5
  # ----------------------------------------
6
6
 
7
- def get_or_generate_ssh_key
8
- public_keys = Dir.glob("#{home_directory}/.ssh/*.pub").sort
9
-
10
- case public_keys.length
11
- when 0 then
12
- puts "Could not find an existing public key."
13
- puts "Let's generate one..."
14
- puts "Generating new SSH public key."
15
- generate_ssh_key("id_rsa")
16
- get_key("#{home_directory}/.ssh/id_rsa.pub")
17
- when 1 then
18
- puts "Using existing public key: #{public_keys.first}"
19
- get_key(public_keys.first)
20
- else
21
- puts "Found the following SSH public keys:"
22
- public_keys.each_with_index do |key, index|
23
- puts "#{index+1}) #{File.basename(key)}"
24
- end
25
- puts "Which would you like to use? (Enter number) "
26
- choice = ask.to_i - 1
27
- chosen = public_keys[choice]
28
- if choice == -1 || chosen.nil?
29
- error("Invalid choice.")
30
- end
31
- get_key(chosen)
32
- end
33
- end
34
7
 
35
8
  def generate_ssh_key(keyfile)
36
9
  ssh_dir = File.join(home_directory, ".ssh")
@@ -45,7 +18,7 @@ def get_key(key)
45
18
  File.read(key).chomp #strip trailing newline if present
46
19
  end
47
20
 
48
- def ask
21
+ def ask_user
49
22
  $stdin.gets.to_s.strip
50
23
  end
51
24
 
@@ -61,3 +34,31 @@ end
61
34
  def running_on_windows?
62
35
  RUBY_PLATFORM =~ /mswin32|mingw32/
63
36
  end
37
+
38
+ def get_or_generate_ssh_key
39
+ public_keys = Dir.glob("#{home_directory}/.ssh/*.pub").sort
40
+
41
+ case public_keys.length
42
+ when 0 then
43
+ puts "Could not find an existing public key."
44
+ puts "Let's generate one..."
45
+ puts "Generating new SSH public key."
46
+ generate_ssh_key("id_rsa")
47
+ get_key("#{home_directory}/.ssh/id_rsa.pub")
48
+ when 1 then
49
+ puts "Using existing public key: #{public_keys.first}"
50
+ get_key(public_keys.first)
51
+ else
52
+ puts "Found the following SSH public keys:"
53
+ public_keys.each_with_index do |key, index|
54
+ puts "#{index+1}) #{File.basename(key)}"
55
+ end
56
+ puts "Which would you like to use? (Enter number) "
57
+ choice = ask_user.to_i - 1
58
+ chosen = public_keys[choice]
59
+ if choice == -1 || chosen.nil?
60
+ error("Invalid choice.")
61
+ end
62
+ get_key(chosen)
63
+ end
64
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "pairkit"
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gabe Hollombe"]
12
- s.date = "2012-07-19"
12
+ s.date = "2012-07-21"
13
13
  s.description = "PairKit lets you temporarily expose any ports, on your local computer, to someone else on the Internet. This makes it great for sharing your local web server with a friend, or letting a buddy ssh into your box to pair with you on some code. PairKit uses SSH to set up reverse tunnels (one per exposed port) to your computer through a public server."
14
14
  s.email = "gabe@avantbard.com"
15
15
  s.executables = ["pairkit"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pairkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-19 00:00:00.000000000 Z
12
+ date: 2012-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  segments:
150
150
  - 0
151
- hash: 2310607049390853809
151
+ hash: -1565081878850399005
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements: