auser-sprinkle 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +16 -0
- data/History.txt +4 -0
- data/MIT-LICENSE +20 -0
- data/Manifest.txt +67 -0
- data/README.rdoc +224 -0
- data/Rakefile +4 -0
- data/bin/sprinkle +86 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +17 -0
- data/examples/merb/deploy.rb +5 -0
- data/examples/rails/README +15 -0
- data/examples/rails/deploy.rb +2 -0
- data/examples/rails/packages/database.rb +9 -0
- data/examples/rails/packages/essential.rb +6 -0
- data/examples/rails/packages/rails.rb +28 -0
- data/examples/rails/packages/search.rb +11 -0
- data/examples/rails/packages/server.rb +28 -0
- data/examples/rails/rails.rb +71 -0
- data/examples/sprinkle/sprinkle.rb +38 -0
- data/lib/sprinkle.rb +28 -0
- data/lib/sprinkle/actors/capistrano.rb +89 -0
- data/lib/sprinkle/actors/vlad.rb +39 -0
- data/lib/sprinkle/configurable.rb +24 -0
- data/lib/sprinkle/deployment.rb +33 -0
- data/lib/sprinkle/extensions/arbitrary_options.rb +10 -0
- data/lib/sprinkle/extensions/array.rb +7 -0
- data/lib/sprinkle/extensions/blank_slate.rb +5 -0
- data/lib/sprinkle/extensions/dsl_accessor.rb +15 -0
- data/lib/sprinkle/extensions/string.rb +10 -0
- data/lib/sprinkle/extensions/symbol.rb +7 -0
- data/lib/sprinkle/installers/apt.rb +25 -0
- data/lib/sprinkle/installers/gem.rb +33 -0
- data/lib/sprinkle/installers/installer.rb +74 -0
- data/lib/sprinkle/installers/rake.rb +17 -0
- data/lib/sprinkle/installers/rpm.rb +20 -0
- data/lib/sprinkle/installers/source.rb +121 -0
- data/lib/sprinkle/package.rb +127 -0
- data/lib/sprinkle/policy.rb +85 -0
- data/lib/sprinkle/script.rb +13 -0
- data/lib/sprinkle/verifiers/directory.rb +11 -0
- data/lib/sprinkle/verifiers/executable.rb +17 -0
- data/lib/sprinkle/verifiers/file.rb +11 -0
- data/lib/sprinkle/verifiers/symlink.rb +15 -0
- data/lib/sprinkle/verify.rb +55 -0
- data/lib/sprinkle/version.rb +9 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/sprinkle/actors/capistrano_spec.rb +170 -0
- data/spec/sprinkle/configurable_spec.rb +46 -0
- data/spec/sprinkle/deployment_spec.rb +80 -0
- data/spec/sprinkle/extensions/array_spec.rb +19 -0
- data/spec/sprinkle/extensions/string_spec.rb +21 -0
- data/spec/sprinkle/installers/apt_spec.rb +74 -0
- data/spec/sprinkle/installers/gem_spec.rb +75 -0
- data/spec/sprinkle/installers/installer_spec.rb +151 -0
- data/spec/sprinkle/installers/rpm_spec.rb +50 -0
- data/spec/sprinkle/installers/source_spec.rb +331 -0
- data/spec/sprinkle/package_spec.rb +422 -0
- data/spec/sprinkle/policy_spec.rb +126 -0
- data/spec/sprinkle/script_spec.rb +51 -0
- data/spec/sprinkle/sprinkle_spec.rb +25 -0
- data/spec/sprinkle/verify_spec.rb +137 -0
- data/sprinkle.gemspec +43 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- metadata +158 -0
@@ -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,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
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Sprinkle::Verify do
|
4
|
+
before do
|
5
|
+
@name = :package
|
6
|
+
@package = package @name do
|
7
|
+
gem 'nonexistent'
|
8
|
+
verify 'moo' do
|
9
|
+
# Check a file exists
|
10
|
+
has_file 'my_file.txt'
|
11
|
+
|
12
|
+
# Check a directory exists
|
13
|
+
has_directory 'mydir'
|
14
|
+
|
15
|
+
# Check a symlink exists
|
16
|
+
has_symlink 'mypointer'
|
17
|
+
|
18
|
+
# Check a symlink points to a certain file
|
19
|
+
has_symlink 'mypointer', 'myfile'
|
20
|
+
|
21
|
+
# Check if an executable exists
|
22
|
+
has_executable '/usr/bin/ruby'
|
23
|
+
|
24
|
+
# Check if a global executable exists (in PATH)
|
25
|
+
has_executable 'rails'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
@verification = @package.verifications[0]
|
29
|
+
@delivery = mock(Sprinkle::Deployment, :process => true)
|
30
|
+
@verification.delivery = @delivery
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'when created' do
|
34
|
+
it 'should raise error without a block' do
|
35
|
+
lambda { Verify.new(nil, '') }.should raise_error
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'with checks' do
|
40
|
+
it 'should do a "test -f" on the has_file check' do
|
41
|
+
@verification.commands.should include('test -f my_file.txt')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should do a "test -d" on the has_directory check' do
|
45
|
+
@verification.commands.should include('test -d mydir')
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should do a "test -L" to check something is a symbolic link' do
|
49
|
+
@verification.commands.should include('test -L mypointer')
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should do a test equality to check a symlink points to a specific file' do
|
53
|
+
@verification.commands.should include("test 'myfile' = `readlink mypointer`")
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should do a "test -x" to check for an executable' do
|
57
|
+
@verification.commands.should include("test -x /usr/bin/ruby")
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should test the "which" command to look for a global executable' do
|
61
|
+
@verification.commands.should include('[ -n "`which rails`"]')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'with configurations' do
|
66
|
+
# Make sure it includes Sprinkle::Configurable
|
67
|
+
it 'should respond to configurable methods' do
|
68
|
+
@verification.should respond_to(:defaults)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should default padding option to 4' do
|
72
|
+
@verification.padding.should eql(4)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe 'with process' do
|
77
|
+
it 'should raise an error when no delivery mechanism is set' do
|
78
|
+
@verification.instance_variable_set(:@delivery, nil)
|
79
|
+
lambda { @verification.process([]) }.should raise_error
|
80
|
+
end
|
81
|
+
|
82
|
+
describe 'when not testing' do
|
83
|
+
before do
|
84
|
+
# To be explicit
|
85
|
+
Sprinkle::OPTIONS[:testing] = false
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should call process on the delivery with the correct parameters' do
|
89
|
+
@delivery.should_receive(:process).with(@name, @verification.commands, [:app], true).once.and_return(true)
|
90
|
+
@verification.process([:app])
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should raise Sprinkle::VerificationFailed exception when commands fail' do
|
94
|
+
@delivery.should_receive(:process).once.and_return(false)
|
95
|
+
lambda { @verification.process([:app]) }.should raise_error(Sprinkle::VerificationFailed) do |error|
|
96
|
+
error.package.should eql(@package)
|
97
|
+
error.description.should eql('moo')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe 'when testing' do
|
103
|
+
before do
|
104
|
+
Sprinkle::OPTIONS[:testing] = true
|
105
|
+
@logger = mock(ActiveSupport::BufferedLogger, :debug => true, :debug? => true)
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should not call process on the delivery' do
|
109
|
+
@delivery.should_not_receive(:process)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should print the install sequence to the console' do
|
113
|
+
@verification.should_receive(:logger).twice.and_return(@logger)
|
114
|
+
end
|
115
|
+
|
116
|
+
after do
|
117
|
+
@verification.process([:app])
|
118
|
+
Sprinkle::OPTIONS[:testing] = false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe 'with registering new verification modules' do
|
124
|
+
module MyModule
|
125
|
+
def rawr; end
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'should not respond to rawr initially' do
|
129
|
+
@verification.should_not respond_to(:rawr)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should respond to rawr after registering the module' do
|
133
|
+
Sprinkle::Verify.register(MyModule)
|
134
|
+
@verification.should respond_to(:rawr)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
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.5"
|
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-16}
|
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"]
|
13
|
+
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "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/configurable.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/verifiers/directory.rb", "lib/sprinkle/verifiers/executable.rb", "lib/sprinkle/verifiers/file.rb", "lib/sprinkle/verifiers/symlink.rb", "lib/sprinkle/verify.rb", "lib/sprinkle/version.rb", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/sprinkle/actors/capistrano_spec.rb", "spec/sprinkle/configurable_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", "spec/sprinkle/verify_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
|
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
|