rudy 0.4.0 → 0.6.0

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.
Files changed (135) hide show
  1. data/CHANGES.txt +54 -30
  2. data/README.rdoc +100 -12
  3. data/Rakefile +103 -8
  4. data/Rudyfile +119 -0
  5. data/bin/ird +175 -0
  6. data/bin/rudy +259 -156
  7. data/bin/rudy-ec2 +228 -95
  8. data/bin/rudy-s3 +76 -0
  9. data/bin/rudy-sdb +67 -0
  10. data/lib/annoy.rb +270 -0
  11. data/lib/console.rb +30 -9
  12. data/lib/escape.rb +305 -0
  13. data/lib/rudy.rb +151 -182
  14. data/lib/rudy/aws.rb +56 -49
  15. data/lib/rudy/aws/ec2.rb +47 -292
  16. data/lib/rudy/aws/ec2/address.rb +157 -0
  17. data/lib/rudy/aws/ec2/group.rb +301 -0
  18. data/lib/rudy/aws/ec2/image.rb +168 -0
  19. data/lib/rudy/aws/ec2/instance.rb +434 -0
  20. data/lib/rudy/aws/ec2/keypair.rb +104 -0
  21. data/lib/rudy/aws/ec2/snapshot.rb +98 -0
  22. data/lib/rudy/aws/ec2/volume.rb +230 -0
  23. data/lib/rudy/aws/ec2/zone.rb +77 -0
  24. data/lib/rudy/aws/s3.rb +54 -0
  25. data/lib/rudy/aws/sdb.rb +298 -0
  26. data/lib/rudy/aws/sdb/error.rb +46 -0
  27. data/lib/rudy/{metadata/backup.rb → backup.rb} +26 -51
  28. data/lib/rudy/cli.rb +157 -0
  29. data/lib/rudy/cli/aws/ec2/addresses.rb +105 -0
  30. data/lib/rudy/cli/aws/ec2/candy.rb +208 -0
  31. data/lib/rudy/cli/aws/ec2/groups.rb +121 -0
  32. data/lib/rudy/cli/aws/ec2/images.rb +196 -0
  33. data/lib/rudy/cli/aws/ec2/instances.rb +194 -0
  34. data/lib/rudy/cli/aws/ec2/keypairs.rb +53 -0
  35. data/lib/rudy/cli/aws/ec2/snapshots.rb +49 -0
  36. data/lib/rudy/cli/aws/ec2/volumes.rb +104 -0
  37. data/lib/rudy/cli/aws/ec2/zones.rb +22 -0
  38. data/lib/rudy/cli/aws/s3/buckets.rb +50 -0
  39. data/lib/rudy/cli/aws/s3/store.rb +22 -0
  40. data/lib/rudy/cli/aws/sdb/domains.rb +41 -0
  41. data/lib/rudy/cli/candy.rb +8 -0
  42. data/lib/rudy/{command → cli}/config.rb +34 -24
  43. data/lib/rudy/cli/disks.rb +35 -0
  44. data/lib/rudy/cli/machines.rb +94 -0
  45. data/lib/rudy/cli/routines.rb +57 -0
  46. data/lib/rudy/config.rb +77 -72
  47. data/lib/rudy/config/objects.rb +29 -0
  48. data/lib/rudy/disks.rb +248 -0
  49. data/lib/rudy/global.rb +121 -0
  50. data/lib/rudy/huxtable.rb +340 -0
  51. data/lib/rudy/machines.rb +245 -0
  52. data/lib/rudy/metadata.rb +123 -13
  53. data/lib/rudy/routines.rb +47 -0
  54. data/lib/rudy/routines/helpers/diskhelper.rb +101 -0
  55. data/lib/rudy/routines/helpers/scripthelper.rb +91 -0
  56. data/lib/rudy/routines/release.rb +34 -0
  57. data/lib/rudy/routines/shutdown.rb +57 -0
  58. data/lib/rudy/routines/startup.rb +58 -0
  59. data/lib/rudy/scm/svn.rb +1 -1
  60. data/lib/rudy/utils.rb +322 -4
  61. data/lib/storable.rb +26 -17
  62. data/lib/sysinfo.rb +274 -0
  63. data/lib/tryouts.rb +6 -13
  64. data/rudy.gemspec +128 -42
  65. data/support/randomize-root-password +45 -0
  66. data/support/rudy-ec2-startup +9 -9
  67. data/support/update-ec2-ami-tools +20 -0
  68. data/test/05_config/00_setup_test.rb +20 -0
  69. data/test/05_config/30_machines_test.rb +69 -0
  70. data/test/20_sdb/00_setup_test.rb +16 -0
  71. data/test/20_sdb/10_domains_test.rb +115 -0
  72. data/test/25_ec2/00_setup_test.rb +29 -0
  73. data/test/25_ec2/10_keypairs_test.rb +41 -0
  74. data/test/25_ec2/20_groups_test.rb +131 -0
  75. data/test/25_ec2/30_addresses_test.rb +38 -0
  76. data/test/25_ec2/40_volumes_test.rb +49 -0
  77. data/test/25_ec2/50_snapshots_test.rb +74 -0
  78. data/test/26_ec2_instances/00_setup_test.rb +28 -0
  79. data/test/26_ec2_instances/10_instances_test.rb +83 -0
  80. data/test/26_ec2_instances/50_images_test.rb +13 -0
  81. data/test/30_sdb_metadata/00_setup_test.rb +21 -0
  82. data/test/30_sdb_metadata/10_disks_test.rb +109 -0
  83. data/test/30_sdb_metadata/20_backups_test.rb +102 -0
  84. data/test/coverage.txt +51 -0
  85. data/test/helper.rb +36 -0
  86. data/vendor/highline-1.5.1/CHANGELOG +222 -0
  87. data/vendor/highline-1.5.1/INSTALL +35 -0
  88. data/vendor/highline-1.5.1/LICENSE +7 -0
  89. data/vendor/highline-1.5.1/README +63 -0
  90. data/vendor/highline-1.5.1/Rakefile +82 -0
  91. data/vendor/highline-1.5.1/TODO +6 -0
  92. data/vendor/highline-1.5.1/examples/ansi_colors.rb +38 -0
  93. data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +18 -0
  94. data/vendor/highline-1.5.1/examples/basic_usage.rb +75 -0
  95. data/vendor/highline-1.5.1/examples/color_scheme.rb +32 -0
  96. data/vendor/highline-1.5.1/examples/limit.rb +12 -0
  97. data/vendor/highline-1.5.1/examples/menus.rb +65 -0
  98. data/vendor/highline-1.5.1/examples/overwrite.rb +19 -0
  99. data/vendor/highline-1.5.1/examples/page_and_wrap.rb +322 -0
  100. data/vendor/highline-1.5.1/examples/password.rb +7 -0
  101. data/vendor/highline-1.5.1/examples/trapping_eof.rb +22 -0
  102. data/vendor/highline-1.5.1/examples/using_readline.rb +17 -0
  103. data/vendor/highline-1.5.1/lib/highline.rb +758 -0
  104. data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +120 -0
  105. data/vendor/highline-1.5.1/lib/highline/compatibility.rb +17 -0
  106. data/vendor/highline-1.5.1/lib/highline/import.rb +43 -0
  107. data/vendor/highline-1.5.1/lib/highline/menu.rb +395 -0
  108. data/vendor/highline-1.5.1/lib/highline/question.rb +463 -0
  109. data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +193 -0
  110. data/vendor/highline-1.5.1/setup.rb +1360 -0
  111. data/vendor/highline-1.5.1/test/tc_color_scheme.rb +56 -0
  112. data/vendor/highline-1.5.1/test/tc_highline.rb +823 -0
  113. data/vendor/highline-1.5.1/test/tc_import.rb +54 -0
  114. data/vendor/highline-1.5.1/test/tc_menu.rb +429 -0
  115. data/vendor/highline-1.5.1/test/ts_all.rb +15 -0
  116. metadata +141 -38
  117. data/lib/aws_sdb.rb +0 -3
  118. data/lib/aws_sdb/error.rb +0 -42
  119. data/lib/aws_sdb/service.rb +0 -215
  120. data/lib/rudy/aws/simpledb.rb +0 -53
  121. data/lib/rudy/command/addresses.rb +0 -46
  122. data/lib/rudy/command/backups.rb +0 -175
  123. data/lib/rudy/command/base.rb +0 -841
  124. data/lib/rudy/command/deploy.rb +0 -12
  125. data/lib/rudy/command/disks.rb +0 -213
  126. data/lib/rudy/command/environment.rb +0 -73
  127. data/lib/rudy/command/groups.rb +0 -61
  128. data/lib/rudy/command/images.rb +0 -91
  129. data/lib/rudy/command/instances.rb +0 -85
  130. data/lib/rudy/command/machines.rb +0 -161
  131. data/lib/rudy/command/metadata.rb +0 -41
  132. data/lib/rudy/command/release.rb +0 -174
  133. data/lib/rudy/command/volumes.rb +0 -66
  134. data/lib/rudy/metadata/disk.rb +0 -138
  135. data/tryouts/console_tryout.rb +0 -91
