justsee-sprinkle 0.2.4
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/CREDITS +22 -0
- data/History.txt +4 -0
- data/MIT-LICENSE +20 -0
- data/Manifest.txt +100 -0
- data/README.txt +241 -0
- data/Rakefile +4 -0
- data/bin/sprinkle +86 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +17 -0
- data/examples/packages/build_essential.rb +9 -0
- data/examples/packages/databases/mysql.rb +13 -0
- data/examples/packages/databases/sqlite3.rb +16 -0
- data/examples/packages/phusion.rb +55 -0
- data/examples/packages/ruby/rails.rb +9 -0
- data/examples/packages/ruby/ruby.rb +17 -0
- data/examples/packages/ruby/rubygems.rb +17 -0
- data/examples/packages/scm/git.rb +11 -0
- data/examples/packages/scm/subversion.rb +4 -0
- data/examples/packages/servers/apache.rb +15 -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 +9 -0
- data/examples/rails/packages/rails.rb +28 -0
- data/examples/rails/packages/scm.rb +11 -0
- data/examples/rails/packages/search.rb +11 -0
- data/examples/rails/packages/server.rb +28 -0
- data/examples/rails/rails.rb +73 -0
- data/examples/sprinkle/sprinkle.rb +38 -0
- data/lib/sprinkle.rb +32 -0
- data/lib/sprinkle/actors/actors.rb +17 -0
- data/lib/sprinkle/actors/capistrano.rb +124 -0
- data/lib/sprinkle/actors/local.rb +30 -0
- data/lib/sprinkle/actors/ssh.rb +81 -0
- data/lib/sprinkle/actors/vlad.rb +65 -0
- data/lib/sprinkle/configurable.rb +31 -0
- data/lib/sprinkle/deployment.rb +73 -0
- data/lib/sprinkle/extensions/arbitrary_options.rb +10 -0
- data/lib/sprinkle/extensions/array.rb +5 -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 +52 -0
- data/lib/sprinkle/installers/bsd_port.rb +33 -0
- data/lib/sprinkle/installers/deb.rb +38 -0
- data/lib/sprinkle/installers/freebsd_pkg.rb +37 -0
- data/lib/sprinkle/installers/gem.rb +63 -0
- data/lib/sprinkle/installers/installer.rb +120 -0
- data/lib/sprinkle/installers/mac_port.rb +38 -0
- data/lib/sprinkle/installers/openbsd_pkg.rb +47 -0
- data/lib/sprinkle/installers/opensolaris_pkg.rb +43 -0
- data/lib/sprinkle/installers/push_text.rb +45 -0
- data/lib/sprinkle/installers/rake.rb +37 -0
- data/lib/sprinkle/installers/rpm.rb +37 -0
- data/lib/sprinkle/installers/source.rb +179 -0
- data/lib/sprinkle/installers/yum.rb +37 -0
- data/lib/sprinkle/package.rb +275 -0
- data/lib/sprinkle/policy.rb +125 -0
- data/lib/sprinkle/script.rb +23 -0
- data/lib/sprinkle/verifiers/directory.rb +16 -0
- data/lib/sprinkle/verifiers/executable.rb +36 -0
- data/lib/sprinkle/verifiers/file.rb +26 -0
- data/lib/sprinkle/verifiers/process.rb +21 -0
- data/lib/sprinkle/verifiers/ruby.rb +25 -0
- data/lib/sprinkle/verifiers/symlink.rb +30 -0
- data/lib/sprinkle/verify.rb +114 -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/actors/local_spec.rb +29 -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 +70 -0
- data/spec/sprinkle/installers/bsd_port_spec.rb +42 -0
- data/spec/sprinkle/installers/freebsd_pkg_spec.rb +49 -0
- data/spec/sprinkle/installers/gem_spec.rb +91 -0
- data/spec/sprinkle/installers/installer_spec.rb +151 -0
- data/spec/sprinkle/installers/mac_port_spec.rb +42 -0
- data/spec/sprinkle/installers/openbsd_pkg_spec.rb +49 -0
- data/spec/sprinkle/installers/opensolaris_pkg_spec.rb +49 -0
- data/spec/sprinkle/installers/push_text_spec.rb +55 -0
- data/spec/sprinkle/installers/rake_spec.rb +29 -0
- data/spec/sprinkle/installers/rpm_spec.rb +50 -0
- data/spec/sprinkle/installers/source_spec.rb +331 -0
- data/spec/sprinkle/installers/yum_spec.rb +49 -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 +167 -0
- data/sprinkle.gemspec +73 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- metadata +195 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::BsdPort do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_port(ports, &block)
|
|
10
|
+
Sprinkle::Installers::BsdPort.new(@package, ports, &block)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'when created' do
|
|
14
|
+
|
|
15
|
+
it 'should accept a single package to install' do
|
|
16
|
+
@installer = create_port 'lang/ruby'
|
|
17
|
+
@installer.port.should == 'lang/ruby'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'during installation' do
|
|
23
|
+
|
|
24
|
+
before do
|
|
25
|
+
@installer = create_port 'lang/ruby' do
|
|
26
|
+
pre :install, 'op1'
|
|
27
|
+
post :install, 'op2'
|
|
28
|
+
end
|
|
29
|
+
@install_commands = @installer.send :install_commands
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should invoke the port installer for all specified packages' do
|
|
33
|
+
@install_commands.should =~ /cd \/usr\/ports\/lang\/ruby && make BATCH=yes install clean/
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
|
37
|
+
@installer.send(:install_sequence).should == [ 'op1', 'sh -c \'cd /usr/ports/lang/ruby && make BATCH=yes install clean\'', 'op2' ]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::FreebsdPkg do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_pkg(pkgs, &block)
|
|
10
|
+
Sprinkle::Installers::FreebsdPkg.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_pkg 'ruby'
|
|
17
|
+
@installer.packages.should == [ 'ruby' ]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'should accept an array of packages to install' do
|
|
21
|
+
@installer = create_pkg %w( gcc gdb g++ )
|
|
22
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'during installation' do
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
@installer = create_pkg 'ruby' do
|
|
31
|
+
pre :install, 'op1'
|
|
32
|
+
post :install, 'op2'
|
|
33
|
+
end
|
|
34
|
+
@install_commands = @installer.send :install_commands
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should invoke the freebsd_pkg installer for all specified packages' do
|
|
38
|
+
@install_commands.should =~ /pkg_add -r ruby/
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
|
42
|
+
@installer.send(:install_sequence).should == [ 'op1', 'pkg_add -r ruby', 'op2' ]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'should install a specific version if defined'
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::Gem do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@gem = 'rails'
|
|
7
|
+
@version = '2.0.2'
|
|
8
|
+
@options = { :source => 'http://gems.github.com/', :repository => '/tmp/gems', :build_flags => '--build_flag=foo' }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create_gem(gem, version = nil, options = {}, &block)
|
|
12
|
+
@package = mock(Sprinkle::Package, :name => gem, :version => version, :source => nil, :repository => nil)
|
|
13
|
+
Sprinkle::Installers::Gem.new(@package, gem, options, &block)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe 'when created' do
|
|
17
|
+
|
|
18
|
+
before do
|
|
19
|
+
@installer = create_gem @gem, @version, @options
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'should accept a single package to install' do
|
|
23
|
+
@installer.gem.should == @gem
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should optionally store a version of the gem to install' do
|
|
27
|
+
@installer.version.should == '2.0.2'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should optionally store a source location of the gem to install' do
|
|
31
|
+
@installer.source.should == 'http://gems.github.com/'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should optionally store the repository location where gems are to be installed' do
|
|
35
|
+
@installer.repository.should == @options[:repository]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'should optionally store the build flags' do
|
|
39
|
+
@installer.build_flags.should == @options[:build_flags]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe 'during installation' do
|
|
45
|
+
|
|
46
|
+
describe 'without a version' do
|
|
47
|
+
|
|
48
|
+
before do
|
|
49
|
+
@installer = create_gem @gem do
|
|
50
|
+
pre :install, 'op1'
|
|
51
|
+
post :install, 'op2'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'should invoke the gem installer for the specified package' do
|
|
56
|
+
@installer.send(:install_commands).should == "gem install #{@gem} --no-rdoc --no-ri"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
|
60
|
+
@installer.send(:install_sequence).should == [ 'op1', "gem install #{@gem} --no-rdoc --no-ri", 'op2']
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe 'with a specific version' do
|
|
66
|
+
|
|
67
|
+
before do
|
|
68
|
+
@installer = create_gem @gem, @version, :build_docs => true
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'should install a specific version if defined, and with docs' do
|
|
72
|
+
@installer.send(:install_commands).should == "gem install #{@gem} --version '#{@version}'"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe 'with build flags' do
|
|
78
|
+
|
|
79
|
+
before do
|
|
80
|
+
@installer = create_gem @gem, nil, :build_flags => '--option=foo'
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'should install with defined build flags' do
|
|
84
|
+
@installer.send(:install_commands).should == "gem install #{@gem} --no-rdoc --no-ri -- --option=foo"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::Installer do
|
|
4
|
+
include Sprinkle::Deployment
|
|
5
|
+
|
|
6
|
+
before do
|
|
7
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
|
8
|
+
@empty = Proc.new { }
|
|
9
|
+
@sequence = ['op1', 'op2']
|
|
10
|
+
@delivery = mock(Sprinkle::Deployment, :process => true)
|
|
11
|
+
@installer = create_installer
|
|
12
|
+
@installer.delivery = @delivery
|
|
13
|
+
@roles = []
|
|
14
|
+
@deployment = deployment do
|
|
15
|
+
delivery :capistrano
|
|
16
|
+
installer do; prefix '/usr/bin'; end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create_installer(&block)
|
|
21
|
+
installer = Sprinkle::Installers::Installer.new @package, &block
|
|
22
|
+
installer.stub!(:puts).and_return
|
|
23
|
+
|
|
24
|
+
# this is actually an abstract class so we'll insert a few fake install sequences
|
|
25
|
+
class << installer
|
|
26
|
+
def install_sequence
|
|
27
|
+
['op1', 'op2']
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
installer
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe 'when created' do
|
|
35
|
+
|
|
36
|
+
it 'should belong to a package' do
|
|
37
|
+
@installer.package.should == @package
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe 'with a block to customize installer defaults' do
|
|
41
|
+
|
|
42
|
+
it 'should accept an optional block to customize installers defaults' do
|
|
43
|
+
@installer = create_installer do; prefix '/usr/local'; end
|
|
44
|
+
@installer.prefix.should == '/usr/local'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'should override any deployment level defaults' do
|
|
48
|
+
@installer = create_installer do; prefix '/usr/local'; end
|
|
49
|
+
@installer.defaults(@deployment)
|
|
50
|
+
@installer.prefix.should == '/usr/local'
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe 'during configuration' do
|
|
56
|
+
# We just check to make sure it has the Sprinkle::Configurable method
|
|
57
|
+
it 'should be configurable' do
|
|
58
|
+
@installer.should respond_to(:defaults)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe 'during installation' do
|
|
63
|
+
|
|
64
|
+
it 'should request the install sequence from the concrete class' do
|
|
65
|
+
@installer.should_receive(:install_sequence).and_return(@sequence)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
describe 'when testing' do
|
|
69
|
+
|
|
70
|
+
before do
|
|
71
|
+
Sprinkle::OPTIONS[:testing] = true
|
|
72
|
+
@logger = mock(ActiveSupport::BufferedLogger, :debug => true, :debug? => true)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'should not invoke the delivery mechanism with the install sequence' do
|
|
76
|
+
@delivery.should_not_receive(:process)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'should print the install sequence to the console' do
|
|
80
|
+
@installer.should_receive(:logger).twice.and_return(@logger)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe 'when in production' do
|
|
86
|
+
it 'should invoke the delivery mechanism to process the install sequence' do
|
|
87
|
+
@delivery.should_receive(:process).with(@package.name, @sequence, @roles)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe "with a pre command" do
|
|
92
|
+
|
|
93
|
+
def create_installer_with_pre_command(cmd="")
|
|
94
|
+
installer = Sprinkle::Installers::Installer.new @package do
|
|
95
|
+
pre :install, cmd
|
|
96
|
+
|
|
97
|
+
def install_commands
|
|
98
|
+
["installer"]
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
installer.stub!(:puts).and_return
|
|
103
|
+
installer.delivery = @delivery
|
|
104
|
+
installer
|
|
105
|
+
end
|
|
106
|
+
before do
|
|
107
|
+
@installer = create_installer_with_pre_command('run')
|
|
108
|
+
end
|
|
109
|
+
describe "string commands" do
|
|
110
|
+
it "should insert the pre command for the specific package in the installation process" do
|
|
111
|
+
@installer.send(:install_sequence).should == [ 'run', 'installer' ]
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
describe "blocks as commands" do
|
|
115
|
+
before(:each) do
|
|
116
|
+
@installer = Sprinkle::Installers::Installer.new @package do
|
|
117
|
+
pre :install do
|
|
118
|
+
%w(a b c)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def install_commands
|
|
122
|
+
["installer"]
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
@installer.stub!(:puts).and_return
|
|
127
|
+
@installer.delivery = @delivery
|
|
128
|
+
end
|
|
129
|
+
it "should be able to store a block if it's the pre command" do
|
|
130
|
+
@installer.send(:install_sequence).should == [ "a", "b", "c", 'installer' ]
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
describe "blocks as commands" do
|
|
134
|
+
before(:each) do
|
|
135
|
+
@array = ["a", "b"]
|
|
136
|
+
@installer = create_installer_with_pre_command(@array)
|
|
137
|
+
end
|
|
138
|
+
it "should be able to store a block if it's the pre command" do
|
|
139
|
+
@installer.send(:install_sequence).should == [ @array, 'installer' ].flatten
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
after do
|
|
145
|
+
@installer.process(@roles)
|
|
146
|
+
Sprinkle::OPTIONS[:testing] = false
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::MacPort do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_port(ports, &block)
|
|
10
|
+
Sprinkle::Installers::MacPort.new(@package, ports, &block)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe 'when created' do
|
|
14
|
+
|
|
15
|
+
it 'should accept a single package to install' do
|
|
16
|
+
@installer = create_port 'ruby'
|
|
17
|
+
@installer.port.should == 'ruby'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'during installation' do
|
|
23
|
+
|
|
24
|
+
before do
|
|
25
|
+
@installer = create_port 'ruby' do
|
|
26
|
+
pre :install, 'op1'
|
|
27
|
+
post :install, 'op2'
|
|
28
|
+
end
|
|
29
|
+
@install_commands = @installer.send :install_commands
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should invoke the port installer for all specified packages' do
|
|
33
|
+
@install_commands.should =~ /port install ruby/
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
|
37
|
+
@installer.send(:install_sequence).should == [ 'op1', 'port install ruby', 'op2' ]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::OpenbsdPkg do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_pkg(pkgs, &block)
|
|
10
|
+
Sprinkle::Installers::OpenbsdPkg.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_pkg 'ruby'
|
|
17
|
+
@installer.packages.should == [ 'ruby' ]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'should accept an array of packages to install' do
|
|
21
|
+
@installer = create_pkg %w( gcc gdb g++ )
|
|
22
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'during installation' do
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
@installer = create_pkg 'ruby' do
|
|
31
|
+
pre :install, 'op1'
|
|
32
|
+
post :install, 'op2'
|
|
33
|
+
end
|
|
34
|
+
@install_commands = @installer.send :install_commands
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should invoke the freebsd_pkg installer for all specified packages' do
|
|
38
|
+
@install_commands.should =~ /pkg_add ruby/
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
|
42
|
+
@installer.send(:install_sequence).should == [ 'op1', 'pkg_add ruby', 'op2' ]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'should install a specific version if defined'
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Sprinkle::Installers::OpensolarisPkg do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@package = mock(Sprinkle::Package, :name => 'package')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_pkg(pkgs, &block)
|
|
10
|
+
Sprinkle::Installers::OpensolarisPkg.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_pkg 'ruby'
|
|
17
|
+
@installer.packages.should == [ 'ruby' ]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'should accept an array of packages to install' do
|
|
21
|
+
@installer = create_pkg %w( gcc gdb g++ )
|
|
22
|
+
@installer.packages.should == ['gcc', 'gdb', 'g++']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'during installation' do
|
|
28
|
+
|
|
29
|
+
before do
|
|
30
|
+
@installer = create_pkg 'ruby' do
|
|
31
|
+
pre :install, 'op1'
|
|
32
|
+
post :install, 'op2'
|
|
33
|
+
end
|
|
34
|
+
@install_commands = @installer.send :install_commands
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should invoke the freebsd_pkg installer for all specified packages' do
|
|
38
|
+
@install_commands.should =~ /pkg install ruby/
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should automatically insert pre/post commands for the specified package' do
|
|
42
|
+
@installer.send(:install_sequence).should == [ 'op1', 'pkg install ruby', 'op2' ]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'should install a specific version if defined'
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|