solutious-rudy 0.5.0 → 0.5.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/CHANGES.txt CHANGED
@@ -1,18 +1,25 @@
1
1
  RUDY, CHANGES
2
2
 
3
- TODO: Remove aws_sdb
4
3
 
4
+ #### 0.5.1 (2009-04-10) ###############################
5
5
 
6
- #### 0.5.0 (2009-04-??) ###############################
6
+ * CHANGE: Removed require 'rubygems'
7
+ * FIXED: Resolved Drydock namespace issue for rudy and ird
8
+
9
+
10
+ #### 0.5.0 (2009-04-09) ###############################
11
+
12
+ NOTE: This is a significant re-write from 0.4
7
13
 
8
14
  * CHANGE: Recommend keypair config to be in ~/.rudy/config
9
15
  * FIX: Rudy now checks for user keys specified by env-role, env, and global
10
16
  * FIX: gemspec dependency net-ssh-multi
11
- * NEW: rerelease command
12
- * NEW: --nocolor option
13
- * NEW: Ruby API
14
- * NEW: Tests with 65% coverage
15
-
17
+ * ADDED: --nocolor option
18
+ * ADDED: Ruby API
19
+ * ADDED: Tests with 55% coverage
20
+ * ADDED: Ruby API (Rudy::Instances, etc...)
21
+ * ADDED: ird, a REPL (experimental)
22
+ * ADDED: Now uses Rye 0.4.1
16
23
 
17
24
  #### 0.4 (2009-03-12) ###############################
18
25
 
@@ -23,18 +30,18 @@ NOTE: This is a significant re-write from 0.3
23
30
  * CHANGE: Moved generic EC2 commands to bin/rudy-ec2
24
31
  * CHANGE: Removed ambiguity of pluralized command names.
25
32
  * OLD: backups, disks, configs
26
- * NEW: backup, disk, config
27
- * NEW: ssh and scp commands for connecting to and copying files to/from machines
28
- * NEW: New dependencies (trying out net-ssh)
29
- * NEW: Domain specific language for configuration
30
- * NEW: "Routines" for handling common actions. Starting, stopping, releasing, deploying.
31
- * NEW: "rudy release" will create a release from the current working copy, start an instance,
33
+ * ADDED: backup, disk, config
34
+ * ADDED: ssh and scp commands for connecting to and copying files to/from machines
35
+ * ADDED: New dependencies (trying out net-ssh)
36
+ * ADDED: Domain specific language for configuration
37
+ * ADDED: "Routines" for handling common actions. Starting, stopping, releasing, deploying.
38
+ * ADDED: "rudy release" will create a release from the current working copy, start an instance,
32
39
  checkout the release, run routines. It needs some work still, but this already functions as
33
40
  a single command release process.
34
- * NEW: "rudy start|destroy|restart|update|status". Routines allow us to have generic commands
41
+ * ADDED: "rudy start|destroy|restart|update|status". Routines allow us to have generic commands
35
42
  that can be used for any machine group. These commands relate to starting new instances.
36
- * NEW: Extra caution when running destructive commands
37
- * NEW: Default ~/.rudy/config created if it doesn't exist.
43
+ * ADDED: Extra caution when running destructive commands
44
+ * ADDED: Default ~/.rudy/config created if it doesn't exist.
38
45
 
39
46
 
40
47
  #### 0.3 (2009-02-26) ###############################
@@ -43,9 +50,9 @@ NOTE: This is a significant re-write from 0.2
43
50
 
44
51
  * CHANGE: Re-written support/rudy-ec2-startup
45
52
  * CHANGE: upgrade to Drydock 0.4
46
- * NEW: More functionality for disks and backups
47
- * NEW: config commands
48
- * NEW: Per machine configuration (via ~/.rudy)
53
+ * ADDED: More functionality for disks and backups
54
+ * ADDED: config commands
55
+ * ADDED: Per machine configuration (via ~/.rudy)
49
56
 
50
57
 
51
58
  #### 0.2 (2009-02-23) ###############################
@@ -54,18 +61,18 @@ NOTE: This is a complete re-write from 0.1
54
61
 
55
62
  * CHANGE: Added Environment variables
56
63
  * CHANGE: upgrade to drydock 0.3.3
57
- * NEW: All time references are converted to UTC
58
- * NEW: Safer "Are you sure?". Number of characters to enter is
64
+ * ADDED: All time references are converted to UTC
65
+ * ADDED: Safer "Are you sure?". Number of characters to enter is
59
66
  commiserate with amount of danger.
60
- * NEW: CLIs: myaddress, addresses, images, instances,
67
+ * ADDED: CLIs: myaddress, addresses, images, instances,
61
68
  disks, connect, copy, stage, backups, volumes
62
- * NEW: Metadata storage to SimpleDB for disks, backups
63
- * NEW: Creates EBS volumes based on startup from metadata
64
- * NEW: Automated release process
65
- * NEW: Automated creation of machine images
66
- * NEW: Partial support for regions and zones
67
- * NEW: Manage system based on security groups.
68
- * NEW: "rudy groups" overhaul. Display, creates, destroys groups.
69
+ * ADDED: Metadata storage to SimpleDB for disks, backups
70
+ * ADDED: Creates EBS volumes based on startup from metadata
71
+ * ADDED: Automated release process
72
+ * ADDED: Automated creation of machine images
73
+ * ADDED: Partial support for regions and zones
74
+ * ADDED: Manage system based on security groups.
75
+ * ADDED: "rudy groups" overhaul. Display, creates, destroys groups.
69
76
 
70
77
 
71
78
 
data/README.rdoc CHANGED
@@ -4,27 +4,37 @@ Rudy is a development and deployment tool for Amazon EC2. It's both a command-li
4
4
 
5
5
  $ rudy group --create
6
6
 
7
+ OR
8
+
7
9
  rgroup = Rudy::Groups.new
8
10
  rgroup.create
9
11
 
10
- Rudy is a bit different from other EC2 libraries in several ways.
11
-
12
12
 
13
13
  == Installation
14
14
 
15
- Step 1 (install the gem):
15
+ === Step 1 (get Rudy on to your machine):
16
+
17
+ Via Rubygems, one of:
18
+
19
+ $ sudo gem install rudy
20
+ $ sudo gem install solutious-rudy --source http://gems.github.com/
21
+
22
+ Via GitHub:
23
+ $ git clone git://github.com/solutious/rudy.git
16
24
 