@@ -1,107 +1,240 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- # Rudy -- Your friend in staging and deploying to EC2
3
+ # = Rudy EC2
4
+ #
5
+ # === A Rudy interface to Amazon EC2
4
6
  #
5
- # See rudy -h for usage
7
+ #
8
+ #
9
+ # See rudy-ec2 -h for usage
6
10
  #
7
11
 
8
- #
9
- # No Ruby 1.9.1 support. Only 1.8.x for now :[
10
- unless RUBY_VERSION < "1.9"
11
- puts "Sorry! We're using the right_aws gem and it doesn't support Ruby 1.9 (md5 error)."
12
- exit 1
13
- else
14
- require 'rubygems'
15
- end
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
+ #require 'rubygems'
16
16
 
17
- RUDY_HOME = File.join(File.dirname(__FILE__), '..')
18
- RUDY_LIB = File.join(RUDY_HOME, 'lib')
19
- $:.unshift RUDY_LIB # Put our local lib in first place
17
+ require 'rudy'
18
+ require 'rudy/cli'
20
19
 
21
20
  require 'drydock'
22
- extend Drydock
23
-
24
- project "Rudy" # This also runs require 'ruby'
25
-
26
- debug :on
27
21
 
28
- capture :stderr
29
-
30
- global :A, :accesskey, String, "AWS Access Key"
31
- global :S, :secretkey, String, "AWS Secret Access Key"
32
- global :R, :region, String, "Connect to a specific EC2 region (default: #{Rudy::DEFAULT_REGION})"
33
- global :z, :zone, String, "Connect to a specific EC2 zone (default: #{Rudy::DEFAULT_ZONE})"
34
- global :q, :quiet, "Run with less output"
35
- global :v, :verbose, "Increase verbosity of output (i.e. -v or -vv or -vvv)" do
36
- @verbose ||= 0
37
- @verbose += 1
38
- end
39
- global :V, :version, "Display version number" do
40
- puts "Rudy version: #{Rudy::VERSION}"
41
- exit 0
22
+ # Command-line interface for bin/rudy-ec2
23
+ module RudyCLI_EC2
24
+ extend Drydock
25
+
26
+
27
+ # ----------------------------------- AMAZON EC2 COMMANDS --------
28
+ # ------------------------------------------------------------------
29
+
30
+ desc "Amazon EC2 Elastic IP addresses"
31
+ usage "rudy-ec2 addresses"
32
+ usage "rudy-ec2 addresses -A -i instance-id address"
33
+ usage "rudy-ec2 addresses -A -i instance-id -n"
34
+ usage "rudy-ec2 addresses -N address"
35
+ usage "rudy-ec2 addresses -D address"
36
+ usage "rudy-ec2 addresses -C"
37
+ option :i, :instance, String, "Instance ID"
38
+ option :n, :newaddress, "Create and assign a new elastic IP"
39
+ action :A, :associate, "Associate an IP address to a running instance"
40
+ action :N, :disassociate, "Disassociate an IP address from an instance"
41
+ action :C, :create, "Request an IP address from Amazon"
42
+ action :D, :destroy, "Return an IP address to Amazon (this is permanent!)"
43
+ argv :ipaddress
44
+ command :addresses => Rudy::CLI::AWS::EC2::Addresses
45
+ command_alias :addresses, :address
46
+ command_alias :addresses, :a
47
+
48
+ desc "Amazon EC2 instance console output"
49
+ usage "rudy-ec2 console [-g group] [instance ID]"
50
+ option :g, :group, String, "A security group name"
51
+ argv :awsid
52
+ command :consoles => Rudy::CLI::AWS::EC2::Instances
53
+ command_alias :consoles, :console
54
+ command_alias :consoles, :c
55
+
56
+ desc "Copy files to or from machines."
57
+ usage "rudy-ec2 copy [-p] [-r] [-u user] [-k path/2/privatekey] source target"
58
+ usage "rudy-ec2 upload -k path/2/privatekey -u username local-source target"
59
+ usage "rudy-ec2 download remote-source target"
60
+ usage "NOTE: Use quotes when using a tilda or asterisk in remote paths ('~/')."
61
+ usage "rudy-ec2 download '~/*' /tmp/"
62
+ option :r, :recursive, "Recursively copy entire directories"
63
+ option :p, :preserve, "Preserve atimes and ctimes."
64
+ option :d, :download, "Download FROM the remote machine to the local machine"
65
+ option :print, "Only print the SSH command, don't connect"
66
+ option :g, :group, String, "A security group name"
67
+ option :i, :awsid, String, "An instance ID"
68
+ option :u, :user, String, "Username"
69
+ command :copy => Rudy::CLI::AWS::EC2::Candy
70
+ command_alias :copy, :ul
71
+ command_alias :copy, :dl
72
+ command_alias :copy, :scp
73
+ command_alias :copy, :upload
74
+ command_alias :copy, :download
75
+
76
+ desc "Amazon EC2 EC2 Security Groups"
77
+ usage "rudy-ec2 groups"
78
+ usage "rudy-ec2 groups -C [-p ports] [-a addresses] [-r protocols] name"
79
+ usage "rudy-ec2 groups -A [-p ports] [-a addresses] [-r protocols] name"
80
+ usage "rudy-ec2 groups -A -p 81,8000-9000 -a 127.0.0.1,127.0.0.2 name"
81
+ usage "rudy-ec2 groups -A -g default -o 123456789012 name"
82
+ usage "rudy-ec2 groups -R -g default name"
83
+ usage "rudy-ec2 groups -D name"
84
+ option :all, "Display all security groups"
85
+ option :r, :protocols, Array, "List of protocols. One of: tcp (default), udp, icmp"
86
+ option :p, :ports, Array, "List of port ranges (default: 22,80,443)"
87
+ option :a, :addresses, Array, "List of IP addresses (default: your current external IP)"
88
+ option :g, :group, String, "Other group to authorize or revoke. Use with -o!"
89
+ option :o, :owner, String, "Other group owner ID (account number). Use with -g!"
90
+ option :d, :description, String, "A group description"
91
+ action :C, :create, "Create a security group"
92
+ action :D, :destroy, "Destroy a security group"
93
+ action :A, :authorize, "Authorize a rule for a security group"
94
+ action :R, :revoke, "Revoke a rule for a security group"
95
+ argv :name
96
+ command :groups => Rudy::CLI::AWS::EC2::Groups
97
+ command_alias :groups, :group
98
+ command_alias :groups, :g
99
+
100
+ desc "Amazon EC2 Machine Images (AMIs)"
101
+ usage "rudy-ec2 im"
102
+ usage "rudy-ec2 image"
103
+ usage "rudy-ec2 images image-id"
104
+ usage "rudy-ec2 images -o 123456789012"
105
+ usage "rudy-ec2 images -o amazon"
106
+ usage "rudy-ec2 images -o self"
107
+ option :o, :owner, String, "Amazon Account Number or one of: amazon, self"
108
+ option :l, :all, "Display all registered machine images (warning: slow)"
109
+ #option :p, :private, "Private images only"
110
+ option :b, :bucket, String, "The name of the bucket that will store the image"
111
+ option :n, :name, String, "The name of the image file (to create)"
112
+ option :u, :user, String, "Username to connect as (used for creating an image)"
113
+ action :C, :create, "Create an image"
114
+ action :P, :prepare, "Prepare a running instance to be used as an image"
115
+ #action :D, :destroy, "Deregister an image (does not remove image files from S3)"
116
+ argv :ami
117
+ command :images => Rudy::CLI::AWS::EC2::Images
118
+ command_alias :images, :image
119
+ command_alias :images, :im
120
+
121
+ desc "Amazon EC2 Instances"
122
+ usage "rudy-ec2 i"
123
+ usage "rudy-ec2 instance"
124
+ usage "rudy-ec2 instances"
125
+ usage "rudy-ec2 instances [-g group-name] [instance-ID]"
126
+ usage "rudy-ec2 instances -C -g group-name -s m1.small -k keypair-name"
127
+ usage "rudy-ec2 instances -C -a 255.255.255.255 -k keypair-name"
128
+ usage "rudy-ec2 instances -R instance-ID"
129
+ usage "rudy-ec2 instances -D instance-ID"
130
+ usage "rudy-ec2 instances -R -g group-name"
131
+ usage "rudy-ec2 instances -D -g group-name"
132
+ option :g, :group, String, "The security group name"
133
+ option :m, :ami, String, "The machine image ID (ami)"
134
+ option :s, :size, String, "The instance size (default: m1.small)"
135
+ option :k, :keypair, String, "The SSH keypair to use for launch"
136
+ option :a, :address, String, "The IP address to associate to the new instance"
137
+ option :n, :newaddress, "Create and assign a new elastic IP"
138
+ option :p, :private, "Do not give the instance a public IP address"
139
+ action :C, :create, "Create a machine instance"
140
+ action :R, :restart, "Restart a machine instance"
141
+ action :D, :destroy, "Destroy a machine instance"
142
+ argv :instid
143
+ command :instances => Rudy::CLI::AWS::EC2::Instances
144
+ command_alias :instances, :instance
145
+ command_alias :instances, :in
146
+ command_alias :instances, :i
147
+
148
+ desc "Amazon EC2 KeyPairs"
149
+ usage "rudy-ec2 keypairs"
150
+ usage "rudy-ec2 keypairs -C name"
151
+ usage "rudy-ec2 keypairs -D name"
152
+ action :D, :destroy, "Unregister keypair from EC2 (this is permanent!)"
153
+ action :C, :create, "Create and register a keypair with EC2"
154
+ argv :name
155
+ command :keypairs => Rudy::CLI::AWS::EC2::KeyPairs
156
+ command_alias :keypairs, :keypair
157
+ command_alias :keypairs, :k
158
+
159
+ desc "Amazon EC2 Snapshots"
160
+ usage "rudy-ec2 snapshots"
161
+ usage "rudy-ec2 snapshots -C -v volume-id"
162
+ usage "rudy-ec2 snapshots -D snapshot-id"
163
+ option :v, :volume, String, "Volume ID"
164
+ action :D, :destroy, "Destroy a snapshot (this is permanent!)"
165
+ action :C, :create, "Create a snapshot"
166
+ argv :snapid
167
+ command :snapshots => Rudy::CLI::AWS::EC2::Snapshots
168
+ command_alias :snapshots, :snapshot
169
+ command_alias :snapshots, :t
170
+
171
+ desc "Open an SSH connection"
172
+ usage "rudy-ec2 ssh"
173
+ usage "rudy-ec2 -u root -k path/2/key ssh"
174
+ usage "rudy-ec2 -u root -k path/2/key ssh uname -a"
175
+ usage "rudy-ec2 ssh -g group-name"
176
+ usage "rudy-ec2 ssh -i instance-id"
177
+ option :print, "Only print the SSH command, don't connect"
178
+ option :g, :group, String, "A security group name"
179
+ option :i, :instid, String, "An instance ID"
180
+ argv :cmd
181
+ command :ssh => Rudy::CLI::AWS::EC2::Candy
182
+ command_alias :ssh, :connect
183
+
184
+ desc "Amazon EC2 status"
185
+ command :status => Rudy::CLI::AWS::EC2::Candy
186
+
187
+ desc "Amazon EC2 Volumes"
188
+ usage "rudy-ec2 volumes"
189
+ usage "rudy-ec2 volumes -C -s size [-d device-path]"
190
+ usage "rudy-ec2 volumes -A volume-id instance-id"
191
+ usage "rudy-ec2 volumes -N volume-id"
192
+ usage "rudy-ec2 volumes -D volume-id"
193
+ option :i, :instance, String, "Instance ID"
194
+ option :s, :size, String, "Size (in GB)"
195
+ option :t, :snapshot, String, "Snapshot ID (snap)"
196
+ option :d, :device, String, "Device path (default: /dev/sdh)"
197
+ action :D, :destroy, "Destroy a volume (this is permanent!)"
198
+ action :C, :create, "Create a volume"
199
+ action :A, :attach, "Attach a volume to a running instance"
200
+ action :N, :detach, "Detach a volume from an instance"
201
+ argv :volid
202
+ command :volumes => Rudy::CLI::AWS::EC2::Volumes
203
+ command_alias :volumes, :volume
204
+ command_alias :volumes, :v
205
+
206
+ desc "Availability Zones"
207
+ argv :name
208
+ command :zones => Rudy::CLI::AWS::EC2::Zones
209
+ command_alias :zones, :zone
210
+ command_alias :zones, :z
211
+
212
+
213
+ # -------------------------------- RUDY-EC2 MISCELLANEOUS --------
214
+ # ------------------------------------------------------------------
215
+
216
+ default :instances
217
+ debug :off
218
+
42
219
  end
