the-maestro 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.document +5 -0
  2. data/.gitignore +25 -0
  3. data/LICENSE +23 -0
  4. data/README.rdoc +378 -0
  5. data/Rakefile +116 -0
  6. data/VERSION +1 -0
  7. data/lib/maestro.rb +354 -0
  8. data/lib/maestro/cloud.rb +384 -0
  9. data/lib/maestro/cloud/aws.rb +1231 -0
  10. data/lib/maestro/dsl_property.rb +15 -0
  11. data/lib/maestro/log4r/console_formatter.rb +18 -0
  12. data/lib/maestro/log4r/file_formatter.rb +24 -0
  13. data/lib/maestro/node.rb +123 -0
  14. data/lib/maestro/operating_system.rb +53 -0
  15. data/lib/maestro/operating_system/cent_os.rb +23 -0
  16. data/lib/maestro/operating_system/debian.rb +40 -0
  17. data/lib/maestro/operating_system/fedora.rb +23 -0
  18. data/lib/maestro/operating_system/ubuntu.rb +100 -0
  19. data/lib/maestro/role.rb +36 -0
  20. data/lib/maestro/tasks.rb +52 -0
  21. data/lib/maestro/validator.rb +32 -0
  22. data/rails/init.rb +1 -0
  23. data/test/integration/base_aws.rb +156 -0
  24. data/test/integration/fixtures/config/maestro/cookbooks/emacs/metadata.json +41 -0
  25. data/test/integration/fixtures/config/maestro/cookbooks/emacs/metadata.rb +3 -0
  26. data/test/integration/fixtures/config/maestro/cookbooks/emacs/recipes/default.rb +21 -0
  27. data/test/integration/fixtures/config/maestro/roles/default.json +9 -0
  28. data/test/integration/fixtures/config/maestro/roles/web.json +9 -0
  29. data/test/integration/helper.rb +8 -0
  30. data/test/integration/test_aws_cloud.rb +805 -0
  31. data/test/integration/test_cent_os.rb +104 -0
  32. data/test/integration/test_debian.rb +119 -0
  33. data/test/integration/test_fedora.rb +104 -0
  34. data/test/integration/test_ubuntu.rb +149 -0
  35. data/test/unit/fixtures/invalid-clouds-not-a-directory/config/maestro/clouds +1 -0
  36. data/test/unit/fixtures/invalid-cookbooks-not-a-directory/config/maestro/cookbooks +0 -0
  37. data/test/unit/fixtures/invalid-maestro-not-a-directory/config/maestro +0 -0
  38. data/test/unit/fixtures/invalid-missing-cookbooks/config/maestro/clouds/valid.yml +21 -0
  39. data/test/unit/fixtures/invalid-missing-roles/config/maestro/clouds/valid.yml +21 -0
  40. data/test/unit/fixtures/invalid-roles-not-a-directory/config/maestro/roles +1 -0
  41. data/test/unit/fixtures/ssh/id_rsa-maestro-test-keypair +27 -0
  42. data/test/unit/helper.rb +6 -0
  43. data/test/unit/test_aws_cloud.rb +133 -0
  44. data/test/unit/test_aws_ec2_node.rb +76 -0
  45. data/test/unit/test_aws_elb_node.rb +221 -0
  46. data/test/unit/test_aws_rds_node.rb +380 -0
  47. data/test/unit/test_cent_os.rb +28 -0
  48. data/test/unit/test_cloud.rb +142 -0
  49. data/test/unit/test_debian.rb +62 -0
  50. data/test/unit/test_fedora.rb +28 -0
  51. data/test/unit/test_invalid_mode.rb +11 -0
  52. data/test/unit/test_maestro.rb +140 -0
  53. data/test/unit/test_node.rb +50 -0
  54. data/test/unit/test_operating_system.rb +19 -0
  55. data/test/unit/test_rails_mode.rb +77 -0
  56. data/test/unit/test_role.rb +59 -0
  57. data/test/unit/test_standalone_mode.rb +75 -0
  58. data/test/unit/test_ubuntu.rb +95 -0
  59. data/the-maestro.gemspec +150 -0
  60. metadata +228 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## RadRails
