rudy 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +28 -5
- data/README.rdoc +1 -1
- data/Rudyfile +51 -19
- data/bin/ird +153 -0
- data/bin/rudy +18 -23
- data/bin/rudy-ec2 +5 -10
- data/bin/rudy-s3 +1 -3
- data/bin/rudy-sdb +0 -2
- data/examples/README.md +10 -0
- data/examples/debian-sinatra-passenger/commands.rb +19 -0
- data/examples/debian-sinatra-passenger/machines.rb +32 -0
- data/examples/debian-sinatra-passenger/routines.rb +30 -0
- data/examples/debian-sinatra-thin/commands.rb +17 -0
- data/examples/debian-sinatra-thin/machines.rb +35 -0
- data/examples/debian-sinatra-thin/routines.rb +72 -0
- data/lib/rudy.rb +8 -17
- data/lib/rudy/aws.rb +1 -2
- data/lib/rudy/aws/ec2/address.rb +0 -1
- data/lib/rudy/aws/ec2/snapshot.rb +11 -0
- data/lib/rudy/aws/s3.rb +6 -3
- data/lib/rudy/cli.rb +12 -2
- data/lib/rudy/cli/aws/ec2/candy.rb +19 -48
- data/lib/rudy/cli/aws/ec2/images.rb +109 -122
- data/lib/rudy/cli/aws/s3/buckets.rb +1 -2
- data/lib/rudy/cli/config.rb +13 -0
- data/lib/rudy/cli/disks.rb +24 -1
- data/lib/rudy/cli/routines.rb +10 -11
- data/lib/rudy/config.rb +6 -9
- data/lib/rudy/config/objects.rb +4 -0
- data/lib/rudy/global.rb +4 -5
- data/lib/rudy/huxtable.rb +23 -8
- data/lib/rudy/machines.rb +11 -4
- data/lib/rudy/metadata.rb +8 -94
- data/lib/rudy/metadata/backup.rb +113 -0
- data/lib/rudy/metadata/backups.rb +65 -0
- data/lib/rudy/{disks.rb → metadata/disk.rb} +36 -69
- data/lib/rudy/metadata/disks.rb +67 -0
- data/lib/rudy/metadata/objectbase.rb +104 -0
- data/lib/rudy/mixins.rb +2 -0
- data/lib/rudy/routines.rb +173 -88
- data/lib/rudy/routines/helpers/dependshelper.rb +34 -0
- data/lib/rudy/routines/helpers/diskhelper.rb +174 -5
- data/lib/rudy/routines/helpers/scmhelper.rb +2 -2
- data/lib/rudy/routines/helpers/scripthelper.rb +11 -4
- data/lib/rudy/routines/passthrough.rb +3 -1
- data/lib/rudy/routines/reboot.rb +75 -0
- data/lib/rudy/routines/startup.rb +3 -3
- data/lib/rudy/scm/git.rb +17 -17
- data/lib/rudy/scm/svn.rb +46 -5
- data/lib/rudy/utils.rb +3 -2
- data/rudy.gemspec +24 -46
- data/test/30_sdb_metadata/10_disks_test.rb +5 -5
- metadata +36 -68
- data/lib/annoy.rb +0 -298
- data/lib/console.rb +0 -404
- data/lib/escape.rb +0 -305
- data/lib/rudy/backup.rb +0 -135
- data/lib/storable.rb +0 -292
- data/lib/sysinfo.rb +0 -285
- data/lib/tryouts.rb +0 -33
- data/vendor/highline-1.5.1/CHANGELOG +0 -222
- data/vendor/highline-1.5.1/INSTALL +0 -35
- data/vendor/highline-1.5.1/LICENSE +0 -7
- data/vendor/highline-1.5.1/README +0 -63
- data/vendor/highline-1.5.1/Rakefile +0 -82
- data/vendor/highline-1.5.1/TODO +0 -6
- data/vendor/highline-1.5.1/examples/ansi_colors.rb +0 -38
- data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +0 -18
- data/vendor/highline-1.5.1/examples/basic_usage.rb +0 -75
- data/vendor/highline-1.5.1/examples/color_scheme.rb +0 -32
- data/vendor/highline-1.5.1/examples/limit.rb +0 -12
- data/vendor/highline-1.5.1/examples/menus.rb +0 -65
- data/vendor/highline-1.5.1/examples/overwrite.rb +0 -19
- data/vendor/highline-1.5.1/examples/page_and_wrap.rb +0 -322
- data/vendor/highline-1.5.1/examples/password.rb +0 -7
- data/vendor/highline-1.5.1/examples/trapping_eof.rb +0 -22
- data/vendor/highline-1.5.1/examples/using_readline.rb +0 -17
- data/vendor/highline-1.5.1/lib/highline.rb +0 -758
- data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +0 -120
- data/vendor/highline-1.5.1/lib/highline/compatibility.rb +0 -17
- data/vendor/highline-1.5.1/lib/highline/import.rb +0 -43
- data/vendor/highline-1.5.1/lib/highline/menu.rb +0 -395
- data/vendor/highline-1.5.1/lib/highline/question.rb +0 -463
- data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +0 -193
- data/vendor/highline-1.5.1/setup.rb +0 -1360
- data/vendor/highline-1.5.1/test/tc_color_scheme.rb +0 -56
- data/vendor/highline-1.5.1/test/tc_highline.rb +0 -823
- data/vendor/highline-1.5.1/test/tc_import.rb +0 -54
- data/vendor/highline-1.5.1/test/tc_menu.rb +0 -429
- data/vendor/highline-1.5.1/test/ts_all.rb +0 -15
data/bin/rudy-ec2
CHANGED
@@ -10,8 +10,6 @@
|
|
10
10
|
#
|
11
11
|
|
12
12
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
|
13
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
|
14
|
-
#%w{net-scp amazon-ec2 caesars rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
|
15
13
|
#require 'rubygems'
|
16
14
|
|
17
15
|
require 'rudy'
|
@@ -63,13 +61,10 @@ module RudyCLI_EC2
|
|
63
61
|
usage "rudy-ec2 download remote-source target"
|
64
62
|
usage "NOTE: Use quotes when using a tilda or asterisk in remote paths ('~/')."
|
65
63
|
usage "rudy-ec2 download '~/*' /tmp/"
|
66
|
-
option :r, :recursive, "Recursively copy entire directories"
|
67
|
-
option :p, :preserve, "Preserve atimes and ctimes."
|
68
|
-
option :d, :download, "Download FROM the remote machine to the local machine"
|
69
|
-
option :print, "Only print the SSH command, don't connect"
|
64
|
+
#option :r, :recursive, "Recursively copy entire directories"
|
65
|
+
#option :p, :preserve, "Preserve atimes and ctimes."
|
70
66
|
option :g, :group, String, "A security group name"
|
71
67
|
option :i, :awsid, String, "An instance ID"
|
72
|
-
option :u, :user, String, "Username"
|
73
68
|
command :copy => Rudy::CLI::AWS::EC2::Candy
|
74
69
|
command_alias :copy, :ul
|
75
70
|
command_alias :copy, :dl
|
@@ -114,8 +109,8 @@ module RudyCLI_EC2
|
|
114
109
|
option :n, :name, String, "The name of the image file (to create)"
|
115
110
|
option :u, :user, String, "Username to connect as (used for creating an image)"
|
116
111
|
action :C, :create, "Create an image"
|
117
|
-
action :P, :prepare, "Prepare a running instance to be used as an image"
|
118
|
-
|
112
|
+
#action :P, :prepare, "Prepare a running instance to be used as an image"
|
113
|
+
action :D, :destroy, "Deregister an image (does not remove image files from S3)"
|
119
114
|
argv :ami
|
120
115
|
command :images => Rudy::CLI::AWS::EC2::Images
|
121
116
|
command_alias :images, :image
|
@@ -167,7 +162,7 @@ module RudyCLI_EC2
|
|
167
162
|
argv :snapid
|
168
163
|
command :snapshots => Rudy::CLI::AWS::EC2::Snapshots
|
169
164
|
command_alias :snapshots, :snapshot
|
170
|
-
command_alias :snapshots, :
|
165
|
+
command_alias :snapshots, :s
|
171
166
|
|
172
167
|
about "Open an SSH connection"
|
173
168
|
usage "rudy-ec2 ssh"
|
data/bin/rudy-s3
CHANGED
@@ -10,8 +10,6 @@
|
|
10
10
|
#
|
11
11
|
|
12
12
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
|
13
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
|
14
|
-
#%w{amazon-ec2 caesars rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
|
15
13
|
#require 'rubygems'
|
16
14
|
|
17
15
|
require 'rudy'
|
@@ -27,7 +25,7 @@ module RudyCLI_S3
|
|
27
25
|
|
28
26
|
about "Amazon S3 Buckets"
|
29
27
|
usage "rudy-s3 buckets"
|
30
|
-
option :l, :
|
28
|
+
option :l, :location, String, "Specify a bucket location. One of: us, eu"
|
31
29
|
action :C, :create, "Create a bucket"
|
32
30
|
action :D, :destroy, "Destroy a bucket"
|
33
31
|
argv :name
|
data/bin/rudy-sdb
CHANGED
@@ -10,8 +10,6 @@
|
|
10
10
|
#
|
11
11
|
|
12
12
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
|
13
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
|
14
|
-
#%w{amazon-ec2 caesars rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
|
15
13
|
#require 'rubygems'
|
16
14
|
|
17
15
|
require 'rudy'
|
data/examples/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Rudy Configuration Examples
|
2
|
+
|
3
|
+
*NOTE: The examples are a work in progress*
|
4
|
+
|
5
|
+
## Contributions
|
6
|
+
|
7
|
+
I'm very open to contributions! Rudy supports all Linux-based platforms (with partial Solaris support) and software (rails, sinatra, MySQL, PostgreSQL, etc...) so it's possible to write examples for pretty much anything. If you're interested in writing new examples, I'll gladly accept them and include them here (with credit of course!).
|
8
|
+
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# ----------------------------------------------------------- COMMANDS --------
|
2
|
+
# The commands block defines shell commands that can be used in routines. The
|
3
|
+
# ones defined here are added to the default list defined by Rye::Cmd (Rudy
|
4
|
+
# executes all SSH commands via Rye).
|
5
|
+
#
|
6
|
+
# Usage:
|
7
|
+
#
|
8
|
+
# allow COMMAND-NAME
|
9
|
+
# allow COMMAND-NAME, '/path/2/COMMAND'
|
10
|
+
# allow COMMAND-NAME, '/path/2/COMMAND', 'default argument', 'another arg'
|
11
|
+
#
|
12
|
+
commands do
|
13
|
+
allow :apt_get, "apt-get", :y, :q
|
14
|
+
allow :gem_install, "/usr/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
|
15
|
+
allow :gem_sources, "/usr/bin/gem", "sources"
|
16
|
+
allow :passenger_install_apache2, "passenger-install-apache2-module", '--auto'
|
17
|
+
allow :passenger_install_nginx, "passenger-install-nginx-module", '--auto', '--autodownload'
|
18
|
+
allow :apache2ctl
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
# --------------------------------------------------------- MACHINES --------
|
3
|
+
# The machines block describes the "physical" characteristics
|
4
|
+
# of your environments.
|
5
|
+
machines do
|
6
|
+
|
7
|
+
# We've defined an environment called "stage" with one role: "app".
|
8
|
+
# The configuration inside the env block is available to all its
|
9
|
+
# roles. The configuration inside the role blocks is available only
|
10
|
+
# to machines in that specific role.
|
11
|
+
env :dev, :stage, :prod do
|
12
|
+
ami "ami-e348af8a" # Debian 5.0 32-bit, Alestic
|
13
|
+
size 'm1.small'
|
14
|
+
|
15
|
+
role :app do
|
16
|
+
# You can define disks for the stage-app machines. Rudy uses
|
17
|
+
# this configuration when it executes a routine (see below).
|
18
|
+
disks do
|
19
|
+
path "/rudy/disk1" do
|
20
|
+
size 10
|
21
|
+
device "/dev/sdr"
|
22
|
+
fstype 'ext3'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
routines do
|
3
|
+
|
4
|
+
sysupdate do
|
5
|
+
script :root do
|
6
|
+
apt_get "update"
|
7
|
+
apt_get "install", "build-essential", "git-core"
|
8
|
+
apt_get "install", "sqlite3", "libsqlite3-dev"
|
9
|
+
apt_get "install", "ruby1.8-dev", "rubygems"
|
10
|
+
apt_get "install", "nginx"
|
11
|
+
apt_get "install", "apache2-mpm-prefork", "apache2-prefork-dev", "libapr1-dev"
|
12
|
+
apt_get "install", "libfcgi-dev", "libfcgi-ruby1.8"
|
13
|
+
gem_sources :a, "http://gems.github.com"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
installdeps do
|
18
|
+
script :root do
|
19
|
+
gem_install "test-spec", "rspec", "camping", "fcgi", "memcache-client"
|
20
|
+
gem_install "rake", "passenger"
|
21
|
+
passenger_install_apache2
|
22
|
+
passenger_install_nginx
|
23
|
+
gem_install "rack", :v, "0.9.1" # 0.9.1 required by sinatra
|
24
|
+
gem_install "sinatra"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# ----------------------------------------------------------- COMMANDS --------
|
2
|
+
# The commands block defines shell commands that can be used in routines. The
|
3
|
+
# ones defined here are added to the default list defined by Rye::Cmd (Rudy
|
4
|
+
# executes all SSH commands via Rye).
|
5
|
+
#
|
6
|
+
# Usage:
|
7
|
+
#
|
8
|
+
# allow COMMAND-NAME
|
9
|
+
# allow COMMAND-NAME, '/path/2/COMMAND'
|
10
|
+
# allow COMMAND-NAME, '/path/2/COMMAND', 'default argument', 'another arg'
|
11
|
+
#
|
12
|
+
commands do
|
13
|
+
allow :apt_get, "apt-get", :y, :q
|
14
|
+
allow :gem_install, "/usr/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
|
15
|
+
allow :gem_sources, "/usr/bin/gem", "sources"
|
16
|
+
allow :thin, "/usr/local/bin/thin", :d, :R, './config.ru', :l, './thin.log', :P, './thin.pid'
|
17
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# THIS EXAMPLE IS INCOMPLETE -- 2009-05-03
|
2
|
+
|
3
|
+
# --------------------------------------------------------- MACHINES --------
|
4
|
+
# The machines block describes the "physical" characteristics
|
5
|
+
# of your environments.
|
6
|
+
machines do
|
7
|
+
|
8
|
+
# We've defined an environment called "stage" with one role: "app".
|
9
|
+
# The configuration inside the env block is available to all its
|
10
|
+
# roles. The configuration inside the role blocks is available only
|
11
|
+
# to machines in that specific role.
|
12
|
+
env :dev, :stage, :prod do
|
13
|
+
ami "ami-e348af8a" # Debian 5.0 32-bit, Alestic
|
14
|
+
size 'm1.small'
|
15
|
+
|
16
|
+
role :app do
|
17
|
+
#positions 2
|
18
|
+
|
19
|
+
# You can define disks for the stage-app machines. Rudy uses
|
20
|
+
# this configuration when it executes a routine (see below).
|
21
|
+
disks do
|
22
|
+
path "/rudy/disk1" do
|
23
|
+
size 10
|
24
|
+
device "/dev/sdr"
|
25
|
+
fstype 'ext2'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# THIS EXAMPLE IS INCOMPLETE -- 2009-05-03
|
2
|
+
|
3
|
+
# Rudy -- debian-sinatra-thin
|
4
|
+
#
|
5
|
+
# Notes:
|
6
|
+
# * Change :rudy to the name of your user remote deployment user
|
7
|
+
#
|
8
|
+
sinatra_home = "/rudy/disk1/sinatra"
|
9
|
+
routines do
|
10
|
+
|
11
|
+
sysupdate do
|
12
|
+
script :root do
|
13
|
+
apt_get "update"
|
14
|
+
apt_get "install", "build-essential", "git-core"
|
15
|
+
apt_get "install", "sqlite3", "libsqlite3-dev"
|
16
|
+
apt_get "install", "ruby1.8-dev", "rubygems"
|
17
|
+
apt_get "install", "apache2-prefork-dev", "libapr1-dev"
|
18
|
+
apt_get "install", "libfcgi-dev", "libfcgi-ruby1.8"
|
19
|
+
gem_sources :a, "http://gems.github.com"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
installdeps do
|
24
|
+
script :root do
|
25
|
+
gem_install "test-spec", "rspec", "camping", "fcgi", "memcache-client"
|
26
|
+
gem_install "mongrel"
|
27
|
+
gem_install 'ruby-openid', :v, "2.0.4" # thin requires 2.0.x
|
28
|
+
gem_install "rack", :v, "0.9.1"
|
29
|
+
gem_install "macournoyer-thin" # need 1.1.0 which works with rack 0.9.1
|
30
|
+
gem_install "sinatra"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
environment :dev, :stage do
|
35
|
+
|
36
|
+
startup do
|
37
|
+
adduser :rudy
|
38
|
+
authorize :rudy
|
39
|
+
disks do
|
40
|
+
create "/rudy/disk1"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
shutdown do
|
44
|
+
disks do
|
45
|
+
destroy "/rudy/disk1"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
restart do
|
50
|
+
after :rudy do
|
51
|
+
thin :c, sinatra_home, "restart"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
start do
|
55
|
+
after :rudy do
|
56
|
+
thin :c, sinatra_home, "start"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
stop do
|
60
|
+
after :rudy do
|
61
|
+
thin :c, sinatra_home, "stop"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
data/lib/rudy.rb
CHANGED
@@ -4,6 +4,8 @@ unless defined?(RUDY_HOME)
|
|
4
4
|
RUDY_LIB = File.join(File.dirname(__FILE__), '..', 'lib')
|
5
5
|
end
|
6
6
|
|
7
|
+
#local_libs = %w{net-scp amazon-ec2 aws-s3 caesars drydock rye storable sysinfo annoy}
|
8
|
+
#local_libs.each { |dir| $:.unshift File.join(RUDY_HOME, '..', dir, 'lib') }
|
7
9
|
|
8
10
|
require 'digest/md5'
|
9
11
|
require 'stringio'
|
@@ -14,28 +16,19 @@ require 'logger'
|
|
14
16
|
require 'socket'
|
15
17
|
require 'timeout'
|
16
18
|
require 'tempfile'
|
17
|
-
|
19
|
+
require 'rudy/mixins'
|
18
20
|
require 'storable'
|
19
|
-
require 'console'
|
20
21
|
require 'sysinfo'
|
21
22
|
require 'annoy'
|
22
|
-
|
23
23
|
require 'rye'
|
24
24
|
|
25
|
-
require 'net/ssh'
|
26
|
-
require 'net/scp'
|
27
|
-
require 'net/ssh/multi'
|
28
|
-
require 'net/ssh/gateway'
|
29
|
-
|
30
|
-
require 'rudy/mixins/hash'
|
31
25
|
|
32
26
|
|
33
27
|
# = Rudy
|
34
28
|
#
|
35
|
-
# == About
|
36
29
|
#
|
37
30
|
# Rudy is a development and deployment tool for the Amazon Elastic Compute Cloud
|
38
|
-
# (EC2).
|
31
|
+
# (EC2). <a href="wiki.github.com/solutious/rudy/getting-started">Getting Started</a> today!
|
39
32
|
#
|
40
33
|
#
|
41
34
|
module Rudy
|
@@ -45,7 +38,7 @@ module Rudy
|
|
45
38
|
unless defined?(MAJOR)
|
46
39
|
MAJOR = 0.freeze
|
47
40
|
MINOR = 7.freeze
|
48
|
-
TINY =
|
41
|
+
TINY = 4.freeze
|
49
42
|
end
|
50
43
|
def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
|
51
44
|
def self.to_f; self.to_s.to_f; end
|
@@ -71,13 +64,13 @@ module Rudy
|
|
71
64
|
DEFAULT_EC2_HOST = "ec2.amazonaws.com"
|
72
65
|
DEFAULT_EC2_PORT = 443
|
73
66
|
|
74
|
-
MAX_INSTANCES =
|
67
|
+
MAX_INSTANCES = 5.freeze
|
75
68
|
|
76
69
|
SUPPORTED_SCM_NAMES = [:svn, :git].freeze
|
77
70
|
|
78
71
|
ID_MAP = {
|
79
|
-
:instance => 'i',
|
80
72
|
:disk => 'disk',
|
73
|
+
:instance => 'i',
|
81
74
|
:backup => 'back',
|
82
75
|
:machine => 'm',
|
83
76
|
:volume => 'vol',
|
@@ -96,7 +89,7 @@ module Rudy
|
|
96
89
|
|
97
90
|
@@quiet = false
|
98
91
|
@@debug = false
|
99
|
-
@@sysinfo =
|
92
|
+
@@sysinfo = SysInfo.new.freeze
|
100
93
|
|
101
94
|
end
|
102
95
|
|
@@ -164,8 +157,6 @@ require 'rudy/config' # of
|
|
164
157
|
require 'rudy/huxtable' # requires
|
165
158
|
require 'rudy/aws' # is
|
166
159
|
require 'rudy/metadata' # important
|
167
|
-
|
168
|
-
require 'rudy/disks'
|
169
160
|
require 'rudy/machines'
|
170
161
|
require 'rudy/routines'
|
171
162
|
require 'rudy/scm'
|
data/lib/rudy/aws.rb
CHANGED
data/lib/rudy/aws/ec2/address.rb
CHANGED
@@ -71,7 +71,6 @@ module Rudy::AWS
|
|
71
71
|
address = address.ipaddress if address.is_a?(Rudy::AWS::EC2::Address)
|
72
72
|
instance = instance.awsid if instance.is_a?(Rudy::AWS::EC2::Instance)
|
73
73
|
raise UnknownAddress unless exists?(address)
|
74
|
-
p address
|
75
74
|
raise AddressNotAssociated unless associated?(address)
|
76
75
|
|
77
76
|
opts ={
|
@@ -21,6 +21,17 @@ module Rudy::AWS
|
|
21
21
|
@@sformat % [liner_note, @volid, @status]
|
22
22
|
end
|
23
23
|
|
24
|
+
def inspect
|
25
|
+
lines = []
|
26
|
+
lines << liner_note
|
27
|
+
field_names.each do |key|
|
28
|
+
next unless self.respond_to?(key)
|
29
|
+
val = self.send(key)
|
30
|
+
lines << sprintf(" %22s: %s", key, (val.is_a?(Array) ? val.join(', ') : val))
|
31
|
+
end
|
32
|
+
lines.join($/)
|
33
|
+
end
|
34
|
+
|
24
35
|
def completed?
|
25
36
|
self.status && self.status == 'completed'
|
26
37
|
end
|
data/lib/rudy/aws/s3.rb
CHANGED
@@ -28,8 +28,10 @@ module Rudy::AWS
|
|
28
28
|
::AWS::S3::Service.buckets
|
29
29
|
end
|
30
30
|
|
31
|
-
def create_bucket(name)
|
32
|
-
|
31
|
+
def create_bucket(name, location=nil)
|
32
|
+
opts = {}
|
33
|
+
opts[:location] = location.to_s.upcase if location
|
34
|
+
::AWS::S3::Bucket.create(name, opts)
|
33
35
|
end
|
34
36
|
|
35
37
|
def destroy_bucket(name)
|
@@ -37,7 +39,8 @@ module Rudy::AWS
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def find_bucket(name)
|
40
|
-
::AWS::S3::
|
42
|
+
blist = ::AWS::S3::Service.buckets
|
43
|
+
blist.select { |bobj| bobj.name == name }.first
|
41
44
|
end
|
42
45
|
|
43
46
|
def list_bucket_objects(name)
|
data/lib/rudy/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'drydock'
|
3
3
|
|
4
|
+
|
4
5
|
module Rudy
|
5
6
|
|
6
7
|
# = CLI
|
@@ -26,7 +27,10 @@ module Rudy
|
|
26
27
|
protected
|
27
28
|
def init
|
28
29
|
|
29
|
-
|
30
|
+
if Drydock.debug?
|
31
|
+
#Caesars.enable_debug
|
32
|
+
Rudy.enable_debug
|
33
|
+
end
|
30
34
|
|
31
35
|
# The CLI wants output!
|
32
36
|
Rudy::Huxtable.update_logger STDOUT
|
@@ -43,6 +47,12 @@ module Rudy
|
|
43
47
|
STDERR.puts ex.backtrace if @@global.verbose > 0
|
44
48
|
exit 81
|
45
49
|
end
|
50
|
+
|
51
|
+
# And then update global again b/c some values come from @@config
|
52
|
+
Rudy::Huxtable.update_global
|
53
|
+
|
54
|
+
@@global.nocolor ? String.disable_color : String.enable_color
|
55
|
+
@@global.yes ? Annoy.enable_skip : Annoy.disable_skip
|
46
56
|
|
47
57
|
unless @@global.accesskey && @@global.secretkey
|
48
58
|
STDERR.puts "No AWS credentials. Check your configs!"
|
@@ -86,7 +96,7 @@ module Rudy
|
|
86
96
|
unless @@global.quiet
|
87
97
|
if @@global.environment == "prod"
|
88
98
|
msg = "YOU ARE PLAYING WITH PRODUCTION"
|
89
|
-
puts Rudy::Utils.banner(msg, :
|
99
|
+
puts Rudy::Utils.banner(msg, :normal), $/
|
90
100
|
end
|
91
101
|
puts Rudy::Utils.banner("THIS IS EC2"), $/ if Rudy.in_situ?
|
92
102
|
end
|