sabat-rudy 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/CHANGES.txt +188 -0
  2. data/LICENSE.txt +19 -0
  3. data/README.rdoc +118 -0
  4. data/Rakefile +165 -0
  5. data/Rudyfile +184 -0
  6. data/bin/ird +153 -0
  7. data/bin/rudy +232 -0
  8. data/bin/rudy-ec2 +241 -0
  9. data/bin/rudy-s3 +79 -0
  10. data/bin/rudy-sdb +69 -0
  11. data/examples/README.md +10 -0
  12. data/examples/debian-sinatra-passenger/commands.rb +19 -0
  13. data/examples/debian-sinatra-passenger/machines.rb +32 -0
  14. data/examples/debian-sinatra-passenger/routines.rb +30 -0
  15. data/examples/debian-sinatra-thin/commands.rb +17 -0
  16. data/examples/debian-sinatra-thin/machines.rb +35 -0
  17. data/examples/debian-sinatra-thin/routines.rb +72 -0
  18. data/lib/rudy.rb +170 -0
  19. data/lib/rudy/aws.rb +75 -0
  20. data/lib/rudy/aws/ec2.rb +59 -0
  21. data/lib/rudy/aws/ec2/address.rb +157 -0
  22. data/lib/rudy/aws/ec2/group.rb +301 -0
  23. data/lib/rudy/aws/ec2/image.rb +168 -0
  24. data/lib/rudy/aws/ec2/instance.rb +438 -0
  25. data/lib/rudy/aws/ec2/keypair.rb +104 -0
  26. data/lib/rudy/aws/ec2/snapshot.rb +109 -0
  27. data/lib/rudy/aws/ec2/volume.rb +230 -0
  28. data/lib/rudy/aws/ec2/zone.rb +77 -0
  29. data/lib/rudy/aws/s3.rb +60 -0
  30. data/lib/rudy/aws/sdb.rb +312 -0
  31. data/lib/rudy/aws/sdb/error.rb +47 -0
  32. data/lib/rudy/cli.rb +186 -0
  33. data/lib/rudy/cli/aws/ec2/addresses.rb +105 -0
  34. data/lib/rudy/cli/aws/ec2/candy.rb +191 -0
  35. data/lib/rudy/cli/aws/ec2/groups.rb +118 -0
  36. data/lib/rudy/cli/aws/ec2/images.rb +185 -0
  37. data/lib/rudy/cli/aws/ec2/instances.rb +222 -0
  38. data/lib/rudy/cli/aws/ec2/keypairs.rb +53 -0
  39. data/lib/rudy/cli/aws/ec2/snapshots.rb +49 -0
  40. data/lib/rudy/cli/aws/ec2/volumes.rb +104 -0
  41. data/lib/rudy/cli/aws/ec2/zones.rb +22 -0
  42. data/lib/rudy/cli/aws/s3/buckets.rb +49 -0
  43. data/lib/rudy/cli/aws/s3/store.rb +22 -0
  44. data/lib/rudy/cli/aws/sdb/domains.rb +41 -0
  45. data/lib/rudy/cli/candy.rb +19 -0
  46. data/lib/rudy/cli/config.rb +81 -0
  47. data/lib/rudy/cli/disks.rb +58 -0
  48. data/lib/rudy/cli/machines.rb +114 -0
  49. data/lib/rudy/cli/routines.rb +108 -0
  50. data/lib/rudy/config.rb +116 -0
  51. data/lib/rudy/config/objects.rb +148 -0
  52. data/lib/rudy/global.rb +130 -0
  53. data/lib/rudy/guidelines.rb +18 -0
  54. data/lib/rudy/huxtable.rb +373 -0
  55. data/lib/rudy/machines.rb +281 -0
  56. data/lib/rudy/metadata.rb +51 -0
  57. data/lib/rudy/metadata/backup.rb +113 -0
  58. data/lib/rudy/metadata/backups.rb +65 -0
  59. data/lib/rudy/metadata/disk.rb +177 -0
  60. data/lib/rudy/metadata/disks.rb +67 -0
  61. data/lib/rudy/metadata/objectbase.rb +104 -0
  62. data/lib/rudy/mixins.rb +2 -0
  63. data/lib/rudy/mixins/hash.rb +25 -0
  64. data/lib/rudy/routines.rb +318 -0
  65. data/lib/rudy/routines/helper.rb +55 -0
  66. data/lib/rudy/routines/helpers/dependshelper.rb +34 -0
  67. data/lib/rudy/routines/helpers/diskhelper.rb +331 -0
  68. data/lib/rudy/routines/helpers/scmhelper.rb +39 -0
  69. data/lib/rudy/routines/helpers/scripthelper.rb +198 -0
  70. data/lib/rudy/routines/helpers/userhelper.rb +37 -0
  71. data/lib/rudy/routines/passthrough.rb +38 -0
  72. data/lib/rudy/routines/reboot.rb +75 -0
  73. data/lib/rudy/routines/release.rb +50 -0
  74. data/lib/rudy/routines/shutdown.rb +33 -0
  75. data/lib/rudy/routines/startup.rb +36 -0
  76. data/lib/rudy/scm.rb +75 -0
  77. data/lib/rudy/scm/git.rb +217 -0
  78. data/lib/rudy/scm/svn.rb +110 -0
  79. data/lib/rudy/utils.rb +365 -0
  80. data/rudy.gemspec +151 -0
  81. data/support/mailtest +40 -0
  82. data/support/randomize-root-password +45 -0
  83. data/support/rudy-ec2-startup +200 -0
  84. data/support/update-ec2-ami-tools +20 -0
  85. data/test/01_mixins/10_hash_test.rb +25 -0
  86. data/test/10_config/00_setup_test.rb +20 -0
  87. data/test/10_config/30_machines_test.rb +69 -0
  88. data/test/15_scm/00_setup_test.rb +20 -0
  89. data/test/15_scm/20_git_test.rb +61 -0
  90. data/test/20_sdb/00_setup_test.rb +16 -0
  91. data/test/20_sdb/10_domains_test.rb +115 -0
  92. data/test/25_ec2/00_setup_test.rb +29 -0
  93. data/test/25_ec2/10_keypairs_test.rb +41 -0
  94. data/test/25_ec2/20_groups_test.rb +131 -0
  95. data/test/25_ec2/30_addresses_test.rb +38 -0
  96. data/test/25_ec2/40_volumes_test.rb +49 -0
  97. data/test/25_ec2/50_snapshots_test.rb +74 -0
  98. data/test/26_ec2_instances/00_setup_test.rb +28 -0
  99. data/test/26_ec2_instances/10_instances_test.rb +83 -0
  100. data/test/26_ec2_instances/50_images_test.rb +13 -0
  101. data/test/30_sdb_metadata/00_setup_test.rb +21 -0
  102. data/test/30_sdb_metadata/10_disks_test.rb +109 -0
  103. data/test/30_sdb_metadata/20_backups_test.rb +102 -0
  104. data/test/coverage.txt +51 -0
  105. data/test/helper.rb +36 -0
  106. metadata +276 -0
