sprinkle 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +18 -14
- data/Gemfile.lock +11 -11
- data/lib/sprinkle.rb +19 -9
- data/lib/sprinkle/actors/capistrano.rb +2 -1
- data/lib/sprinkle/actors/dummy.rb +3 -3
- data/lib/sprinkle/actors/local.rb +7 -9
- data/lib/sprinkle/actors/ssh.rb +5 -5
- data/lib/sprinkle/deployment.rb +2 -1
- data/lib/sprinkle/extensions/sudo.rb +8 -4
- data/lib/sprinkle/installers/installer.rb +48 -37
- data/lib/sprinkle/installers/npm.rb +31 -30
- data/lib/sprinkle/installers/source.rb +6 -6
- data/lib/sprinkle/installers/user.rb +7 -6
- data/lib/sprinkle/package.rb +55 -51
- data/lib/sprinkle/package/chooser.rb +5 -4
- data/lib/sprinkle/package/rendering.rb +2 -2
- data/lib/sprinkle/policy.rb +13 -13
- data/lib/sprinkle/script.rb +5 -1
- data/lib/sprinkle/verify.rb +1 -0
- data/lib/sprinkle/version.rb +1 -1
- data/spec/spec_helper.rb +13 -7
- data/spec/sprinkle/actors/capistrano_spec.rb +18 -18
- data/spec/sprinkle/actors/local_spec.rb +3 -3
- data/spec/sprinkle/deployment_spec.rb +3 -3
- data/spec/sprinkle/installers/apt_spec.rb +1 -1
- data/spec/sprinkle/installers/binary_spec.rb +1 -1
- data/spec/sprinkle/installers/brew_spec.rb +1 -1
- data/spec/sprinkle/installers/bsd_port_spec.rb +1 -1
- data/spec/sprinkle/installers/file_spec.rb +9 -9
- data/spec/sprinkle/installers/freebsd_pkg_spec.rb +1 -1
- data/spec/sprinkle/installers/freebsd_portinstall_spec.rb +1 -1
- data/spec/sprinkle/installers/gem_spec.rb +1 -1
- data/spec/sprinkle/installers/installer_spec.rb +62 -25
- data/spec/sprinkle/installers/mac_port_spec.rb +1 -1
- data/spec/sprinkle/installers/npm_spec.rb +1 -1
- data/spec/sprinkle/installers/openbsd_pkg_spec.rb +1 -1
- data/spec/sprinkle/installers/opensolaris_pkg_spec.rb +1 -1
- data/spec/sprinkle/installers/pear_spec.rb +1 -1
- data/spec/sprinkle/installers/push_text_spec.rb +12 -12
- data/spec/sprinkle/installers/rake_spec.rb +1 -1
- data/spec/sprinkle/installers/replace_text_spec.rb +10 -10
- data/spec/sprinkle/installers/rpm_spec.rb +1 -1
- data/spec/sprinkle/installers/runner_spec.rb +9 -9
- data/spec/sprinkle/installers/smart_spec.rb +1 -1
- data/spec/sprinkle/installers/source_spec.rb +22 -27
- data/spec/sprinkle/installers/thor_spec.rb +1 -1
- data/spec/sprinkle/installers/transfer_spec.rb +35 -35
- data/spec/sprinkle/installers/user_spec.rb +13 -7
- data/spec/sprinkle/installers/yum_spec.rb +1 -1
- data/spec/sprinkle/installers/zypper_spec.rb +1 -1
- data/spec/sprinkle/package/package_repository_spec.rb +7 -7
- data/spec/sprinkle/package_spec.rb +58 -58
- data/spec/sprinkle/policy_spec.rb +20 -20
- data/spec/sprinkle/script_spec.rb +1 -1
- data/spec/sprinkle/verify_spec.rb +2 -2
- metadata +2 -2
@@ -4,11 +4,11 @@ describe Sprinkle::Installers::Installer do
|
|
4
4
|
include Sprinkle::Deployment
|
5
5
|
|
6
6
|
before do
|
7
|
-
@package =
|
7
|
+
@package = double(Sprinkle::Package, :name => 'package', :sudo? => false)
|
8
8
|
@empty = Proc.new { }
|
9
9
|
@sequence = ['op1', 'op2']
|
10
|
-
@delivery =
|
11
|
-
:sudo_command => "sudo")
|
10
|
+
@delivery = double(Sprinkle::Deployment, :process => true, :install => true,
|
11
|
+
:sudo_command => "sudo", :sudo? => false)
|
12
12
|
@installer = create_installer
|
13
13
|
@installer.delivery = @delivery
|
14
14
|
@roles = []
|
@@ -20,7 +20,7 @@ describe Sprinkle::Installers::Installer do
|
|
20
20
|
|
21
21
|
def create_installer(&block)
|
22
22
|
installer = Sprinkle::Installers::Installer.new @package, &block
|
23
|
-
installer.stub
|
23
|
+
installer.stub(:puts).and_return
|
24
24
|
|
25
25
|
# this is actually an abstract class so we'll insert a few fake install sequences
|
26
26
|
class << installer
|
@@ -69,7 +69,7 @@ describe Sprinkle::Installers::Installer do
|
|
69
69
|
|
70
70
|
before do
|
71
71
|
Sprinkle::OPTIONS[:testing] = true
|
72
|
-
@logger =
|
72
|
+
@logger = double(:debug => true, :debug? => true)
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should not invoke the delivery mechanism with the install sequence' do
|
@@ -81,37 +81,75 @@ describe Sprinkle::Installers::Installer do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
|
+
describe "with sudo from actor level" do
|
86
|
+
before do
|
87
|
+
@installer = Sprinkle::Installers::Installer.new @package
|
88
|
+
@installer.package = double(Sprinkle::Package, :name => 'package', :sudo? => nil)
|
89
|
+
@installer.delivery = double(Sprinkle::Deployment, :process => true, :install => true,
|
90
|
+
:sudo_command => "sudo -p blah", :sudo? => true)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should know it uses sudo" do
|
94
|
+
@installer.sudo?.should == true
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should offer up the sudo command" do
|
98
|
+
@installer.sudo_cmd.should =~ /sudo /
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
85
103
|
describe "with sudo from package level" do
|
86
104
|
before do
|
87
|
-
@installer.package =
|
105
|
+
@installer.package = double(Sprinkle::Package, :name => 'package', :sudo? => true)
|
88
106
|
end
|
89
|
-
|
107
|
+
|
90
108
|
it "should know it uses sudo" do
|
91
109
|
@installer.sudo?.should == true
|
92
110
|
end
|
93
|
-
|
111
|
+
|
94
112
|
it "should offer up the sudo command" do
|
95
113
|
@installer.sudo_cmd.should =~ /sudo /
|
96
|
-
end
|
114
|
+
end
|
97
115
|
end
|
98
|
-
|
116
|
+
|
117
|
+
describe "with sudo false" do
|
118
|
+
before do
|
119
|
+
@installer = Sprinkle::Installers::Installer.new @package, :sudo => false
|
120
|
+
@installer.package = double(Sprinkle::Package, :name => 'package', :sudo? => true)
|
121
|
+
@installer.delivery = @delivery
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should override package sudo true" do
|
125
|
+
@installer.sudo?.should == false
|
126
|
+
@installer.sudo_cmd.should_not =~ /sudo /
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should override delivery sudo true" do
|
130
|
+
@installer.package = double(Sprinkle::Package, :name => 'package', :sudo? => nil)
|
131
|
+
@installer.delivery = double(Sprinkle::Deployment, :process => true, :install => true,
|
132
|
+
:sudo_command => "sudo ", :sudo? => true)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
99
137
|
describe "with sudo" do
|
100
138
|
before do
|
101
139
|
@installer = Sprinkle::Installers::Installer.new @package, :sudo => true
|
102
140
|
@installer.delivery = @delivery
|
103
141
|
end
|
104
|
-
|
142
|
+
|
105
143
|
it "should use sudo command from actor" do
|
106
|
-
@installer.delivery =
|
107
|
-
:sudo_command => "sudo -p blah")
|
108
|
-
@installer.sudo_cmd.should =~ /sudo -p blah /
|
144
|
+
@installer.delivery = double(Sprinkle::Deployment, :process => true, :install => true,
|
145
|
+
:sudo_command => "sudo -p blah", :sudo? => false)
|
146
|
+
@installer.sudo_cmd.should =~ /sudo -p blah /
|
109
147
|
end
|
110
|
-
|
148
|
+
|
111
149
|
it "should know it uses sudo" do
|
112
150
|
@installer.sudo?.should == true
|
113
151
|
end
|
114
|
-
|
152
|
+
|
115
153
|
it "should offer up the sudo command" do
|
116
154
|
@installer.sudo_cmd.should =~ /sudo /
|
117
155
|
end
|
@@ -122,25 +160,24 @@ describe Sprinkle::Installers::Installer do
|
|
122
160
|
@delivery.should_receive(:install).with(@installer, @roles, :per_host => false)
|
123
161
|
end
|
124
162
|
end
|
125
|
-
|
163
|
+
|
126
164
|
describe "with a pre command" do
|
127
|
-
|
128
165
|
def create_installer_with_pre_command(cmd = nil, &block)
|
129
166
|
installer = Sprinkle::Installers::Installer.new @package do
|
130
167
|
pre :install, cmd if cmd
|
131
|
-
|
168
|
+
|
132
169
|
def install_commands
|
133
170
|
["installer"]
|
134
|
-
end
|
171
|
+
end
|
135
172
|
end
|
136
|
-
installer.instance_eval
|
137
|
-
installer.stub
|
173
|
+
installer.instance_eval(&block) if block
|
174
|
+
installer.stub(:puts).and_return
|
138
175
|
installer.delivery = @delivery
|
139
176
|
installer
|
140
177
|
end
|
141
178
|
before do
|
142
179
|
@installer = create_installer_with_pre_command('run')
|
143
|
-
@package.stub
|
180
|
+
@package.stub(:installers).and_return []
|
144
181
|
end
|
145
182
|
describe "string commands" do
|
146
183
|
it "should insert the pre command for the specific package in the installation process" do
|
@@ -164,7 +201,7 @@ describe Sprinkle::Installers::Installer do
|
|
164
201
|
end
|
165
202
|
end
|
166
203
|
describe "blocks as commands" do
|
167
|
-
before(:each) do
|
204
|
+
before(:each) do
|
168
205
|
@package = Package.new("package") do; end
|
169
206
|
@installer = create_installer_with_pre_command do
|
170
207
|
pre :install do
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::MacPort do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package')
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_port(ports, &block)
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Npm do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'spec')
|
7
7
|
@installer = Sprinkle::Installers::Npm.new(@package, 'spec')
|
8
8
|
end
|
9
9
|
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::OpenbsdPkg do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package')
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_pkg(pkgs, &block)
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::OpensolarisPkg do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package')
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_pkg(pkgs, &block)
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Pear do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'spec')
|
7
7
|
@installer = Sprinkle::Installers::Pear.new(@package, 'spec')
|
8
8
|
end
|
9
9
|
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::PushText do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package', :sudo? => false)
|
7
7
|
@options = {:sudo => true}
|
8
8
|
end
|
9
9
|
|
@@ -17,8 +17,8 @@ describe Sprinkle::Installers::PushText do
|
|
17
17
|
|
18
18
|
it 'should accept a single package to install' do
|
19
19
|
@installer = create_text 'crazy-configuration-methods', '/etc/doomed/file.conf'
|
20
|
-
@installer.text.should
|
21
|
-
@installer.path.should
|
20
|
+
@installer.text.should eq 'crazy-configuration-methods'
|
21
|
+
@installer.path.should eq '/etc/doomed/file.conf'
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -39,7 +39,7 @@ describe Sprinkle::Installers::PushText do
|
|
39
39
|
@install_commands = @installer.send :install_commands
|
40
40
|
end
|
41
41
|
it "should grep for existing of the string" do
|
42
|
-
@install_commands.should
|
42
|
+
@install_commands.should eq %q<grep -qPzo '^another\-hair\-brained\-idea$' /dev/mind/late-night || /bin/echo -e 'another-hair-brained-idea' |tee -a /dev/mind/late-night>
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -54,7 +54,7 @@ MULTI
|
|
54
54
|
@install_commands = @installer.send :install_commands
|
55
55
|
end
|
56
56
|
it "should grep for existence of the string" do
|
57
|
-
@install_commands.should
|
57
|
+
@install_commands.should eq %q<grep -qPzo '^\^search\(\ \[adnor\]\{2,3\}\ rescue\)\?\$\n\^fries\(\ \[adnor\]\{2,3\}\ barbecue\)\?\n\^songs\(\ \[adnor\]\{2,3\}\ autocue\)\?$' /dev/mind/late-night || /bin/echo -e '^search( [adnor]{2,3} rescue)?$\n^fries( [adnor]{2,3} barbecue)?\n^songs( [adnor]{2,3} autocue)?' |tee -a /dev/mind/late-night>
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -64,16 +64,16 @@ MULTI
|
|
64
64
|
@install_commands = @installer.send :install_commands
|
65
65
|
end
|
66
66
|
it 'should invoke sudo if sudo option passed' do
|
67
|
-
@install_commands.should
|
67
|
+
@install_commands.should eq %q[/bin/echo -e 'another-hair-brained-idea' |sudo tee -a /dev/mind/late-night]
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should invoke the push text installer for all specified packages' do
|
72
|
-
@install_commands.should
|
72
|
+
@install_commands.should eq %q[/bin/echo -e 'another-hair-brained-idea' |tee -a /dev/mind/late-night]
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should automatically insert pre/post commands for the specified package' do
|
76
|
-
@installer.send(:install_sequence).should
|
76
|
+
@installer.send(:install_sequence).should eq [ 'op1', "/bin/echo -e 'another-hair-brained-idea' |tee -a /dev/mind/late-night", 'op2' ]
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
@@ -85,7 +85,7 @@ MULTI
|
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should invoke the push installer with sudo" do
|
88
|
-
@install_commands.should
|
88
|
+
@install_commands.should eq %q[/bin/echo -e 'a special user' |sudo tee -a /dev/mind/the-day-after]
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -94,13 +94,13 @@ MULTI
|
|
94
94
|
it "should not escape an ampersand" do
|
95
95
|
@installer = create_text "bob & lucy", "/dev/mind/the-day-after"
|
96
96
|
@install_commands = @installer.send :install_commands
|
97
|
-
@install_commands.should
|
97
|
+
@install_commands.should eq %q[/bin/echo -e 'bob & lucy' |tee -a /dev/mind/the-day-after]
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should not escape a slash" do
|
101
101
|
@installer = create_text "bob/lucy", "/dev/mind/the-day-after"
|
102
102
|
@install_commands = @installer.send :install_commands
|
103
|
-
@install_commands.should
|
103
|
+
@install_commands.should eq %q[/bin/echo -e 'bob/lucy' |tee -a /dev/mind/the-day-after]
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -111,7 +111,7 @@ MULTI
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should correctly encode the single quote character" do
|
114
|
-
@install_commands.should
|
114
|
+
@install_commands.should eq %q[/bin/echo -e 'I'\''m a string with a single quote' |tee -a /dev/mind/the-day-after]
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Rake do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'spec')
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_rake(names, options = {}, &block)
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::ReplaceText do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package', :sudo? => false)
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_replacement_text(regex, text, path, options={}, &block)
|
@@ -14,16 +14,16 @@ describe Sprinkle::Installers::ReplaceText do
|
|
14
14
|
|
15
15
|
it 'should accept text to replace, replacement, and path' do
|
16
16
|
@installer = create_replacement_text 'text_to_replace', 'new_text', '/etc/example/foo.conf'
|
17
|
-
@installer.regex.should
|
18
|
-
@installer.text.should
|
19
|
-
@installer.path.should
|
17
|
+
@installer.regex.should eq 'text_to_replace'
|
18
|
+
@installer.text.should eq 'new_text'
|
19
|
+
@installer.path.should eq '/etc/example/foo.conf'
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should not escape original search string and replacement' do
|
23
23
|
@installer = create_replacement_text "some option with 'quotes' & ampersand", "other 'quotes' & ampersand", '/etc/example/foo.conf'
|
24
|
-
@installer.regex.should
|
25
|
-
@installer.text.should
|
26
|
-
@installer.path.should
|
24
|
+
@installer.regex.should eq %q[some option with 'quotes' & ampersand]
|
25
|
+
@installer.text.should eq %q[other 'quotes' & ampersand]
|
26
|
+
@installer.path.should eq '/etc/example/foo.conf'
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -39,16 +39,16 @@ describe Sprinkle::Installers::ReplaceText do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should invoke the replace text installer for all specified packages' do
|
42
|
-
@install_commands.should
|
42
|
+
@install_commands.should eq %q[sed -i 's/bad option/super option/g' /etc/brand/new.conf]
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should automatically insert pre/post commands for the specified package' do
|
46
|
-
@installer.send(:install_sequence).should
|
46
|
+
@installer.send(:install_sequence).should eq [ 'op1', "sed -i 's/bad option/super option/g' /etc/brand/new.conf", 'op2' ]
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should correctly escape search string and replacement' do
|
50
50
|
installer = create_replacement_text "some option with 'quotes' & ampersand", "other 'quotes' & ampersand", '/etc/example/foo.conf'
|
51
|
-
installer.send(:install_commands).should
|
51
|
+
installer.send(:install_commands).should eq "sed -i 's/some option with '\\''quotes'\\'' \\& ampersand/other '\\''quotes'\\'' \\& ampersand/g' /etc/example/foo.conf"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Rpm do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package')
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_rpm(debs, &block)
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Runner do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package', :sudo? => false)
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_runner(*cmds)
|
@@ -14,13 +14,13 @@ describe Sprinkle::Installers::Runner do
|
|
14
14
|
describe 'when created' do
|
15
15
|
it 'should accept a single cmd to run' do
|
16
16
|
@installer = create_runner 'teste'
|
17
|
-
@installer.cmds.should
|
17
|
+
@installer.cmds.should eq ['teste']
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should accept an array of commands to run' do
|
21
21
|
@installer = create_runner ['teste', 'world']
|
22
|
-
@installer.cmds.should
|
23
|
-
@installer.install_sequence.should
|
22
|
+
@installer.cmds.should eq ['teste', 'world']
|
23
|
+
@installer.install_sequence.should eq ['teste', 'world']
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -29,7 +29,7 @@ describe Sprinkle::Installers::Runner do
|
|
29
29
|
it 'should use sudo if specified locally' do
|
30
30
|
@installer = create_runner 'teste', :sudo => true
|
31
31
|
@install_commands = @installer.send :install_commands
|
32
|
-
@install_commands.should
|
32
|
+
@install_commands.should eq ['sudo teste']
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should accept env options and convert to uppercase" do
|
@@ -42,8 +42,8 @@ describe Sprinkle::Installers::Runner do
|
|
42
42
|
@install_commands = @installer.send :install_commands
|
43
43
|
command_parts = @install_commands.first.split(/ /)
|
44
44
|
|
45
|
-
command_parts.shift.should
|
46
|
-
command_parts.pop.should
|
45
|
+
command_parts.shift.should eq 'env'
|
46
|
+
command_parts.pop.should eq 'command1'
|
47
47
|
|
48
48
|
command_parts.should =~ ['PATH=/some/path', 'USER=deploy', 'Z=foo', 'A=bar']
|
49
49
|
|
@@ -52,13 +52,13 @@ describe Sprinkle::Installers::Runner do
|
|
52
52
|
it "should accept multiple commands" do
|
53
53
|
@installer = create_runner 'teste', 'test2'
|
54
54
|
@install_commands = @installer.send :install_commands
|
55
|
-
@install_commands.should
|
55
|
+
@install_commands.should eq ['teste','test2']
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should run the given command for all specified packages' do
|
59
59
|
@installer = create_runner 'teste'
|
60
60
|
@install_commands = @installer.send :install_commands
|
61
|
-
@install_commands.should
|
61
|
+
@install_commands.should eq ['teste']
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
|
3
3
|
describe Sprinkle::Installers::Smart do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@package =
|
6
|
+
@package = double(Sprinkle::Package, :name => 'package')
|
7
7
|
end
|
8
8
|
|
9
9
|
def create_smart(pkgs, &block)
|
@@ -35,7 +35,7 @@ describe Sprinkle::Installers::Source do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def create_source(source, version = nil, &block)
|
38
|
-
@package =
|
38
|
+
@package = double(Sprinkle::Package, :name => 'package', :version => version,
|
39
39
|
:installer_methods => [])
|
40
40
|
|
41
41
|
Sprinkle::Installers::Source.new(@package, source, &block)
|
@@ -44,7 +44,7 @@ describe Sprinkle::Installers::Source do
|
|
44
44
|
describe 'when created' do
|
45
45
|
|
46
46
|
it 'should accept a source archive name to install' do
|
47
|
-
@installer.source.should
|
47
|
+
@installer.source.should eq @source
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -77,35 +77,35 @@ describe Sprinkle::Installers::Source do
|
|
77
77
|
describe 'customized configuration' do
|
78
78
|
|
79
79
|
it 'should support specification of "enable" options' do
|
80
|
-
@installer.enable.should
|
80
|
+
@installer.enable.should eq %w( headers ssl deflate so )
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'should support specification of "disable" options' do
|
84
|
-
@installer.disable.should
|
84
|
+
@installer.disable.should eq %w( cache proxy rewrite )
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'should support specification of "with" options' do
|
88
|
-
@installer.with.should
|
88
|
+
@installer.with.should eq %w( debug extras )
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'should support specification of "without" options' do
|
92
|
-
@installer.without.should
|
92
|
+
@installer.without.should eq %w( fancyisms pandas )
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'should support specification of "option" options' do
|
96
|
-
@installer.option.should
|
96
|
+
@installer.option.should eq %w( foo bar baz )
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'should support customized build area' do
|
100
|
-
@installer.prefix.should
|
100
|
+
@installer.prefix.should eq '/usr/local'
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should support customized source area' do
|
104
|
-
@installer.archives.should
|
104
|
+
@installer.archives.should eq '/usr/local/archives'
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'should support customized install area' do
|
108
|
-
@installer.builds.should
|
108
|
+
@installer.builds.should eq '/usr/local/builds'
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -116,8 +116,7 @@ describe Sprinkle::Installers::Source do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
it "should prepare the build, installation and source archives area with correct paths" do
|
119
|
-
@installer.send(:prepare).should
|
120
|
-
[
|
119
|
+
@installer.send(:prepare).should eq [
|
121
120
|
'mkdir -p /usr/local',
|
122
121
|
'mkdir -p /usr/local/builds',
|
123
122
|
'mkdir -p /usr/local/archives'
|
@@ -129,8 +128,7 @@ describe Sprinkle::Installers::Source do
|
|
129
128
|
end
|
130
129
|
|
131
130
|
it 'should download the source archive to the correct path' do
|
132
|
-
@installer.send(:download).should
|
133
|
-
[
|
131
|
+
@installer.send(:download).should eq [
|
134
132
|
"wget -cq -O '/usr/local/archives/#{@source.split('/').last}' #{@source}"
|
135
133
|
]
|
136
134
|
end
|
@@ -140,8 +138,7 @@ describe Sprinkle::Installers::Source do
|
|
140
138
|
end
|
141
139
|
|
142
140
|
it 'should extract the source to the correct path' do
|
143
|
-
@installer.send(:extract).should
|
144
|
-
[
|
141
|
+
@installer.send(:extract).should eq [
|
145
142
|
"bash -c 'cd /usr/local/builds && tar xzf /usr/local/archives/ruby-1.8.6-p111.tar.gz'"
|
146
143
|
]
|
147
144
|
end
|
@@ -177,8 +174,7 @@ describe Sprinkle::Installers::Source do
|
|
177
174
|
end
|
178
175
|
|
179
176
|
it 'should build the source in the correct build path' do
|
180
|
-
@installer.send(:build).should
|
181
|
-
[
|
177
|
+
@installer.send(:build).should eq [
|
182
178
|
"bash -c 'cd /usr/local/builds/#{@filename} && make > #{@package.name}-build.log 2>&1'"
|
183
179
|
]
|
184
180
|
end
|
@@ -188,8 +184,7 @@ describe Sprinkle::Installers::Source do
|
|
188
184
|
end
|
189
185
|
|
190
186
|
it 'should install the source from the correct build path' do
|
191
|
-
@installer.send(:install).should
|
192
|
-
[
|
187
|
+
@installer.send(:install).should eq [
|
193
188
|
"bash -c 'cd /usr/local/builds/#{@filename} && make install > #{@package.name}-install.log 2>&1'"
|
194
189
|
]
|
195
190
|
end
|
@@ -237,9 +232,9 @@ describe Sprinkle::Installers::Source do
|
|
237
232
|
end
|
238
233
|
|
239
234
|
it 'should store the custom commands' do
|
240
|
-
@installer.options[:configure_command].should
|
241
|
-
@installer.options[:build_command].should
|
242
|
-
@installer.options[:install_command].should
|
235
|
+
@installer.options[:configure_command].should eq './custom-configure'
|
236
|
+
@installer.options[:build_command].should eq 'custom-make'
|
237
|
+
@installer.options[:install_command].should eq 'custom-make install'
|
243
238
|
end
|
244
239
|
|
245
240
|
it 'should use the custom commands' do
|
@@ -261,7 +256,7 @@ describe Sprinkle::Installers::Source do
|
|
261
256
|
end
|
262
257
|
|
263
258
|
it 'should store the custom install commands' do
|
264
|
-
@installer.options[:custom_install].first.should
|
259
|
+
@installer.options[:custom_install].first.should eq 'ruby setup.rb'
|
265
260
|
end
|
266
261
|
|
267
262
|
it 'should identify as having a custom install command' do
|
@@ -295,7 +290,7 @@ describe Sprinkle::Installers::Source do
|
|
295
290
|
end
|
296
291
|
|
297
292
|
it 'should store the custom build dir path' do
|
298
|
-
@installer.options[:custom_dir].should
|
293
|
+
@installer.options[:custom_dir].should eq 'test'
|
299
294
|
end
|
300
295
|
|
301
296
|
end
|
@@ -424,7 +419,7 @@ describe Sprinkle::Installers::Source do
|
|
424
419
|
end
|
425
420
|
|
426
421
|
after do
|
427
|
-
@installer.send(:extract_command).should
|
422
|
+
@installer.send(:extract_command).should eq @extraction
|
428
423
|
end
|
429
424
|
|
430
425
|
end
|
@@ -435,7 +430,7 @@ describe Sprinkle::Installers::Source do
|
|
435
430
|
|
436
431
|
it "should recognize #{archive} style archives" do
|
437
432
|
@installer.source = "blah.#{archive}"
|
438
|
-
@installer.send(:base_dir).should
|
433
|
+
@installer.send(:base_dir).should eq 'blah'
|
439
434
|
end
|
440
435
|
|
441
436
|
end
|