17
+ .project
18
+
19
+ ## PROJECT::GENERAL
20
+ coverage
21
+ rdoc
22
+ pkg
23
+
24
+ ## PROJECT::SPECIFIC
25
+ .loadpath
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2010 Brian Ploetz <bploetz@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
data/README.rdoc ADDED
@@ -0,0 +1,378 @@
1
+ <b>Maestro: Conduct your clouds</b>
2
+
3
+ Maestro is a cloud provisioning, configuration, and deployment utility for your Ruby and Ruby On Rails applications.
4
+ Simply declare the structure of your clouds via configuration files, create {Chef}[http://wiki.opscode.com/display/chef/Home]
5
+ recipes to configure the nodes in your clouds, and Maestro takes care of the rest.
6
+
7
+ Maestro currently supports the Amazon Web Services cloud. Support for other cloud providers is on the roadmap.
8
+
9
+ Maestro currently supports the following Linux distributions:
10
+
11
+ Ubuntu (9.10, 9.04, 8.10, 8.04)
12
+ Debian (6.0, 5.0)
13
+ Fedora (8)
14
+ CentOS (5.4)
15
+
16
+
17
+ == Using Maestro with Ruby On Rails
18
+
19
+ === Installation
20
+
21
+ Add the following gem dependency to your Rails project's <code>config/environment.rb</code> file:
22
+
23
+ Rails::Initializer.run do |config|
24
+
25
+ config.gem "the-maestro", :version => '0.2.0'
26
+
27
+ end
28
+
29
+ You'll interact with Maestro through custom Rake tasks that Maestro adds to your Rails project. Until {this}[https://rails.lighthouseapp.com/projects/8994/tickets/59] Rails issue is resolved, you'll need to add this to your Rails project's Rakefile:
30
+
31
+ require 'maestro/tasks'
32
+
33
+ === Configuration
34
+
35
+ To create the Maestro configuration directory structure, run the following Rake task:
36
+
37
+ rake maestro:create_config_dirs
38
+
39
+ This will create the following directory structure within your Rails project's config/ directory:
40
+
41
+ YOUR_RAILS_APP/config/maestro/clouds/ - the directory which contains your cloud configuration files
42
+ YOUR_RAILS_APP/config/maestro/cookbooks/ - the directory which contains your Chef cookbooks
43
+ YOUR_RAILS_APP/config/maestro/roles/ - the directory which contains your Chef JSON Roles files
44
+
45
+ If these directories already exist when running <code>rake maestro:create_config_dirs</code>, no action is taken.
46
+
47
+
48
+ ==== Declare your clouds
49
+
50
+ To declare a cloud, simply create a configuration file within your Rails project's <code>YOUR_RAILS_APP/config/maestro/clouds/</code> directory with the same name as your cloud.
51
+ For example, to create "dev", "staging", and "production" clouds, your <code>YOUR_RAILS_APP/config/maestro/clouds/</code> directory would contain the following files:
52
+
53
+ YOUR_RAILS_APP/config/maestro/clouds/dev.rb
54
+ YOUR_RAILS_APP/config/maestro/clouds/staging.rb
55
+ YOUR_RAILS_APP/config/maestro/clouds/production.rb
56
+
57
+ A cloud configuration file is a Ruby file containing a simple DSL for describing the structure of a cloud for a given cloud provider. Currently the Amazon Web Services cloud is the only supported provider.
58
+
59
+
60
+ ==== Amazon Web Services Cloud pre-requisites
61
+
62
+ To use the Amazon Web Services cloud provider, the following are minimally required:
63
+
64
+ - An Amazon Web Services Account
65
+ - EC2 enabled in your account
66
+ - S3 enabled in your account
67
+ - AWS Account ID
68
+ - AWS Access Key
69
+ - AWS Secret Access Key
70
+ - AWS Keypair name and keypair file stored locally
71
+
72
+ You may optionally utilize all other features of the Amazon Web Services cloud infrastructure, such as ELB, RDS, etc, assuming
73
+ that these capabilities are enabled in your Amazon Web Services account. See the Amazon Web Services documentation for more information.
74
+
75
+ ==== Anatomy of an Amazon Web Services cloud configuration file
76
+
77
+
78
+ aws_cloud :dev do
79
+
80
+ keypair_name "XXXXXXX-keypair"
81
+ keypair_file "/path/to/id_rsa-XXXXXXX-keypair"
82
+ aws_account_id "XXXX-XXXX-XXXX"
83
+ aws_access_key "XXXXXXXXXXXXXXXXXXXX"
84
+ aws_secret_access_key "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
85
+ chef_bucket "maestro.yourdomain.com"
86
+
87
+ roles do
88
+ role "web" do
89
+ public_ports [80, 443]
90
+ end
91
+ end
92
+
93
+ nodes do
94
+ ec2_node "web-1" do
95
+ roles ["web"]
96
+ ami "ami-bb709dd2"
97
+ ssh_user "ubuntu"
98
+ instance_type "m1.small"
99
+ availability_zone "us-east-1b"
100
+ end
101
+
102
+ ...etc...
103
+ end
104
+ end
105
+
106
+
107
+ Let's look at each of these sections in more detail:
108
+
109
+ ===== aws_cloud <i>cloud_name</i> do
110
+
111
+ The aws_cloud method declares an Amazon Web Services cloud with the given name. The cloud name can be either a symbol or a string.
112
+
113
+ aws_cloud :dev do
114
+
115
+ aws_cloud "dev" do
116
+
117
+ A cloud name may only contain alphanumerics and dashes.
118
+
119
+ ===== AWS cloud attributes
120
+
121
+ The following attributes must be present after your aws_cloud declaration:
122
+
123
+ - <b>keypair_name</b>: A keypair associated with your Amazon Web Services account
124
+ - <b>keypair_file</b>: Fully qualified path to the keypair file on your computer matching the above keypair_name
125
+ - <b>aws_account_id</b>: Your Amazon Web Services Account ID
126
+ - <b>aws_access_key</b>: Your Amazon Web Services Access Key
127
+ - <b>aws_secret_access_key</b>: Your Amazon Web Services Secret Access Key
128
+ - <b>chef_bucket</b>: The name of the Amazon S3 Bucket where you want your Chef recipes and roles stored. If this Bucket does not exist, Maestro will create it for you. Please note that the Bucket itself, and all objects stored within the Bucket use the canned 'private' access policy, meaning no one but the Bucket owner (i.e. you) may access the Bucket or the objects within it. Maestro uses query string authentication when accessing the objects to ensure the integrity of your data.
129
+
130
+
131
+ ===== roles do
132
+ The <code>roles</code> method allows you to apply configuration to all of the nodes in your cloud which are in a given role, rather than repeating that configuration for all nodes individually.
133
+
134
+ ===== role <i>role_name</i> do
135
+ A role corresponds to a Chef role that the configurable nodes in your Cloud can play. A role name may either be a symbol or a string.
136
+
137
+ role "web" do
138
+ public_ports [80, 443]
139
+ end
140
+
141
+ A role name may only contain alphanumerics and dashes.
142
+
143
+ ===== role attributes
144
+
145
+ A role may configure the following attributes:
146
+
147
+ - <b>public_ports</b>: The ports that should be open to the public internet, for example ports 80 and 443 for a web role. The value of this attribute must be an array of integers.
148
+
149
+
150
+ ===== nodes do
151
+ The <code>nodes</code> method is where you define the nodes (servers, machine, VMs, devices, etc…) in your cloud.
152
+
153
+ ===== AWS Node types
154
+
155
+ The following are the AWS node types supported by Maestro:
156
+
157
+ <b><code>ec2_node <i>node-name</i> do</code></b>
158
+
159
+ Creates an Elastic Cloud Compute (EC2) node. An EC2 node name may only contain alphanumerics and dashes.
160
+
161
+ The following attributes must be present:
162
+
163
+ - <b>roles</b>: An array of Chef roles to apply to this node. The role names in the array must match the Chef roles that are defined in config/maestro/roles.
164
+ - <b>ami</b>: The AMI identifier to use.
165
+ - <b>ssh_user</b>: The name of the user to use to ssh to the instance.
166
+ - <b>instance_type</b>: The instance type to use for this EC2 node.
167
+ - <b>availability_zone</b>: The availability zone to launch the instance in.
168
+
169
+ The following attributes are optional:
170
+
171
+ - <b>elastic_ip</b>: The Elastic IP address to associate with this node.
172
+ - <b>ebs_volume_id</b>: The id of the EBS Volume to attach to this node.
173
+ - <b>ebs_device</b>: The device to attach the EBS Volume to.
174
+
175
+ An example ec2_node:
176
+
177
+ ec2_node "node-1" do
178
+ roles ["role-1"]
179
+ ami "ami-bb709dd2"
180
+ ssh_user "ubuntu"
181
+ instance_type "m1.small"
182
+ availability_zone "us-east-1b"
183
+ elastic_ip "123.45.678.90"
184
+ ebs_volume_id "vol-xxxxxxxx"
185
+ ebs_device "/dev/sdh"
186
+ end
187
+
188
+
189
+ <b><code>elb_node <i>node-name</i> do</code></b>
190
+
191
+ Creates an Elastic Load Balancer (ELB) node. An ELB node name may only contain alphanumerics and dashes.
192
+
193
+ The following attributes must be present:
194
+
195
+ - <b>availability_zones</b>: An array of availability zone names this ELB node will operate in.
196
+ - <b>listeners</b>: An array of hashes configuring the ELB listeners.
197
+ - <b>ec2_nodes</b>: An array of EC2 node names that this ELB fronts.
198
+ - <b>health_check</b>: A hash configuring the health check of this ELB.
199
+
200
+ An example elb_node:
201
+
202
+ elb_node "lb-1" do
203
+ availability_zones ["us-east-1b"]
204
+ listeners [{:load_balancer_port => 80, :instance_port => 80, :protocol => "http"}]
205
+ ec2_nodes ["app-1", "app-2"]
206
+ health_check(:target => "TCP:80", :timeout => 15, :interval => 60, :unhealthy_threshold => 5, :healthy_threshold => 3)
207
+ end
208
+
209
+
210
+ <b><code>rds_node <i>node-name</i> do</code></b>
211
+
212
+ Creates a Relational Database Service (RDS) node. An RDS node name may only contain alphanumerics and dashes.
213
+
214
+ The following attributes must be present:
215
+
216
+ - <b>engine</b>: The name of the database engine to use.
217
+ - <b>db_instance_class</b>: The instance class to use.
218
+ - <b>master_username</b>: The master user's username.
219
+ - <b>master_user_password</b>: The master user's password.
220
+ - <b>port</b>: The port this RDS node should listen on.
221
+ - <b>allocated_storage</b>: The storage to allocate (in GB).
222
+ - <b>availability_zone</b>: The availability zone to launch this RDS node in.
223
+ - <b>preferred_maintenance_window</b>: The preferred 4 hour window in which to run maintenance.
224
+ - <b>preferred_backup_window</b>: The preferred 2 hour window in which backups should run.
225
+ - <b>backup_retention_period</b>: The number of days to retain backups.
226
+
227
+ The following attributes are optional:
228
+
229
+ - <b>db_parameters</b>: An array of hashes containing "name" and "value" keys representing database parameters.
230
+
231
+ An example rds_node:
232
+
233
+ rds_node "db-2" do
234
+ engine "MySQL5.1"
235
+ db_instance_class "db.m1.small"
236
+ master_username "root"
237
+ master_user_password "password"
238
+ port 3306
239
+ allocated_storage 5
240
+ availability_zone "us-east-1b"
241
+ preferred_maintenance_window "Sun:03:00-Sun:07:00"
242
+ preferred_backup_window "03:00-05:00"
243
+ backup_retention_period 7
244
+ db_parameters [{:name => "character_set_server", :value => "utf8"},
245
+ {:name => "collation_server", :value => "utf8_bin"},
246
+ {:name => "long_query_time", :value => "5"}]
247
+ end
248
+
249
+
250
+ ===== A note about node definitions
251
+
252
+ If your cloud has a large number of nodes which are identical other than their name, defining each node individually with a node method would be tedious.
253
+ Don't forget that your cloud definition files are Ruby, which allows you to do things like the following:
254
+
255
+ nodes do
256
+ 10.times do |i|
257
+ ec2_node "web-#{i+1}" do
258
+ .......
259
+ end
260
+ end
261
+ end
262
+
263
+ This will create 10 different ec2_nodes, each with a distinct name ("web-1" through "web-10").
264
+
265
+
266
+ ==== Validate your configuration
267
+
268
+ At any time, you may run the following Rake task to validate your Maestro configurations:
269
+
270
+ rake maestro:validate_configs
271
+
272
+ This will validate all of the files in your Maestro config directory
273
+
274
+ === Conduct
275
+
276
+ Maestro creates Rake tasks for all of your valid clouds. These tasks allow you to provision, configure, and deploy to your cloud.
277
+ A very simplistic workflow:
278
+
279
+ rake maestro:validate_configs
280
+
281
+ rake maestro:mycloud:status
282
+ rake maestro:mycloud:start
283
+ rake maestro:mycloud:configure
284
+ rake maestro:mycloud:shutdown
285
+
286
+ If you do not see a maestro:<i>cloud-name</i>:... set of tasks for a named cloud when running rake -T, your cloud configuration file is not valid. Simply run...
287
+
288
+ rake maestro:validate_configs
289
+
290
+ ...and you will be given a report as to what is wrong with the given cloud configuration file.
291
+
292
+ To see all available rake commands for all of your clouds:
293
+
294
+ rake -T | grep maestro
295
+
296
+ === Configuring the nodes in your cloud
297
+
298
+ Maestro uses the {Chef}[http://wiki.opscode.com/display/chef/Home] framework to configure the nodes in your cloud. Any roles defined in your
299
+ ec2_nodes must map to Chef Roles with the same name. These Chef Roles are stored as JSON files within <code>YOUR_RAILS_APP/config/maestro/roles/</code>.
300
+ When you run <code>rake maestro:mycloud:configure</code>, Maestro will apply the recipes defined in the Role JSON files on all nodes in that role.
301
+ Your recipes should be placed in <code>YOUR_RAILS_APP/config/maestro/cookbooks</code>.
302
+
303
+ For a more in depth explanation of Chef, please consult {the Chef documentation}[http://wiki.opscode.com/display/chef/Home].
304
+
305
+ == Using Maestro with a stand alone Ruby application
306
+
307
+ sudo gem install the-maestro
308
+
309
+ TODO...
310
+
311
+
312
+ == Contributing
313
+ Please use the {Issues}[http://github.com/bploetz/maestro/issues] page on the Maestro GitHub site to report bugs or feature requests.
314
+
315
+ To contribute fixes for Issues, please create a topic branch off of the appropriate branch and send a pull request indicating which Issue the commit is for.
316
+ All bug fixes must have a corresponding unit and/or integration test (depending on the nature of the Issue) in order to be accepted.
317
+
318
+ To run the unit tests:
319
+
320
+ rake test:units
321
+
322
+ To run all integration tests:
323
+
324
+ rake test:integration
325
+
326
+ To run just the AWS integration tests (please see <code>test/integration/base_aws.rb</code> for instructions on how to supply your AWS credentials to run the tests):
327
+
328
+ rake test:integration:aws
329
+
330
+ Due to the nature of the AWS integration tests, they take quite a long time to run (well over an hour), so you may want to grab a beer or 3 to pass the time.
331
+
332
+ To run just the operating system integration tests:
333
+
334
+ rake test:integration:centos
335
+ rake test:integration:debian
336
+ rake test:integration:fedora
337
+ rake test:integration:ubuntu
338
+
339
+ Be mindful of the code coverage metrics. We try to maintain a > 85% coverage percentage, and any pull requests should not result in a lower percentage unless for a very good reason.
340
+
341
+ To run RCov:
342
+
343
+ rake rcov
344
+
345
+ To install the gem locally:
346
+
347
+ rake install
348
+
349
+ To generate RDoc locally:
350
+
351
+ rake rdoc
352
+
353
+
354
+ == License
355
+
356
+ (The MIT License)
357
+
358
+ Copyright (c) 2010 Brian Ploetz <bploetz@gmail.com>
359
+
360
+ Permission is hereby granted, free of charge, to any person
361
+ obtaining a copy of this software and associated documentation
362
+ files (the "Software"), to deal in the Software without
363
+ restriction, including without limitation the rights to use,
364
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
365
+ copies of the Software, and to permit persons to whom the
366
+ Software is furnished to do so, subject to the following
367
+ conditions:
368
+
369
+ The above copyright notice and this permission notice shall be
370
+ included in all copies or substantial portions of the Software.
371
+
372
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
373
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
374
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
375
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
376
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
377
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
378
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
data/Rakefile ADDED
@@ -0,0 +1,116 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "the-maestro"
8
+ gem.summary = %Q{Maestro: Conduct your clouds.}
9
+ gem.description = %Q{Maestro is a cloud provisioning, configuration, and deployment utility for your Ruby and Ruby On Rails applications.}
10
+ gem.homepage = "http://github.com/bploetz/maestro"
11
+ gem.authors = ["Brian Ploetz"]
12
+ gem.add_development_dependency "thoughtbot-shoulda", "= 2.10.2"
13
+ gem.add_dependency "net-ssh", "= 2.0.15"
14
+ gem.add_dependency "net-scp", "= 1.0.2"
15
+ gem.add_dependency "net-ssh-multi", "= 1.0.1"
16
+ gem.add_dependency "net-ssh-gateway", "= 1.0.1"
17
+ gem.add_dependency "archive-tar-minitar", "= 0.5.2"
18
+ gem.add_dependency "amazon-ec2", "= 0.9.11"
19
+ gem.add_dependency "aws-s3", "= 0.6.2"
20
+ gem.add_dependency "log4r", "= 1.1.7"
21
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
22
+ end
23
+ Jeweler::GemcutterTasks.new
24
+ rescue LoadError
25
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
26
+ end
27
+
28
+ desc 'Run all unit and integration tests'
29
+ task :test do
30
+ errors = %w(test:units test:integration).collect do |task|
31
+ begin
32
+ Rake::Task[task].invoke
33
+ nil
34
+ rescue => e
35
+ task
36
+ end
37
+ end.compact
38
+ abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
39
+ end
40
+
41
+ require 'rake/testtask'
42
+ namespace :test do
43
+ Rake::TestTask.new(:units) do |test|
44
+ test.libs << 'lib' << 'test/unit'
45
+ test.pattern = 'test/unit/test_*.rb'
46
+ test.verbose = true
47
+ end
48
+
49
+ Rake::TestTask.new(:integration) do |test|
50
+ test.libs << 'lib' << 'test/integration'
51
+ test.pattern = 'test/integration/test_*.rb'
52
+ test.verbose = true
53
+ end
54
+
55
+ namespace :integration do
56
+ Rake::TestTask.new(:aws) do |test|
57
+ test.libs << 'lib' << 'test/integration'
58
+ test.pattern = 'test/integration/test_aws_cloud.rb'
59
+ test.verbose = true
60
+ end
61
+
62
+ Rake::TestTask.new(:ubuntu) do |test|
63
+ test.libs << 'lib' << 'test/integration'
64
+ test.pattern = 'test/integration/test_ubuntu.rb'
65
+ test.verbose = true
66
+ end
67
+
68
+ Rake::TestTask.new(:debian) do |test|
69
+ test.libs << 'lib' << 'test/integration'
70
+ test.pattern = 'test/integration/test_debian.rb'
71
+ test.verbose = true
72
+ end
73
+
74
+ Rake::TestTask.new(:fedora) do |test|
75
+ test.libs << 'lib' << 'test/integration'
76
+ test.pattern = 'test/integration/test_fedora.rb'
77
+ test.verbose = true
78
+ end
79
+
80
+ Rake::TestTask.new(:centos) do |test|
81
+ test.libs << 'lib' << 'test/integration'
82
+ test.pattern = 'test/integration/test_cent_os.rb'
83
+ test.verbose = true
84
+ end
85
+ end
86
+ end
87
+
88
+ begin
89
+ require 'rcov/rcovtask'
90
+ Rcov::RcovTask.new do |test|
91
+ test.libs << 'lib' << 'test/units' << 'test/integration'
92
+ test.pattern = 'test/**/test_*.rb'
93
+ test.verbose = true
94
+ end
95
+ rescue LoadError
96
+ task :rcov do
97
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
98
+ end
99
+ end
100
+
101
+ task :test => :check_dependencies
102
+
103
+ task :default => :test
104
+
105
+ require 'rake/rdoctask'
106
+ Rake::RDocTask.new do |rdoc|
107
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
108
+
109
+ files = ['README.rdoc', 'LICENSE', 'lib/**/*.rb']
110
+
111
+ rdoc.rdoc_dir = 'rdoc'
112
+ rdoc.options << "-A Module.dsl_property"
113
+ rdoc.main = 'README.rdoc'
114
+ rdoc.title = "Maestro #{version}"
115
+ rdoc.rdoc_files.include('LICENSE', 'README.rdoc', 'lib/**/*.rb')
116
+ end