43
220
 
44
-
45
-
46
-
47
-
48
- # ----------------------------------- AMAZON EC2 COMMANDS --------
49
- # ------------------------------------------------------------------
50
-
51
- usage "rudy [global options] addresses [-A address instance ID]"
52
- desc "Manage Amazon Elastic IP addresses"
53
- argv :address, :instanceid
54
- action :A, :associate, "Associate an address to a running instance"
55
- command :addresses => Rudy::Command::Addresses
56
- command_alias :addresses, :address
57
-
58
-
59
- usage "rudy images [-C -i name [-b bucket -a account]] [-D AMI-ID]"
60
- desc "Manage EC2 Machine Images (AMIs)"
61
- option :a, :account, String, "Your Amazon Account Number"
62
- option :i, :image_name, String, "The name of the image"
63
- option :b, :bucket_name, String, "The name of the bucket that will store the image"
64
- action :C, :create, "Create an image"
65
- #action :P, :prepare, "Prepare a running instance to be used as an image"
66
- action :D, :destroy, "Deregister an image (currently _does not_ remove images files from S3)"
67
- argv :ami
68
- command :images => Rudy::Command::Images
69
- command_alias :images, :image
70
-
71
-
72
- desc "Manage EC2 Volumes"
73
- action :D, :destroy, "Destroy a volume"
74
- argv :vol
75
- command :volumes => Rudy::Command::Volumes
76
- command_alias :volumes, :volume
77
-
78
-
79
- usage "rudy [global options] instances [-D] [-S -i image ID] [instance ID OR group name]"
80
- desc "Manage EC2 Instances"
81
- option :all, "Display all instances"
82
- option :a, :address, String, "Amazon elastic IP"
83
- option :i, :image, String, "Amazon machine image ID (ami)"
84
- #option :v, :volume, String, "Amazon volume ID"
85
- action :D, :destroy, "Destroy the given instance IDs. All data will be lost!"
86
- #action :S, :start, "Start an instance"
87
- #action :R, :restart, "Restart an instance"
88
- argv :filter
89
- command :instances => Rudy::Command::Instances
90
- command_alias :instances, :instance
91
-
92
-
93
- usage "rudy [global options] groups [-C] [-a IP addresses] [-p ports] [group name]"
94
- desc "Manage EC2 Security Groups"
95
- option :all, "Display all security groups"
96
- option :r, :protocols, Array, "Comma-separated list of protocols. One of: tcp (default), udp, icmp"
97
- option :p, :ports, Array, "List of comma-separated ports to authorize (default: 22,80,443)"
98
- option :a, :addresses, Array, "List of comma-separated IP addresses to authorize (default: your external IP)"
99
- action :C, :create, "Create a security group"
100
- action :D, :destroy, "Destroy a security group"
101
- action :M, :modify, "Modify a security group"
102
- argv :group
103
- command :groups => Rudy::Command::Groups
104
- command_alias :groups, :group
105
-
106
-
221
+ #puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}") if Drydock.debug?
222
+
223
+ # We call Drydock specifically otherwise it will run at_exit. Rye also
224
+ # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
225
+ # blocks in reverse order so if Drydock is required first, it's block
226
+ # will run after Rye shuts down the ssh-agent.
227
+ begin
228
+ Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
229
+ rescue Drydock::ArgError, Drydock::OptError=> ex
230
+ STDERR.puts ex.message
231
+ STDERR.puts ex.usage
232
+ rescue Rudy::Error => ex
233
+ STDERR.puts ex.message
234
+ rescue => ex
235
+ STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
236
+ STDERR.puts ex.backtrace if Drydock.debug?
237
+ rescue SystemExit
238
+ # Don't balk
239
+ end
107
240
 
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # = Rudy S3
4
+ #
5
+ # === A Rudy interface to Amazon Simple Storage Service
6
+ #
7
+ #
8
+ #
9
+ # See rudy-s3 -h for usage
10
+ #
11
+
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
+ #require 'rubygems'
16
+
17
+ require 'rudy'
18
+ require 'rudy/cli'
19
+ require 'drydock'
20
+
21
+ # Command-line interface for bin/rudy-s3
22
+ module RudyCLI_S3
23
+ extend Drydock
24
+
25
+ # ------------------------------------ AMAZON S3 COMMANDS --------
26
+ # ------------------------------------------------------------------
27
+
28
+ desc "Amazon S3 Buckets"
29
+ usage "rudy-s3 buckets"
30
+ option :l, :list, "List bucket objects"
31
+ action :C, :create, "Create a bucket"
32
+ action :D, :destroy, "Destroy a bucket"
33
+ argv :name
34
+ command :buckets => Rudy::CLI::AWS::S3::Buckets
35
+ command_alias :buckets, :b
36
+
37
+ #desc "Amazon S3 Storage Interface"
38
+ #usage "rudy-s3 store file-path"
39
+ #option :b, :bucket, String, "Bucket name"
40
+ #argv :path
41
+ #command :store => Rudy::CLI::AWS::S3::Store
42
+ #command_alias :store, :s
43
+
44
+
45
+
46
+ # --------------------------------- RUDY-S3 MISCELLANEOUS --------
47
+ # ------------------------------------------------------------------
48
+
49
+ default :buckets
50
+ debug :off
51
+
52
+
53
+ end
54
+
55
+
56
+ #puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}") if Drydock.debug?
57
+
58
+ # We call Drydock specifically otherwise it will run at_exit. Rye also
59
+ # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
60
+ # blocks in reverse order so if Drydock is required first, it's block
61
+ # will run after Rye shuts down the ssh-agent.
62
+ begin
63
+ Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
64
+ rescue Drydock::ArgError, Drydock::OptError=> ex
65
+ STDERR.puts ex.message
66
+ STDERR.puts ex.usage
67
+ rescue Rudy::Error => ex
68
+ STDERR.puts ex.message
69
+ rescue => ex
70
+ STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
71
+ STDERR.puts ex.backtrace if Drydock.debug?
72
+ rescue SystemExit
73
+ # Don't balk
74
+ end
75
+
76
+
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # = Rudy SDB
4
+ #
5
+ # === A Rudy interface to Amazon Simple Storage Service
6
+ #
7
+ #
8
+ #
9
+ # See rudy-sdb -h for usage
10
+ #
11
+
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
+ #require 'rubygems'
16
+
17
+ require 'rudy'
18
+ require 'rudy/cli'
19
+ require 'drydock'
20
+
21
+ # Command-line interface for bin/rudy-sdb
22
+ module RudyCLI_SDB
23
+ extend Drydock
24
+
25
+ # ----------------------------------- AMAZON SDB COMMANDS --------
26
+ # ------------------------------------------------------------------
27
+
28
+
29
+ desc "Displays the SimpleDB domains associated to your account"
30
+ action :C, :create, "Create a domain"
31
+ action :D, :destroy, "Destroy a domain"
32
+ argv :name
33
+ command :domains => Rudy::CLI::AWS::SDB::Domains
34
+
35
+
36
+ # -------------------------------- RUDY-SDB MISCELLANEOUS --------
37
+ # ------------------------------------------------------------------
38
+
39
+ default :domains
40
+ debug :off
41
+
42
+
43
+ end
44
+
45
+
46
+ #puts Rudy::Utils.banner("THIS IS RUBY #{RUBY_VERSION}") if Drydock.debug?
47
+
48
+ # We call Drydock specifically otherwise it will run at_exit. Rye also
49
+ # uses at_exit for shutting down the ssh-agent. Ruby executes at_exit
50
+ # blocks in reverse order so if Drydock is required first, it's block
51
+ # will run after Rye shuts down the ssh-agent.
52
+ begin
53
+ Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
54
+ rescue Drydock::ArgError, Drydock::OptError=> ex
55
+ STDERR.puts ex.message
56
+ STDERR.puts ex.usage
57
+ rescue Rudy::Error => ex
58
+ STDERR.puts ex.message
59
+ rescue => ex
60
+ STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
61
+ STDERR.puts ex.backtrace if Drydock.debug?
62
+ rescue SystemExit
63
+ # Don't balk
64
+ end
65
+
66
+
67
+