rudy 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +54 -30
- data/README.rdoc +100 -12
- data/Rakefile +103 -8
- data/Rudyfile +119 -0
- data/bin/ird +175 -0
- data/bin/rudy +259 -156
- data/bin/rudy-ec2 +228 -95
- data/bin/rudy-s3 +76 -0
- data/bin/rudy-sdb +67 -0
- data/lib/annoy.rb +270 -0
- data/lib/console.rb +30 -9
- data/lib/escape.rb +305 -0
- data/lib/rudy.rb +151 -182
- data/lib/rudy/aws.rb +56 -49
- data/lib/rudy/aws/ec2.rb +47 -292
- data/lib/rudy/aws/ec2/address.rb +157 -0
- data/lib/rudy/aws/ec2/group.rb +301 -0
- data/lib/rudy/aws/ec2/image.rb +168 -0
- data/lib/rudy/aws/ec2/instance.rb +434 -0
- data/lib/rudy/aws/ec2/keypair.rb +104 -0
- data/lib/rudy/aws/ec2/snapshot.rb +98 -0
- data/lib/rudy/aws/ec2/volume.rb +230 -0
- data/lib/rudy/aws/ec2/zone.rb +77 -0
- data/lib/rudy/aws/s3.rb +54 -0
- data/lib/rudy/aws/sdb.rb +298 -0
- data/lib/rudy/aws/sdb/error.rb +46 -0
- data/lib/rudy/{metadata/backup.rb → backup.rb} +26 -51
- data/lib/rudy/cli.rb +157 -0
- data/lib/rudy/cli/aws/ec2/addresses.rb +105 -0
- data/lib/rudy/cli/aws/ec2/candy.rb +208 -0
- data/lib/rudy/cli/aws/ec2/groups.rb +121 -0
- data/lib/rudy/cli/aws/ec2/images.rb +196 -0
- data/lib/rudy/cli/aws/ec2/instances.rb +194 -0
- data/lib/rudy/cli/aws/ec2/keypairs.rb +53 -0
- data/lib/rudy/cli/aws/ec2/snapshots.rb +49 -0
- data/lib/rudy/cli/aws/ec2/volumes.rb +104 -0
- data/lib/rudy/cli/aws/ec2/zones.rb +22 -0
- data/lib/rudy/cli/aws/s3/buckets.rb +50 -0
- data/lib/rudy/cli/aws/s3/store.rb +22 -0
- data/lib/rudy/cli/aws/sdb/domains.rb +41 -0
- data/lib/rudy/cli/candy.rb +8 -0
- data/lib/rudy/{command → cli}/config.rb +34 -24
- data/lib/rudy/cli/disks.rb +35 -0
- data/lib/rudy/cli/machines.rb +94 -0
- data/lib/rudy/cli/routines.rb +57 -0
- data/lib/rudy/config.rb +77 -72
- data/lib/rudy/config/objects.rb +29 -0
- data/lib/rudy/disks.rb +248 -0
- data/lib/rudy/global.rb +121 -0
- data/lib/rudy/huxtable.rb +340 -0
- data/lib/rudy/machines.rb +245 -0
- data/lib/rudy/metadata.rb +123 -13
- data/lib/rudy/routines.rb +47 -0
- data/lib/rudy/routines/helpers/diskhelper.rb +101 -0
- data/lib/rudy/routines/helpers/scripthelper.rb +91 -0
- data/lib/rudy/routines/release.rb +34 -0
- data/lib/rudy/routines/shutdown.rb +57 -0
- data/lib/rudy/routines/startup.rb +58 -0
- data/lib/rudy/scm/svn.rb +1 -1
- data/lib/rudy/utils.rb +322 -4
- data/lib/storable.rb +26 -17
- data/lib/sysinfo.rb +274 -0
- data/lib/tryouts.rb +6 -13
- data/rudy.gemspec +128 -42
- data/support/randomize-root-password +45 -0
- data/support/rudy-ec2-startup +9 -9
- data/support/update-ec2-ami-tools +20 -0
- data/test/05_config/00_setup_test.rb +20 -0
- data/test/05_config/30_machines_test.rb +69 -0
- data/test/20_sdb/00_setup_test.rb +16 -0
- data/test/20_sdb/10_domains_test.rb +115 -0
- data/test/25_ec2/00_setup_test.rb +29 -0
- data/test/25_ec2/10_keypairs_test.rb +41 -0
- data/test/25_ec2/20_groups_test.rb +131 -0
- data/test/25_ec2/30_addresses_test.rb +38 -0
- data/test/25_ec2/40_volumes_test.rb +49 -0
- data/test/25_ec2/50_snapshots_test.rb +74 -0
- data/test/26_ec2_instances/00_setup_test.rb +28 -0
- data/test/26_ec2_instances/10_instances_test.rb +83 -0
- data/test/26_ec2_instances/50_images_test.rb +13 -0
- data/test/30_sdb_metadata/00_setup_test.rb +21 -0
- data/test/30_sdb_metadata/10_disks_test.rb +109 -0
- data/test/30_sdb_metadata/20_backups_test.rb +102 -0
- data/test/coverage.txt +51 -0
- data/test/helper.rb +36 -0
- data/vendor/highline-1.5.1/CHANGELOG +222 -0
- data/vendor/highline-1.5.1/INSTALL +35 -0
- data/vendor/highline-1.5.1/LICENSE +7 -0
- data/vendor/highline-1.5.1/README +63 -0
- data/vendor/highline-1.5.1/Rakefile +82 -0
- data/vendor/highline-1.5.1/TODO +6 -0
- data/vendor/highline-1.5.1/examples/ansi_colors.rb +38 -0
- data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +18 -0
- data/vendor/highline-1.5.1/examples/basic_usage.rb +75 -0
- data/vendor/highline-1.5.1/examples/color_scheme.rb +32 -0
- data/vendor/highline-1.5.1/examples/limit.rb +12 -0
- data/vendor/highline-1.5.1/examples/menus.rb +65 -0
- data/vendor/highline-1.5.1/examples/overwrite.rb +19 -0
- data/vendor/highline-1.5.1/examples/page_and_wrap.rb +322 -0
- data/vendor/highline-1.5.1/examples/password.rb +7 -0
- data/vendor/highline-1.5.1/examples/trapping_eof.rb +22 -0
- data/vendor/highline-1.5.1/examples/using_readline.rb +17 -0
- data/vendor/highline-1.5.1/lib/highline.rb +758 -0
- data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +120 -0
- data/vendor/highline-1.5.1/lib/highline/compatibility.rb +17 -0
- data/vendor/highline-1.5.1/lib/highline/import.rb +43 -0
- data/vendor/highline-1.5.1/lib/highline/menu.rb +395 -0
- data/vendor/highline-1.5.1/lib/highline/question.rb +463 -0
- data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +193 -0
- data/vendor/highline-1.5.1/setup.rb +1360 -0
- data/vendor/highline-1.5.1/test/tc_color_scheme.rb +56 -0
- data/vendor/highline-1.5.1/test/tc_highline.rb +823 -0
- data/vendor/highline-1.5.1/test/tc_import.rb +54 -0
- data/vendor/highline-1.5.1/test/tc_menu.rb +429 -0
- data/vendor/highline-1.5.1/test/ts_all.rb +15 -0
- metadata +141 -38
- data/lib/aws_sdb.rb +0 -3
- data/lib/aws_sdb/error.rb +0 -42
- data/lib/aws_sdb/service.rb +0 -215
- data/lib/rudy/aws/simpledb.rb +0 -53
- data/lib/rudy/command/addresses.rb +0 -46
- data/lib/rudy/command/backups.rb +0 -175
- data/lib/rudy/command/base.rb +0 -841
- data/lib/rudy/command/deploy.rb +0 -12
- data/lib/rudy/command/disks.rb +0 -213
- data/lib/rudy/command/environment.rb +0 -73
- data/lib/rudy/command/groups.rb +0 -61
- data/lib/rudy/command/images.rb +0 -91
- data/lib/rudy/command/instances.rb +0 -85
- data/lib/rudy/command/machines.rb +0 -161
- data/lib/rudy/command/metadata.rb +0 -41
- data/lib/rudy/command/release.rb +0 -174
- data/lib/rudy/command/volumes.rb +0 -66
- data/lib/rudy/metadata/disk.rb +0 -138
- data/tryouts/console_tryout.rb +0 -91
data/CHANGES.txt
CHANGED
@@ -1,41 +1,65 @@
|
|
1
1
|
RUDY, CHANGES
|
2
2
|
|
3
|
-
TODO:
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
* TODO: Remove string messages for non-string output formats
|
4
|
+
* TODO: Support for reserved instances
|
5
|
+
* TODO: Test for zone and region support
|
6
|
+
* TODO: Support for machine image attributes
|
7
|
+
* TODO: Support for product codes
|
8
|
+
* TODO: HTTPS
|
7
9
|
|
8
|
-
TODO: Remove aws_swb
|
9
10
|
|
11
|
+
#### 0.6.0 (2009-04-19) ###############################
|
10
12
|
|
11
|
-
|
13
|
+
NOTE: This is a significant re-write from 0.5
|
14
|
+
|
15
|
+
* CHANGE: Rebuilt Rudy::AWS::*
|
16
|
+
* CHANGE: Removed lib/rudy/commands/* and lib/rudy/metadata/*
|
17
|
+
* ADDED: rudy-ec2 executable
|
18
|
+
* CHANGE: have local copies of Caesars and Drydock to reduce external dependencies.
|
19
|
+
* ADDED: new output formats: yaml, json, csv, tsv
|
20
|
+
|
21
|
+
|
22
|
+
#### 0.5.1 (2009-04-10) ###############################
|
23
|
+
|
24
|
+
* CHANGE: Removed require 'rubygems'
|
25
|
+
* FIXED: Resolved Drydock namespace issue for rudy and ird
|
26
|
+
|
27
|
+
|
28
|
+
#### 0.5.0 (2009-04-09) ###############################
|
29
|
+
|
30
|
+
NOTE: This is a significant re-write from 0.4
|
12
31
|
|
13
32
|
* CHANGE: Recommend keypair config to be in ~/.rudy/config
|
14
33
|
* FIX: Rudy now checks for user keys specified by env-role, env, and global
|
15
34
|
* FIX: gemspec dependency net-ssh-multi
|
16
|
-
*
|
35
|
+
* ADDED: --nocolor option
|
36
|
+
* ADDED: Ruby API
|
37
|
+
* ADDED: Tests with 55% coverage
|
38
|
+
* ADDED: Ruby API (Rudy::Machines, etc...)
|
39
|
+
* ADDED: ird, a REPL (experimental)
|
40
|
+
* ADDED: Now uses Rye 0.4.1
|
17
41
|
|
18
42
|
#### 0.4 (2009-03-12) ###############################
|
19
43
|
|
20
44
|
NOTE: This is a significant re-write from 0.3
|
21
45
|
|
22
|
-
* CHANGE: Mostly re-written bin/ruby, moving validation to
|
46
|
+
* CHANGE: Mostly re-written bin/ruby, moving validation to CLI classes
|
23
47
|
* CHANGE: upgrade to Drydock 0.5
|
24
48
|
* CHANGE: Moved generic EC2 commands to bin/rudy-ec2
|
25
49
|
* CHANGE: Removed ambiguity of pluralized command names.
|
26
50
|
* OLD: backups, disks, configs
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
51
|
+
* ADDED: backup, disk, config
|
52
|
+
* ADDED: ssh and scp commands for connecting to and copying files to/from machines
|
53
|
+
* ADDED: New dependencies (trying out net-ssh)
|
54
|
+
* ADDED: Domain specific language for configuration
|
55
|
+
* ADDED: "Routines" for handling common actions. Starting, stopping, releasing, deploying.
|
56
|
+
* ADDED: "rudy release" will create a release from the current working copy, start an instance,
|
33
57
|
checkout the release, run routines. It needs some work still, but this already functions as
|
34
58
|
a single command release process.
|
35
|
-
*
|
59
|
+
* ADDED: "rudy start|destroy|restart|update|status". Routines allow us to have generic commands
|
36
60
|
that can be used for any machine group. These commands relate to starting new instances.
|
37
|
-
*
|
38
|
-
*
|
61
|
+
* ADDED: Extra caution when running destructive commands
|
62
|
+
* ADDED: Default ~/.rudy/config created if it doesn't exist.
|
39
63
|
|
40
64
|
|
41
65
|
#### 0.3 (2009-02-26) ###############################
|
@@ -44,9 +68,9 @@ NOTE: This is a significant re-write from 0.2
|
|
44
68
|
|
45
69
|
* CHANGE: Re-written support/rudy-ec2-startup
|
46
70
|
* CHANGE: upgrade to Drydock 0.4
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
71
|
+
* ADDED: More functionality for disks and backups
|
72
|
+
* ADDED: config commands
|
73
|
+
* ADDED: Per machine configuration (via ~/.rudy)
|
50
74
|
|
51
75
|
|
52
76
|
#### 0.2 (2009-02-23) ###############################
|
@@ -55,18 +79,18 @@ NOTE: This is a complete re-write from 0.1
|
|
55
79
|
|
56
80
|
* CHANGE: Added Environment variables
|
57
81
|
* CHANGE: upgrade to drydock 0.3.3
|
58
|
-
*
|
59
|
-
*
|
82
|
+
* ADDED: All time references are converted to UTC
|
83
|
+
* ADDED: Safer "Are you sure?". Number of characters to enter is
|
60
84
|
commiserate with amount of danger.
|
61
|
-
*
|
85
|
+
* ADDED: CLIs: myaddress, addresses, images, instances,
|
62
86
|
disks, connect, copy, stage, backups, volumes
|
63
|
-
*
|
64
|
-
*
|
65
|
-
*
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
87
|
+
* ADDED: Metadata storage to SimpleDB for disks, backups
|
88
|
+
* ADDED: Creates EBS volumes based on startup from metadata
|
89
|
+
* ADDED: Automated release process
|
90
|
+
* ADDED: Automated creation of machine images
|
91
|
+
* ADDED: Partial support for regions and zones
|
92
|
+
* ADDED: Manage system based on security groups.
|
93
|
+
* ADDED: "rudy groups" overhaul. Display, creates, destroys groups.
|
70
94
|
|
71
95
|
|
72
96
|
|
data/README.rdoc
CHANGED
@@ -1,34 +1,122 @@
|
|
1
|
-
= Rudy - v0.
|
1
|
+
= Rudy - v0.6 ALPHA
|
2
2
|
|
3
|
-
Rudy is a
|
3
|
+
Rudy is a command-line development and deployment tool for Amazon Web Services. It helps you build and manage machines in EC2 by organizing them into groups of _environments_ and _roles_. These are called _machine_ _groups_. <tt>stage</tt> is the default environment and <tt>app</tt> is the default role. You can run multiple machines with the same role. These are called _positions_. Rudy also supports running machine groups across availability _zones_.
|
4
4
|
|
5
|
-
|
5
|
+
When you put all this together, you have a unique name for every machine. The default machine is:
|
6
|
+
|
7
|
+
zone env role
|
8
|
+
v v v
|
9
|
+
m-us-east-1b-stage-app-01
|
10
|
+
^ ^
|
11
|
+
"machine" position
|
12
|
+
|
13
|
+
All configuration is organized into the zones, environments, and roles that you specify (Rudy assumes positions are identical which is important for backups and scaling). And as you'd expect, the defaults can be changed too (in <tt>~/.rudy/config</tt>). See below for usage examples.
|
14
|
+
|
15
|
+
<b>NOTE: This is an ALPHA release. That means Rudy's not ready for production use! See Alpha Warning.</b>
|
6
16
|
|
7
17
|
== Installation
|
8
18
|
|
9
|
-
|
10
|
-
|
19
|
+
=== Step 1 of 2 (get Rudy on to your machine):
|
20
|
+
|
21
|
+
Via Rubygems, one of:
|
22
|
+
|
23
|
+
$ sudo gem install rudy
|
24
|
+
$ sudo gem install solutious-rudy --source http://gems.github.com/
|
25
|
+
|
26
|
+
or via download:
|
27
|
+
* rudy-0.6.0.tar.gz[http://github.com/solutious/rudy/tarball/rudy-0.6.0]
|
28
|
+
* rudy-0.6.0.zip[http://github.com/solutious/rudy/zipball/rudy-0.6.0]
|
29
|
+
|
30
|
+
NOTE: <em>If you are not installing via RubyGems, you need to make sure the dependencies are in your LOAD_PATH (<tt>$:</tt>). Ryan Tomayko wrote a gist[http://gist.github.com/54177] about it.</em>
|
31
|
+
|
32
|
+
=== Step 2 of 2 (initialize your configuration):
|
33
|
+
|
34
|
+
$ rudy generate-config
|
35
|
+
[edit ~/.rudy/config with your Amazon Web Services credentials]
|
36
|
+
$ rudy init
|
37
|
+
|
38
|
+
NOTE: <em>You need an Amazon[http://aws.amazon.com/] account to use Rudy. Sign up for EC2[http://aws.amazon.com/ec2/], SimpleDB[http://aws.amazon.com/simpledb/], and S3[http://aws.amazon.com/s3/]</em>
|
39
|
+
|
40
|
+
|
41
|
+
== Example -- Launch a Machine Group
|
42
|
+
|
43
|
+
Machine groups are named after the current environment and role. The default machine group is <tt>stage-app</tt>. In this example, Rudy will create the default machine group from scratch.
|
44
|
+
|
45
|
+
<b>Note: Make sure your <tt>~/.rudy/config</tt> contains your AWS credentials</b>
|
46
|
+
|
47
|
+
We need to tell Rudy what this machine group should look like. We can generate a default machine configuration with this command:
|
48
|
+
|
49
|
+
$ rudy config --rudy > Rudyfile
|
50
|
+
|
51
|
+
This will generate a config file called <tt>Rudyfile</tt> which contains a default machines and routines configuration. The machine configuration describes the "physical" characteristics of your machine groups. The routine configuration describes what happens when you startup and shutdown a machine group (Rudy refers to these as _routines_).
|
52
|
+
|
53
|
+
We can launch the default machine group (stage-app) with this command:
|
54
|
+
|
55
|
+
$ rudy startup
|
56
|
+
|
57
|
+
You now have a new EC2 instance called <tt>m-us-east-1b-stage-app-01</tt> to work with. You can log into it with:
|
58
|
+
|
59
|
+
$ rudy -u root ssh
|
60
|
+
|
61
|
+
The <tt>-u root</tt> tells Rudy to open a connection as the root user. If you create an account on that instance, you can login as that user too. When you don't feel like paying for the instance you can run the following command to destroy it forever:
|
62
|
+
|
63
|
+
$ rudy shutdown
|
64
|
+
|
65
|
+
|
66
|
+
== Dependencies:
|
67
|
+
|
68
|
+
* OpenSSH[http://www.openssh.com/]
|
69
|
+
* Net::SSH[http://net-ssh.rubyforge.org/]
|
70
|
+
* Net::SCP[http://net-ssh.rubyforge.org/]
|
71
|
+
* amazon-ec2[http://github.com/grempe/amazon-ec2]
|
72
|
+
* Rye[http://github.com/delano/rye]
|
73
|
+
* Drydock[http://github.com/delano/drydock]
|
74
|
+
* Caesars[http://github.com/delano/caesars]
|
75
|
+
|
76
|
+
|
77
|
+
== Common Errors
|
78
|
+
|
79
|
+
* <tt>"`require': no such file to load -- amazon-ec2 (LoadError)"</tt>
|
80
|
+
* You're probably running a mix of Rubygem and non-Rubygem libraries. Ryan Tomayko has you covered: http://gist.github.com/54177
|
81
|
+
* <tt>"The request signature we calculated does not match the signature you provided."</tt>
|
82
|
+
* Check that your Amazon Web Service access key and secret key are correct
|
83
|
+
* <tt>"AWS was not able to validate the provided access credentials"</tt>
|
84
|
+
* If it's a new Amazon Account, you need to sign up for EC2, SDB, and S3.
|
85
|
+
|
86
|
+
== Alpha Warning
|
87
|
+
|
88
|
+
Although Rudy has been pretty well tested and is currently being used in production in a private beta, it's not ready for general production use. There are a few things to keep in mind while Rudy is in alpha status.
|
89
|
+
|
90
|
+
* If you already have private SSH keys, back them up. Rudy is quite safe but hasn't been audited so backup your keys as a precaution.
|
91
|
+
* If you're running EC2 instances in production, create a new set of AWS credentials (access key and secret key) to use with Rudy. This will ensure that Rudy has no access to your production instances.
|
92
|
+
* Rudy commands and APIs may change in later releases. This means that if you create an environment with an alpha release and later upgrade Rudy, some things may not work as expected.
|
93
|
+
|
11
94
|
|
12
95
|
== More Info
|
13
96
|
|
14
97
|
* GitHub[http://github.com/solutious/rudy]
|
98
|
+
* Issues[http://github.com/solutious/rudy/issues]
|
15
99
|
* RubyForge[http://rubyforge.org/projects/rudy]
|
16
100
|
* Inspiration[http://www.youtube.com/watch?v=CgaiIW5Rzes]
|
17
101
|
|
18
102
|
|
19
|
-
== Credits
|
20
|
-
|
21
|
-
* Delano Mandelbaum (delano@solutious.com)
|
22
|
-
* Keshia Knight Pulliam (rudy@solutious.com)
|
23
|
-
|
24
|
-
|
25
103
|
== Thanks
|
26
104
|
|
27
|
-
* The Rilli.com team -- for the initial use case, the ongoing feedback and support, and the good times!
|
105
|
+
* The Rilli.com[http://rilli.com] team -- for the initial use case, the ongoing feedback and support, and the good times!
|
28
106
|
* Adam Bognar
|
29
107
|
* Andrew Simpson
|
30
108
|
* Caleb Buxton
|
31
109
|
* Colin Brumelle
|
110
|
+
* Everyone at Utrecht.rb[http://groups.google.com/group/utrecht-rb]
|
111
|
+
* Jamis Buck for writing Net::SSH and friends.
|
112
|
+
|
113
|
+
|
114
|
+
== Credits
|
115
|
+
|
116
|
+
* Rudy::AWS::SDB adapted from aws_sdb by Tim Dysinger (http://dysinger.net)
|
117
|
+
* Escape, Copyright (C) 2006,2007 Tanaka Akira <akr@fsij.org>
|
118
|
+
* Keshia Knight Pulliam (rudy@solutious.com)
|
119
|
+
* Delano Mandelbaum (delano@solutious.com)
|
32
120
|
|
33
121
|
|
34
122
|
== License
|
data/Rakefile
CHANGED
@@ -1,15 +1,106 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
require 'rake/clean'
|
3
3
|
require 'rake/gempackagetask'
|
4
4
|
require 'hanna/rdoctask'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'shoulda/tasks'
|
7
|
+
require 'rake/runtest'
|
8
|
+
require 'monkeyspecdoc' # http://jgre.org/2008/09/03/monkeyspecdoc/
|
5
9
|
require 'fileutils'
|
6
10
|
include FileUtils
|
7
11
|
|
8
|
-
task :default => :
|
12
|
+
task :default => :test
|
9
13
|
|
10
|
-
#
|
14
|
+
# TESTS ===============================================================
|
11
15
|
|
12
|
-
|
16
|
+
Rake::TestTask.new(:test_old) do |t|
|
17
|
+
require 'monkeyspecdoc'
|
18
|
+
test_files = FileList['test/**/*_test.rb'] || []
|
19
|
+
t.test_files = test_files
|
20
|
+
t.ruby_opts = ['-rubygems'] if defined? Gem
|
21
|
+
t.verbose = true
|
22
|
+
# t.warning = true
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
namespace :test do
|
28
|
+
desc 'Measures test coverage'
|
29
|
+
task :coverage do
|
30
|
+
rm_f "coverage"
|
31
|
+
rm_f "coverage.data"
|
32
|
+
rcov = "rcov -Itest --aggregate coverage.data -T -x ' rubygems/*,/Library/Ruby/Site/*,gems/*,rcov*'"
|
33
|
+
system("#{rcov} --html test/**/*_test.rb")
|
34
|
+
system("open coverage/index.html") if RUBY_PLATFORM['darwin']
|
35
|
+
end
|
36
|
+
task :list do
|
37
|
+
puts Dir.glob(File.join('test', '**', '*_test.rb'))
|
38
|
+
end
|
39
|
+
|
40
|
+
# Run individual test groups with:
|
41
|
+
# rake test:05
|
42
|
+
# rake test:60
|
43
|
+
# etc...
|
44
|
+
('00'..'99').each do |group|
|
45
|
+
task group.to_sym do
|
46
|
+
Rake.run_tests "test/#{group}*/*_test.rb"
|
47
|
+
end
|
48
|
+
|
49
|
+
# And also individual test files
|
50
|
+
# rake test:50:10
|
51
|
+
# etc...
|
52
|
+
('00'..'99').each do |test|
|
53
|
+
namespace group.to_sym do
|
54
|
+
task test.to_sym do
|
55
|
+
Rake.run_tests "test/#{group}*/{00,#{test}}*_test.rb"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
task :test do
|
63
|
+
|
64
|
+
#all_tests = Dir.glob(File.join('test', '{05,20,50}*', '*_test.rb')) || []
|
65
|
+
#all_tests.sort.each do |file|
|
66
|
+
# load file
|
67
|
+
#end
|
68
|
+
Rake.run_tests 'test/**/*_test.rb'
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
# From: shoulda/tasks/list_tests.rake
|
73
|
+
namespace :shoulda do
|
74
|
+
desc "List the names of the test methods in a specification like format"
|
75
|
+
task :list_fixed do
|
76
|
+
$LOAD_PATH.unshift("test")
|
77
|
+
|
78
|
+
require 'test/unit'
|
79
|
+
require 'active_support'
|
80
|
+
|
81
|
+
# bug in test unit. Set to true to stop from running.
|
82
|
+
Test::Unit.run = true
|
83
|
+
|
84
|
+
test_files = Dir.glob(File.join('test', '**', '*_test.rb'))
|
85
|
+
|
86
|
+
test_files.each do |file|
|
87
|
+
load file
|
88
|
+
klass = File.basename(file, '.rb').classify
|
89
|
+
#unless Object.const_defined?(klass.to_s) # => raises: wrong constant name 00SetupTest
|
90
|
+
unless Object.constants.member?(klass.to_s) # fixed
|
91
|
+
puts "Skipping #{klass} because it doesn't map to a Class"
|
92
|
+
next
|
93
|
+
end
|
94
|
+
klass = klass.constantize
|
95
|
+
|
96
|
+
puts klass.name.gsub('Test', '')
|
97
|
+
|
98
|
+
test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort
|
99
|
+
test_methods.each {|m| puts " " + m }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
13
104
|
|
14
105
|
# PACKAGE =============================================================
|
15
106
|
|
@@ -22,7 +113,11 @@ Rake::GemPackageTask.new(@spec) do |p|
|
|
22
113
|
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
23
114
|
end
|
24
115
|
|
25
|
-
task :release => [ :rdoc, :package ]
|
116
|
+
task :release => [ :rdoc, :package ] do
|
117
|
+
$: << File.join(File.dirname(__FILE__), 'lib')
|
118
|
+
require "rudy"
|
119
|
+
abort if Drydock.debug?
|
120
|
+
end
|
26
121
|
|
27
122
|
task :install => [ :rdoc, :package ] do
|
28
123
|
sh %{sudo gem install pkg/#{name}-#{version}.gem}
|
@@ -52,17 +147,17 @@ end
|
|
52
147
|
Rake::RDocTask.new do |t|
|
53
148
|
t.rdoc_dir = 'doc'
|
54
149
|
t.title = @spec.summary
|
55
|
-
t.options << '--line-numbers' <<
|
150
|
+
t.options << '--line-numbers' << '-A cattr_accessor=object'
|
56
151
|
t.options << '--charset' << 'utf-8'
|
57
152
|
t.rdoc_files.include('LICENSE.txt')
|
58
153
|
t.rdoc_files.include('README.rdoc')
|
59
154
|
t.rdoc_files.include('CHANGES.txt')
|
155
|
+
#t.rdoc_files.include('Rudyfile') # why is the formatting f'd?
|
60
156
|
t.rdoc_files.include('bin/*')
|
61
|
-
t.rdoc_files.include('lib/*.rb')
|
62
157
|
t.rdoc_files.include('lib/**/*.rb')
|
63
158
|
end
|
64
159
|
|
65
|
-
CLEAN.include [ 'pkg', '*.gem', '.config', 'doc' ]
|
160
|
+
CLEAN.include [ 'pkg', '*.gem', '.config', 'doc', 'coverage*' ]
|
66
161
|
|
67
162
|
|
68
163
|
|
data/Rudyfile
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# = Rudy
|
2
|
+
#
|
3
|
+
# This is an example Rudy configuration.
|
4
|
+
#
|
5
|
+
# Rudy automatically looks for configuration files in the
|
6
|
+
# following locations (in this order):
|
7
|
+
#
|
8
|
+
# ~/.rudy/config
|
9
|
+
# ./.rudy/config
|
10
|
+
#
|
11
|
+
# ./Rudyfile
|
12
|
+
# ./config/rudy/*.rb
|
13
|
+
# ./.rudy/*.rb
|
14
|
+
# /etc/rudy/*.rb
|
15
|
+
#
|
16
|
+
# When multuple files are found, the configuration is
|
17
|
+
# NOT OVERRIDDEN. It's ADDED / APPENDED. This means you can
|
18
|
+
# split configuration across many files as you please.
|
19
|
+
#
|
20
|
+
# There are three sections: accounts, defaults, machines.
|
21
|
+
#
|
22
|
+
# By convention, accounts and defaults go in ~/.rudy/config or ./.rudy/config
|
23
|
+
# machines configuration goes in ./Rudyfile or ./config/rudy/machines.rb
|
24
|
+
|
25
|
+
|
26
|
+
# --------------------------------------------------------- MACHINES --------
|
27
|
+
# The machines block describes the "physical" characteristics
|
28
|
+
# of your environments.
|
29
|
+
machines do
|
30
|
+
|
31
|
+
users do
|
32
|
+
# If you already have private keys for logging in to your EC2 instances
|
33
|
+
# EC2 instances you can specify them here and Rudy will use these instead.
|
34
|
+
# root :keypair => "/#{Rudy.sysinfo.home}/.rudy/root-private-key"
|
35
|
+
end
|
36
|
+
|
37
|
+
zone :"us-east-1b" do
|
38
|
+
ami 'ami-235fba4a' # Amazon Getting Started AMI (US)
|
39
|
+
end
|
40
|
+
zone :"eu-west-1b" do
|
41
|
+
ami 'ami-e40f2790' # Amazon Getting Started AMI (EU)
|
42
|
+
end
|
43
|
+
|
44
|
+
# We've defined an environment called "stage" with one role: "app".
|
45
|
+
# The configuration inside the env block is available to all its
|
46
|
+
# roles. The configuration inside the role blocks is available only
|
47
|
+
# to machines in that specific role.
|
48
|
+
env :stage do
|
49
|
+
ami "ami-5394733a" # ec2onrails/ec2onrails-v0_9_9_1-i386.manifest.xml
|
50
|
+
size 'm1.small'
|
51
|
+
|
52
|
+
role :app do
|
53
|
+
positions 1
|
54
|
+
|
55
|
+
# We define two disks for the stage-app machines
|
56
|
+
disks do
|
57
|
+
path "/rudy/disk1" do
|
58
|
+
size 2
|
59
|
+
device "/dev/sdr"
|
60
|
+
end
|
61
|
+
path "/rudy/disk2" do
|
62
|
+
size 1
|
63
|
+
device "/dev/sdm"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
role :SUCCESS do
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
# The routines section below contains calls to local and remote
|
77
|
+
# scripts. The config contained in this block is made available
|
78
|
+
# those scripts in the form of a yaml file. The file is called
|
79
|
+
# rudy-config.yml.
|
80
|
+
config do
|
81
|
+
dbmaster 'localhost'
|
82
|
+
newparam 573114
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
# ----------------------------------------------------------- ROUTINES --------
|
89
|
+
# The routines block describes the repeatable processes for each machine group.
|
90
|
+
routines do
|
91
|
+
|
92
|
+
env :stage do
|
93
|
+
role :app do
|
94
|
+
|
95
|
+
startup do
|
96
|
+
before_local Rudy.sysinfo.user => :uname
|
97
|
+
|
98
|
+
disks do
|
99
|
+
create "/rudy/disk1"
|
100
|
+
end
|
101
|
+
|
102
|
+
after :root => [:uname, :a]
|
103
|
+
after :root => [:touch, '/rudy/disk1/rudy-was-here']
|
104
|
+
after_local Rudy.sysinfo.user => :date
|
105
|
+
end
|
106
|
+
|
107
|
+
shutdown do
|
108
|
+
before :root => '/a/nonexistent/script'
|
109
|
+
before :root => :uptime
|
110
|
+
|
111
|
+
disks do
|
112
|
+
destroy "/rudy/disk1"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|