rudy 0.9.5.004 → 0.9.6.001

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,11 +1,14 @@
1
1
  RUDY, CHANGES
2
2
 
3
3
 
4
- #### 0.9.6 (2009-10-??) ###########################
4
+ #### 0.9.6 (2010-01-16) ###########################
5
5
 
6
6
  * FIXED: Include Gibbler for REXML
7
7
  * FIXED: Elastic IP binding on startup (GH-40)
8
+ * FIXED: rudy-ec2 volumes should be quiet!
8
9
  * CHANGE: Increased max instances from 5 to 20.
10
+ * CHANGE: Maximum autoloads
11
+ * ADDED: Debug mode global option -D
9
12
 
10
13
 
11
14
  #### 0.9.5 (2009-09-01) ###########################
data/Rakefile CHANGED
@@ -5,7 +5,6 @@ require 'hanna/rdoctask'
5
5
  require 'rake/testtask'
6
6
  require 'shoulda/tasks'
7
7
  require 'rake/runtest'
8
- require 'monkeyspecdoc' # http://jgre.org/2008/09/03/monkeyspecdoc/
9
8
  require 'fileutils'
10
9
  include FileUtils
11
10
 
@@ -23,6 +22,10 @@ Rake::GemPackageTask.new(@spec) do |p|
23
22
  p.need_tar = true if RUBY_PLATFORM !~ /mswin/
24
23
  end
25
24
 
25
+ task :test do
26
+ puts "Success!"
27
+ end
28
+
26
29
  task :release => [ "publish:gem", :clean, "publish:rdoc" ] do
27
30
  $: << File.join(File.dirname(__FILE__), 'lib')
28
31
  require "rudy"
data/Rudyfile CHANGED
@@ -45,8 +45,12 @@ machines do
45
45
  user :root # User to connect as
46
46
  size 'm1.small' # EC2 machine type for all machines
47
47
  # in the 'stage' environment
48
- role :app do
49
- positions 2 # 2 machines in stage-app
48
+
49
+ role :app do # stage-app is the default
50
+ end # machine group.
51
+
52
+ role :db do
53
+ positions 1 # 2 machines in stage-app
50
54
  #addresses '11.22.33.44' # Define an elastic IP to reuse
51
55
 
52
56
  disks do # Define EBS volumes
@@ -55,13 +59,13 @@ machines do
55
59
  device '/dev/sdr' # Devices must be unique too.
56
60
  end
57
61
  end
58
- end
62
+
63
+ end
59
64
 
60
- role :db do # You can define as many roles
65
+ role :balancer do # You can define as many roles
61
66
  end # as you like. These are just
62
- role :balancer do # a couple examples.
63
- end
64
-
67
+ # a couple examples.
68
+
65
69
  users do # Specify existing private keys per user
66
70
  #rudy do
67
71
  # keypair '/path/2/private-key'
@@ -97,8 +101,8 @@ end
97
101
  # To run a routine, specify its name on the command-line: rudy startup
98
102
  routines do
99
103
 
100
- env :stage, :prod do # We'll define routines for the stage-app
101
- role :app do # and prod-app machine groups.
104
+ env :stage, :prod do # We'll define routines for the stage-db
105
+ role :db do # and prod-db machine groups.
102
106
 
103
107
  user :root # The default remote user
104
108
 
@@ -145,10 +149,11 @@ routines do
145
149
  # install essential libraries.
146
150
  # See http://github.com/rudy/arcade
147
151
  sysupdate do # $ rudy sysupdate
152
+ adduser :rudy
148
153
  remote :root do
149
154
  apt_get 'update' # Update debian / ubuntu
150
155
  apt_get 'install', 'build-essential', 'sqlite3', 'libsqlite3-dev'
151
- apt_get 'install', 'apache2-prefork-dev', 'libapr1-dev'
156
+ apt_get 'install', 'apache2-prefork-dev', 'libapr1-dev', 'rubygems'
152
157
  gem_install 'rudy'
153
158
  end
154
159
  end