17
- $ sudo gem install rudy
18
- $ sudo gem install solutious-rudy --source http://gems.github.com/
19
- $ git clone git://github.com/solutious/rudy.git
25
+ Via download:
26
+ * rudy-0.5.1.tar.gz[http://github.com/solutious/rudy/tarball/rudy-0.5.1]
27
+ * rudy-0.5.1.zip[http://github.com/solutious/rudy/zipball/rudy-0.5.1]
20
28
 
21
- Step 2 (initialize your configuration):
29
+ NOTE: If your are not installing via RubyGems, you will need to make sure the Ruby dependencies (see below) are installed and in your LOAD_PATH.
30
+
31
+ === Step 2 (initialize your configuration):
22
32
 
23
33
  $ rudy generate-config
24
34
  [modify ~/.rudy/config]
25
35
  $ rudy init
26
36
 
27
- Step 3 (get to work with EC2):
37
+ === Step 3 (start working with EC2):
28
38
 
29
39
  $ rudy group --create
30
40
  $ rudy keypair --create
@@ -33,22 +43,25 @@ Step 3 (get to work with EC2):
33
43
 
34
44
  == Dependencies:
35
45
 
36
- * OpenSSH
37
- * Net::SSH
38
- * Net::SCP
39
- * amazon-ec2
40
- * aws_sdb
41
- * Drydock
42
- * Caesars
43
- * Rye
46
+ * OpenSSH[http://www.openssh.com/]
47
+ * Net::SSH[http://net-ssh.rubyforge.org/]
48
+ * Net::SCP[http://net-ssh.rubyforge.org/]
49
+ * amazon-ec2[http://github.com/grempe/amazon-ec2]
50
+ * aws_sdb[http://rubyforge.org/projects/aws-sdb/]
51
+ * Drydock[http://github.com/delano/drydock]
52
+ * Caesars[http://github.com/delano/caesars]
53
+ * Rye[http://github.com/delano/rye]
44
54
 
45
55
 
46
56
  == Common Errors
47
57
 
48
- * "The request signature we calculated does not match the signature you provided."
58
+ * <tt>`require': no such file to load -- amazon-ec2 (LoadError)</tt>
59
+ * You're probably running a mix of Rubygem and non-Rubygem libraries. Ryan Tomayko has you covered: http://gist.github.com/54177
60
+
61
+ * <tt>The request signature we calculated does not match the signature you provided.</tt>
49
62
  * Check that your Amazon Web Service access key and secret key are correct
50
63
 
51
- * "AWS was not able to validate the provided access credentials"
64
+ * <tt>AWS was not able to validate the provided access credentials</tt>
52
65
  * If it's a new Amazon Accounts, you need to sign up for EC2, SDB, and S3.
53
66
 
54
67
 
@@ -58,11 +71,6 @@ Step 3 (get to work with EC2):
58
71
  * RubyForge[http://rubyforge.org/projects/rudy]
59
72
  * Inspiration[http://www.youtube.com/watch?v=CgaiIW5Rzes]
60
73
 
61
- == Credits
62
-
63
- * Delano Mandelbaum (delano@solutious.com)
64
- * Keshia Knight Pulliam (rudy@solutious.com)
65
-
66
74
 
67
75
  == Thanks
68
76
 
@@ -72,6 +80,12 @@ Step 3 (get to work with EC2):
72
80
  * Caleb Buxton
73
81
  * Colin Brumelle
74
82
 
83
+
84
+ == Credits
85
+
86
+ * Delano Mandelbaum (delano@solutious.com)
87
+ * Keshia Knight Pulliam (rudy@solutious.com)
88
+
75
89
  == License
76
90
 
77
91
  See: LICENSE.txt
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'rubygems'
1
+
2
2
  require 'rake/clean'
3
3
  require 'rake/gempackagetask'
4
4
  require 'hanna/rdoctask'
@@ -76,7 +76,6 @@ namespace :shoulda do
76
76
  $LOAD_PATH.unshift("test")
77
77
 
78
78
  require 'test/unit'
79
- require 'rubygems'
80
79
  require 'active_support'
81
80
 
82
81
  # bug in test unit. Set to true to stop from running.
data/bin/ird CHANGED
@@ -9,8 +9,6 @@
9
9
 
10
10
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
11
11
 
12
- require 'rubygems' unless defined?(Gem)
13
-
14
12
  # SEE: http://github.com/rubyspec/matzruby/blob/a34130eb7c4ecc164115a59aa1b76c643bd98202/lib/irb/xmp.rb
15
13
  # SEE: http://github.com/blackwinter/wirble/tree/master
16
14
  require "irb"
@@ -20,142 +18,154 @@ require 'rudy'
20
18
  require 'drydock'
21
19
  require 'rudy/cli'
22
20
 
23
- include Readline
24
- include Drydock
25
-
26
- global :A, :accesskey, String, "AWS Access Key"
27
- global :S, :secretkey, String, "AWS Secret Access Key"
28
- #global :R, :region, String, "Connect to a specific EC2 region (ie: #{Rudy::DEFAULT_REGION})"
29
- #global :n, :nocolor, "Disable output colors"
30
- global :f, :config, String, "Specify another configuration file to read (ie: #{Rudy::RUDY_CONFIG_FILE})"
31
- global :z, :zone, String, "Connect to a specific EC2 zone (ie: #{Rudy::DEFAULT_ZONE})"
32
- global :e, :environment, String, "Connect to the specified environment (ie: #{Rudy::DEFAULT_ENVIRONMENT})"
33
- global :r, :role, String, "Connect to a machine with the specified role (ie: #{Rudy::DEFAULT_ROLE})"
34
- global :p, :position, String, "Position in the machine in its group (ie: #{Rudy::DEFAULT_POSITION})"
35
- global :u, :user, String, "Provide a username (ie: #{Rudy::DEFAULT_USER})"
36
- #global :q, :quiet, "Run with less output"
37
- #global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
38
- # @verbose ||= 0
39
- # @verbose += 1
40
- #end
41
- global :V, :version, "Display version number" do
42
- puts "Rudy version: #{Rudy::VERSION}"
43
- exit 0
44
- end
21
+
22
+ module CLI
23
+ extend self
24
+ extend Drydock
25
+ include Readline
26
+
27
+ global :A, :accesskey, String, "AWS Access Key"
28
+ global :S, :secretkey, String, "AWS Secret Access Key"
29
+ #global :R, :region, String, "Connect to a specific EC2 region (ie: #{Rudy::DEFAULT_REGION})"
30
+ #global :n, :nocolor, "Disable output colors"
31
+ global :f, :config, String, "Specify another configuration file to read (ie: #{Rudy::RUDY_CONFIG_FILE})"
32
+ global :z, :zone, String, "Connect to a specific EC2 zone (ie: #{Rudy::DEFAULT_ZONE})"
33
+ global :e, :environment, String, "Connect to the specified environment (ie: #{Rudy::DEFAULT_ENVIRONMENT})"
34
+ global :r, :role, String, "Connect to a machine with the specified role (ie: #{Rudy::DEFAULT_ROLE})"
35
+ global :p, :position, String, "Position in the machine in its group (ie: #{Rudy::DEFAULT_POSITION})"
36
+ global :u, :user, String, "Provide a username (ie: #{Rudy::DEFAULT_USER})"
37
+ #global :q, :quiet, "Run with less output"
38
+ #global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
39
+ # @verbose ||= 0
40
+ # @verbose += 1
41
+ #end
42
+ global :V, :version, "Display version number" do
43
+ puts "Rudy version: #{Rudy::VERSION}"
44
+ exit 0
45
+ end
45
46
 
46
47
 
47
- default :interactive
48
- debug :off
49
- desc "An interactive REPL for Rudy."
50
- usage "#{$0} [global options]"
51
- command :interactive do |obj|
48
+ default :interactive
49
+ debug :on
50
+ desc "An interactive REPL for Rudy."
51
+ usage "#{$0} [global options]"
52
+ command :interactive do |obj|
52
53
 
53
- @rmach = Rudy::Instances.new(:global => obj.global)
54
- @rkey = Rudy::KeyPairs.new(:global => obj.global)
55
- @rgrp = Rudy::Groups.new(:global => obj.global)
56
- @rvol = Rudy::Volumes.new(:global => obj.global)
57
- @radd = Rudy::Addresses.new(:global => obj.global)
54
+ @@rmach = Rudy::Instances.new(:global => obj.global)
55
+ @@rkey = Rudy::KeyPairs.new(:global => obj.global)
56
+ @@rgrp = Rudy::Groups.new(:global => obj.global)
57
+ @@rvol = Rudy::Volumes.new(:global => obj.global)
58
+ @@radd = Rudy::Addresses.new(:global => obj.global)
58
59
 
59
- puts Rudy::CLI.generate_header(@rmach.global, @rmach.config)
60
- puts Rudy::Utils.without_indent(%Q`
61
- ------------------------------------------------------------
62
- Welcome Interactive Rudy! (EXPERIMENTAL)
63
- ------------------------------------------------------------
60
+ puts Rudy::CLI.generate_header(@@rmach.global, @@rmach.config)
61
+ puts Rudy::Utils.without_indent(%Q`
62
+ ------------------------------------------------------------
63
+ Welcome Interactive Rudy! (EXPERIMENTAL)
64
+ ------------------------------------------------------------
64
65
 
65
- `)
66
- h
66
+ `)
67
+ h
67
68
 
68
- # What's the deal with this error message when defining a help method?
69
- # => rb: warn: can't alias help from irb_help
70
- if __FILE__ == $0
71
- IRB.start(__FILE__)
72
- else
73
- # check -e option
74
- if /^-e$/ =~ $0
69
+ # What's the deal with this error message when defining a help method?
70
+ # => rb: warn: can't alias help from irb_help
71
+ if __FILE__ == $0
75
72
  IRB.start(__FILE__)
76
73
  else
77
- IRB.start(__FILE__)
74
+ # check -e option
75
+ if /^-e$/ =~ $0
76
+ IRB.start(__FILE__)
77
+ else
78
+ IRB.start(__FILE__)
79
+ end
78
80
  end
81
+
79
82
  end
80
83
 
81
- end
82
-
83
- def h;
84
- puts (%Q`
85
- HELP
86
84
 
87
- h Help (this screen)
88
- m Rudy::Machines instance
89
- g Rudy::Groups instance
90
- k Rudy::KeyPairs instance
91
- v Rudy::Volumes instance
92
- a Rudy::Addresses instance
93
- ssh [GROUP] Connect to a machine
94
- example Start an EC2 instance from scratch.
95
- `)
96
- end
97
- def example
98
- puts (%Q`
99
- EXAMPLE
100
- Start an EC2 instance from scratch.
101
-
102
- # Create a security group
103
- >> g.create
104
- => #<Rudy::AWS::EC2::Group @name="stage-app" ...>
105
-
106
- # Create a keypair (used to login as root)
107
- >> k.create
108
- => #<Rudy::AWS::EC2::KeyPair @name="key-stage-app" ...>
109
-
110
- # Start an EC2 machine instance:
111
- >> m.create
112
- Instance: i-228def51
113
- Waiting for the instance to startup
114
- ........It's up!
115
-
116
- # Login to the new instance
117
- >> ssh
118
-
119
- All commands in Rudy refer to the global defaults unless
120
- otherwise specified. "stage" is the default environment and
121
- "app" is the default role. You can change these with command
122
- line arguments or by modifying the defaults in your Rudy
123
- config file: #{@rmach.config_dirname}
124
-
125
- You can also specify your own names by providing
126
- one as the first argument: g.create 'group5000'.
127
-
128
- # List instances in stage-app
129
- >> m.list :running
130
- => [#<Rudy::AWS::EC2::Instance:0x18c5888 ...>]
131
-
132
- # Print the instance in a human readable way
133
- >> puts m.list.first.to_s
134
-
135
- # Print instance system console output
136
- >> puts m.console
137
-
138
- # Destroy ALL INSTANCES in stage-app
139
- >> m.destroy
140
- `)
141
- end
85
+
86
+
87
+ def h;
88
+ puts (%Q`
89
+ HELP
90
+
91
+ h Help (this screen)
92
+ m Rudy::Machines instance
93
+ g Rudy::Groups instance
94
+ k Rudy::KeyPairs instance
95
+ v Rudy::Volumes instance
96
+ a Rudy::Addresses instance
97
+ ssh [GROUP] Connect to a machine
98
+ example Start an EC2 instance from scratch.
99
+ `)
100
+ end
101
+ def example
102
+ puts (%Q`
103
+ EXAMPLE
104
+ Start an EC2 instance from scratch.
105
+
106
+ # Create a security group
107
+ >> g.create
108
+ => #<Rudy::AWS::EC2::Group @name="stage-app" ...>
142
109
 
143
- def m; @rmach; end
144
- def k; @rkey; end
145
- def g; @rgrp; end
146
- def v; @rvol; end
147
- def a; @radd; end
110
+ # Create a keypair (used to login as root)
111
+ >> k.create
112
+ => #<Rudy::AWS::EC2::KeyPair @name="key-stage-app" ...>
148
113
 
149
- # Change Group
150
- #def cg(name); end
114
+ # Start an EC2 machine instance:
115
+ >> m.create
116
+ Instance: i-228def51
117
+ Waiting for the instance to startup
118
+ ........It's up!
151
119
 
152
- def ssh(*args)
153
- @rmach.switch_user :root
154
- @rmach.connect(*args)
155
- @rmach.switch_user # back to previous user
156
- nil
120
+ # Login to the new instance
121
+ >> ssh
122
+
123
+ All commands in Rudy refer to the global defaults unless
124
+ otherwise specified. "stage" is the default environment and
125
+ "app" is the default role. You can change these with command
126
+ line arguments or by modifying the defaults in your Rudy
127
+ config file: #{@@rmach.config_dirname}
128
+
129
+ You can also specify your own names by providing
130
+ one as the first argument: g.create 'group5000'.
131
+
132
+ # List instances in stage-app
133
+ >> m.list :running
134
+ => [#<Rudy::AWS::EC2::Instance:0x18c5888 ...>]
135
+
136
+ # Print the instance in a human readable way
137
+ >> puts m.list.first.to_s
138
+
139
+ # Print instance system console output
140
+ >> puts m.console
141
+
142
+ # Destroy ALL INSTANCES in stage-app
143
+ >> m.destroy
144
+ `)
145
+ end
146
+
147
+ def m; @@rmach; end
148
+ def k; @@rkey; end
149
+ def g; @@rgrp; end
150
+ def v; @@rvol; end
151
+ def a; @@radd; end
152
+
153
+ # Change Group
154
+ #def cg(name); end
155
+
156
+ def ssh(*args)
157
+ @@rmach.switch_user :root
158
+ @@rmach.connect(*args)
159
+ @@rmach.switch_user # back to previous user
160
+ nil
161
+ end
162
+
163
+
157
164
  end
158
165
 
166
+ include CLI # So we don't have to say CLI.example in the REPL.
167
+
168
+
159
169
  __END__
160
170
  #@rbox = Rye::Box.new('ec2-174-129-173-3.compute-1.amazonaws.com', 'root')
161
171
  #@rbox2 = Rye::Box.new('ec2-174-129-173-3.compute-1.amazonaws.com', 'root')
data/bin/rudy CHANGED
@@ -9,12 +9,10 @@
9
9
 
10
10
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
11
11
 
12
- require 'rubygems' unless defined? Gem
13
12
  require 'date'
14
13
  require 'drydock'
15
14
  require 'rudy'
16
15
  require 'rudy/cli'
17
- extend Drydock
18
16
 
19
17
  # Is there a bug in Ruby 1.9 open-uri?
20
18
  #$ /usr/local/bin/ruby bin/rudy myaddress
@@ -22,348 +20,350 @@ extend Drydock
22
20
  #$SAFE = 2
23
21
 
24
22
 
25
-
26
- global :A, :accesskey, String, "AWS Access Key"
27
- global :S, :secretkey, String, "AWS Secret Access Key"
28
- #global :R, :region, String, "Connect to a specific EC2 region (ie: #{Rudy::DEFAULT_REGION})"
29
- global :n, :nocolor, "Disable output colors"
30
- global :f, :config, String, "Specify another configuration file to read (ie: #{Rudy::RUDY_CONFIG_FILE})"
31
- global :z, :zone, String, "Connect to a specific EC2 zone (ie: #{Rudy::DEFAULT_ZONE})"
32
- global :e, :environment, String, "Connect to the specified environment (ie: #{Rudy::DEFAULT_ENVIRONMENT})"
33
- global :r, :role, String, "Connect to a machine with the specified role (ie: #{Rudy::DEFAULT_ROLE})"
34
- global :p, :position, String, "Position in the machine in its group (ie: #{Rudy::DEFAULT_POSITION})"
35
- global :u, :user, String, "Provide a username (ie: #{Rudy::DEFAULT_USER})"
36
- global :q, :quiet, "Run with less output"
37
- global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
38
- @verbose ||= 0
39
- @verbose += 1
40
- end
41
- global :V, :version, "Display version number" do
42
- puts "Rudy version: #{Rudy::VERSION}"
43
- exit 0
44
- end
23
+ module RudyCLI
24
+ extend Drydock
25
+
26
+ global :A, :accesskey, String, "AWS Access Key"
27
+ global :S, :secretkey, String, "AWS Secret Access Key"
28
+ #global :R, :region, String, "Connect to a specific EC2 region (ie: #{Rudy::DEFAULT_REGION})"
29
+ global :n, :nocolor, "Disable output colors"
30
+ global :f, :config, String, "Specify another configuration file to read (ie: #{Rudy::RUDY_CONFIG_FILE})"
31
+ global :z, :zone, String, "Connect to a specific EC2 zone (ie: #{Rudy::DEFAULT_ZONE})"
32
+ global :e, :environment, String, "Connect to the specified environment (ie: #{Rudy::DEFAULT_ENVIRONMENT})"
33
+ global :r, :role, String, "Connect to a machine with the specified role (ie: #{Rudy::DEFAULT_ROLE})"
34
+ global :p, :position, String, "Position in the machine in its group (ie: #{Rudy::DEFAULT_POSITION})"
35
+ global :u, :user, String, "Provide a username (ie: #{Rudy::DEFAULT_USER})"
36
+ global :q, :quiet, "Run with less output"
37
+ global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
38
+ @verbose ||= 0
39
+ @verbose += 1
40
+ end
41
+ global :V, :version, "Display version number" do
42
+ puts "Rudy version: #{Rudy::VERSION}"
43
+ exit 0
44
+ end
45
45
 
46
46
 
47
- # --------------------------------- RUDY MACHINE COMMANDS --------
48
- # ------------------------------------------------------------------
49
-
50
-
51
- desc "Machine Status"
52
- usage "rudy [global options] status [-g group-name] [-s state] [--all] [instance-ID]"
53
- option :g, :group, String, "A security group name"
54
- option :s, :state, String, "Machine state. One of: running (default), pending, terminated"
55
- option :l, :all, "Show all machines in this group, regardless of state."
56
- argv :awsid
57
- command :status => Rudy::CLI::Instances
58
-
59
- usage "rudy [global options] connect [-g group-name] [-i instance-ID] [cmd]"
60
- desc "Open an SSH connection"
61
- option :print, "Only print the SSH command, don't connect"
62
- option :g, :group, String, "A security group name"
63
- option :i, :awsid, String, "An instance ID"
64
- argv :cmd
65
- command :connect => Rudy::CLI::Instances
66
- command_alias :connect, :ssh
67
-
68
- usage "rudy [global options] copy [-p] [-r] source target"
69
- desc "Copy files to or from machines. NOTE: You must use quotes when using a tilda for your remote dir ('~/')."
70
- option :r, :recursive, "Recursively copy entire directories"
71
- option :p, :preserve, "Preserve atimes and ctimes."
72
- option :d, :download, "Download FROM the remote machine to the local machine"
73
- option :print, "Only print the SSH command, don't connect"
74
- option :g, :group, String, "A security group name"
75
- option :i, :awsid, String, "An instance ID"
76
- command :copy => Rudy::CLI::Instances
77
- command_alias :copy, :scp
78
- command_alias :copy, :upload
79
- command_alias :copy, :download
80
-
81
-
82
-
83
- # ----------------------------------- AMAZON EC2 COMMANDS --------
84
- # ------------------------------------------------------------------
85
-
86
- usage "rudy [global options] addresses [-A address instance ID]"
87
- desc "Manage Amazon Elastic IP addresses"
88
- argv :ipaddress, :instid
89
- action :A, :associate, "Associate an IP address to a running instance"
90
- action :C, :create, "Create an IP address"
91
- action :D, :destroy, "Destroy an IP address"
92
- command :addresses => Rudy::CLI::Addresses
93
- command_alias :addresses, :address
94
-
95
- usage "rudy [global options] groups [-C -R -A] [-a IP addresses] [-p ports] [group name]"
96
- usage "rudy groups -C (create a group)"
97
- usage "rudy -e prod groups (list groups in the prod environment)"
98
- usage "rudy groups -A -p 81,82,83 (open ports to a group from this machine)"
99
- desc "Manage EC2 Security Groups"
100
- option :all, "Display all security groups"
101
- option :r, :protocols, Array, "Comma-separated list of protocols. One of: tcp (default), udp, icmp"
102
- option :p, :ports, Array, "List of comma-separated port ranges in the form FROM:TO (default: 22,80,443)"
103
- option :a, :addresses, Array, "List of comma-separated IP addresses (default: your current external IP)"
104
- option :g, :group, String, "A group name to authorize or revoke network rule. Must also supply -o!"
105
- option :o, :owner, String, "A group owner ID (account number). Must also supply -g!"
106
- action :C, :create, "Create a security group"
107
- action :D, :destroy, "Destroy a security group"
108
- action :A, :authorize, "Authorize a rule for a security group"
109
- action :R, :revoke, "Revoke a rule for a security group"
110
- argv :name
111
- command :group => Rudy::CLI::Groups
112
- command_alias :group, :groups
113
-
114
- desc "Manage EC2 Volumes"
115
- usage "rudy volumes"
116
- usage "rudy volume -C -s size [-d device-path]"
117
- usage "rudy volume -A volume-id instance-id"
118
- usage "rudy volume -N volume-id"
119
- usage "rudy volume -D volume-id"
120
- option :s, :size, String, "Size (in GB)"
121
- option :d, :device, String, "Device path (default: /dev/sdh)"
122
- action :D, :destroy, "Destroy a volume"
123
- action :C, :create, "Create a volume"
124
- action :A, :attach, "Attach a volume to a running instance"
125
- action :N, :detach, "Detach a volume from an instance"
126
- argv :volid, :insid
127
- command :volume => Rudy::CLI::Volumes
128
- command_alias :volume, :volumes
129
-
130
- desc "Manage KeyPairs"
131
- usage "rudy keypairs [-C] [-D] [name]"
132
- action :D, :destroy, "Destroy KeyPair"
133
- action :C, :create, "Create KeyPair"
134
- argv :kpname
135
- command :keypair => Rudy::CLI::KeyPairs
136
- command_alias :keypair, :keypairs
137
-
138
- usage "rudy console [-g group] [instance ID]"
139
- desc "Displays system console output for given instance(s)"
140
- option :g, :group, String, "A group name to authorize or revoke network rule. Must also supply -o!"
141
- argv :awsid
142
- command :console => Rudy::CLI::Instances
143
-
144
- desc "Manage Machines"
145
- usage "rudy [global options] machines [-g group-name] [-s state] [instance-ID]"
146
- option :g, :group, String, "The security group name"
147
- option :i, :ami, String, "The machine image ID (ami-)"
148
- option :t, :itype, String, "The instance type (default: m1.small)"
149
- option :k, :keypair, String, "The SSH keypair to use for launch"
150
- option :a, :address, String, "The IP address to associate"
151
- action :C, :create, "Create a machine instance"
152
- action :D, :destroy, "Destroy a machine instance"
153
- argv :awsid
154
- command :instance => Rudy::CLI::Instances
155
- command_alias :instance, :instances
156
-
157
- #usage "rudy images [-C -i name [-b bucket -a account]] [-D AMI-ID]"
158
- #desc "Manage EC2 Machine Images (AMIs)"
159
- #option :a, :account, String, "Your Amazon Account Number"
160
- #option :i, :image_name, String, "The name of the image" # TODO: change to --ami
161
- #option :p, :print, "Print-only (don't execute commands)"
162
- #option :b, :bucket_name, String, "The name of the bucket that will store the image"
163
- #action :C, :create, "Create an image"
164
- ##action :P, :prepare, "Prepare a running instance to be used as an image"
165
- #action :D, :destroy, "Deregister an image (currently _does not_ remove images files from S3)"
166
- #argv :ami
167
- #command :images => Rudy::CLI::Images
168
- #command_alias :images, :image
169
-
170
-
171
- # -------------------------------- MISCELLANEOUS COMMANDS --------
172
- # ------------------------------------------------------------------
173
-
174
- usage "rudy [-f config-file] config [param-name]"
175
- desc "Check Rudy configuration."
176
- option :l, :all, "Display configs for all machines"
177
- option :d, :defaults, "Display the default value for the supplied parameter"
178
- option :g, :group, String, "Display configuration for a specific group"
179
- argv :name
180
- command :config => Rudy::CLI::Config
181
-
182
- usage "rudy myaddress [-i] [-e]"
183
- desc "Displays you current internal and external IP addresses"
184
- option :e, :external, "Display only external IP address"
185
- option :i, :internal, "Display only internal IP address"
186
- command :myaddress do |obj|
187
- ea = Rudy::Utils::external_ip_address || ''
188
- ia = Rudy::Utils::internal_ip_address || ''
189
- if obj.global.quiet
190
- puts ia unless obj.option.external && !obj.option.internal
191
- puts ea unless obj.option.internal && !obj.option.external
192
- else
193
- puts "%10s: %s" % ['Internal', ia] unless obj.option.external && !obj.option.internal
194
- puts "%10s: %s" % ['External', ea] unless obj.option.internal && !obj.option.external
47
+ # --------------------------------- RUDY MACHINE COMMANDS --------
48
+ # ------------------------------------------------------------------
49
+
50
+
51
+ desc "Machine Status"
52
+ usage "rudy [global options] status [-g group-name] [-s state] [--all] [instance-ID]"
53
+ option :g, :group, String, "A security group name"
54
+ option :s, :state, String, "Machine state. One of: running (default), pending, terminated"
55
+ option :l, :all, "Show all machines in this group, regardless of state."
56
+ argv :awsid
57
+ command :status => Rudy::CLI::Instances
58
+
59
+ usage "rudy [global options] connect [-g group-name] [-i instance-ID] [cmd]"
60
+ desc "Open an SSH connection"
61
+ option :print, "Only print the SSH command, don't connect"
62
+ option :g, :group, String, "A security group name"
63
+ option :i, :awsid, String, "An instance ID"
64
+ argv :cmd
65
+ command :connect => Rudy::CLI::Instances
66
+ command_alias :connect, :ssh
67
+
68
+ usage "rudy [global options] copy [-p] [-r] source target"
69
+ desc "Copy files to or from machines. NOTE: You must use quotes when using a tilda for your remote dir ('~/')."
70
+ option :r, :recursive, "Recursively copy entire directories"
71
+ option :p, :preserve, "Preserve atimes and ctimes."
72
+ option :d, :download, "Download FROM the remote machine to the local machine"
73
+ option :print, "Only print the SSH command, don't connect"
74
+ option :g, :group, String, "A security group name"
75
+ option :i, :awsid, String, "An instance ID"
76
+ command :copy => Rudy::CLI::Instances
77
+ command_alias :copy, :scp
78
+ command_alias :copy, :upload
79
+ command_alias :copy, :download
80
+
81
+
82
+
83
+ # ----------------------------------- AMAZON EC2 COMMANDS --------
84
+ # ------------------------------------------------------------------
85
+
86
+ usage "rudy [global options] addresses [-A address instance ID]"
87
+ desc "Manage Amazon Elastic IP addresses"
88
+ argv :ipaddress, :instid
89
+ action :A, :associate, "Associate an IP address to a running instance"
90
+ action :C, :create, "Create an IP address"
91
+ action :D, :destroy, "Destroy an IP address"
92
+ command :addresses => Rudy::CLI::Addresses
93
+ command_alias :addresses, :address
94
+
95
+ usage "rudy [global options] groups [-C -R -A] [-a IP addresses] [-p ports] [group name]"
96
+ usage "rudy groups -C (create a group)"
97
+ usage "rudy -e prod groups (list groups in the prod environment)"
98
+ usage "rudy groups -A -p 81,82,83 (open ports to a group from this machine)"
99
+ desc "Manage EC2 Security Groups"
100
+ option :all, "Display all security groups"
101
+ option :r, :protocols, Array, "Comma-separated list of protocols. One of: tcp (default), udp, icmp"
102
+ option :p, :ports, Array, "List of comma-separated port ranges in the form FROM:TO (default: 22,80,443)"
103
+ option :a, :addresses, Array, "List of comma-separated IP addresses (default: your current external IP)"
104
+ option :g, :group, String, "A group name to authorize or revoke network rule. Must also supply -o!"
105
+ option :o, :owner, String, "A group owner ID (account number). Must also supply -g!"
106
+ action :C, :create, "Create a security group"
107
+ action :D, :destroy, "Destroy a security group"
108
+ action :A, :authorize, "Authorize a rule for a security group"
109
+ action :R, :revoke, "Revoke a rule for a security group"
110
+ argv :name
111
+ command :group => Rudy::CLI::Groups
112
+ command_alias :group, :groups
113
+
114
+ desc "Manage EC2 Volumes"
115
+ usage "rudy volumes"
116
+ usage "rudy volume -C -s size [-d device-path]"
117
+ usage "rudy volume -A volume-id instance-id"
118
+ usage "rudy volume -N volume-id"
119
+ usage "rudy volume -D volume-id"
120
+ option :s, :size, String, "Size (in GB)"
121
+ option :d, :device, String, "Device path (default: /dev/sdh)"
122
+ action :D, :destroy, "Destroy a volume"
123
+ action :C, :create, "Create a volume"
124
+ action :A, :attach, "Attach a volume to a running instance"
125
+ action :N, :detach, "Detach a volume from an instance"
126
+ argv :volid, :insid
127
+ command :volume => Rudy::CLI::Volumes
128
+ command_alias :volume, :volumes
129
+
130
+ desc "Manage KeyPairs"
131
+ usage "rudy keypairs [-C] [-D] [name]"
132
+ action :D, :destroy, "Destroy KeyPair"
133
+ action :C, :create, "Create KeyPair"
134
+ argv :kpname
135
+ command :keypair => Rudy::CLI::KeyPairs
136
+ command_alias :keypair, :keypairs
137
+
138
+ usage "rudy console [-g group] [instance ID]"
139
+ desc "Displays system console output for given instance(s)"
140
+ option :g, :group, String, "A group name to authorize or revoke network rule. Must also supply -o!"
141
+ argv :awsid
142
+ command :console => Rudy::CLI::Instances
143
+
144
+ desc "Manage Machines"
145
+ usage "rudy [global options] machines [-g group-name] [-s state] [instance-ID]"
146
+ option :g, :group, String, "The security group name"
147
+ option :i, :ami, String, "The machine image ID (ami-)"
148
+ option :t, :itype, String, "The instance type (default: m1.small)"
149
+ option :k, :keypair, String, "The SSH keypair to use for launch"
150
+ option :a, :address, String, "The IP address to associate"
151
+ action :C, :create, "Create a machine instance"
152
+ action :D, :destroy, "Destroy a machine instance"
153
+ argv :awsid
154
+ command :instance => Rudy::CLI::Instances
155
+ command_alias :instance, :instances
156
+
157
+ #usage "rudy images [-C -i name [-b bucket -a account]] [-D AMI-ID]"
158
+ #desc "Manage EC2 Machine Images (AMIs)"
159
+ #option :a, :account, String, "Your Amazon Account Number"
160
+ #option :i, :image_name, String, "The name of the image" # TODO: change to --ami
161
+ #option :p, :print, "Print-only (don't execute commands)"
162
+ #option :b, :bucket_name, String, "The name of the bucket that will store the image"
163
+ #action :C, :create, "Create an image"
164
+ ##action :P, :prepare, "Prepare a running instance to be used as an image"
165
+ #action :D, :destroy, "Deregister an image (currently _does not_ remove images files from S3)"
166
+ #argv :ami
167
+ #command :images => Rudy::CLI::Images
168
+ #command_alias :images, :image
169
+
170
+
171
+ # -------------------------------- MISCELLANEOUS COMMANDS --------
172
+ # ------------------------------------------------------------------
173
+
174
+ usage "rudy [-f config-file] config [param-name]"
175
+ desc "Check Rudy configuration."
176
+ option :l, :all, "Display configs for all machines"
177
+ option :d, :defaults, "Display the default value for the supplied parameter"
178
+ option :g, :group, String, "Display configuration for a specific group"
179
+ argv :name
180
+ command :config => Rudy::CLI::Config
181
+
182
+ usage "rudy myaddress [-i] [-e]"
183
+ desc "Displays you current internal and external IP addresses"
184
+ option :e, :external, "Display only external IP address"
185
+ option :i, :internal, "Display only internal IP address"
186
+ command :myaddress do |obj|
187
+ ea = Rudy::Utils::external_ip_address || ''
188
+ ia = Rudy::Utils::internal_ip_address || ''
189
+ if obj.global.quiet
190
+ puts ia unless obj.option.external && !obj.option.internal
191
+ puts ea unless obj.option.internal && !obj.option.external
192
+ else
193
+ puts "%10s: %s" % ['Internal', ia] unless obj.option.external && !obj.option.internal
194
+ puts "%10s: %s" % ['External', ea] unless obj.option.internal && !obj.option.external
195
+ end
195
196
  end
196
- end
197
197
 
198
- usage "rudy [global options] annoy [-h -m -l] [-e]"
199
- desc "Play around with Rudy's annoying challenges"
200
- option :s, :string, "A numeric challenge"
201
- option :n, :numeric, "A numeric challenge"
202
- option :i, :insane, "Insane annoyance factor"
203
- option :h, :high, "High annoyance factor"
204
- option :m, :medium, "Medium annoyance factor"
205
- option :l, :low, "Low annoyance factor"
206
- option :r, :rand, "Random challenge type"
207
- command :annoy do |obj|
208
- srand(Time.now.to_f)
209
- flavor = [:numeric, :string, :rand].detect { |v| obj.option.send(v) } || :string
210
- factor = [:insane, :high, :medium, :low].detect { |v| obj.option.send(v) } || :medium
211
- success = Annoy.challenge?("Is this annoying?", factor, flavor)
212
- puts (success ? "Correct!" : "WRONG!").bright
213
- end
198
+ usage "rudy [global options] annoy [-h -m -l] [-e]"
199
+ desc "Play around with Rudy's annoying challenges"
200
+ option :s, :string, "A numeric challenge"
201
+ option :n, :numeric, "A numeric challenge"
202
+ option :i, :insane, "Insane annoyance factor"
203
+ option :h, :high, "High annoyance factor"
204
+ option :m, :medium, "Medium annoyance factor"
205
+ option :l, :low, "Low annoyance factor"
206
+ option :r, :rand, "Random challenge type"
207
+ command :annoy do |obj|
208
+ srand(Time.now.to_f)
209
+ flavor = [:numeric, :string, :rand].detect { |v| obj.option.send(v) } || :string
210
+ factor = [:insane, :high, :medium, :low].detect { |v| obj.option.send(v) } || :medium
211
+ success = Annoy.challenge?("Is this annoying?", factor, flavor)
212
+ puts (success ? "Correct!" : "WRONG!").bright
213
+ end
214
214
 
215
- desc "Display the current Rudy slogan"
216
- command :slogan do
217
- puts "Rudy: Not your grandparent's deployment tool!"
218
- end
215
+ desc "Display the current Rudy slogan"
216
+ command :slogan do
217
+ puts "Rudy: Not your grandparent's deployment tool!"
218
+ end
219
219
 
220
- desc "Generates a configuration template to #{Rudy::RUDY_CONFIG_FILE}"
221
- command :generate_config do |obj|
222
- unless File.exists?(Rudy::RUDY_CONFIG_FILE)
223
- Rudy::Config.init_config_dir
224
- puts "Add your AWS credentials to #{Rudy::RUDY_CONFIG_FILE}"
225
- else
226
- puts "#{Rudy::RUDY_CONFIG_FILE} already exists"
220
+ desc "Generates a configuration template to #{Rudy::RUDY_CONFIG_FILE}"
221
+ command :generate_config do |obj|
222
+ unless File.exists?(Rudy::RUDY_CONFIG_FILE)
223
+ Rudy::Config.init_config_dir
224
+ puts "Add your AWS credentials to #{Rudy::RUDY_CONFIG_FILE}"
225
+ else
226
+ puts "#{Rudy::RUDY_CONFIG_FILE} already exists"
227
+ end
227
228
  end
228
- end
229
229
 
230
230
 
231
- desc "Initialize Rudy configuration"
232
- command :init do |obj|
231
+ desc "Initialize Rudy configuration"
232
+ command :init do |obj|
233
233
 
234
- unless File.exists?(Rudy::RUDY_CONFIG_FILE)
235
- Rudy::Config.init_config_dir
236
- end
234
+ unless File.exists?(Rudy::RUDY_CONFIG_FILE)
235
+ Rudy::Config.init_config_dir
236
+ end
237
237
 
238
- begin
239
- rdom = Rudy::Domains.new(:global => obj.global)
238
+ begin
239
+ rdom = Rudy::Domains.new(:global => obj.global)
240
240
 
241
- unless rdom.exists?
242
- puts "Creating SimpleDB domain #{rdom.name}"
243
- rdom.create
244
- puts "Initialized"
245
- else
246
- puts "Already Initialized"
247
- end
241
+ unless rdom.exists?
242
+ puts "Creating SimpleDB domain #{rdom.name}"
243
+ rdom.create
244
+ puts "Initialized"
245
+ else
246
+ puts "Already Initialized"
247
+ end
248
248
 
249
249
 
250
- exit 0 # a quick hack to not print elapsed time
250
+ exit 0 # a quick hack to not print elapsed time
251
251
 
252
- rescue Rudy::NoConfig => ex
253
- puts "AWS credentials must be configured to continue."
254
- puts "You can modify these in #{Rudy::RUDY_CONFIG_FILE}"
255
- exit 1
256
- end
252
+ rescue Rudy::NoConfig => ex
253
+ puts "AWS credentials must be configured to continue."
254
+ puts "You can modify these in #{Rudy::RUDY_CONFIG_FILE}"
255
+ exit 1
256
+ end
257
257
 
258
258
 
259
259
 
260
- end
261
-
262
- desc "Displays the SimpleDB domains associated to your account"
263
- command :domains => Rudy::CLI::Domains
264
-
265
-
266
- # --------------------------------- RUDY MANAGER COMMANDS --------
267
- # ------------------------------------------------------------------
268
-
269
- #usage "rudy init"
270
- #desc "Run this the first time you use Rudy (it's immutable so running it again does no harm)."
271
- #command :create_domain => Rudy::CLI::Manager
272
- #
273
- #usage "rudy info"
274
- #desc "Displays info about the current Rudy configuration"
275
- #command :info => Rudy::CLI::Manager
276
-
277
- #desc "Update a Machine Group with the current version of Rudy"
278
- #option :g, :group, String, "A security group name"
279
- #command :update => Rudy::CLI::Manager
280
-
281
-
282
- #usage "#{$/} [global options] disks [-C -p path -d device -s size] [-A] [-D] [path]"
283
- #desc "Manage Disks"
284
- #option :l, :all, "Display all disk definitions"
285
- #option :i, :awsid, String, "EC2 Instance ID"
286
- #option :g, :group, String, "Machine group name"
287
- #option :p, :path, String, "The filesystem path to use as the mount point"
288
- #option :d, :device, String, "The device id (default: /dev/sdh)"
289
- #option :s, :size, Integer, "The size of disk (in GB)"
290
- #action :C, :create, "Create a disk definition"
291
- #action :D, :destroy, "Destroy a disk definition"
292
- #action :A, :attach, "Attach a disk"
293
- #action :N, :unattach, "Unattach a disk"
294
- #argv :diskname
295
- #command :disk => Rudy::CLI::Disks
296
- #command_alias :disk, :disks
297
-
298
-
299
- #usage "rudy [global options] backups [-C] [disk name]"
300
- #desc "Manage Backups"
301
- #option :s, :snapshot, String, "Create a backup entry from an existing snapshot"
302
- #action :Z, :sync, "Check for and delete backup metadata with no snapshot. DOES NOT delete snapshots."
303
- ##action :T, :tidy, "Tidy existing backups"
304
- #action :D, :destroy, "Destroy a backup and DELETE its snapshots."
305
- #action :C, :create, "Create a backup"
306
- #argv :disk
307
- #command :'backup' => Rudy::CLI::Backups
308
- #command_alias :backup, :bu
309
-
310
- #usage "rudy [global options] metadata instance-ID"
311
- #desc "Display Rudy metadata."
312
- #command :metadata => Rudy::CLI::Manager
313
- #command_alias :metadata, :md
314
-
315
-
316
- # -------------------------- RUDY RELEASE/DEPLOY COMMANDS --------
317
- # ------------------------------------------------------------------
318
-
319
- #desc "Release to a Machine Group"
320
- #option :g, :group, String, "A security group name"
321
- #option :s, :switch, "Switch to the release branch/tag"
322
- #option :m, :msg, String, "A short release note"
323
- #command :release => Rudy::CLI::Release
324
-
325
- #desc "Update the release currently running in a machine group"
326
- #command :rerelease => Rudy::CLI::Release
327
- #command_alias :rerelease, :rere
328
-
329
- #desc "Deploy disk snapshots from one machine to another"
330
- #command :deploy => Rudy::CLI::Deploy
331
-
332
-
333
- #desc "Shutdown a Machine Group"
334
- #usage "rudy [global options] shutdown [-g group-name] [instance-ID]"
335
- #option :g, :group, String, "A security group name"
336
- #argv :awsid
337
- #command :shutdown => Rudy::CLI::Routines
338
- #
339
- #
340
- #desc "Start a Machine Group"
341
- #usage "rudy [global options] startup [-g group-name] [-i image-ID]"
342
- #option :ami, String, "EC2 image ID (AMI)"
343
- #option :g, :group, String, "A security group name"
344
- #command :startup => Rudy::CLI::Routines
345
- #command_alias :startup, :start
346
-
347
- #desc "Restart a Machine Group"
348
- #option :g, :group, String, "A security group name"
349
- #argv :awsid
350
- #command :restart => Rudy::CLI::Routines
351
- #
352
-
353
-
260
+ end
354
261
 
355
- # ------------------------------------------- UGLY STUFFS --------
356
- # ------------------------------------------------------------------
357
- debug :off
358
- default :status
359
- #capture :stderr
360
- before do
361
- @start = Time.now
362
- end
363
- after do |obj|
364
- unless obj.global.quiet
365
- @elapsed = Time.now - @start
366
- puts $/, "Elapsed: %.2f seconds" % @elapsed.to_f if @elapsed > 0.1
262
+ desc "Displays the SimpleDB domains associated to your account"
263
+ command :domains => Rudy::CLI::Domains
264
+
265
+
266
+ # --------------------------------- RUDY MANAGER COMMANDS --------
267
+ # ------------------------------------------------------------------
268
+
269
+ #usage "rudy init"
270
+ #desc "Run this the first time you use Rudy (it's immutable so running it again does no harm)."
271
+ #command :create_domain => Rudy::CLI::Manager
272
+ #
273
+ #usage "rudy info"
274
+ #desc "Displays info about the current Rudy configuration"
275
+ #command :info => Rudy::CLI::Manager
276
+
277
+ #desc "Update a Machine Group with the current version of Rudy"
278
+ #option :g, :group, String, "A security group name"
279
+ #command :update => Rudy::CLI::Manager
280
+
281
+
282
+ #usage "#{$/} [global options] disks [-C -p path -d device -s size] [-A] [-D] [path]"
283
+ #desc "Manage Disks"
284
+ #option :l, :all, "Display all disk definitions"
285
+ #option :i, :awsid, String, "EC2 Instance ID"
286
+ #option :g, :group, String, "Machine group name"
287
+ #option :p, :path, String, "The filesystem path to use as the mount point"
288
+ #option :d, :device, String, "The device id (default: /dev/sdh)"
289
+ #option :s, :size, Integer, "The size of disk (in GB)"
290
+ #action :C, :create, "Create a disk definition"
291
+ #action :D, :destroy, "Destroy a disk definition"
292
+ #action :A, :attach, "Attach a disk"
293
+ #action :N, :unattach, "Unattach a disk"
294
+ #argv :diskname
295
+ #command :disk => Rudy::CLI::Disks
296
+ #command_alias :disk, :disks
297
+
298
+
299
+ #usage "rudy [global options] backups [-C] [disk name]"
300
+ #desc "Manage Backups"
301
+ #option :s, :snapshot, String, "Create a backup entry from an existing snapshot"
302
+ #action :Z, :sync, "Check for and delete backup metadata with no snapshot. DOES NOT delete snapshots."
303
+ ##action :T, :tidy, "Tidy existing backups"
304
+ #action :D, :destroy, "Destroy a backup and DELETE its snapshots."
305
+ #action :C, :create, "Create a backup"
306
+ #argv :disk
307
+ #command :'backup' => Rudy::CLI::Backups
308
+ #command_alias :backup, :bu
309
+
310
+ #usage "rudy [global options] metadata instance-ID"
311
+ #desc "Display Rudy metadata."
312
+ #command :metadata => Rudy::CLI::Manager
313
+ #command_alias :metadata, :md
314
+
315
+
316
+ # -------------------------- RUDY RELEASE/DEPLOY COMMANDS --------
317
+ # ------------------------------------------------------------------
318
+
319
+ #desc "Release to a Machine Group"
320
+ #option :g, :group, String, "A security group name"
321
+ #option :s, :switch, "Switch to the release branch/tag"
322
+ #option :m, :msg, String, "A short release note"
323
+ #command :release => Rudy::CLI::Release
324
+
325
+ #desc "Update the release currently running in a machine group"
326
+ #command :rerelease => Rudy::CLI::Release
327
+ #command_alias :rerelease, :rere
328
+
329
+ #desc "Deploy disk snapshots from one machine to another"
330
+ #command :deploy => Rudy::CLI::Deploy
331
+
332
+
333
+ #desc "Shutdown a Machine Group"
334
+ #usage "rudy [global options] shutdown [-g group-name] [instance-ID]"
335
+ #option :g, :group, String, "A security group name"
336
+ #argv :awsid
337
+ #command :shutdown => Rudy::CLI::Routines
338
+ #
339
+ #
340
+ #desc "Start a Machine Group"
341
+ #usage "rudy [global options] startup [-g group-name] [-i image-ID]"
342
+ #option :ami, String, "EC2 image ID (AMI)"
343
+ #option :g, :group, String, "A security group name"
344
+ #command :startup => Rudy::CLI::Routines
345
+ #command_alias :startup, :start
346
+
347
+ #desc "Restart a Machine Group"
348
+ #option :g, :group, String, "A security group name"
349
+ #argv :awsid
350
+ #command :restart => Rudy::CLI::Routines
351
+ #
352
+
353
+
354
+
355
+ # ------------------------------------------- UGLY STUFFS --------
356
+ # ------------------------------------------------------------------
357
+ debug :off
358
+ default :status
359
+ #capture :stderr
360
+ before do
361
+ @start = Time.now
362
+ end
363
+ after do |obj|
364
+ unless obj.global.quiet
365
+ @elapsed = Time.now - @start
366
+ puts $/, "Elapsed: %.2f seconds" % @elapsed.to_f if @elapsed > 0.1
367
+ end
367
368
  end
368
369
  end
369
-
data/lib/rudy.rb CHANGED
@@ -106,7 +106,7 @@ module Rudy
106
106
  unless defined?(MAJOR)
107
107
  MAJOR = 0.freeze
108
108
  MINOR = 5.freeze
109
- TINY = 0.freeze
109
+ TINY = 1.freeze
110
110
  end
111
111
  def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
112
112
  def self.to_f; self.to_s.to_f; end
data/lib/rudy/config.rb CHANGED
@@ -49,6 +49,7 @@ module Rudy
49
49
  @paths += Dir.glob(File.join(cwd, 'config', 'rudy', '*.rb')) || []
50
50
  @paths += Dir.glob(File.join(cwd, '.rudy', '*.rb')) || []
51
51
  @paths &&= @paths.uniq
52
+
52
53
  refresh
53
54
  end
54
55
 
data/lib/rudy/huxtable.rb CHANGED
@@ -5,6 +5,8 @@ module Rudy
5
5
  module Huxtable
6
6
  include Rudy::AWS
7
7
 
8
+ # TODO: investigate @@debug bug. When this is true, Caesars.debug? returns true
9
+ # too. It's probably some include thing.
8
10
  @@debug = false
9
11
 
10
12
  attr_accessor :config
@@ -90,7 +92,7 @@ module Rudy
90
92
  Rudy.enable_quiet if @global.quiet
91
93
  end
92
94
 
93
- def debug?; @@debug && @@debug == true; end
95
+ def debug?; @@debug == true; end
94
96
 
95
97
  def check_keys
96
98
  raise "No EC2 .pem keys provided" unless has_pem_keys?
data/lib/tryouts.rb CHANGED
@@ -3,25 +3,20 @@ require 'ostruct'
3
3
 
4
4
  module Tryouts
5
5
 
6
- def before(&b)
7
- b.call
8
- end
9
- def after(&b)
10
- at_exit &b
11
- end
12
-
13
-
14
6
  # tryout :name do
15
7
  # ...
16
8
  # end
17
9
  def tryout(name, &b)
10
+ puts '-'*50
18
11
  puts "Running#{@poop}: #{name}"
19
12
  begin
20
13
  b.call
21
- puts $/*2
22
- sleep 1
14
+ sleep 0.1
23
15
  rescue Interrupt
24
- end
16
+ rescue => ex
17
+ STDERR.puts "Tryout error: #{ex.message}"
18
+ end
19
+ puts $/*2
25
20
  end
26
21
 
27
22
  # Ignore everything
@@ -36,5 +31,3 @@ module Tryouts
36
31
  end
37
32
 
38
33
  end
39
-
40
- include Tryouts
data/rudy.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "rudy"
3
3
  s.rubyforge_project = 'rudy'
4
- s.version = "0.5.0"
4
+ s.version = "0.5.1"
5
5
  s.summary = "Not your grandparent's deployment tool."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
data/test/helper.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'rubygems' if defined? Gem
2
-
1
+
3
2
  libdir = File.join(File.dirname(__FILE__), '..', 'lib')
4
3
  $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
5
4
 
@@ -2,8 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
4
 
5
-
6
- require 'rubygems'
7
5
  require 'session'
8
6
  require 'net/ssh'
9
7
  require 'rye'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solutious-rudy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum