sprinkle 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/CREDITS +14 -0
  2. data/History.txt +4 -0
  3. data/MIT-LICENSE +20 -0
  4. data/Manifest.txt +63 -0
  5. data/README.rdoc +218 -0
  6. data/Rakefile +4 -0
  7. data/TODO +56 -0
  8. data/bin/sprinkle +79 -0
  9. data/config/hoe.rb +70 -0
  10. data/config/requirements.rb +17 -0
  11. data/examples/merb/deploy.rb +5 -0
  12. data/examples/rails/README +15 -0
  13. data/examples/rails/deploy.rb +2 -0
  14. data/examples/rails/packages/database.rb +9 -0
  15. data/examples/rails/packages/essential.rb +6 -0
  16. data/examples/rails/packages/rails.rb +28 -0
  17. data/examples/rails/packages/search.rb +11 -0
  18. data/examples/rails/packages/server.rb +28 -0
  19. data/examples/rails/rails.rb +71 -0
  20. data/examples/sprinkle/sprinkle.rb +38 -0
  21. data/lib/sprinkle/actors/capistrano.rb +80 -0
  22. data/lib/sprinkle/actors/vlad.rb +30 -0
  23. data/lib/sprinkle/deployment.rb +33 -0
  24. data/lib/sprinkle/extensions/arbitrary_options.rb +10 -0
  25. data/lib/sprinkle/extensions/array.rb +7 -0
  26. data/lib/sprinkle/extensions/blank_slate.rb +5 -0
  27. data/lib/sprinkle/extensions/dsl_accessor.rb +15 -0
  28. data/lib/sprinkle/extensions/string.rb +10 -0
  29. data/lib/sprinkle/extensions/symbol.rb +7 -0
  30. data/lib/sprinkle/installers/apt.rb +20 -0
  31. data/lib/sprinkle/installers/gem.rb +33 -0
  32. data/lib/sprinkle/installers/installer.rb +85 -0
  33. data/lib/sprinkle/installers/rake.rb +17 -0
  34. data/lib/sprinkle/installers/rpm.rb +20 -0
  35. data/lib/sprinkle/installers/source.rb +120 -0
  36. data/lib/sprinkle/package.rb +94 -0
  37. data/lib/sprinkle/policy.rb +85 -0
  38. data/lib/sprinkle/script.rb +13 -0
  39. data/lib/sprinkle/sequence.rb +21 -0
  40. data/lib/sprinkle/version.rb +9 -0
  41. data/lib/sprinkle.rb +26 -0
  42. data/script/destroy +14 -0
  43. data/script/generate +14 -0
  44. data/spec/spec.opts +1 -0
  45. data/spec/spec_helper.rb +17 -0
  46. data/spec/sprinkle/actors/capistrano_spec.rb +150 -0
  47. data/spec/sprinkle/deployment_spec.rb +80 -0
  48. data/spec/sprinkle/extensions/array_spec.rb +19 -0
  49. data/spec/sprinkle/extensions/string_spec.rb +21 -0
  50. data/spec/sprinkle/installers/apt_spec.rb +53 -0
  51. data/spec/sprinkle/installers/gem_spec.rb +75 -0
  52. data/spec/sprinkle/installers/installer_spec.rb +125 -0
  53. data/spec/sprinkle/installers/rpm_spec.rb +50 -0
  54. data/spec/sprinkle/installers/source_spec.rb +315 -0
  55. data/spec/sprinkle/package_spec.rb +247 -0
  56. data/spec/sprinkle/policy_spec.rb +126 -0
  57. data/spec/sprinkle/script_spec.rb +51 -0
  58. data/spec/sprinkle/sequence_spec.rb +44 -0
  59. data/spec/sprinkle/sprinkle_spec.rb +25 -0
  60. data/sprinkle.gemspec +43 -0
  61. data/tasks/deployment.rake +34 -0
  62. data/tasks/environment.rake +7 -0
  63. data/tasks/rspec.rake +21 -0
  64. metadata +157 -0
@@ -0,0 +1,247 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprinkle::Package do
4
+ include Sprinkle::Package
5
+
6
+ before do
7
+ @name = :package_name
8
+ @empty = Proc.new { }
9
+ @opts = { }
10
+ end
11
+
12
+ describe 'when created' do
13
+
14
+ it 'should be invalid without a block descriptor' do
15
+ lambda { package @name }.should raise_error
16
+ end
17
+
18
+ it 'should be invalid without a name' do
19
+ lambda { package nil, &@empty }.should raise_error
20
+ lambda { package @name, &@empty }.should_not raise_error
21
+ end
22
+
23
+ it 'should optionally accept a description' do
24
+ pkg = package @name do
25
+ description 'my package description'
26
+ end
27
+ pkg.description.should == 'my package description'
28
+ end
29
+
30
+ it 'should optionally accept a version' do
31
+ pkg = package @name do
32
+ version '2.0.2'
33
+ end
34
+ pkg.version.should == '2.0.2'
35
+ end
36
+
37
+ it 'should optionally accept an installer' do
38
+ pkg = package @name do
39
+ gem 'rails'
40
+ end
41
+ pkg.installer.should_not be_nil
42
+ end
43
+
44
+ it 'should optionally accept dependencies' do
45
+ pkg = package @name do
46
+ requires :webserver, :database
47
+ end
48
+ pkg.dependencies.should == [:webserver, :database]
49
+ end
50
+
51
+ it 'should optionally accept recommended dependencies' do
52
+ pkg = package @name do
53
+ recommends :webserver, :database
54
+ end
55
+ pkg.recommends.should == [:webserver, :database]
56
+ end
57
+
58
+ it 'should optionally define a virtual package implementation' do
59
+ pkg = package @name, :provides => :database do; end
60
+ pkg.provides.should == :database
61
+ end
62
+
63
+ it 'should be able to represent itself as a string' do
64
+ pkg = package @name do; end
65
+ pkg.to_s.should == @name
66
+ end
67
+
68
+ end
69
+
70
+ describe 'helper method' do
71
+
72
+ it 'should added new packages to the global package hash' do
73
+ pkg = package @name do; end
74
+ Sprinkle::Package::PACKAGES[@name].should == pkg
75
+ end
76
+
77
+ it 'should add the new package to the provides list if specified' do
78
+ pkg = package @name, :provides => :database do; end
79
+ Sprinkle::Package::PACKAGES[:database].last.should == pkg
80
+ end
81
+
82
+ end
83
+
84
+ describe 'installer configuration' do
85
+
86
+ it 'should optionally accept an apt installer' do
87
+ pkg = package @name do
88
+ apt %w( deb1 deb2 )
89
+ end
90
+ pkg.should respond_to(:apt)
91
+ pkg.installer.class.should == Sprinkle::Installers::Apt
92
+ end
93
+
94
+ it 'should optionally accept an rpm installer' do
95
+ pkg = package @name do
96
+ rpm %w( rpm1 rpm2 )
97
+ end
98
+ pkg.should respond_to(:rpm)
99
+ pkg.installer.class.should == Sprinkle::Installers::Rpm
100
+ end
101
+
102
+ it 'should optionally accept a gem installer' do
103
+ pkg = package @name do
104
+ gem 'gem'
105
+ end
106
+ pkg.should respond_to(:gem)
107
+ pkg.installer.class.should == Sprinkle::Installers::Gem
108
+ end
109
+
110
+ it 'should optionally accept a source installer' do
111
+ pkg = package @name do
112
+ source 'archive'
113
+ end
114
+ pkg.should respond_to(:source)
115
+ pkg.installer.class.should == Sprinkle::Installers::Source
116
+ end
117
+
118
+ end
119
+
120
+ describe 'with a source installer' do
121
+
122
+ it 'should optionally accept a block containing customisations' do
123
+ pkg = package @name do
124
+ source 'archive' do; end
125
+ end
126
+ pkg.should respond_to(:source)
127
+ pkg.installer.class.should == Sprinkle::Installers::Source
128
+ end
129
+
130
+ it 'should automatically add a build essential recommendation' do
131
+ pkg = package @name do
132
+ source 'archive'
133
+ end
134
+ pkg.recommends.should include(:build_essential)
135
+ end
136
+
137
+ end
138
+
139
+ describe 'with an gem installer' do
140
+
141
+ it 'should automatically add a rubygems recommendation' do
142
+ pkg = package @name do
143
+ gem 'gem'
144
+ end
145
+ pkg.recommends.should include(:rubygems)
146
+ end
147
+
148
+ end
149
+
150
+ describe 'when processing' do
151
+
152
+ before do
153
+ @deployment = mock(Sprinkle::Deployment)
154
+ @roles = [ :app, :db ]
155
+ @installer = mock(Sprinkle::Installers::Installer, :defaults => true, :process => true)
156
+ @package = package @name do; end
157
+ end
158
+
159
+ describe 'with an installer' do
160
+
161
+ before do
162
+ @package.installer = @installer
163
+ end
164
+
165
+ it 'should configure itself against the deployment context' do
166
+ @installer.should_receive(:defaults).with(@deployment).and_return
167
+ end
168
+
169
+ it 'should request the installer to process itself' do
170
+ @installer.should_receive(:process).with(@roles).and_return
171
+ end
172
+
173
+ after do
174
+ @package.process(@deployment, @roles)
175
+ end
176
+ end
177
+
178
+ describe 'without an installer' do
179
+
180
+ it 'should not request the installer to process if the package is a metapackage' do
181
+ @installer.should_not_receive(:process)
182
+ @package.process(@deployment, @roles)
183
+ end
184
+
185
+ end
186
+
187
+ end
188
+
189
+ describe 'hierarchies' do
190
+
191
+ before do
192
+ @a = package :a do; requires :b; end
193
+ @b = package :b do; requires :c; end
194
+ @c = package :c do; recommends :d; end
195
+ @d = package :d do; end
196
+ end
197
+
198
+ it 'should be able to return a dependency hierarchy tree' do
199
+ @a.tree.flatten.should == [ @d, @c, @b, @a ]
200
+ @b.tree.flatten.should == [ @d, @c, @b ]
201
+ @c.tree.flatten.should == [ @d, @c ]
202
+ @d.tree.flatten.should == [ @d ]
203
+ end
204
+
205
+ describe 'with missing recommendations' do
206
+
207
+ before do
208
+ @d.recommends :e
209
+ end
210
+
211
+ it 'should ignore missing recommendations' do
212
+ @d.tree.flatten.should == [ @d ]
213
+ end
214
+
215
+ end
216
+
217
+ it 'should optionally accept a block to call upon item in the tree during hierarchy traversal' do
218
+ @count = 0
219
+ @a.tree do
220
+ @count += 1
221
+ end
222
+ @count.should == 3
223
+ end
224
+
225
+ it 'should maintain a depth count of how deep the hierarchy is' do
226
+ @b.should_receive(:tree).with(2).and_return([@b])
227
+ @a.tree do; end
228
+ end
229
+
230
+ end
231
+
232
+ describe 'with missing dependencies' do
233
+
234
+ before do
235
+ @pkg = package @name do
236
+ gem 'gem'
237
+ requires :missing
238
+ end
239
+ end
240
+
241
+ it 'should raise an error if a package is missing' do
242
+ lambda { @pkg.tree }.should raise_error
243
+ end
244
+
245
+ end
246
+
247
+ end
@@ -0,0 +1,126 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprinkle::Policy do
4
+ include Sprinkle::Policy
5
+
6
+ before do
7
+ @name = 'a policy'
8
+ end
9
+
10
+ describe 'when created' do
11
+
12
+ it 'should be invalid without a name' do
13
+ lambda { policy nil }.should raise_error
14
+ end
15
+
16
+ it 'should be invalid without role definitions' do
17
+ lambda { policy @name do; end }.should raise_error
18
+ lambda { policy @name, :roles => :app do; end }.should_not raise_error
19
+ end
20
+
21
+ it 'should optionally accept package dependencies' do
22
+ p = policy @name, :roles => :app do; end
23
+ p.should respond_to(:requires)
24
+ p.requires :appserver
25
+ p.packages.should == [ :appserver ]
26
+ end
27
+
28
+ it 'should optionally accept package dependencies with versions' do
29
+ p = policy @name, :roles => :app do; end
30
+ p.requires :appserver, :version => 2
31
+ p.packages.should == [ :appserver ]
32
+ pending 'requires version checking implementation'
33
+ end
34
+
35
+ it 'should add itself to the global policy list' do
36
+ sz = Sprinkle::Policy::POLICIES.size
37
+ p = policy @name, :roles => :app do; end
38
+ Sprinkle::Policy::POLICIES.size.should == sz + 1
39
+ Sprinkle::Policy::POLICIES.last.should == p
40
+ end
41
+
42
+ end
43
+
44
+ describe 'with packages' do
45
+ include Sprinkle::Package
46
+
47
+ before do
48
+ @deployment = mock(Sprinkle::Deployment)
49
+ Sprinkle::Package::PACKAGES.clear # reset full package list before each spec is run
50
+
51
+ @a = package :a do; requires :b; requires :c; end
52
+ @b = package :b, :provides => :xyz do; end
53
+ @c = package :c, :provides => :abc do; end
54
+ @d = package :d, :provides => :abc do; end
55
+
56
+ @policy = policy :test, :roles => :app do; requires :a; end
57
+ $terminal.stub!(:choose).and_return(:c) # stub out highline asking questions
58
+ end
59
+
60
+ describe 'when applying' do
61
+ include Sprinkle::Package
62
+
63
+ it 'should determine the packages to install via the hierarchy dependency tree of each package in the policy' do
64
+ @a.should_receive(:process).and_return
65
+ @b.should_receive(:process).and_return
66
+ @c.should_receive(:process).and_return
67
+ @d.should_not_receive(:process)
68
+ end
69
+
70
+ it 'should normalize (ie remove duplicates from) the installation order of all packages including dependencies' do
71
+ @e = package :e do; requires :b; end
72
+ @policy.requires :e
73
+
74
+ @a.should_receive(:process).once.and_return
75
+ @b.should_receive(:process).once.and_return
76
+ @c.should_receive(:process).once.and_return
77
+ @d.should_not_receive(:process)
78
+ @e.should_receive(:process).once.and_return
79
+ end
80
+ end
81
+
82
+ describe 'containing package dependencies with versions' do
83
+
84
+ it 'should be invalid if the specified package does not exist'
85
+ it 'should ignore any packages of the same name that have other versions'
86
+ it 'should select the correct package version when applying'
87
+
88
+ end
89
+
90
+ describe 'containing virtual packages' do
91
+
92
+ it 'should automatically select a concrete package implementation for a virtual one when there exists only one possible selection' do
93
+ @policy = policy :virtual, :roles => :app do; requires :xyz; end
94
+ Sprinkle::Package::PACKAGES[:xyz].should == [ @b ]
95
+ end
96
+
97
+ it 'should ask the user for the concrete package implementation to use for a virtual one when more than one possible choice exists' do
98
+ @policy = policy :virtual, :roles => :app do; requires :abc; end
99
+ Sprinkle::Package::PACKAGES[:abc].should include(@c)
100
+ Sprinkle::Package::PACKAGES[:abc].should include(@d)
101
+ $terminal.should_receive(:choose).and_return(:c)
102
+ end
103
+
104
+ end
105
+
106
+ after do
107
+ @policy.process(@deployment)
108
+ end
109
+ end
110
+ end
111
+
112
+ describe Sprinkle::Policy, 'with missing packages' do
113
+
114
+ before do
115
+ @deployment = mock(Sprinkle::Deployment)
116
+ Sprinkle::Package::PACKAGES.clear # reset full package list before each spec is run
117
+
118
+ @policy = policy :test, :roles => :app do; requires :z; end
119
+ $terminal.stub!(:choose).and_return(:c) # stub out highline asking questions
120
+ end
121
+
122
+ it 'should raise an error if a package is missing' do
123
+ lambda { @policy.process(@deployment) }.should raise_error
124
+ end
125
+
126
+ end
@@ -0,0 +1,51 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprinkle::Script, 'class' do
4
+
5
+ it 'should define a entry point into the system' do
6
+ Sprinkle::Script.should respond_to(:sprinkle)
7
+ end
8
+
9
+ end
10
+
11
+ describe Sprinkle::Script, 'when given a script' do
12
+
13
+ before do
14
+ @script = 'script'
15
+ @filename = 'filename'
16
+
17
+ @sprinkle = Sprinkle::Script.new
18
+ Sprinkle::Script.stub!(:new).and_return(@sprinkle)
19
+ end
20
+
21
+ it 'should create a new sprinkle instance' do
22
+ Sprinkle::Script.should_receive(:new).and_return(@sprinkle)
23
+ Sprinkle::Script.sprinkle @script
24
+ end
25
+
26
+ it 'should evaulate the sprinkle script against the instance' do
27
+ @sprinkle.should_receive(:instance_eval).and_return
28
+ Sprinkle::Script.sprinkle @script
29
+ end
30
+
31
+ it 'should specify the filename if given for line number errors' do
32
+ @sprinkle.should_receive(:instance_eval).with(@script, @filename).and_return
33
+ Sprinkle::Script.sprinkle @script, @filename
34
+ end
35
+
36
+ it 'should specify a filename of __SCRIPT__ by default if none is provided' do
37
+ @sprinkle.should_receive(:instance_eval).with(@script, '__SCRIPT__').and_return
38
+ Sprinkle::Script.sprinkle @script
39
+ end
40
+
41
+ it 'should automatically run in production mode by default' do
42
+ @sprinkle.should_receive(:instance_eval).with(@script, '__SCRIPT__').and_return
43
+ Sprinkle::Script.sprinkle @script
44
+ end
45
+
46
+ it 'should ask the Sprinkle instance to process the data from the script' do
47
+ @sprinkle.should_receive(:sprinkle)
48
+ Sprinkle::Script.sprinkle @script
49
+ end
50
+
51
+ end
@@ -0,0 +1,44 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprinkle::Sequence do
4
+
5
+ before do
6
+ @sequence = Sprinkle::Sequence.new do
7
+ section1 do
8
+ 'command1'
9
+ end
10
+
11
+ section2 do
12
+ 'command2'
13
+ end
14
+ end
15
+ end
16
+
17
+ describe 'during initialization' do
18
+
19
+ it 'should yield the block, storing all section definitions provided' do
20
+ @sequence.stages.size.should == 2
21
+ end
22
+
23
+ end
24
+
25
+ describe 'during iteration' do
26
+
27
+ before do
28
+ @stages = { }
29
+ @sequence.each do |stage, commands|
30
+ @stages[stage] = commands
31
+ end
32
+ end
33
+
34
+ it 'should yield to a given block with the stage and commands for that stage' do
35
+ @stages.size.should == 2
36
+ @stages.keys.should include(:section1)
37
+ @stages[:section1].should == 'command1'
38
+ @stages.keys.should include(:section2)
39
+ @stages[:section2].should == 'command2'
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Sprinkle do
4
+
5
+ it 'should automatically extend Object to support package, policy and deployment DSL keywords' do
6
+ %w( package policy deployment ).each do |keyword|
7
+ Object.should respond_to(keyword.to_sym)
8
+ end
9
+ end
10
+
11
+ it 'should default to production mode' do
12
+ Sprinkle::OPTIONS[:testing].should be_false
13
+ end
14
+
15
+ it 'should automatically create a logger object on Kernel' do
16
+ Object.should respond_to(:logger)
17
+ logger.should_not be_nil
18
+ logger.class.should == ActiveSupport::BufferedLogger
19
+ end
20
+
21
+ it 'should create a logger of level INFO' do
22
+ logger.level.should == ActiveSupport::BufferedLogger::Severity::INFO
23
+ end
24
+
25
+ end
data/sprinkle.gemspec ADDED
@@ -0,0 +1,43 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{sprinkle}
3
+ s.version = "0.1.4"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Marcus Crafter"]
7
+ s.date = %q{2008-07-13}
8
+ s.default_executable = %q{sprinkle}
9
+ s.description = %q{Ruby DSL based software provisioning tool}
10
+ s.email = ["crafterm@redartisan.com"]
11
+ s.executables = ["sprinkle"]
12
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
13
+ s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "bin/sprinkle", "config/hoe.rb", "config/requirements.rb", "examples/merb/deploy.rb", "examples/rails/README", "examples/rails/deploy.rb", "examples/rails/packages/database.rb", "examples/rails/packages/essential.rb", "examples/rails/packages/rails.rb", "examples/rails/packages/search.rb", "examples/rails/packages/server.rb", "examples/rails/rails.rb", "examples/sprinkle/sprinkle.rb", "lib/sprinkle.rb", "lib/sprinkle/actors/capistrano.rb", "lib/sprinkle/actors/vlad.rb", "lib/sprinkle/deployment.rb", "lib/sprinkle/extensions/arbitrary_options.rb", "lib/sprinkle/extensions/array.rb", "lib/sprinkle/extensions/blank_slate.rb", "lib/sprinkle/extensions/dsl_accessor.rb", "lib/sprinkle/extensions/string.rb", "lib/sprinkle/extensions/symbol.rb", "lib/sprinkle/installers/apt.rb", "lib/sprinkle/installers/gem.rb", "lib/sprinkle/installers/installer.rb", "lib/sprinkle/installers/rake.rb", "lib/sprinkle/installers/rpm.rb", "lib/sprinkle/installers/source.rb", "lib/sprinkle/package.rb", "lib/sprinkle/policy.rb", "lib/sprinkle/script.rb", "lib/sprinkle/version.rb", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/sprinkle/actors/capistrano_spec.rb", "spec/sprinkle/deployment_spec.rb", "spec/sprinkle/extensions/array_spec.rb", "spec/sprinkle/extensions/string_spec.rb", "spec/sprinkle/installers/apt_spec.rb", "spec/sprinkle/installers/gem_spec.rb", "spec/sprinkle/installers/installer_spec.rb", "spec/sprinkle/installers/rpm_spec.rb", "spec/sprinkle/installers/source_spec.rb", "spec/sprinkle/package_spec.rb", "spec/sprinkle/policy_spec.rb", "spec/sprinkle/script_spec.rb", "spec/sprinkle/sprinkle_spec.rb", "sprinkle.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://sprinkle.rubyforge.org}
16
+ s.rdoc_options = ["--main", "README.txt"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{sprinkle}
19
+ s.rubygems_version = %q{1.2.0}
20
+ s.summary = %q{Ruby DSL based software provisioning tool}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if current_version >= 3 then
27
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
28
+ s.add_runtime_dependency(%q<highline>, [">= 1.4.0"])
29
+ s.add_runtime_dependency(%q<capistrano>, [">= 2.2.0"])
30
+ s.add_development_dependency(%q<hoe>, [">= 1.7.0"])
31
+ else
32
+ s.add_dependency(%q<activesupport>, [">= 2.0.2"])
33
+ s.add_dependency(%q<highline>, [">= 1.4.0"])
34
+ s.add_dependency(%q<capistrano>, [">= 2.2.0"])
35
+ s.add_dependency(%q<hoe>, [">= 1.7.0"])
36
+ end
37
+ else
38
+ s.add_dependency(%q<activesupport>, [">= 2.0.2"])
39
+ s.add_dependency(%q<highline>, [">= 1.4.0"])
40
+ s.add_dependency(%q<capistrano>, [">= 2.2.0"])
41
+ s.add_dependency(%q<hoe>, [">= 1.7.0"])
42
+ end
43
+ end
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end