cliaws 1.4.1 → 1.4.2

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/Manifest.txt CHANGED
@@ -4,11 +4,14 @@ License.txt
4
4
  Manifest.txt
5
5
  README.txt
6
6
  Rakefile
7
+ bin/cliec2
7
8
  bin/clis3
8
9
  bin/clisqs
10
+ cliaws.gemspec
9
11
  config/hoe.rb
10
12
  config/requirements.rb
11
13
  lib/cliaws.rb
14
+ lib/cliaws/ec2.rb
12
15
  lib/cliaws/s3.rb
13
16
  lib/cliaws/sqs.rb
14
17
  lib/cliaws/version.rb
data/bin/cliec2 ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2008-4-12.
4
+ # Copyright (c) 2008. All rights reserved.
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ # no rubygems to load, so we fail silently
10
+ end
11
+
12
+ require "main"
13
+
14
+ $:.unshift File.dirname(__FILE__) + "/../lib"
15
+ require "cliaws"
16
+
17
+ Main {
18
+ mode("list") do
19
+ def run
20
+ instances = Cliaws.ec2.list
21
+ printf "%-50s %-12s %s\n", "DNS Name", "State", "Groups"
22
+ printf "-"*120
23
+ print "\n"
24
+ instances.each do |instance|
25
+ printf "%-50s %-12s %s\n", instance.public_dns_name, instance.state, instance.groups.join(", ")
26
+ end
27
+ end
28
+ end
29
+ }
data/cliaws.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{cliaws}
3
+ s.version = "1.4.1"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Fran\303\247ois Beausoleil"]
7
+ s.date = %q{2008-10-26}
8
+ s.description = %q{A command-line suite of tools to access Amazon Web Services, using the RightAws gems.}
9
+ s.email = ["francois@teksol.info"]
10
+ s.executables = ["clis3", "clisqs", "cliec2"]
11
+ s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "vendor/right_http_connection-1.2.1/README.txt"]
12
+ s.files = [".gitignore", "History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/cliec2", "bin/clis3", "bin/clisqs", "config/hoe.rb", "config/requirements.rb", "lib/cliaws.rb", "lib/cliaws/ec2.rb", "lib/cliaws/s3.rb", "lib/cliaws/sqs.rb", "lib/cliaws/version.rb", "log/.gitignore", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "tasks/deployment.rake", "tasks/environment.rake", "test/test_cliaws.rb", "test/test_helper.rb", "vendor/right_http_connection-1.2.1/README.txt", "vendor/right_http_connection-1.2.1/lib/right_http_connection.rb"]
13
+ s.has_rdoc = true
14
+ s.homepage = %q{http://cliaws.rubyforge.org}
15
+ s.rdoc_options = ["--main", "README.txt"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{cliaws}
18
+ s.rubygems_version = %q{1.2.0}
19
+ s.summary = %q{A command-line suite of tools to access Amazon Web Services, using the RightAws gems.}
20
+ s.test_files = ["test/test_cliaws.rb", "test/test_helper.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if current_version >= 3 then
27
+ s.add_runtime_dependency(%q<main>, ["~> 2.8"])
28
+ s.add_runtime_dependency(%q<right_aws>, ["~> 1.8"])
29
+ s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
30
+ else
31
+ s.add_dependency(%q<main>, ["~> 2.8"])
32
+ s.add_dependency(%q<right_aws>, ["~> 1.8"])
33
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
34
+ end
35
+ else
36
+ s.add_dependency(%q<main>, ["~> 2.8"])
37
+ s.add_dependency(%q<right_aws>, ["~> 1.8"])
38
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
39
+ end
40
+ end
data/lib/cliaws/ec2.rb ADDED
@@ -0,0 +1,51 @@
1
+ require "right_aws"
2
+
3
+ module Cliaws
4
+ class Ec2
5
+ attr_reader :access_key_id, :secret_access_key
6
+ protected :access_key_id, :secret_access_key
7
+
8
+ def initialize(access_key_id, secret_access_key)
9
+ @access_key_id, @secret_access_key = access_key_id, secret_access_key
10
+ end
11
+
12
+ def list
13
+ ec2.describe_instances.map {|raw_data| Instance.new(raw_data)}
14
+ end
15
+
16
+ class Instance
17
+ def initialize(raw_data)
18
+ @raw_data = raw_data
19
+ end
20
+
21
+ def running?
22
+ @raw_data[:aws_state] == "running"
23
+ end
24
+
25
+ def instance_id
26
+ @raw_data[:aws_instance_id]
27
+ end
28
+
29
+ def public_dns_name
30
+ @raw_data[:dns_name]
31
+ end
32
+
33
+ def private_dns_name
34
+ @raw_data[:aws_private_dns_name]
35
+ end
36
+
37
+ def state
38
+ @raw_data[:aws_state]
39
+ end
40
+
41
+ def groups
42
+ @raw_data[:aws_groups]
43
+ end
44
+ end
45
+
46
+ protected
47
+ def ec2
48
+ @ec2 ||= RightAws::Ec2.new(access_key_id, secret_access_key, :logger => Logger.new("/dev/null"))
49
+ end
50
+ end
51
+ end
@@ -2,7 +2,7 @@ module Cliaws #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 4
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cliaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"
@@ -46,6 +46,7 @@ description: A command-line suite of tools to access Amazon Web Services, using
46
46
  email:
47
47
  - francois@teksol.info
48
48
  executables:
49
+ - cliec2
49
50
  - clis3
50
51
  - clisqs
51
52
  extensions: []
@@ -63,11 +64,14 @@ files:
63
64
  - Manifest.txt
64
65
  - README.txt
65
66
  - Rakefile
67
+ - bin/cliec2
66
68
  - bin/clis3
67
69
  - bin/clisqs
70
+ - cliaws.gemspec
68
71
  - config/hoe.rb
69
72
  - config/requirements.rb
70
73
  - lib/cliaws.rb
74
+ - lib/cliaws/ec2.rb
71
75
  - lib/cliaws/s3.rb
72
76
  - lib/cliaws/sqs.rb
73
77
  - lib/cliaws/version.rb