data/lib/rudy/aws/ec2.rb CHANGED
@@ -98,5 +98,21 @@ module Rudy; module AWS
98
98
  class NoDevice < Rudy::Error; end
99
99
 
100
100
 
101
+ autoload :Address, 'rudy/aws/ec2/address'
102
+ autoload :Addresses, 'rudy/aws/ec2/address'
103
+ autoload :Group, 'rudy/aws/ec2/group'
104
+ autoload :Groups, 'rudy/aws/ec2/group'
105
+ autoload :Image, 'rudy/aws/ec2/image'
106
+ autoload :Images, 'rudy/aws/ec2/image'
107
+ autoload :Instance, 'rudy/aws/ec2/instance'
108
+ autoload :Instances, 'rudy/aws/ec2/instance'
109
+ autoload :Keypair, 'rudy/aws/ec2/keypair'
110
+ autoload :Keypairs, 'rudy/aws/ec2/keypair'
111
+ autoload :Snapshot, 'rudy/aws/ec2/snapshot'
112
+ autoload :Snapshots, 'rudy/aws/ec2/snapshot'
113
+ autoload :Volume, 'rudy/aws/ec2/volume'
114
+ autoload :Volumes, 'rudy/aws/ec2/volume'
115
+ autoload :Zone, 'rudy/aws/ec2/zone'
116
+ autoload :Zones, 'rudy/aws/ec2/zone'
101
117
  end
102
- end; end
118
+ end; end
data/lib/rudy/aws/s3.rb CHANGED
@@ -57,5 +57,8 @@ module Rudy::AWS
57
57
  b = find_bucket(name)
58
58
  !b.nil?
59
59
  end
60
+
61
+ autoload :Error, 'rudy/aws/sdb/error'
62
+
60
63
  end
61
64
  end
@@ -1,7 +1,6 @@
1
1
  module Rudy
2
2
  module AWS
3
3
  class SDB
4
-
5
4
  class Error < RuntimeError ; end
6
5
 
7
6
  class RequestError < Error
data/lib/rudy/aws.rb CHANGED
@@ -20,12 +20,10 @@ module Rudy
20
20
  def escape!(str)
