sprinkle 0.4.2 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +54 -0
- data/README.markdown +178 -166
- data/Rakefile +4 -28
- data/bin/sprinkle +14 -1
- data/lib/sprinkle.rb +5 -1
- data/lib/sprinkle/actors/actors.rb +20 -5
- data/lib/sprinkle/actors/capistrano.rb +62 -36
- data/lib/sprinkle/actors/dummy.rb +127 -0
- data/lib/sprinkle/actors/local.rb +59 -17
- data/lib/sprinkle/actors/ssh.rb +189 -107
- data/lib/sprinkle/actors/vlad.rb +51 -32
- data/lib/sprinkle/configurable.rb +2 -1
- data/lib/sprinkle/deployment.rb +22 -2
- data/lib/sprinkle/errors/pretty_failure.rb +41 -0
- data/lib/sprinkle/errors/remote_command_failure.rb +24 -0
- data/lib/sprinkle/errors/transfer_failure.rb +28 -0
- data/lib/sprinkle/installers/apt.rb +17 -16
- data/lib/sprinkle/installers/binary.rb +23 -8
- data/lib/sprinkle/installers/brew.rb +17 -10
- data/lib/sprinkle/installers/bsd_port.rb +10 -6
- data/lib/sprinkle/installers/deb.rb +3 -10
- data/lib/sprinkle/installers/freebsd_pkg.rb +5 -11
- data/lib/sprinkle/installers/freebsd_portinstall.rb +8 -2
- data/lib/sprinkle/installers/gem.rb +9 -3
- data/lib/sprinkle/installers/group.rb +28 -4
- data/lib/sprinkle/installers/installer.rb +58 -7
- data/lib/sprinkle/installers/mac_port.rb +13 -6
- data/lib/sprinkle/installers/npm.rb +42 -0
- data/lib/sprinkle/installers/openbsd_pkg.rb +4 -11
- data/lib/sprinkle/installers/opensolaris_pkg.rb +7 -13
- data/lib/sprinkle/installers/package_installer.rb +33 -0
- data/lib/sprinkle/installers/pacman.rb +5 -13
- data/lib/sprinkle/installers/pear.rb +40 -0
- data/lib/sprinkle/installers/push_text.rb +18 -5
- data/lib/sprinkle/installers/rake.rb +7 -2
- data/lib/sprinkle/installers/reconnect.rb +29 -0
- data/lib/sprinkle/installers/replace_text.rb +11 -2
- data/lib/sprinkle/installers/rpm.rb +8 -6
- data/lib/sprinkle/installers/runner.rb +41 -16
- data/lib/sprinkle/installers/smart.rb +6 -17
- data/lib/sprinkle/installers/source.rb +22 -10
- data/lib/sprinkle/installers/thor.rb +7 -0
- data/lib/sprinkle/installers/transfer.rb +62 -41
- data/lib/sprinkle/installers/user.rb +34 -4
- data/lib/sprinkle/installers/yum.rb +10 -10
- data/lib/sprinkle/installers/zypper.rb +4 -15
- data/lib/sprinkle/package.rb +81 -98
- data/lib/sprinkle/policy.rb +11 -4
- data/lib/sprinkle/utility/log_recorder.rb +33 -0
- data/lib/sprinkle/verifiers/directory.rb +1 -1
- data/lib/sprinkle/verifiers/executable.rb +1 -1
- data/lib/sprinkle/verifiers/file.rb +11 -2
- data/lib/sprinkle/verifiers/package.rb +2 -14
- data/lib/sprinkle/verifiers/permission.rb +40 -0
- data/lib/sprinkle/verifiers/symlink.rb +2 -2
- data/lib/sprinkle/verifiers/test.rb +21 -0
- data/lib/sprinkle/verify.rb +3 -3
- data/lib/sprinkle/version.rb +3 -0
- data/spec/fixtures/my_file.txt +1 -0
- data/spec/sprinkle/actors/capistrano_spec.rb +16 -3
- data/spec/sprinkle/actors/local_spec.rb +24 -6
- data/spec/sprinkle/actors/ssh_spec.rb +38 -0
- data/spec/sprinkle/installers/apt_spec.rb +23 -2
- data/spec/sprinkle/installers/binary_spec.rb +22 -14
- data/spec/sprinkle/installers/brew_spec.rb +4 -4
- data/spec/sprinkle/installers/installer_spec.rb +36 -7
- data/spec/sprinkle/installers/npm_spec.rb +16 -0
- data/spec/sprinkle/installers/pear_spec.rb +16 -0
- data/spec/sprinkle/installers/push_text_spec.rb +23 -1
- data/spec/sprinkle/installers/rpm_spec.rb +5 -0
- data/spec/sprinkle/installers/runner_spec.rb +27 -11
- data/spec/sprinkle/installers/smart_spec.rb +60 -0
- data/spec/sprinkle/installers/source_spec.rb +4 -4
- data/spec/sprinkle/installers/transfer_spec.rb +31 -16
- data/spec/sprinkle/package_spec.rb +10 -2
- data/spec/sprinkle/policy_spec.rb +6 -0
- data/spec/sprinkle/verify_spec.rb +18 -4
- data/sprinkle.gemspec +22 -158
- metadata +178 -96
- data/TODO +0 -56
- data/VERSION +0 -1
- data/lib/sprinkle/verifiers/apt.rb +0 -21
- data/lib/sprinkle/verifiers/brew.rb +0 -21
- data/lib/sprinkle/verifiers/rpm.rb +0 -21
- data/lib/sprinkle/verifiers/users_groups.rb +0 -33
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Sprinkle::Installers::Npm do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'spec')
|
7
|
+
@installer = Sprinkle::Installers::Npm.new(@package, 'spec')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'during installation' do
|
11
|
+
it 'should invoke the npm executer for all specified tasks' do
|
12
|
+
@install_commands = @installer.send :install_commands
|
13
|
+
@install_commands.should == "npm install --global spec"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Sprinkle::Installers::Pear do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'spec')
|
7
|
+
@installer = Sprinkle::Installers::Pear.new(@package, 'spec')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'during installation' do
|
11
|
+
it 'should invoke the pear executer for all specified tasks' do
|
12
|
+
@install_commands = @installer.send :install_commands
|
13
|
+
@install_commands.should == "pear install --alldeps spec"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -3,11 +3,13 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::PushText do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package = mock(Sprinkle::Package, :name => 'package')
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package', :sudo? => false)
|
7
7
|
@options = {:sudo => true}
|
8
8
|
end
|
9
9
|
|
10
10
|
def create_text(text, path, options={}, &block)
|
11
|
+
# the old default
|
12
|
+
options.reverse_merge!(:idempotent => false)
|
11
13
|
Sprinkle::Installers::PushText.new(@package, text, path, options, &block)
|
12
14
|
end
|
13
15
|
|
@@ -30,6 +32,26 @@ describe Sprinkle::Installers::PushText do
|
|
30
32
|
end
|
31
33
|
@install_commands = @installer.send :install_commands
|
32
34
|
end
|
35
|
+
|
36
|
+
describe 'with idempotent' do
|
37
|
+
before do
|
38
|
+
@installer = create_text 'another-hair-brained-idea', '/dev/mind/late-night', :idempotent => true
|
39
|
+
@install_commands = @installer.send :install_commands
|
40
|
+
end
|
41
|
+
it "should grep for existing of the string" do
|
42
|
+
@install_commands.should == %q[grep "^another-hair-brained-idea$" /dev/mind/late-night || /bin/echo -e 'another-hair-brained-idea' |tee -a /dev/mind/late-night]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'with sudo' do
|
47
|
+
before do
|
48
|
+
@installer = create_text 'another-hair-brained-idea', '/dev/mind/late-night', :sudo => true
|
49
|
+
@install_commands = @installer.send :install_commands
|
50
|
+
end
|
51
|
+
it 'should invoke sudo if sudo option passed' do
|
52
|
+
@install_commands.should == %q[/bin/echo -e 'another-hair-brained-idea' |sudo tee -a /dev/mind/late-night]
|
53
|
+
end
|
54
|
+
end
|
33
55
|
|
34
56
|
it 'should invoke the push text installer for all specified packages' do
|
35
57
|
@install_commands.should == %q[/bin/echo -e 'another-hair-brained-idea' |tee -a /dev/mind/late-night]
|
@@ -21,6 +21,11 @@ describe Sprinkle::Installers::Rpm do
|
|
21
21
|
@installer = create_rpm %w( gcc gdb g++ )
|
22
22
|
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
23
23
|
end
|
24
|
+
|
25
|
+
it 'should accept a list of packages to install' do
|
26
|
+
@installer = Sprinkle::Installers::Rpm.new(@package, "gcc", "gdb", "g++")
|
27
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
28
|
+
end
|
24
29
|
|
25
30
|
end
|
26
31
|
|
@@ -3,29 +3,45 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Runner do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package = mock(Sprinkle::Package, :name => 'package')
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package', :sudo? => false)
|
7
7
|
end
|
8
8
|
|
9
|
-
def create_runner(
|
10
|
-
|
9
|
+
def create_runner(*cmds)
|
10
|
+
options=cmds.extract_options!
|
11
|
+
Sprinkle::Installers::Runner.new(@package, cmds, options)
|
11
12
|
end
|
12
13
|
|
13
14
|
describe 'when created' do
|
14
15
|
it 'should accept a single cmd to run' do
|
15
16
|
@installer = create_runner 'teste'
|
16
|
-
@installer.
|
17
|
+
@installer.cmds.should == ['teste']
|
17
18
|
end
|
19
|
+
|
20
|
+
it 'should accept an array of commands to run' do
|
21
|
+
@installer = create_runner ['teste', 'world']
|
22
|
+
@installer.cmds.should == ['teste', 'world']
|
23
|
+
@installer.install_sequence.should == ['teste', 'world']
|
24
|
+
end
|
18
25
|
end
|
19
26
|
|
20
|
-
describe 'during
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
describe 'during installation' do
|
28
|
+
|
29
|
+
it 'should use sudo if specified locally' do
|
30
|
+
@installer = create_runner 'teste', :sudo => true
|
31
|
+
@install_commands = @installer.send :install_commands
|
32
|
+
@install_commands.should == ['sudo teste']
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should accept multiple commands" do
|
36
|
+
@installer = create_runner 'teste', 'test2'
|
37
|
+
@install_commands = @installer.send :install_commands
|
38
|
+
@install_commands.should == ['teste','test2']
|
39
|
+
end
|
26
40
|
|
27
41
|
it 'should run the given command for all specified packages' do
|
28
|
-
|
42
|
+
@installer = create_runner 'teste'
|
43
|
+
@install_commands = @installer.send :install_commands
|
44
|
+
@install_commands.should == ['teste']
|
29
45
|
end
|
30
46
|
end
|
31
47
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Sprinkle::Installers::Smart do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_smart(pkgs, &block)
|
10
|
+
Sprinkle::Installers::Smart.new(@package, pkgs, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'when created' do
|
14
|
+
|
15
|
+
it 'should accept a single package to install' do
|
16
|
+
@installer = create_smart 'ruby'
|
17
|
+
@installer.packages.should == [ 'ruby' ]
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should accept an array of packages to install' do
|
21
|
+
@installer = create_smart %w( gcc gdb g++ )
|
22
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should accept a list of packages to install' do
|
26
|
+
@installer = Sprinkle::Installers::Smart.new(@package, "gcc", "gdb", "g++")
|
27
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'during installation' do
|
33
|
+
|
34
|
+
before do
|
35
|
+
@installer = create_smart 'ruby' do
|
36
|
+
pre :install, 'op1'
|
37
|
+
post :install, 'op2'
|
38
|
+
end
|
39
|
+
@install_commands = @installer.send :install_commands
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should invoke the rpm installer for all specified packages' do
|
43
|
+
@install_commands.should == "smart install ruby -y 2>&1 | tee -a /var/log/smart-sprinkle"
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
47
|
+
@installer.send(:install_sequence).should == [ 'op1',
|
48
|
+
'smart install ruby -y 2>&1 | tee -a /var/log/smart-sprinkle', 'op2' ]
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should specify a non interactive mode to the apt installer' do
|
52
|
+
pending
|
53
|
+
end
|
54
|
+
it 'should install a specific version if defined' do
|
55
|
+
pending
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -52,22 +52,22 @@ describe Sprinkle::Installers::Source do
|
|
52
52
|
|
53
53
|
before do
|
54
54
|
@settings = { :prefix => '/usr/local', :archives => '/usr/local/tmp', :builds => '/usr/local/stage' }
|
55
|
+
@settings.each { |k, v| @installer.send k, v }
|
55
56
|
end
|
56
57
|
|
57
58
|
it 'should fail if no installation area has been specified' do
|
58
|
-
@
|
59
|
+
@installer.options[:prefix] = nil
|
59
60
|
end
|
60
61
|
|
61
62
|
it 'should fail if no build area has been specified' do
|
62
|
-
@
|
63
|
+
@installer.options[:builds] = nil
|
63
64
|
end
|
64
65
|
|
65
66
|
it 'should fail if no source download area has been specified' do
|
66
|
-
@
|
67
|
+
@installer.options[:archives] = nil
|
67
68
|
end
|
68
69
|
|
69
70
|
after do
|
70
|
-
@settings.each { |k, v| @installer.send k, v }
|
71
71
|
lambda { @installer.install_sequence }.should raise_error
|
72
72
|
end
|
73
73
|
|
@@ -5,9 +5,9 @@ describe Sprinkle::Installers::Transfer do
|
|
5
5
|
include Sprinkle::Deployment
|
6
6
|
|
7
7
|
before do
|
8
|
-
@package = mock(Sprinkle::Package, :name => 'package')
|
8
|
+
@package = mock(Sprinkle::Package, :name => 'package', :sudo? => false)
|
9
9
|
@empty = Proc.new { }
|
10
|
-
@delivery = mock(Sprinkle::Deployment, :
|
10
|
+
@delivery = mock(Sprinkle::Deployment, :install => true)
|
11
11
|
@source = 'source'
|
12
12
|
@destination = 'destination'
|
13
13
|
@installer = create_transfer(@source, @destination)
|
@@ -33,26 +33,43 @@ describe Sprinkle::Installers::Transfer do
|
|
33
33
|
|
34
34
|
describe 'during installation' do
|
35
35
|
|
36
|
+
context "setting mode and owner" do
|
37
|
+
before do
|
38
|
+
@installer = create_transfer @source, @destination do
|
39
|
+
mode "744"
|
40
|
+
owner "root"
|
41
|
+
end
|
42
|
+
@installer_commands = @installer.install_sequence
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should include command to set owner" do
|
46
|
+
@installer_commands.should include("chmod 744 #{@destination}")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should include command to set mode" do
|
50
|
+
@installer_commands.should include("chown root #{@destination}")
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
36
55
|
context 'single pre/post commands' do
|
37
56
|
before do
|
38
57
|
@installer = create_transfer @source, @destination do
|
39
58
|
pre :install, 'op1'
|
40
59
|
post :install, 'op2'
|
41
60
|
end
|
42
|
-
|
61
|
+
@installer_commands = @installer.install_sequence
|
43
62
|
@delivery = @installer.delivery
|
44
63
|
end
|
45
64
|
|
46
65
|
it "should call the pre and post install commands around the file transfer" do
|
47
|
-
@
|
48
|
-
@delivery.should_receive(:transfer).and_return
|
49
|
-
@delivery.should_receive(:process).with(@package.name, ['op2'], @roles).and_return
|
66
|
+
@installer_commands.should == ["op1",:TRANSFER, "op2"]
|
50
67
|
end
|
51
68
|
|
52
|
-
it "should call transfer with recursive defaulted to nil" do
|
53
|
-
|
54
|
-
|
55
|
-
end
|
69
|
+
# it "should call transfer with recursive defaulted to nil" do
|
70
|
+
# @delivery.should_receive(:process).and_return
|
71
|
+
# @delivery.should_receive(:transfer).with(@package.name, @source, @destination, @roles, nil)
|
72
|
+
# end
|
56
73
|
|
57
74
|
end
|
58
75
|
|
@@ -62,14 +79,12 @@ describe Sprinkle::Installers::Transfer do
|
|
62
79
|
pre :install, 'op1', 'op1-1'
|
63
80
|
post :install, 'op2', 'op2-1'
|
64
81
|
end
|
65
|
-
|
82
|
+
@installer_commands = @installer.install_sequence
|
66
83
|
@delivery = @installer.delivery
|
67
84
|
end
|
68
85
|
|
69
86
|
it "should call the pre and post install commands around the file transfer" do
|
70
|
-
@
|
71
|
-
@delivery.should_receive(:transfer).and_return
|
72
|
-
@delivery.should_receive(:process).with(@package.name, ['op2', 'op2-1'], @roles).and_return
|
87
|
+
@installer_commands.should == ["op1","op1-1",:TRANSFER, "op2","op2-1"]
|
73
88
|
end
|
74
89
|
|
75
90
|
end
|
@@ -95,7 +110,7 @@ describe Sprinkle::Installers::Transfer do
|
|
95
110
|
it "should call transfer with recursive set to false" do
|
96
111
|
@tempfile = Tempfile.new("foo")
|
97
112
|
@installer.should_receive(:render_template_file).with(@source, anything, @package.name).and_return(@tempfile)
|
98
|
-
@
|
113
|
+
@installer.options[:recursive].should == false
|
99
114
|
end
|
100
115
|
|
101
116
|
after do
|
@@ -110,7 +125,7 @@ describe Sprinkle::Installers::Transfer do
|
|
110
125
|
|
111
126
|
it "should call transfer with recursive set to false" do
|
112
127
|
delivery = @installer.delivery
|
113
|
-
|
128
|
+
@installer.options[:recursive].should == false
|
114
129
|
end
|
115
130
|
|
116
131
|
after do
|
@@ -151,7 +151,7 @@ CODE
|
|
151
151
|
pkg.installers.first.class.should == Sprinkle::Installers::Runner
|
152
152
|
@installer = pkg.installers.first
|
153
153
|
@install_commands = @installer.send :install_commands
|
154
|
-
@install_commands.should == 'echo noop'
|
154
|
+
@install_commands.should == ['echo noop']
|
155
155
|
end
|
156
156
|
|
157
157
|
it 'should optionally accept an group installer' do
|
@@ -395,6 +395,12 @@ CODE
|
|
395
395
|
end
|
396
396
|
|
397
397
|
it 'should be able to return a dependency hierarchy tree' do
|
398
|
+
@ai, @bi, @ci, @di, @ei = @a, @b, @c, @d, @e
|
399
|
+
@b.should_receive(:instance).any_number_of_times.and_return(@bi)
|
400
|
+
@c.should_receive(:instance).any_number_of_times.and_return(@ci)
|
401
|
+
@d.should_receive(:instance).any_number_of_times.and_return(@di)
|
402
|
+
@e.should_receive(:instance).any_number_of_times.and_return(@ei)
|
403
|
+
|
398
404
|
@a.tree.flatten.should == [ @d, @c, @b, @a ]
|
399
405
|
@b.tree.flatten.should == [ @d, @c, @b ]
|
400
406
|
@c.tree.flatten.should == [ @d, @c ]
|
@@ -435,7 +441,9 @@ CODE
|
|
435
441
|
end
|
436
442
|
|
437
443
|
it 'should maintain a depth count of how deep the hierarchy is' do
|
438
|
-
|
444
|
+
instance=mock
|
445
|
+
@b.should_receive(:instance).and_return(instance)
|
446
|
+
instance.should_receive(:tree).with(2).and_return([@b])
|
439
447
|
@a.tree do; end
|
440
448
|
end
|
441
449
|
|
@@ -52,6 +52,11 @@ describe Sprinkle::Policy do
|
|
52
52
|
@b = package :b, :provides => :xyz do; end
|
53
53
|
@c = package :c, :provides => :abc do; end
|
54
54
|
@d = package :d, :provides => :abc do; end
|
55
|
+
|
56
|
+
@a.stub!(:instance).and_return(@a)
|
57
|
+
@b.stub!(:instance).and_return(@b)
|
58
|
+
@c.stub!(:instance).and_return(@c)
|
59
|
+
@d.stub!(:instance).and_return(@d)
|
55
60
|
|
56
61
|
@policy = policy :test, :roles => :app do; requires :a; end
|
57
62
|
$terminal.stub!(:choose).and_return(:c) # stub out highline asking questions
|
@@ -70,6 +75,7 @@ describe Sprinkle::Policy do
|
|
70
75
|
it 'should normalize (ie remove duplicates from) the installation order of all packages including dependencies' do
|
71
76
|
@e = package :e do; requires :b; end
|
72
77
|
@policy.requires :e
|
78
|
+
@e.stub!(:instance).and_return(@e)
|
73
79
|
|
74
80
|
@a.should_receive(:process).once.and_return
|
75
81
|
@b.should_receive(:process).once.and_return
|
@@ -12,9 +12,15 @@ describe Sprinkle::Verify do
|
|
12
12
|
# Check that a file contains a substring
|
13
13
|
file_contains 'my_file.txt', 'A sunny day on the lower east-side'
|
14
14
|
|
15
|
+
# Checks that a file matches a local file
|
16
|
+
matches_local File.join(File.dirname(__FILE__), '..', 'fixtures', 'my_file.txt'), 'my_file.txt'
|
17
|
+
|
15
18
|
# Check a directory exists
|
16
19
|
has_directory 'mydir'
|
17
20
|
|
21
|
+
# generic test
|
22
|
+
test "`version` == \"one\""
|
23
|
+
|
18
24
|
# Check for a user
|
19
25
|
has_user "bob"
|
20
26
|
|
@@ -73,12 +79,20 @@ describe Sprinkle::Verify do
|
|
73
79
|
@verification.commands.should include("grep 'A sunny day on the lower east-side' my_file.txt")
|
74
80
|
end
|
75
81
|
|
82
|
+
it 'should do a md5sum to see if a file matches local file' do
|
83
|
+
@verification.commands.should include(%{[ "X$(md5sum my_file.txt|cut -d\\ -f 1)" = "Xed20d984b757ad5291963389fc209864" ]})
|
84
|
+
end
|
85
|
+
|
76
86
|
it 'should do a "test -d" on the has_directory check' do
|
77
87
|
@verification.commands.should include('test -d mydir')
|
78
88
|
end
|
79
89
|
|
80
|
-
it 'should
|
81
|
-
@verification.commands.should include("
|
90
|
+
it 'should include the generic test' do
|
91
|
+
@verification.commands.should include("test `version` == \"one\"")
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should use to check for user in group' do
|
95
|
+
@verification.commands.should include("id -nG alf | xargs -n1 echo | grep alien")
|
82
96
|
end
|
83
97
|
|
84
98
|
it 'should use id to check for user' do
|
@@ -150,12 +164,12 @@ describe Sprinkle::Verify do
|
|
150
164
|
end
|
151
165
|
|
152
166
|
it 'should call process on the delivery with the correct parameters' do
|
153
|
-
@delivery.should_receive(:
|
167
|
+
@delivery.should_receive(:verify).with(@verification, [:app]).once.and_return(true)
|
154
168
|
@verification.process([:app])
|
155
169
|
end
|
156
170
|
|
157
171
|
it 'should raise Sprinkle::VerificationFailed exception when commands fail' do
|
158
|
-
@delivery.should_receive(:
|
172
|
+
@delivery.should_receive(:verify).once.and_return(false)
|
159
173
|
lambda { @verification.process([:app]) }.should raise_error(Sprinkle::VerificationFailed) do |error|
|
160
174
|
error.package.should eql(@package)
|
161
175
|
error.description.should eql('moo')
|
data/sprinkle.gemspec
CHANGED
@@ -1,170 +1,34 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
1
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
2
|
+
s.name = "sprinkle"
|
3
|
+
s.version = "0.5.0.rc1"
|
9
4
|
|
10
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
6
|
s.authors = ["Marcus Crafter"]
|
12
|
-
s.date =
|
13
|
-
s.
|
14
|
-
s.
|
15
|
-
s.email = %q{crafterm@redartisan.com}
|
7
|
+
s.date = "2012-05-05"
|
8
|
+
s.description = "Ruby DSL based software provisioning tool"
|
9
|
+
s.email = "crafterm@redartisan.com"
|
16
10
|
s.executables = ["sprinkle"]
|
17
11
|
s.extra_rdoc_files = [
|
18
|
-
"README.markdown"
|
19
|
-
"TODO"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
"CREDITS",
|
23
|
-
"MIT-LICENSE",
|
24
|
-
"README.markdown",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"bin/sprinkle",
|
28
|
-
"examples/packages/build_essential.rb",
|
29
|
-
"examples/packages/databases/mysql.rb",
|
30
|
-
"examples/packages/databases/sqlite3.rb",
|
31
|
-
"examples/packages/phusion.rb",
|
32
|
-
"examples/packages/ruby/rails.rb",
|
33
|
-
"examples/packages/ruby/ruby.rb",
|
34
|
-
"examples/packages/ruby/rubygems.rb",
|
35
|
-
"examples/packages/scm/git.rb",
|
36
|
-
"examples/packages/scm/subversion.rb",
|
37
|
-
"examples/packages/servers/apache.rb",
|
38
|
-
"examples/rails/README",
|
39
|
-
"examples/rails/deploy.rb",
|
40
|
-
"examples/rails/packages/database.rb",
|
41
|
-
"examples/rails/packages/essential.rb",
|
42
|
-
"examples/rails/packages/rails.rb",
|
43
|
-
"examples/rails/packages/scm.rb",
|
44
|
-
"examples/rails/packages/search.rb",
|
45
|
-
"examples/rails/packages/server.rb",
|
46
|
-
"examples/rails/rails.rb",
|
47
|
-
"examples/sprinkle/sprinkle.rb",
|
48
|
-
"lib/sprinkle.rb",
|
49
|
-
"lib/sprinkle/actors/actors.rb",
|
50
|
-
"lib/sprinkle/actors/capistrano.rb",
|
51
|
-
"lib/sprinkle/actors/local.rb",
|
52
|
-
"lib/sprinkle/actors/ssh.rb",
|
53
|
-
"lib/sprinkle/actors/vlad.rb",
|
54
|
-
"lib/sprinkle/configurable.rb",
|
55
|
-
"lib/sprinkle/deployment.rb",
|
56
|
-
"lib/sprinkle/extensions/arbitrary_options.rb",
|
57
|
-
"lib/sprinkle/extensions/array.rb",
|
58
|
-
"lib/sprinkle/extensions/blank_slate.rb",
|
59
|
-
"lib/sprinkle/extensions/dsl_accessor.rb",
|
60
|
-
"lib/sprinkle/extensions/string.rb",
|
61
|
-
"lib/sprinkle/extensions/symbol.rb",
|
62
|
-
"lib/sprinkle/installers/apt.rb",
|
63
|
-
"lib/sprinkle/installers/binary.rb",
|
64
|
-
"lib/sprinkle/installers/brew.rb",
|
65
|
-
"lib/sprinkle/installers/bsd_port.rb",
|
66
|
-
"lib/sprinkle/installers/deb.rb",
|
67
|
-
"lib/sprinkle/installers/freebsd_pkg.rb",
|
68
|
-
"lib/sprinkle/installers/freebsd_portinstall.rb",
|
69
|
-
"lib/sprinkle/installers/gem.rb",
|
70
|
-
"lib/sprinkle/installers/group.rb",
|
71
|
-
"lib/sprinkle/installers/install_package.rb",
|
72
|
-
"lib/sprinkle/installers/installer.rb",
|
73
|
-
"lib/sprinkle/installers/mac_port.rb",
|
74
|
-
"lib/sprinkle/installers/openbsd_pkg.rb",
|
75
|
-
"lib/sprinkle/installers/opensolaris_pkg.rb",
|
76
|
-
"lib/sprinkle/installers/pacman.rb",
|
77
|
-
"lib/sprinkle/installers/push_text.rb",
|
78
|
-
"lib/sprinkle/installers/rake.rb",
|
79
|
-
"lib/sprinkle/installers/replace_text.rb",
|
80
|
-
"lib/sprinkle/installers/rpm.rb",
|
81
|
-
"lib/sprinkle/installers/runner.rb",
|
82
|
-
"lib/sprinkle/installers/smart.rb",
|
83
|
-
"lib/sprinkle/installers/source.rb",
|
84
|
-
"lib/sprinkle/installers/thor.rb",
|
85
|
-
"lib/sprinkle/installers/transfer.rb",
|
86
|
-
"lib/sprinkle/installers/user.rb",
|
87
|
-
"lib/sprinkle/installers/yum.rb",
|
88
|
-
"lib/sprinkle/installers/zypper.rb",
|
89
|
-
"lib/sprinkle/package.rb",
|
90
|
-
"lib/sprinkle/policy.rb",
|
91
|
-
"lib/sprinkle/script.rb",
|
92
|
-
"lib/sprinkle/verifiers/apt.rb",
|
93
|
-
"lib/sprinkle/verifiers/brew.rb",
|
94
|
-
"lib/sprinkle/verifiers/directory.rb",
|
95
|
-
"lib/sprinkle/verifiers/executable.rb",
|
96
|
-
"lib/sprinkle/verifiers/file.rb",
|
97
|
-
"lib/sprinkle/verifiers/package.rb",
|
98
|
-
"lib/sprinkle/verifiers/process.rb",
|
99
|
-
"lib/sprinkle/verifiers/rpm.rb",
|
100
|
-
"lib/sprinkle/verifiers/ruby.rb",
|
101
|
-
"lib/sprinkle/verifiers/symlink.rb",
|
102
|
-
"lib/sprinkle/verifiers/users_groups.rb",
|
103
|
-
"lib/sprinkle/verify.rb",
|
104
|
-
"script/console",
|
105
|
-
"script/destroy",
|
106
|
-
"script/generate",
|
107
|
-
"spec/spec.opts",
|
108
|
-
"spec/spec_helper.rb",
|
109
|
-
"spec/sprinkle/actors/capistrano_spec.rb",
|
110
|
-
"spec/sprinkle/actors/local_spec.rb",
|
111
|
-
"spec/sprinkle/configurable_spec.rb",
|
112
|
-
"spec/sprinkle/deployment_spec.rb",
|
113
|
-
"spec/sprinkle/extensions/array_spec.rb",
|
114
|
-
"spec/sprinkle/extensions/string_spec.rb",
|
115
|
-
"spec/sprinkle/installers/apt_spec.rb",
|
116
|
-
"spec/sprinkle/installers/binary_spec.rb",
|
117
|
-
"spec/sprinkle/installers/brew_spec.rb",
|
118
|
-
"spec/sprinkle/installers/bsd_port_spec.rb",
|
119
|
-
"spec/sprinkle/installers/freebsd_pkg_spec.rb",
|
120
|
-
"spec/sprinkle/installers/freebsd_portinstall_spec.rb",
|
121
|
-
"spec/sprinkle/installers/gem_spec.rb",
|
122
|
-
"spec/sprinkle/installers/installer_spec.rb",
|
123
|
-
"spec/sprinkle/installers/mac_port_spec.rb",
|
124
|
-
"spec/sprinkle/installers/openbsd_pkg_spec.rb",
|
125
|
-
"spec/sprinkle/installers/opensolaris_pkg_spec.rb",
|
126
|
-
"spec/sprinkle/installers/push_text_spec.rb",
|
127
|
-
"spec/sprinkle/installers/rake_spec.rb",
|
128
|
-
"spec/sprinkle/installers/replace_text_spec.rb",
|
129
|
-
"spec/sprinkle/installers/rpm_spec.rb",
|
130
|
-
"spec/sprinkle/installers/runner_spec.rb",
|
131
|
-
"spec/sprinkle/installers/source_spec.rb",
|
132
|
-
"spec/sprinkle/installers/thor_spec.rb",
|
133
|
-
"spec/sprinkle/installers/transfer_spec.rb",
|
134
|
-
"spec/sprinkle/installers/yum_spec.rb",
|
135
|
-
"spec/sprinkle/installers/zypper_spec.rb",
|
136
|
-
"spec/sprinkle/package_spec.rb",
|
137
|
-
"spec/sprinkle/policy_spec.rb",
|
138
|
-
"spec/sprinkle/script_spec.rb",
|
139
|
-
"spec/sprinkle/sprinkle_spec.rb",
|
140
|
-
"spec/sprinkle/verify_spec.rb",
|
141
|
-
"sprinkle.gemspec"
|
12
|
+
"README.markdown"
|
142
13
|
]
|
143
|
-
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
|
19
|
+
s.homepage = "http://github.com/crafterm/sprinkle"
|
144
20
|
s.require_paths = ["lib"]
|
145
|
-
s.rubyforge_project =
|
146
|
-
s.rubygems_version =
|
147
|
-
s.summary =
|
21
|
+
s.rubyforge_project = "sprinkle"
|
22
|
+
s.rubygems_version = "1.8.15"
|
23
|
+
s.summary = "Ruby DSL based software provisioning tool"
|
148
24
|
|
149
|
-
|
150
|
-
|
25
|
+
s.add_development_dependency(%q<rspec>, [">= 2.5"])
|
26
|
+
s.add_development_dependency(%q<rake>, [">= 0.8.7"])
|
27
|
+
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
28
|
+
s.add_runtime_dependency(%q<open4>, [">= 1.1.0"])
|
29
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
|
30
|
+
s.add_runtime_dependency(%q<highline>, [">= 1.4.0"])
|
31
|
+
s.add_runtime_dependency(%q<capistrano>, [">= 2.5.5"])
|
151
32
|
|
152
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
153
|
-
s.add_development_dependency(%q<rspec>, [">= 2.5"])
|
154
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
|
155
|
-
s.add_runtime_dependency(%q<highline>, [">= 1.4.0"])
|
156
|
-
s.add_runtime_dependency(%q<capistrano>, [">= 2.5.5"])
|
157
|
-
else
|
158
|
-
s.add_dependency(%q<rspec>, [">= 2.5"])
|
159
|
-
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
160
|
-
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
161
|
-
s.add_dependency(%q<capistrano>, [">= 2.5.5"])
|
162
|
-
end
|
163
|
-
else
|
164
|
-
s.add_dependency(%q<rspec>, [">= 2.5"])
|
165
|
-
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
166
|
-
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
167
|
-
s.add_dependency(%q<capistrano>, [">= 2.5.5"])
|
168
|
-
end
|
169
33
|
end
|
170
34
|
|