data/CHANGES.txt ADDED
@@ -0,0 +1,188 @@
1
+ RUDY, CHANGES
2
+
3
+ * TODO: Remove string messages for non-string output formats
4
+ * TODO: Support for reserved instances
5
+ * TODO: Tests for zone and region support
6
+ * TODO: Support for machine image attributes
7
+ * TODO: Support for product codes
8
+
9
+ #### 0.7.5 (2009-05-??) ###############################
10
+
11
+ * CHANGE: rudy-ec2 console now displays windows password automatically if keypair is supplied.
12
+ * ADDED: register and destroy commands to rudy-ec2 images
13
+
14
+
15
+ #### 0.7.4 (2009-05-10) ###############################
16
+
17
+ * CHANGE: Keypairs now include zone. This was necessary to allow US and EU keypairs to
18
+ be stored in the same directory.
19
+ * CHANGE: Moved non-rudy specific modules to separate projects (storable, sysinfo, annoy, console -> Drydock, escape -> Rye, tryouts -> tryouts/).
20
+ * CHANGE: Renamed restart routine to reboot to make it clear it's about the machine
21
+ * CHANGE: Renamed Rudy::Disk to Rudy::MetaData::Disk
22
+ * CHANGE: Short alias for rudy-ec2 snapshot is now 's' (instead of 't')
23
+ * CHANGE: Removed highline-1.5.1 from vendor (it's now available as a gem)
24
+ * FIXED: Bug in Huxtable when loading global. Wasn't reloaded after config was updated.
25
+ * FIXED: Closed gh-12 (thanks sabat)
26
+ * ADDED: Routines now support dependencies
27
+ * ADDED: Disk routines now support mount, umount, snapshot, and restore
28
+ * ADDED: rudy disk command now displays backups with -b switch
29
+ * ADDED: RE-added basic support for creating Linux images (with security warning)
30
+ * ADDED: Routines with underscores can now be called with dashes (a_routine vs a-routine)
31
+
32
+
33
+ #### 0.7.3 (2009-05-05) ###############################
34
+
35
+ * FIXED: Corrected a few minor interface errors in rudy-ec2
36
+ * ADDED: rudy-ec2 console can now display the decoded admin password for Windows instances.
37
+
38
+
39
+ #### 0.7.2 (2009-05-04) ###############################
40
+
41
+ * FIXED: cli/routine.rb release method wasn't sending command alias (which broke rerelease)
42
+ * ADDED: global.offline for being cool when Internet is down
43
+ * ADDED: Better handling in aws/sdb when call returns nil (Internet is down)
44
+
45
+
46
+ #### 0.7.1 (2009-05-04) ###############################
47
+
48
+ * FIXED: rudy wasn't honouring -C option for specifying a config file
49
+ * FIXED: Was disabling, but not enabling colour
50
+ * FIXED: Symbol errors in 1.8
51
+ * FIXED: Command blocks for root user are always run first now in Routines config.
52
+ * CHANGE: routines before, after, and script blocks are now processed by Rye::Box.batch as Procs.
53
+ * CHANGE: deny was removed from commands config (it will come back later).
54
+ * CHANGE: Rudy now checks the current working directory for machines, commands, etc... configs
55
+ * ADDED: examples/
56
+ * ADDED: "script" keyword to routines config.
57
+ * ADDED: script_local
58
+ * ADDED: Routine now checks whether there are any remote tasks. If not, it doesn't loop through machines.
59
+
60
+
61
+ #### 0.7.0 (2009-05-02) ###############################
62
+
63
+ * CHANGE: Upgrade to Drydock 0.6, Caesars 0.6, and Rye 0.6
64
+ * CHANGE: Updated Routines configuration syntax for specifying shell commands
65
+ * ADDED: Releases via local git repository
66
+ * ADDED: authorize and adduser directives to routines config.
67
+ * ADDED: Improved CLI output for routines.
68
+ * ADDED: Commands configuration for custom SSH commands
69
+ * ADDED: Auto-set hostname to machine name
70
+ * ADDED: Support for arbitrary routines via passthrough
71
+
72
+
73
+
74
+ #### 0.6.8 (2009-04-24) ###############################
75
+
76
+ * CHANGE: Renamed rudy config --rudy option to --project. This was important
77
+ to maintain consistency in documentation.
78
+ * CHANGE: Cleaned README. See: http://wiki.github.com/solutious/rudy
79
+
80
+ #### 0.6.7 (2009-04-22) ###############################
81
+
82
+ * ADDED: rudy-ec2 status can now display EU status
83
+ * FIXED: Fixed bug on instance create. Instance.groups was nil, now it returns
84
+ empty Array.
85
+
86
+ #### 0.6.6 (2009-04-22) ###############################
87
+
88
+ * ADDED: Better error handling for Rudy::AWS::SDB
89
+ * FIXED: Ruby 1.9.1 compatability (including requiring aws-s3 >=0.6.1)
90
+
91
+
92
+ #### 0.6.5 (2009-04-20) ###############################
93
+
94
+ * FIXED: Startup and Shutdown routines now check machine group status first
95
+ * FIXED: Misc release process issues between 0.6.0 and 0.6.4
96
+ * ADDED: Better error handling during startup and shutdown.
97
+ * ADDED: Support for assigning addresses on startup
98
+
99
+
100
+ #### 0.6.0 (2009-04-19) ###############################
101
+
102
+ NOTE: This is a significant re-write from 0.5
103
+
104
+ * CHANGE: Rebuilt Rudy::AWS::*
105
+ * CHANGE: Removed lib/rudy/commands/* and lib/rudy/metadata/*
106
+ * ADDED: rudy-ec2 executable
107
+ * CHANGE: have local copies of Caesars and Drydock to reduce external dependencies.
108
+ * ADDED: new output formats: yaml, json, csv, tsv
109
+
110
+
111
+ #### 0.5.1 (2009-04-10) ###############################
112
+
113
+ * CHANGE: Removed require 'rubygems'
114
+ * FIXED: Resolved Drydock namespace issue for rudy and ird
115
+
116
+
117
+ #### 0.5.0 (2009-04-09) ###############################
118
+
119
+ NOTE: This is a significant re-write from 0.4
120
+
121
+ * CHANGE: Recommend keypair config to be in ~/.rudy/config
122
+ * FIX: Rudy now checks for user keys specified by env-role, env, and global
123
+ * FIX: gemspec dependency net-ssh-multi
124
+ * ADDED: --nocolor option
125
+ * ADDED: Ruby API
126
+ * ADDED: Tests with 55% coverage
127
+ * ADDED: Ruby API (Rudy::Machines, etc...)
128
+ * ADDED: ird, a REPL (experimental)
129
+ * ADDED: Now uses Rye 0.4.1
130
+
131
+ #### 0.4 (2009-03-12) ###############################
132
+
133
+ NOTE: This is a significant re-write from 0.3
134
+
135
+ * CHANGE: Mostly re-written bin/ruby, moving validation to CLI classes
136
+ * CHANGE: upgrade to Drydock 0.5
137
+ * CHANGE: Moved generic EC2 commands to bin/rudy-ec2
138
+ * CHANGE: Removed ambiguity of pluralized command names.
139
+ * OLD: backups, disks, configs
140
+ * ADDED: backup, disk, config
141
+ * ADDED: ssh and scp commands for connecting to and copying files to/from machines
142
+ * ADDED: New dependencies (trying out net-ssh)
143
+ * ADDED: Domain specific language for configuration
144
+ * ADDED: "Routines" for handling common actions. Starting, stopping, releasing, deploying.
145
+ * ADDED: "rudy release" will create a release from the current working copy, start an instance,
146
+ checkout the release, run routines. It needs some work still, but this already functions as
147
+ a single command release process.
148
+ * ADDED: "rudy start|destroy|restart|update|status". Routines allow us to have generic commands
149
+ that can be used for any machine group. These commands relate to starting new instances.
150
+ * ADDED: Extra caution when running destructive commands
151
+ * ADDED: Default ~/.rudy/config created if it doesn't exist.
152
+
153
+
154
+ #### 0.3 (2009-02-26) ###############################
155
+
156
+ NOTE: This is a significant re-write from 0.2
157
+
158
+ * CHANGE: Re-written support/rudy-ec2-startup
159
+ * CHANGE: upgrade to Drydock 0.4
160
+ * ADDED: More functionality for disks and backups
161
+ * ADDED: config commands
162
+ * ADDED: Per machine configuration (via ~/.rudy)
163
+
164
+
165
+ #### 0.2 (2009-02-23) ###############################
166
+
167
+ NOTE: This is a complete re-write from 0.1
168
+
169
+ * CHANGE: Added Environment variables
170
+ * CHANGE: upgrade to drydock 0.3.3
171
+ * ADDED: All time references are converted to UTC
172
+ * ADDED: Safer "Are you sure?". Number of characters to enter is
173
+ commiserate with amount of danger.
174
+ * ADDED: CLIs: myaddress, addresses, images, instances,
175
+ disks, connect, copy, stage, backups, volumes
176
+ * ADDED: Metadata storage to SimpleDB for disks, backups
177
+ * ADDED: Creates EBS volumes based on startup from metadata
178
+ * ADDED: Automated release process
179
+ * ADDED: Automated creation of machine images
180
+ * ADDED: Partial support for regions and zones
181
+ * ADDED: Manage system based on security groups.
182
+ * ADDED: "rudy groups" overhaul. Display, creates, destroys groups.
183
+
184
+
185
+
186
+ #### 0.1 (2009-02-06) ###############################
187
+
188
+ * Initial public release
data/LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2009 Solutious Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,118 @@
1
+ = Rudy - v0.7 BETA
2
+
3
+ <b>Not your grandparents' EC2 deployment tool.</b>
4
+
5
+ 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_.
6
+
7
+ When you put all this together, you have a unique name for every machine. The default machine is:
8
+
9
+ zone env role
10
+ v v v
11
+ m-us-east-1b-stage-app-01
12
+ ^ ^
13
+ "machine" position
14
+
15
+ 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>).
16
+
17
+ <b>See Getting-Started[http://wiki.github.com/solutious/rudy/getting-started] for more info.</b>
18
+
19
+ <em>NOTE: This is a BETA release. That means Rudy's not ready for production use! See Project-Status[http://wiki.github.com/solutious/rudy/project-status].</em>
20
+
21
+ == Features
22
+
23
+ * Create complex environments with a single command
24
+ * Launch multiple instances
25
+ * Assign elastic IP addresses
26
+ * Create EBS volumes, attach to instances, format, and mount
27
+ * Run scripts locally and remotely automatically
28
+ * Organize instances into environments and roles
29
+ * Powerful command-line tools
30
+ * <tt>$ rudy -u root ssh</tt>
31
+ * <tt>$ rudy -e testing -r database startup</tt>
32
+ * Use _any Linux_ Amazon machine image (AMI) (partial Solaris support)
33
+ * Complete command-line interface for EC2. See <tt>bin/rudy-ec2</tt>.
34
+
35
+ == Installation
36
+
37
+ Via Rubygems, one of:
38
+
39
+ $ sudo gem install rudy
40
+ $ sudo gem install solutious-rudy --source http://gems.github.com/
41
+
42
+ or via download:
43
+ * rudy-latest.tar.gz[http://github.com/solutious/rudy/tarball/latest]
44
+ * rudy-latest.zip[http://github.com/solutious/rudy/zipball/latest]
45
+
46
+ 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>
47
+
48
+ <b>See Getting-Started[http://wiki.github.com/solutious/rudy/getting-started] for more info.</b>
49
+
50
+
51
+ == Pre-Requisites
52
+
53
+ * Amazon AWS[http://aws.amazon.com/] Account
54
+ * EC2[http://aws.amazon.com/ec2/]
55
+ * SimpleDB[http://aws.amazon.com/simpledb/]
56
+ * S3[http://aws.amazon.com/s3/]
57
+ * OpenSSH[http://www.openssh.com/]
58
+ * Ruby[http://ruby-lang.org] 1.8.x, 1.9.x, or JRuby[http://jruby.codehaus.org] 1.2
59
+ * Net::SSH[http://net-ssh.rubyforge.org/]
60
+ * Net::SCP[http://net-ssh.rubyforge.org/]
61
+ * amazon-ec2[http://github.com/grempe/amazon-ec2]
62
+ * aws-s3[http://github.com/marcel/aws-s3]
63
+ * Rye[http://github.com/delano/rye]
64
+ * Drydock[http://github.com/delano/drydock]
65
+ * Caesars[http://github.com/delano/caesars]
66
+
67
+
68
+ == More Info
69
+
70
+ * Fork at GitHub[http://github.com/solutious/rudy]
71
+ * Read the Documentation[http://wiki.github.com/solutious/rudy]
72
+ * Submit issues to the IssueTracker[http://github.com/solutious/rudy/issues]
73
+ * Start a discussion on the GoogleGroup[http://groups.google.com/group/rudy-deployment]
74
+ * Find some Inspiration[http://www.youtube.com/watch?v=CgaiIW5Rzes]
75
+ * For all other inquires, email me directly: delano@solutious.com
76
+
77
+
78
+ == Thanks
79
+
80
+ * The Rilli.com[http://rilli.com] team
81
+ * Adam Bognar
82
+ * Andrew Simpson
83
+ * Caleb Buxton
84
+ * Colin Brumelle
85
+ * Sam Aaron
86
+ * Everyone at Utrecht.rb[http://groups.google.com/group/utrecht-rb]
87
+ * Jamis Buck for Net::SSH and friends
88
+ * Glenn Rempe for amazon-ec2
89
+ * Marcel Molina Jr. for aws-s3
90
+ * sabat[http://github.com/sabat]
91
+ * Keshia Knight Pulliam
92
+
93
+
94
+ == Contributions
95
+
96
+ I'm very open to contributions!
97
+
98
+ * For bigger features please fork the git repo and send me a pull request.
99
+ * For small or single file changes, send me an email with the details: <tt>delano@solutious.com</tt>
100
+
101
+
102
+ == Credits
103
+
104
+ * Delano Mandelbaum (delano@solutious.com)
105
+ * Rudy::AWS::SDB adapted from aws_sdb by Tim Dysinger (http://dysinger.net)
106
+
107
+
108
+ == Related Projects
109
+
110
+ * Pool Party -- http://www.poolpartyrb.com/
111
+ * Rubber -- http://github.com/wr0ngway/rubber/wikis
112
+ * Moonshine -- http://github.com/railsmachine/moonshine/tree
113
+ * Boto -- http://code.google.com/p/boto/
114
+
115
+
116
+ == License
117
+
118
+ See: LICENSE.txt
data/Rakefile ADDED
@@ -0,0 +1,165 @@
1
+
2
+ require 'rake/clean'
3
+ require 'rake/gempackagetask'
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/
9
+ require 'fileutils'
10
+ include FileUtils
11
+
12
+ task :default => :test
13
+
14
+
15
+
16
+ # TESTS ===============================================================
17
+
18
+ Rake::TestTask.new(:test_old) do |t|
19
+ require 'monkeyspecdoc'
20
+ test_files = FileList['test/**/*_test.rb'] || []
21
+ t.test_files = test_files
22
+ t.ruby_opts = ['-rubygems'] if defined? Gem
23
+ t.verbose = true
24
+ # t.warning = true
25
+
26
+ end
27
+
28
+
29
+ namespace :test do
30
+ #about 'Measures test coverage'
31
+ task :coverage do
32
+ rm_f "coverage"
33
+ rm_f "coverage.data"
34
+ rcov = "rcov -Itest --aggregate coverage.data -T -x ' rubygems/*,/Library/Ruby/Site/*,gems/*,rcov*'"
35
+ system("#{rcov} --html test/**/*_test.rb")
36
+ system("open coverage/index.html") if RUBY_PLATFORM['darwin']
37
+ end
38
+ task :list do
39
+ puts Dir.glob(File.join('test', '**', '*_test.rb'))
40
+ end
41
+
42
+ # Run individual test groups with:
43
+ # rake test:05
44
+ # rake test:60
45
+ # etc...
46
+ ('00'..'99').each do |group|
47
+ task group.to_sym do
48
+ Rake.run_tests "test/#{group}*/*_test.rb"
49
+ end
50
+
51
+ # And also individual test files
52
+ # rake test:50:10
53
+ # etc...
54
+ ('00'..'99').each do |test|
55
+ namespace group.to_sym do
56
+ task test.to_sym do
57
+ Rake.run_tests "test/#{group}*/{00,#{test}}*_test.rb"
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ task :test do
65
+
66
+ #all_tests = Dir.glob(File.join('test', '{05,20,50}*', '*_test.rb')) || []
67
+ #all_tests.sort.each do |file|
68
+ # load file
69
+ #end
70
+ Rake.run_tests 'test/**/*_test.rb'
71
+ end
72
+
73
+
74
+ # From: shoulda/tasks/list_tests.rake
75
+ namespace :shoulda do
76
+ #about "List the names of the test methods in a specification like format"
77
+ task :list_fixed do
78
+ $LOAD_PATH.unshift("test")
79
+
80
+ require 'test/unit'
81
+ require 'active_support'
82
+
83
+ # bug in test unit. Set to true to stop from running.
84
+ Test::Unit.run = true
85
+
86
+ test_files = Dir.glob(File.join('test', '**', '*_test.rb'))
87
+
88
+ test_files.each do |file|
89
+ load file
90
+ klass = File.basename(file, '.rb').classify
91
+ #unless Object.const_defined?(klass.to_s) # => raises: wrong constant name 00SetupTest
92
+ unless Object.constants.member?(klass.to_s) # fixed
93
+ puts "Skipping #{klass} because it doesn't map to a Class"
94
+ next
95
+ end
96
+ klass = klass.constantize
97
+
98
+ puts klass.name.gsub('Test', '')
99
+
100
+ test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort
101
+ test_methods.each {|m| puts " " + m }
102
+ end
103
+ end
104
+ end
105
+
106
+
107
+ # PACKAGE =============================================================
108
+
109
+ name = "rudy"
110
+ load "#{name}.gemspec"
111
+
112
+ version = @spec.version
113
+
114
+ Rake::GemPackageTask.new(@spec) do |p|
115
+ p.need_tar = true if RUBY_PLATFORM !~ /mswin/
116
+ end
117
+
118
+ task :release => [ "publish:gem", :clean, "publish:rdoc" ] do
119
+ $: << File.join(File.dirname(__FILE__), 'lib')
120
+ require "rudy"
121
+ abort if Drydock.debug?
122
+ end
123
+
124
+ task :install => [ :rdoc, :package ] do
125
+ sh %{sudo gem install pkg/#{name}-#{version}.gem}
126
+ end
127
+
128
+ task :uninstall => [ :clean ] do
129
+ sh %{sudo gem uninstall #{name}}
130
+ end
131
+
132
+
133
+ # Rubyforge Release / Publish Tasks ==================================
134
+
135
+ #about 'Publish website to rubyforge'
136
+ task 'publish:rdoc' => 'doc/index.html' do
137
+ sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
138
+ end
139
+
140
+ #about 'Public release to rubyforge'
141
+ task 'publish:gem' => [:package] do |t|
142
+ sh <<-end
143
+ rubyforge add_release -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
144
+ rubyforge add_file -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
145
+ end
146
+ end
147
+
148
+
149
+ Rake::RDocTask.new do |t|
150
+ t.rdoc_dir = 'doc'
151
+ t.title = @spec.summary
152
+ t.options << '--line-numbers' << '-A cattr_accessor=object'
153
+ t.options << '--charset' << 'utf-8'
154
+ t.rdoc_files.include('LICENSE.txt')
155
+ t.rdoc_files.include('README.rdoc')
156
+ t.rdoc_files.include('CHANGES.txt')
157
+ #t.rdoc_files.include('Rudyfile') # why is the formatting f'd?
158
+ t.rdoc_files.include('bin/*')
159
+ t.rdoc_files.include('lib/**/*.rb')
160
+ end
161
+
162
+ CLEAN.include [ 'pkg', '*.gem', '.config', 'doc', 'coverage*' ]
163
+
164
+
165
+