fssh 0.0.1

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.
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,70 @@
1
+ ## fssh
2
+
3
+ Easily ssh into remote Amazon EC2 hosts by name. Eg. `fssh hellfire`.
4
+
5
+ ## Installation
6
+
7
+ `gem install fssh`
8
+
9
+ ## Setup
10
+
11
+ Add your Amazon security credentials as variables in your shell. Usually this is done via a file like your `~/.bash_profile` or `~/.bashrc`:
12
+
13
+ ```
14
+ export AMAZON_ACCESS_KEY_ID=...
15
+ export AMAZON_ACCESS_SECRET=...
16
+ ```
17
+
18
+ Create the file `~/.fssh` that will contain your fssh config in YAML format. Mine looks something like this:
19
+
20
+ ```
21
+ :local_private_key_file: ~/.ssh/private.pem
22
+ :remote_private_key_file: /home/camertron/.ssh/private.pem
23
+ :gateway:
24
+ - :name: bastion
25
+ :except:
26
+ - bastion
27
+ - :name: bastion2
28
+ :except:
29
+ - bastion2
30
+ :only:
31
+ - hellfire
32
+ :username: camertron
33
+ ```
34
+
35
+ 1. The local and remote key files should point to your Amazon-issued .pem file. If you don't use a gateway, the remote key file isn't necessary since you don't need to hop more than once.
36
+ 2. You can specify more than one gateway and when to use it via the `:only` and `:except` options. It's usually a good idea to put the gateway's name into the `:except` list since you don't want to connect to the gateway through itself (right?). Use the `:only` list to indicate servers that should always be connected to via this gateway. In the example above, a connection to the `hellfire` server will happen through the `bastion2` gateway.
37
+ 3. Specify the username you want to connect to the remote server as.
38
+
39
+ ## Usage
40
+
41
+ SSH to and (optionally) run a command on a remote ec2 server:
42
+
43
+ `fssh server_name [command]`
44
+
45
+ Securely copy a file from a remote ec2 server to your local machine or vice-versa. For the most part, the `fscp` command uses the same `host:/path/` syntax that the `scp` command uses:
46
+
47
+ `fscp server_name:/remote_path local_path`
48
+
49
+ `fscp local_path, server_name:/remote_path`
50
+
51
+ ## Requirements
52
+
53
+ The fssh gem assumes you have OpenSSH (or some variant) installed and that you're running some *nix-based operating system like Linux or Mac OS. The `fscp` command also relies on the existence of netcat.
54
+
55
+ ## Running Tests
56
+
57
+ `bundle exec rake` or `bundle exec rspec`
58
+
59
+ ## Authors
60
+
61
+ * Cameron C. Dutro: http://github.com/camertron
62
+
63
+ ## Links
64
+ * amazon-ec2 gem: [https://github.com/grempe/amazon-ec2](https://github.com/grempe/amazon-ec2)
65
+
66
+ ## License
67
+
68
+ Copyright 2012 Forrager.
69
+
70
+ Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
7
+
8
+ require 'bundler'
9
+ require 'digest'
10
+
11
+ require 'rspec/core/rake_task'
12
+ require 'rubygems/package_task'
13
+
14
+ require './lib/fssh'
15
+
16
+ Bundler::GemHelper.install_tasks
17
+
18
+ task :default => :spec
19
+
20
+ desc 'Run specs'
21
+ RSpec::Core::RakeTask.new do |t|
22
+ t.pattern = './spec/**/*_spec.rb'
23
+ end
@@ -0,0 +1,65 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ # encoding: UTF-8
4
+
5
+ # Copyright 2012 Forrager
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ require 'rubygems' unless ENV["NO_RUBYGEMS"]
9
+ require 'fssh'
10
+
11
+ if ARGV[0] && ARGV[1]
12
+ if ARGV[0].include?(":")
13
+ remote_path = ARGV[0]
14
+ local_path = ARGV[1]
15
+ direction = :down
16
+ else
17
+ remote_path = ARGV[1]
18
+ local_path = ARGV[0]
19
+ direction = :up
20
+ end
21
+
22
+ server_name, remote_path = remote_path.split(":")
23
+ cli = FSSH::CLI.new(server_name)
24
+ else
25
+ puts "fscp must be given a remote path and a local path, eg: fscp hellfire:/tmp/file ~/Desktop"
26
+ exit 1
27
+ end
28
+
29
+ unless cli.private_key_exists?
30
+ puts "Could not find #{cli.config.local_private_key_file}"
31
+ exit 1
32
+ end
33
+
34
+ puts " * Finding instances ..."
35
+ cli.find_instances
36
+
37
+ if cli.find_gateway
38
+ puts " * Found gateway"
39
+ end
40
+
41
+ if cli.find_server
42
+ puts " * Found #{cli.server_name}"
43
+ else
44
+ puts " * Couldn't find server with name #{cli.server_name}"
45
+ exit 1
46
+ end
47
+
48
+ command = if cli.hops.size == 1
49
+ case direction
50
+ when :down
51
+ "scp -i #{cli.config.local_private_key_file} #{cli.config.username}@#{cli.hops.first.dns_name}:#{remote_path} #{local_path}"
52
+ when :up
53
+ "scp -i #{cli.config.local_private_key_file} #{local_path} #{cli.config.username}@#{cli.hops.first.dns_name}:#{remote_path}"
54
+ end
55
+ else
56
+ case direction
57
+ when :down
58
+ %Q(scp -i #{cli.config.local_private_key_file} -Cp -o "ProxyCommand ssh -i #{cli.config.local_private_key_file} #{cli.config.username}@#{cli.hops.first.dns_name} nc #{cli.hops[1].private_dns_name} 22" #{cli.config.username}@#{cli.hops[1].private_dns_name}:#{remote_path} #{local_path})
59
+ when :up
60
+ %Q(scp -i #{cli.config.local_private_key_file} -Cp -o "ProxyCommand ssh -i #{cli.config.local_private_key_file} #{cli.config.username}@#{cli.hops.first.dns_name} nc #{cli.hops[1].private_dns_name} 22" #{local_path} #{cli.config.username}@#{cli.hops[1].private_dns_name}:#{remote_path})
61
+ end
62
+ end
63
+
64
+ puts " * Executing #{command}"
65
+ exec command
@@ -0,0 +1,45 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ # encoding: UTF-8
4
+
5
+ # Copyright 2012 Forrager
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ require 'rubygems' unless ENV["NO_RUBYGEMS"]
9
+ require 'fssh'
10
+
11
+ if ARGV[0]
12
+ cli = FSSH::CLI.new(ARGV[0])
13
+ else
14
+ puts "fssh must be given the name of the server to connect to, eg: fssh my_awesome_server"
15
+ exit 1
16
+ end
17
+
18
+ remote_command = (ARGV[1..-1] || "").join(" ")
19
+
20
+ unless cli.private_key_exists?
21
+ puts "Could not find #{cli.config.local_private_key_file}"
22
+ exit 1
23
+ end
24
+
25
+ puts " * Finding instances ..."
26
+ cli.find_instances
27
+
28
+ if cli.find_gateway
29
+ puts " * Found gateway"
30
+ end
31
+
32
+ if cli.find_server
33
+ puts " * Found #{cli.server_name}"
34
+ else
35
+ puts " * Couldn't find server with name #{cli.server_name}"
36
+ exit 1
37
+ end
38
+
39
+ command = cli.hops.each_with_index.map do |hop, idx|
40
+ cmd = "ssh -t -t -i #{idx == 0 ? cli.config.local_private_key_file : cli.config.remote_private_key_file} "
41
+ cmd + "#{cli.config.username}@#{idx == 0 ? hop.dns_name : hop.private_dns_name}"
42
+ end.join(" ") + " #{remote_command}"
43
+
44
+ puts " * Executing: #{command}"
45
+ exec command
@@ -0,0 +1,29 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ $:.unshift File.join(File.dirname(__FILE__), 'lib')
7
+ require 'fssh/version'
8
+
9
+ Gem::Specification.new do |s|
10
+ s.name = "fssh"
11
+ s.version = ::FSSH::VERSION
12
+ s.authors = ["Cameron Dutro"]
13
+ s.email = ["cameron@forrager.com"]
14
+ s.homepage = "http://forrager.com"
15
+
16
+ s.description = s.summary = "Easily ssh into remote Amazon EC2 hosts by name."
17
+
18
+ s.platform = Gem::Platform::RUBY
19
+ s.has_rdoc = true
20
+ s.summary = ""
21
+
22
+ s.add_dependency 'amazon-ec2', '~> 0.9.17'
23
+
24
+ s.require_path = 'lib'
25
+
26
+ s.files = Dir["{lib}/**/*", "Gemfile", "History.txt", "LICENSE", "README.md", "Rakefile", "fssh.gemspec"]
27
+ s.executables << "fssh"
28
+ s.executables << "fscp"
29
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ require 'aws'
7
+ require 'yaml'
8
+
9
+ module FSSH
10
+ autoload :Instance, "fssh/instance"
11
+ autoload :ServerSet, "fssh/server_set"
12
+ autoload :ServerManager, "fssh/server_manager"
13
+ autoload :Config, "fssh/config"
14
+ autoload :CLI, "fssh/cli"
15
+ end
@@ -0,0 +1,63 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ module FSSH
7
+ class CLI
8
+ attr_reader :server_name, :config, :config_file
9
+ attr_reader :instances, :server, :gateway
10
+
11
+ def initialize(server_name)
12
+ @server_name = server_name
13
+ load_config
14
+ end
15
+
16
+ def find_instances
17
+ @instances = FSSH::ServerManager.instances
18
+ !!@instances
19
+ end
20
+
21
+ def find_gateway
22
+ running = @instances.filter_running
23
+ @gateway_config = @config.resolve_gateway(server_name)
24
+
25
+ if @gateway_config
26
+ @gateway = running.filter_group(@gateway_config[:name]).first
27
+ true
28
+ else
29
+ false
30
+ end
31
+ end
32
+
33
+ def find_server
34
+ if !@gateway_config || @gateway_config[:name] != @server_name
35
+ running = @instances.filter_running
36
+ @server = running.filter_tags("Name" => @server_name).first
37
+ !!@server.base
38
+ else
39
+ true
40
+ end
41
+ end
42
+
43
+ def private_key_exists?
44
+ File.exist?(File.expand_path(@config.local_private_key_file))
45
+ end
46
+
47
+ def hops
48
+ @hops ||= [@gateway, @server].compact
49
+ end
50
+
51
+ protected
52
+
53
+ def load_config
54
+ @config_file = File.expand_path("~/.fssh")
55
+
56
+ if File.exist?(@config_file)
57
+ @config = FSSH::Config.load_file(@config_file)
58
+ else
59
+ raise "Couldn't find .fssh config file at #{@config_fie}"
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,41 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ module FSSH
7
+ class Config
8
+ attr_reader :data
9
+
10
+ class << self
11
+ def load_file(file)
12
+ result = Config.new
13
+ result.instance_variable_set(:'@data', YAML.load_file(file))
14
+ result
15
+ end
16
+
17
+ def load(content)
18
+ result = Config.new
19
+ result.instance_variable_set(:'@data', YAML.load(content))
20
+ result
21
+ end
22
+ end
23
+
24
+ def [](key)
25
+ @data[key]
26
+ end
27
+
28
+ def method_missing(method)
29
+ @data[method]
30
+ end
31
+
32
+ def resolve_gateway(server)
33
+ @data[:gateway].find do |rules|
34
+ passed = true
35
+ passed &&= rules[:except].none? { |rule| server == rule } if rules[:except]
36
+ passed &&= rules[:only].include?(server) if rules[:only]
37
+ passed
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ module FSSH
7
+ class Instance
8
+ def initialize(instance)
9
+ @instance = instance
10
+ end
11
+
12
+ def base
13
+ @instance
14
+ end
15
+
16
+ def dns_name
17
+ base.instancesSet.item.first.dnsName
18
+ end
19
+
20
+ def private_dns_name
21
+ base.instancesSet.item.first.privateDnsName
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ module FSSH
7
+ class ServerManager
8
+ class << self
9
+ def client
10
+ @client ||= AWS::EC2::Base.new(
11
+ :access_key_id => ENV["AMAZON_ACCESS_KEY_ID"],
12
+ :secret_access_key => ENV["AMAZON_ACCESS_SECRET"]
13
+ )
14
+ end
15
+
16
+ def instances
17
+ @instances ||= ServerSet.new(client.describe_instances.reservationSet.item)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,54 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ module FSSH
7
+ class ServerSet
8
+ def initialize(instances)
9
+ @instances = instances
10
+ end
11
+
12
+ def filter_group(group)
13
+ ServerSet.new(@instances.select do |item|
14
+ item.groupSet.item.any? do |set|
15
+ set.groupId == group
16
+ end
17
+ end)
18
+ end
19
+
20
+ def filter_running
21
+ ServerSet.new(@instances.select do |item|
22
+ item.instancesSet.item.first.instanceState.name == "running"
23
+ end)
24
+ end
25
+
26
+ def filter_tags(tags = {})
27
+ ServerSet.new(@instances.select do |item|
28
+ item.instancesSet.item.first.tagSet.item.any? do |instance_tag|
29
+ tags.include?(instance_tag["key"]) && tags[instance_tag["key"]] == instance_tag["value"]
30
+ end
31
+ end)
32
+ end
33
+
34
+ def dns_names
35
+ @instances.map { |instance| instance.instancesSet.item.first.dnsName }
36
+ end
37
+
38
+ def first
39
+ Instance.new(@instances.first)
40
+ end
41
+
42
+ def [](index)
43
+ Instance.new(@instances[index])
44
+ end
45
+
46
+ def size
47
+ @instances.size
48
+ end
49
+
50
+ def -(arr)
51
+ ServerSet.new(@instances - arr)
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2012 Forrager
4
+ # http://www.apache.org/licenses/LICENSE-2.0
5
+
6
+ module FSSH
7
+ VERSION = "0.0.1"
8
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fssh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Cameron Dutro
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: amazon-ec2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.9.17
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.9.17
30
+ description: Easily ssh into remote Amazon EC2 hosts by name.
31
+ email:
32
+ - cameron@forrager.com
33
+ executables:
34
+ - fssh
35
+ - fscp
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - lib/fssh/cli.rb
40
+ - lib/fssh/config.rb
41
+ - lib/fssh/instance.rb
42
+ - lib/fssh/server_manager.rb
43
+ - lib/fssh/server_set.rb
44
+ - lib/fssh/version.rb
45
+ - lib/fssh.rb
46
+ - Gemfile
47
+ - LICENSE
48
+ - README.md
49
+ - Rakefile
50
+ - fssh.gemspec
51
+ - bin/fssh
52
+ - bin/fscp
53
+ homepage: http://forrager.com
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 1.8.24
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: ''
77
+ test_files: []