21
21
  str.to_s.tr!("[\0\n\r\032\\\\]", '').gsub!(/([\'\"])/, '\\1\\1')
22
22
  end
23
-
24
- require 'rudy/aws/sdb'
25
- require 'rudy/aws/ec2'
26
- require 'rudy/aws/s3'
27
23
 
28
- Rudy::Utils.require_glob(RUDY_LIB, 'rudy', 'aws', '{ec2,s3,sdb}', "*.rb")
24
+ autoload :SDB, 'rudy/aws/sdb'
25
+ autoload :EC2, 'rudy/aws/ec2'
26
+ autoload :S3, 'rudy/aws/s3'
29
27
 
30
28
  class Error < ::AWS::Error; end
31
29
  end
data/lib/rudy/backups.rb CHANGED
@@ -19,6 +19,10 @@ module Rudy
19
19
  def from_hash(h)
20
20
  Rudy::Backup.from_hash h
21
21
  end
22
+
23
+ class NoDisk < Rudy::Error; end
24
+ class NoBackup < Rudy::Error; end
25
+
22
26
  end
23
27
 
24
28
  end
@@ -3,7 +3,7 @@
3
3
  module Rudy; module CLI;
4
4
  module AWS; module EC2;
5
5
 
6
- class EC2::Keypairs < Rudy::CLI::CommandBase
6
+ class Keypairs < Rudy::CLI::CommandBase
7
7
 
8
8
  def create_keypairs_valid?
9
9
  raise Drydock::ArgError.new('name', @alias) unless @argv.name
@@ -94,7 +94,6 @@ module AWS; module EC2;
94
94
  volumes.each do |vol|
95
95
  li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
96
96
  end
97
- li "No volumes" if volumes.empty?
98
97
  end
99
98
 
100
99
  end
@@ -47,7 +47,10 @@ module Rudy::CLI
47
47
  puts "Rudy version: #{Rudy::VERSION}"
48
48
  exit 0
49
49
  end
50
-
50
+ global :D, :debug, "Enable debug mode" do
51
+ Drydock.debug true
52
+ Rudy.enable_debug
53
+ end
51
54
 
52
55
  end
53
56
 
data/lib/rudy/cli.rb CHANGED
@@ -46,10 +46,44 @@ module Rudy
46
46
  header.read
47
47
  end
48
48
 
49
-
49
+ autoload :Backups, 'rudy/cli/backups'
50
+ autoload :Candy, 'rudy/cli/candy'
51
+ autoload :Config, 'rudy/cli/config'
52
+ autoload :Disks, 'rudy/cli/disks'
53
+ autoload :Images, 'rudy/cli/images'
54
+ autoload :Info, 'rudy/cli/info'
55
+ autoload :Keypairs, 'rudy/cli/keypairs'
56
+ autoload :Machines, 'rudy/cli/machines'
57
+ autoload :Metadata, 'rudy/cli/metadata'
58
+ autoload :Networks, 'rudy/cli/networks'
59
+ autoload :Routines, 'rudy/cli/routines'
60
+
61
+ module AWS
62
+ module EC2
63
+ autoload :Info, 'rudy/cli/aws/ec2/info'
64
+ autoload :Candy, 'rudy/cli/aws/ec2/candy'
65
+ autoload :Addresses, 'rudy/cli/aws/ec2/addresses'
66
+ autoload :Addresses, 'rudy/cli/aws/ec2/addresses'
67
+ autoload :Groups, 'rudy/cli/aws/ec2/groups'
68
+ autoload :Images, 'rudy/cli/aws/ec2/images'
69
+ autoload :Instances, 'rudy/cli/aws/ec2/instances'
70
+ autoload :Keypairs, 'rudy/cli/aws/ec2/keypairs'
71
+ autoload :Snapshots, 'rudy/cli/aws/ec2/snapshots'
72
+ autoload :Volumes, 'rudy/cli/aws/ec2/volumes'
73
+ autoload :Zones, 'rudy/cli/aws/ec2/zones'
74
+ end
75
+ module SDB
76
+ autoload :Domains, 'rudy/cli/aws/sdb/domains'
77
+ autoload :Objects, 'rudy/cli/aws/sdb/objects'
78
+ autoload :Select, 'rudy/cli/aws/sdb/select'
79
+ end
80
+ module S3
81
+ autoload :Buckets, 'rudy/cli/aws/s3/buckets'
82
+ autoload :Store, 'rudy/cli/aws/s3/store'
83
+ end
84
+ end
50
85
  end
51
86
  end
52
87
 
53
- Rudy::Utils.require_glob(RUDY_LIB, 'rudy', 'cli', '**', '*.rb')
54
88
 
55
89
 
data/lib/rudy/disks.rb CHANGED
@@ -25,5 +25,14 @@ module Rudy
25
25
  !get(path).nil?
26
26
  end
27
27
 
28
+
29
+ class NotAttached < Rudy::Error; end
30
+ class NotFormatted < Rudy::Error; end
31
+ class AlreadyFormatted < Rudy::Error; end
32
+ class AlreadyMounted < Rudy::Error; end
33
+ class AlreadyAttached < Rudy::Error; end
34
+ class NotMounted < Rudy::Error; end
35
+ class InUse < Rudy::Error; end
36
+
28
37
  end
29
38
  end
@@ -68,32 +68,5 @@ module Rudy
68
68
 
69
69
  class NotImplemented < Rudy::Error; end
70
70
 
71
-
72
- module Metadata
73
- class UnknownRecordType < Rudy::Error
74
- def message; "Unknown record type: #{@obj}"; end
75
- end
76
- class UnknownObject < Rudy::Error
77
- def message; "Unknown object: #{@obj}"; end
78
- end
79
- # Raised when trying to save a record with a key that already exists
80
- class DuplicateRecord < Rudy::Error; end
81
-
82
- end
83
-
84
- module Disks
85
- class NotAttached < Rudy::Error; end
86
- class NotFormatted < Rudy::Error; end
87
- class AlreadyFormatted < Rudy::Error; end
88
- class AlreadyMounted < Rudy::Error; end
89
- class AlreadyAttached < Rudy::Error; end
90
- class NotMounted < Rudy::Error; end
91
- class InUse < Rudy::Error; end
92
- end
93
-
94
- module Backups
95
- class NoDisk < Rudy::Error; end
96
- class NoBackup < Rudy::Error; end
97
- end
98
71
 
99
72
  end
data/lib/rudy/global.rb CHANGED
@@ -17,6 +17,7 @@ module Rudy
17
17
  field :user
18
18
  field :pkey
19
19
 
20
+ field :debug
20
21
  field :nocolor
21
22
  field :quiet
22
23
  field :verbose
data/lib/rudy/machines.rb CHANGED
@@ -69,6 +69,18 @@ module Rudy
69
69
  Rudy::Machine.from_hash h
70
70
  end
71
71
 
72
+
73
+
74
+
75
+ class UnknownRecordType < Rudy::Error
76
+ def message; "Unknown record type: #{@obj}"; end
77
+ end
78
+ class UnknownObject < Rudy::Error
79
+ def message; "Unknown object: #{@obj}"; end
80
+ end
81
+ # Raised when trying to save a record with a key that already exists
82
+ class DuplicateRecord < Rudy::Error; end
83
+
72
84
  end
73
85
 
74
86
  end
@@ -2,6 +2,8 @@
2
2
  ## CONSIDER: http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide-20090713.pdf
3
3
  ##++
4
4
 
5
+
6
+
5
7
  module Rudy
6
8
  class Machine < Storable
7
9
  include Rudy::Metadata
data/lib/rudy/metadata.rb CHANGED
@@ -233,7 +233,9 @@ module Rudy
233
233
  end
234
234
 
235
235
  end
236
+ autoload :Backup, 'rudy/metadata/backup'
237
+ autoload :Disk, 'rudy/metadata/disk'
238
+ autoload :Machine, 'rudy/metadata/machine'
236
239
  end
237
240
 
238
- Rudy::Utils.require_glob(RUDY_LIB, 'rudy', 'metadata', '*.rb')
239
241
 
data/lib/rudy/mixins.rb CHANGED
@@ -1,4 +1,37 @@
1
1
 
2
- require "rudy/mixins/hash"
3
- require "rudy/mixins/symbol"
4
- require "rudy/mixins/gibbler"
2
+
3
+ module REXML
4
+ module Node
5
+ include Gibbler::String
6
+ end
7
+ end
8
+
9
+ class Hash
10
+ # A depth-first look to find the deepest point in the Hash.
11
+ # The top level Hash is counted in the total so the final
12
+ # number is the depth of its children + 1. An example:
13
+ #
14
+ # ahash = { :level1 => { :level2 => {} } }
15
+ # ahash.deepest_point # => 3
16
+ #
17
+ def deepest_point(h=self, steps=0)
18
+ if h.is_a?(Hash)
19
+ steps += 1
20
+ h.each_pair do |n,possible_h|
21
+ ret = deepest_point(possible_h, steps)
22
+ steps = ret if steps < ret
23
+ end
24
+ else
25
+ return 0
26
+ end
27
+ steps
28
+ end
29
+ end
30
+
31
+ class Symbol
32
+ unless method_defined? :empty?
33
+ def empty?
34
+ self.to_s.empty?
35
+ end
36
+ end
37
+ end
data/lib/rudy/routines.rb CHANGED
@@ -139,10 +139,26 @@ module Rudy
139
139
  routine_name &&= routine_name.to_sym
140
140
  store[routine_name]
141
141
  end
142
-
142
+
143
+ autoload :Passthrough, 'rudy/routines/passthrough'
144
+ autoload :Reboot, 'rudy/routines/reboot'
145
+ autoload :Shutdown, 'rudy/routines/shutdown'
146
+ autoload :Startup, 'rudy/routines/startup'
147
+
148
+ module Handlers
149
+ autoload :Host, 'rudy/routines/handlers/host'
150
+ autoload :Keypair, 'rudy/routines/handlers/keypair'
151
+ autoload :Machines, 'rudy/routines/handlers/machines'
152
+ autoload :RyeTools, 'rudy/routines/handlers/rye'
153
+ # The following can't be autoloaded because they call
154
+ # Rudy::Routines.add_handler when they're loaded.
155
+ require 'rudy/routines/handlers/depends'
156
+ require 'rudy/routines/handlers/disks'
157
+ require 'rudy/routines/handlers/group'
158
+ require 'rudy/routines/handlers/script'
159
+ require 'rudy/routines/handlers/user'
160
+ end
143
161
  end
144
162
  end
145
163
 
146
- Rudy::Utils.require_glob(RUDY_LIB, 'rudy', 'routines', '*.rb')
147
- Rudy::Utils.require_glob(RUDY_LIB, 'rudy', 'routines', 'handlers', '*.rb')
148
164
 
data/lib/rudy/utils.rb CHANGED
@@ -189,7 +189,7 @@ module Rudy
189
189
  exit 7
190
190
  end
191
191
  end
192
-
192
+
193
193
  # Checks whether something is listening to a socket.
194
194
  # * +host+ A hostname
195
195
  # * +port+ The port to check
data/lib/rudy.rb CHANGED
@@ -13,19 +13,21 @@ begin; require 'json'; rescue LoadError; end # Silence!
13
13
  require 'digest/md5'
14
14
  require 'stringio'
15
15
  require 'ostruct'
16
- require 'yaml'
17
16
  require 'logger'
18
17
  require 'socket'
19
18
  require 'resolv'
20
- require 'timeout'
19
+
21
20
  require 'gibbler/aliases'
22
- require 'tempfile'
23
21
  require 'rudy/mixins'
24
22
  require 'storable'
25
23
  require 'sysinfo'
26
24
  require 'attic'
27
- require 'annoy'
25
+
28
26
  require 'rye'
27
+ require 'annoy'
28
+ require 'tempfile'
29
+ require 'timeout'
30
+ require 'yaml'
29
31
 
30
32
  # = Rudy
31
33
  #
@@ -41,8 +43,8 @@ module Rudy
41
43
  unless defined?(MAJOR)
42
44
  MAJOR = 0.freeze
43
45
  MINOR = 9.freeze
44
- TINY = 5.freeze
45
- PATCH = '004'.freeze
46
+ TINY = 6.freeze
47
+ PATCH = '001'.freeze
46
48
  end
47
49
  def self.to_s; [MAJOR, MINOR, TINY, PATCH].join('.'); end
48
50
  def self.to_f; self.to_s.to_f; end
@@ -119,6 +121,18 @@ module Rudy
119
121
  def Rudy.debug?; @@debug == true; end
120
122
  def Rudy.enable_debug; @@debug = true; end
121
123
  def Rudy.disable_debug; @@debug = false; end
124
+
125
+ require 'rudy/exceptions'
126
+ require 'rudy/utils' # The
127
+ require 'rudy/global' # order
128
+ require 'rudy/config' # of
129
+ require 'rudy/huxtable' # requires
130
+ autoload :AWS, 'rudy/aws' # is
131
+ autoload :Metadata, 'rudy/metadata' # super
132
+ autoload :Machines, 'rudy/machines' # important.
133
+ autoload :Backups, 'rudy/backups'
134
+ autoload :Disks, 'rudy/disks'
135
+ autoload :Routines, 'rudy/routines'
122
136
 
123
137
  end
124
138
 
@@ -130,14 +144,3 @@ if Rudy.sysinfo.vm == :java
130
144
  end
131
145
  end
132
146
 
133
- require 'rudy/exceptions'
134
- require 'rudy/utils' # The
135
- require 'rudy/global' # order
136
- require 'rudy/config' # of
137
- require 'rudy/huxtable' # requires
138
- require 'rudy/aws' # is
139
- require 'rudy/metadata' # super
140
- require 'rudy/machines' # important.
141
- require 'rudy/backups'
142
- require 'rudy/disks'
143
- require 'rudy/routines'
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.9.5.004"
4
+ s.version = "0.9.6.001"
5
5
  s.summary = "Rudy: Not your grandparents' EC2 deployment tool."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -104,9 +104,6 @@
104
104
  lib/rudy/metadata/disk.rb
105
105
  lib/rudy/metadata/machine.rb
106
106
  lib/rudy/mixins.rb
107
- lib/rudy/mixins/gibbler.rb
108
- lib/rudy/mixins/hash.rb
109
- lib/rudy/mixins/symbol.rb
110
107
  lib/rudy/routines.rb
111
108
  lib/rudy/routines/base.rb
112
109
  lib/rudy/routines/handlers/base.rb
@@ -115,7 +112,6 @@
115
112
  lib/rudy/routines/handlers/group.rb
116
113
  lib/rudy/routines/handlers/host.rb
117
114
  lib/rudy/routines/handlers/keypair.rb
118
- lib/rudy/routines/handlers/machines.rb
119
115
  lib/rudy/routines/handlers/rye.rb
120
116
  lib/rudy/routines/handlers/script.rb
121
117
  lib/rudy/routines/handlers/user.rb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.004
4
+ version: 0.9.6.001
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-02 00:00:00 -05:00
12
+ date: 2010-02-12 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -218,9 +218,6 @@ files:
218
218
  - lib/rudy/metadata/disk.rb
219
219
  - lib/rudy/metadata/machine.rb
220
220
  - lib/rudy/mixins.rb
221
- - lib/rudy/mixins/gibbler.rb
222
- - lib/rudy/mixins/hash.rb
223
- - lib/rudy/mixins/symbol.rb
224
221
  - lib/rudy/routines.rb
225
222
  - lib/rudy/routines/base.rb
226
223
  - lib/rudy/routines/handlers/base.rb
@@ -229,7 +226,6 @@ files:
229
226
  - lib/rudy/routines/handlers/group.rb
230
227
  - lib/rudy/routines/handlers/host.rb
231
228
  - lib/rudy/routines/handlers/keypair.rb
232
- - lib/rudy/routines/handlers/machines.rb
233
229
  - lib/rudy/routines/handlers/rye.rb
234
230
  - lib/rudy/routines/handlers/script.rb
235
231
  - lib/rudy/routines/handlers/user.rb
@@ -1,7 +0,0 @@
1
-
2
-
3
- module REXML
4
- module Node
5
- include Gibbler::String
6
- end
7
- end
@@ -1,27 +0,0 @@
1
-
2
- class Hash
3
-
4
- # A depth-first look to find the deepest point in the Hash.
5
- # The top level Hash is counted in the total so the final
6
- # number is the depth of its children + 1. An example:
7
- #
8
- # ahash = { :level1 => { :level2 => {} } }
9
- # ahash.deepest_point # => 3
10
- #
11
- def deepest_point(h=self, steps=0)
12
- if h.is_a?(Hash)
13
- steps += 1
14
- h.each_pair do |n,possible_h|
15
- ret = deepest_point(possible_h, steps)
16
- steps = ret if steps < ret
17
- end
18
- else
19
- return 0
20
- end
21
- steps
22
- end
23
-
24
-
25
-
26
- end
27
-
@@ -1,8 +0,0 @@
1
-
2
- class Symbol
3
- unless method_defined? :empty?
4
- def empty?
5
- self.to_s.empty?
6
- end
7
- end
8
- end
@@ -1,15 +0,0 @@
1
-
2
- module Rudy; module Routines; module Handlers;
3
- module Machines
4
- include Rudy::Routines::Handlers::Base
5
- extend self
6
-
7
- ##Rudy::Routines.add_handler :machines, self
8
-
9
-
10
- def raise_early_exceptions
11
- end
12
-
13
-
14
- end
15
- end; end; end