anveo-ec2ssh 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/anveo-ec2ssh.gemspec +2 -2
  3. data/lib/ec2ssh.rb +16 -0
  4. metadata +22 -22
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{anveo-ec2ssh}
8
- s.version = "0.1.9"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Ramon Salvadó}, %q{Brian Racer}]
12
- s.date = %q{2012-01-18}
12
+ s.date = %q{2012-01-31}
13
13
  s.description = %q{Since ec2 instance public hostnames are dynamic, and not easy to remember or type, this script provides a list all your running instances so you can select the one you want to ssh into easily (without having to pass the aws console ritual each time you need the hostname).}
14
14
  s.email = %q{bracer@gmail.com}
15
15
  s.executables = [%q{ec2ssh}]
@@ -49,6 +49,12 @@ module Ec2ssh
49
49
  input = ask(">> ")
50
50
  options = input.split
51
51
 
52
+ # check if last arg is 'public' or 'private'. If so remove it from the options stack and save the value
53
+ pub_priv_override = ''
54
+ if options[-1] =~ /public|private/
55
+ pub_priv_override = options.pop
56
+ end
57
+
52
58
  input_host = options[0]
53
59
  input_user = options[1]
54
60
  input_key = options[2]
@@ -67,6 +73,16 @@ module Ec2ssh
67
73
 
68
74
  template = @config[:template] || "ssh #{default_user}@<public_dns>"
69
75
 
76
+ # if we have a public or private ip override, replace the template variable
77
+ unless pub_priv_override.blank?
78
+ case pub_priv_override
79
+ when 'public'
80
+ template.gsub!("<private_ip>", "<public_dns>")
81
+ when 'private'
82
+ template.gsub!("<public_dns>", "<private_ip>")
83
+ end
84
+ end
85
+
70
86
  # <instance> remains for compatibility with upstream
71
87
  command = template.gsub("<instance>", host_public_dns).
72
88
  gsub("<public_dns>", host_public_dns).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anveo-ec2ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-18 00:00:00.000000000Z
13
+ date: 2012-01-31 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws
17
- requirement: &70334023754160 !ruby/object:Gem::Requirement
17
+ requirement: &70219192880180 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.5.6
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70334023754160
25
+ version_requirements: *70219192880180
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &70334023753040 !ruby/object:Gem::Requirement
28
+ requirement: &70219192879080 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 3.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70334023753040
36
+ version_requirements: *70219192879080
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: colorize
39
- requirement: &70334023751520 !ruby/object:Gem::Requirement
39
+ requirement: &70219192877760 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - =
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 0.5.8
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70334023751520
47
+ version_requirements: *70219192877760
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: highline
50
- requirement: &70334023750560 !ruby/object:Gem::Requirement
50
+ requirement: &70219192876660 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.6.8
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70334023750560
58
+ version_requirements: *70219192876660
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: text-table
61
- requirement: &70334023749960 !ruby/object:Gem::Requirement
61
+ requirement: &70219192875040 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - =
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.2.2
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70334023749960
69
+ version_requirements: *70219192875040
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: aws
72
- requirement: &70334023743260 !ruby/object:Gem::Requirement
72
+ requirement: &70219192873280 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 2.5.6
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *70334023743260
80
+ version_requirements: *70219192873280
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: activesupport
83
- requirement: &70334023742500 !ruby/object:Gem::Requirement
83
+ requirement: &70219192872220 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 3.0.0
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *70334023742500
91
+ version_requirements: *70219192872220
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: colorize
94
- requirement: &70334023741540 !ruby/object:Gem::Requirement
94
+ requirement: &70219192870940 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - =
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 0.5.8
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *70334023741540
102
+ version_requirements: *70219192870940
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: highline
105
- requirement: &70334023740240 !ruby/object:Gem::Requirement
105
+ requirement: &70219192869600 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: 1.6.8
111
111
  type: :runtime
112
112
  prerelease: false
113
- version_requirements: *70334023740240
113
+ version_requirements: *70219192869600
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: text-table
116
- requirement: &70334023739180 !ruby/object:Gem::Requirement
116
+ requirement: &70219192868140 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ~>
@@ -121,7 +121,7 @@ dependencies:
121
121
  version: 1.2.2
122
122
  type: :runtime
123
123
  prerelease: false
124
- version_requirements: *70334023739180
124
+ version_requirements: *70219192868140
125
125
  description: Since ec2 instance public hostnames are dynamic, and not easy to remember
126
126
  or type, this script provides a list all your running instances so you can select
127
127
  the one you want to ssh into easily (without having to pass the aws console ritual