sprinkle 0.1.9 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +2 -0
- data/Manifest.txt +9 -0
- data/README.txt +4 -1
- data/config/hoe.rb +1 -1
- data/examples/packages/databases/mysql.rb +2 -2
- data/lib/sprinkle/actors/local.rb +5 -1
- data/lib/sprinkle/installers/bsd_port.rb +33 -0
- data/lib/sprinkle/installers/freebsd_pkg.rb +37 -0
- data/lib/sprinkle/installers/gem.rb +2 -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/rake.rb +11 -4
- data/lib/sprinkle/installers/yum.rb +1 -1
- data/lib/sprinkle/package.rb +28 -0
- data/lib/sprinkle/verifiers/file.rb +6 -0
- data/lib/sprinkle/version.rb +2 -2
- 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 +21 -5
- data/spec/sprinkle/installers/mac_port_spec.rb +42 -0
- data/spec/sprinkle/installers/openbsd_pkg_spec.rb +49 -0
- data/spec/sprinkle/installers/yum_spec.rb +2 -2
- data/spec/sprinkle/verify_spec.rb +7 -0
- data/sprinkle.gemspec +37 -7
- metadata +14 -5
data/CREDITS
CHANGED
@@ -17,3 +17,5 @@ Mitchell Hashimoto (http://mitchellhashimoto.com)
|
|
17
17
|
Ari Lerner (http://www.citrusbyte.com)
|
18
18
|
Jorgen Orehøj Erichsen (http://blog.erichsen.net)
|
19
19
|
Joshua Sierles (http://diluvia.net)
|
20
|
+
Julian Russell (http://github.com/plusplus)
|
21
|
+
Dave (Gassto) (http://github.com/gassto)
|
data/Manifest.txt
CHANGED
@@ -49,6 +49,11 @@ lib/sprinkle/installers/rake.rb
|
|
49
49
|
lib/sprinkle/installers/rpm.rb
|
50
50
|
lib/sprinkle/installers/source.rb
|
51
51
|
lib/sprinkle/installers/yum.rb
|
52
|
+
lib/sprinkle/installers/freebsd_pkg.rb
|
53
|
+
lib/sprinkle/installers/openbsd_pkg.rb
|
54
|
+
lib/sprinkle/installers/opensolaris_pkg.rb
|
55
|
+
lib/sprinkle/installers/bsd_port.rb
|
56
|
+
lib/sprinkle/installers/mac_port.rb
|
52
57
|
lib/sprinkle/package.rb
|
53
58
|
lib/sprinkle/policy.rb
|
54
59
|
lib/sprinkle/script.rb
|
@@ -76,6 +81,10 @@ spec/sprinkle/installers/installer_spec.rb
|
|
76
81
|
spec/sprinkle/installers/rpm_spec.rb
|
77
82
|
spec/sprinkle/installers/yum_spec.rb
|
78
83
|
spec/sprinkle/installers/source_spec.rb
|
84
|
+
spec/sprinkle/installers/openbsd_pkg_spec.rb
|
85
|
+
spec/sprinkle/installers/freebsd_pkg_spec.rb
|
86
|
+
spec/sprinkle/installers/bsd_port_spec.rb
|
87
|
+
spec/sprinkle/installers/mac_port_spec.rb
|
79
88
|
spec/sprinkle/package_spec.rb
|
80
89
|
spec/sprinkle/policy_spec.rb
|
81
90
|
spec/sprinkle/script_spec.rb
|
data/README.txt
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
http://redartisan.com/2008/5/27/sprinkle-intro
|
4
4
|
http://github.com/crafterm/sprinkle
|
5
|
+
http://github.com/benschwarz/passenger-stack
|
6
|
+
http://www.vimeo.com/2888665
|
7
|
+
http://redartisan.lighthouseapp.com/projects/25275-sprinkle/tickets
|
5
8
|
|
6
9
|
== DESCRIPTION:
|
7
10
|
|
@@ -205,7 +208,7 @@ and Git (via source with dependencies from APT):
|
|
205
208
|
|
206
209
|
end
|
207
210
|
|
208
|
-
Please see the examples directory for more complete examples of Sprinkle deployment scripts.
|
211
|
+
Please see the examples directory for more complete examples of Sprinkle deployment scripts, and also the Passenger Stack github page and video by Ben Schwarz (http://github.com/benschwarz/passenger-stack and http://www.vimeo.com/2888665 respectively).
|
209
212
|
|
210
213
|
Sprinkle is a work in progress and I'm excited to hear if anyone finds it useful - please feel free to
|
211
214
|
comment, ask any questions, or send in any ideas, patches, bugs. All most welcome.
|
data/config/hoe.rb
CHANGED
@@ -58,7 +58,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
58
58
|
|
59
59
|
# == Optional
|
60
60
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
|
-
p.extra_deps = [ ['activesupport', '>= 2.0.2'], ['highline', '>= 1.4.0'], ['capistrano', '>= 2.
|
61
|
+
p.extra_deps = [ ['activesupport', '>= 2.0.2'], ['highline', '>= 1.4.0'], ['capistrano', '>= 2.5.5'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
62
62
|
|
63
63
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
64
|
|
@@ -18,7 +18,11 @@ module Sprinkle
|
|
18
18
|
class Local
|
19
19
|
|
20
20
|
def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc:
|
21
|
-
commands.each
|
21
|
+
commands.each do |command|
|
22
|
+
system command
|
23
|
+
return false if $?.to_i != 0
|
24
|
+
end
|
25
|
+
return true
|
22
26
|
end
|
23
27
|
|
24
28
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = OpenBSD and FreeBSD Port Installer
|
4
|
+
#
|
5
|
+
# The Port installer installs OpenBSD and FreeBSD ports.
|
6
|
+
# Before usage, the ports sytem must be installed and
|
7
|
+
# read on the target operating system.
|
8
|
+
#
|
9
|
+
# == Example Usage
|
10
|
+
#
|
11
|
+
# Installing the magic_beans port.
|
12
|
+
#
|
13
|
+
# package :magic_beans do
|
14
|
+
# bsd_port 'magic/magic_beans'
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
class BsdPort < Installer
|
18
|
+
attr_accessor :port #:nodoc:
|
19
|
+
|
20
|
+
def initialize(parent, port, &block) #:nodoc:
|
21
|
+
super parent, &block
|
22
|
+
@port = port
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def install_commands #:nodoc:
|
28
|
+
"sh -c 'cd /usr/ports/#{@port} && make BATCH=yes install clean'"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = FreeBSD Package Installer
|
4
|
+
#
|
5
|
+
# The Pkg package installer installs FreeBSD packages.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# Installing the magic_beans package.
|
10
|
+
#
|
11
|
+
# package :magic_beans do
|
12
|
+
# freebsd_pkg 'magic_beans'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# You may also specify multiple packages as an array:
|
16
|
+
#
|
17
|
+
# package :magic_beans do
|
18
|
+
# freebsd_pkg %w(magic_beans magic_sauce)
|
19
|
+
# end
|
20
|
+
class FreebsdPkg < Installer
|
21
|
+
attr_accessor :packages #:nodoc:
|
22
|
+
|
23
|
+
def initialize(parent, packages, &block) #:nodoc:
|
24
|
+
super parent, &block
|
25
|
+
packages = [packages] unless packages.is_a? Array
|
26
|
+
@packages = packages
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
def install_commands #:nodoc:
|
32
|
+
"pkg_add -r #{@packages.join(' ')}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -53,6 +53,8 @@ module Sprinkle
|
|
53
53
|
cmd << " --version '#{version}'" if version
|
54
54
|
cmd << " --source #{source}" if source
|
55
55
|
cmd << " --install-dir #{repository}" if option?(:repository)
|
56
|
+
cmd << " --no-rdoc --no-ri" unless option?(:build_docs)
|
57
|
+
cmd << " -- #{build_flags}" if option?(:build_flags)
|
56
58
|
cmd
|
57
59
|
end
|
58
60
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = Mac OS X Port Installer (macports)
|
4
|
+
#
|
5
|
+
# The Port installer installs macports ports.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# Installing the magic_beans port.
|
10
|
+
#
|
11
|
+
# package :magic_beans do
|
12
|
+
# mac_port 'magic/magic_beans'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# == Notes
|
16
|
+
# Before MacPorts packages can be installed, the PATH
|
17
|
+
# environment variable probably has to be changed so
|
18
|
+
# capistrano can find the /opt/local/bin/port executable
|
19
|
+
#
|
20
|
+
# You must set PATH in ~/.ssh/environment on the remote
|
21
|
+
# system and enable 'PermitUserEnvironment yes' in /etc/sshd_config
|
22
|
+
class MacPort < Installer
|
23
|
+
attr_accessor :port #:nodoc:
|
24
|
+
|
25
|
+
def initialize(parent, port, &block) #:nodoc:
|
26
|
+
super parent, &block
|
27
|
+
@port = port
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def install_commands #:nodoc:
|
33
|
+
"port install #{@port}"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = OpenBSD Package Installer
|
4
|
+
#
|
5
|
+
# The Pkg package installer installs OpenBSD packages.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# Installing the magic_beans package.
|
10
|
+
#
|
11
|
+
# package :magic_beans do
|
12
|
+
# openbsd_pkg 'magic_beans'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# You may also specify multiple packages as an array:
|
16
|
+
#
|
17
|
+
# package :magic_beans do
|
18
|
+
# openbsd_pkg %w(magic_beans magic_sauce)
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# == Notes
|
22
|
+
# Before OpenBSD packages can be installed, the PKG_PATH
|
23
|
+
# environment variable must be set.
|
24
|
+
#
|
25
|
+
# You must set PKG_PATH in ~/.ssh/environment on the remote
|
26
|
+
# system and enable 'PermitUserEnvironment yes' in /etc/ssh/sshd_config
|
27
|
+
#
|
28
|
+
# For help on PKG_PATH see section 15.2.2 of the OpenBSD FAQ
|
29
|
+
# (http://www.openbsd.org/faq/faq15.html)
|
30
|
+
class OpenbsdPkg < Installer
|
31
|
+
attr_accessor :packages #:nodoc:
|
32
|
+
|
33
|
+
def initialize(parent, packages, &block) #:nodoc:
|
34
|
+
super parent, &block
|
35
|
+
packages = [packages] unless packages.is_a? Array
|
36
|
+
@packages = packages
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def install_commands #:nodoc:
|
42
|
+
"pkg_add #{@packages.join(' ')}"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
# = OpenSolaris Package Installer
|
4
|
+
#
|
5
|
+
# The Pkg package installer installs OpenSolaris packages.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# Installing the magic_beans package.
|
10
|
+
#
|
11
|
+
# package :magic_beans do
|
12
|
+
# opensolaris_pkg 'magic_beans'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# You may also specify multiple packages as an array:
|
16
|
+
#
|
17
|
+
# package :magic_beans do
|
18
|
+
# opensolaris_pkg %w(magic_beans magic_sauce)
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# == Note
|
22
|
+
# If you are using capistrano as the deployment method
|
23
|
+
# you will need to add the following lines to your deploy.rb
|
24
|
+
# set :sudo, 'pfexec'
|
25
|
+
# set :sudo_prompt, ''
|
26
|
+
class OpensolarisPkg < Installer
|
27
|
+
attr_accessor :packages #:nodoc:
|
28
|
+
|
29
|
+
def initialize(parent, packages, &block) #:nodoc:
|
30
|
+
super parent, &block
|
31
|
+
packages = [packages] unless packages.is_a? Array
|
32
|
+
@packages = packages
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def install_commands #:nodoc:
|
38
|
+
"pkg install #{@packages.join(' ')}"
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -13,16 +13,23 @@ module Sprinkle
|
|
13
13
|
# rake 'spec'
|
14
14
|
# end
|
15
15
|
#
|
16
|
+
# Specify a Rakefile with the :rakefile option.
|
17
|
+
#
|
18
|
+
# package :spec, :rakefile => "/var/setup/Rakefile" do
|
19
|
+
# rake 'spec'
|
20
|
+
# end
|
21
|
+
|
16
22
|
class Rake < Installer
|
17
|
-
def initialize(parent, commands =
|
18
|
-
super parent, &block
|
19
|
-
@commands = commands
|
23
|
+
def initialize(parent, commands, options = {}, &block) #:nodoc:
|
24
|
+
super parent, options, &block
|
25
|
+
@commands = commands.to_a
|
20
26
|
end
|
21
27
|
|
22
28
|
protected
|
23
29
|
|
24
30
|
def install_commands #:nodoc:
|
25
|
-
"
|
31
|
+
file = @options[:rakefile] ? "-f #{@options[:rakefile]} " : ""
|
32
|
+
"rake #{file}#{@commands.join(' ')}"
|
26
33
|
end
|
27
34
|
|
28
35
|
end
|
data/lib/sprinkle/package.rb
CHANGED
@@ -120,6 +120,26 @@ module Sprinkle
|
|
120
120
|
self.instance_eval &block
|
121
121
|
end
|
122
122
|
|
123
|
+
def freebsd_pkg(*names, &block)
|
124
|
+
@installer = Sprinkle::Installers::FreebsdPkg.new(self, *names, &block)
|
125
|
+
end
|
126
|
+
|
127
|
+
def openbsd_pkg(*names, &block)
|
128
|
+
@installer = Sprinkle::Installers::OpenbsdPkg.new(self, *names, &block)
|
129
|
+
end
|
130
|
+
|
131
|
+
def opensolaris_pkg(*names, &block)
|
132
|
+
@installer = Sprinkle::Installers::OpensolarisPkg.new(self, *names, &block)
|
133
|
+
end
|
134
|
+
|
135
|
+
def bsd_port(port, &block)
|
136
|
+
@installer = Sprinkle::Installers::BsdPort.new(self, port, &block)
|
137
|
+
end
|
138
|
+
|
139
|
+
def mac_port(port, &block)
|
140
|
+
@installer = Sprinkle::Installers::MacPort.new(self, port, &block)
|
141
|
+
end
|
142
|
+
|
123
143
|
def apt(*names, &block)
|
124
144
|
@installer = Sprinkle::Installers::Apt.new(self, *names, &block)
|
125
145
|
end
|
@@ -146,6 +166,14 @@ module Sprinkle
|
|
146
166
|
@installer = Sprinkle::Installers::Source.new(self, source, options, &block)
|
147
167
|
end
|
148
168
|
|
169
|
+
def rake(name, options = {}, &block)
|
170
|
+
@installer = Sprinkle::Installers::Rake.new(self, name, options, &block)
|
171
|
+
end
|
172
|
+
|
173
|
+
def push_text(text, path, options = {}, &block)
|
174
|
+
@installer = Sprinkle::Installers::PushText.new(self, text, path, options, &block)
|
175
|
+
end
|
176
|
+
|
149
177
|
def verify(description = '', &block)
|
150
178
|
@verifications << Sprinkle::Verify.new(self, description, &block)
|
151
179
|
end
|
@@ -8,6 +8,8 @@ module Sprinkle
|
|
8
8
|
#
|
9
9
|
# verify { has_file '/etc/apache2/apache2.conf' }
|
10
10
|
#
|
11
|
+
# verify { file_contains '/etc/apache2/apache2.conf', 'mod_gzip'}
|
12
|
+
#
|
11
13
|
module File
|
12
14
|
Sprinkle::Verify.register(Sprinkle::Verifiers::File)
|
13
15
|
|
@@ -15,6 +17,10 @@ module Sprinkle
|
|
15
17
|
def has_file(path)
|
16
18
|
@commands << "test -f #{path}"
|
17
19
|
end
|
20
|
+
|
21
|
+
def file_contains(path, text)
|
22
|
+
@commands << "grep '#{text}' #{path}"
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
data/lib/sprinkle/version.rb
CHANGED
@@ -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
|
@@ -5,7 +5,7 @@ describe Sprinkle::Installers::Gem do
|
|
5
5
|
before do
|
6
6
|
@gem = 'rails'
|
7
7
|
@version = '2.0.2'
|
8
|
-
@options = { :source => 'http://gems.github.com/', :repository => '/tmp/gems' }
|
8
|
+
@options = { :source => 'http://gems.github.com/', :repository => '/tmp/gems', :build_flags => '--build_flag=foo' }
|
9
9
|
end
|
10
10
|
|
11
11
|
def create_gem(gem, version = nil, options = {}, &block)
|
@@ -34,6 +34,10 @@ describe Sprinkle::Installers::Gem do
|
|
34
34
|
it 'should optionally store the repository location where gems are to be installed' do
|
35
35
|
@installer.repository.should == @options[:repository]
|
36
36
|
end
|
37
|
+
|
38
|
+
it 'should optionally store the build flags' do
|
39
|
+
@installer.build_flags.should == @options[:build_flags]
|
40
|
+
end
|
37
41
|
|
38
42
|
end
|
39
43
|
|
@@ -49,11 +53,11 @@ describe Sprinkle::Installers::Gem do
|
|
49
53
|
end
|
50
54
|
|
51
55
|
it 'should invoke the gem installer for the specified package' do
|
52
|
-
@installer.send(:install_commands).should == "gem install #{@gem}"
|
56
|
+
@installer.send(:install_commands).should == "gem install #{@gem} --no-rdoc --no-ri"
|
53
57
|
end
|
54
58
|
|
55
59
|
it 'should automatically insert pre/post commands for the specified package' do
|
56
|
-
@installer.send(:install_sequence).should == [ 'op1', "gem install #{@gem}", 'op2'
|
60
|
+
@installer.send(:install_sequence).should == [ 'op1', "gem install #{@gem} --no-rdoc --no-ri", 'op2']
|
57
61
|
end
|
58
62
|
|
59
63
|
end
|
@@ -61,15 +65,27 @@ describe Sprinkle::Installers::Gem do
|
|
61
65
|
describe 'with a specific version' do
|
62
66
|
|
63
67
|
before do
|
64
|
-
@installer = create_gem @gem, @version
|
68
|
+
@installer = create_gem @gem, @version, :build_docs => true
|
65
69
|
end
|
66
70
|
|
67
|
-
it 'should install a specific version if defined' do
|
71
|
+
it 'should install a specific version if defined, and with docs' do
|
68
72
|
@installer.send(:install_commands).should == "gem install #{@gem} --version '#{@version}'"
|
69
73
|
end
|
70
74
|
|
71
75
|
end
|
72
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
|
+
|
73
89
|
end
|
74
90
|
|
75
91
|
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
|
@@ -35,11 +35,11 @@ describe Sprinkle::Installers::Yum do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should invoke the rpm installer for all specified packages' do
|
38
|
-
@install_commands.should =~ /yum ruby -y/
|
38
|
+
@install_commands.should =~ /yum install ruby -y/
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should automatically insert pre/post commands for the specified package' do
|
42
|
-
@installer.send(:install_sequence).should == [ 'op1', 'yum ruby -y', 'op2' ]
|
42
|
+
@installer.send(:install_sequence).should == [ 'op1', 'yum install ruby -y', 'op2' ]
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should install a specific version if defined'
|
@@ -9,6 +9,9 @@ describe Sprinkle::Verify do
|
|
9
9
|
# Check a file exists
|
10
10
|
has_file 'my_file.txt'
|
11
11
|
|
12
|
+
# Check that a file contains a substring
|
13
|
+
file_contains 'my_file.txt', 'A sunny day on the lower east-side'
|
14
|
+
|
12
15
|
# Check a directory exists
|
13
16
|
has_directory 'mydir'
|
14
17
|
|
@@ -51,6 +54,10 @@ describe Sprinkle::Verify do
|
|
51
54
|
@verification.commands.should include('test -f my_file.txt')
|
52
55
|
end
|
53
56
|
|
57
|
+
it 'should do a grep to see if a file contains a text string' do
|
58
|
+
@verification.commands.should include("grep 'A sunny day on the lower east-side' my_file.txt")
|
59
|
+
end
|
60
|
+
|
54
61
|
it 'should do a "test -d" on the has_directory check' do
|
55
62
|
@verification.commands.should include('test -d mydir')
|
56
63
|
end
|
data/sprinkle.gemspec
CHANGED
@@ -1,22 +1,51 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{sprinkle}
|
3
|
-
s.version = "0.1
|
3
|
+
s.version = "0.2.1"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Marcus Crafter", "Mitchell Hashimoto"]
|
7
|
-
s.date = %q{2008-11-
|
7
|
+
s.date = %q{2008-11-25}
|
8
8
|
s.default_executable = %q{sprinkle}
|
9
9
|
s.description = %q{Ruby DSL based software provisioning tool}
|
10
10
|
s.email = ["crafterm@redartisan.com", "mitchell.hashimoto@citrusbyte.com"]
|
11
11
|
s.executables = ["sprinkle"]
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
13
|
-
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "bin/sprinkle",
|
13
|
+
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "bin/sprinkle",
|
14
|
+
"config/hoe.rb", "config/requirements.rb", "examples/packages/build_essential.rb",
|
15
|
+
"examples/packages/databases/mysql.rb", "examples/packages/databases/sqlite3.rb",
|
16
|
+
"examples/packages/phusion.rb", "examples/packages/ruby/rails.rb", "examples/packages/ruby/ruby.rb",
|
17
|
+
"examples/packages/ruby/rubygems.rb", "examples/packages/scm/git.rb", "examples/packages/scm/subversion.rb",
|
18
|
+
"examples/packages/servers/apache.rb", "examples/rails/README", "examples/rails/deploy.rb",
|
19
|
+
"examples/rails/packages/database.rb", "examples/rails/packages/essential.rb", "examples/rails/packages/rails.rb",
|
20
|
+
"examples/rails/packages/scm.rb", "examples/rails/packages/search.rb", "examples/rails/packages/server.rb",
|
21
|
+
"examples/rails/rails.rb", "examples/sprinkle/sprinkle.rb", "lib/sprinkle.rb", "lib/sprinkle/actors/actors.rb",
|
22
|
+
"lib/sprinkle/actors/capistrano.rb", "lib/sprinkle/actors/local.rb", "lib/sprinkle/actors/ssh.rb", "lib/sprinkle/actors/vlad.rb",
|
23
|
+
"lib/sprinkle/configurable.rb", "lib/sprinkle/deployment.rb", "lib/sprinkle/extensions/arbitrary_options.rb",
|
24
|
+
"lib/sprinkle/extensions/array.rb", "lib/sprinkle/extensions/blank_slate.rb", "lib/sprinkle/extensions/dsl_accessor.rb",
|
25
|
+
"lib/sprinkle/extensions/string.rb", "lib/sprinkle/extensions/symbol.rb", "lib/sprinkle/installers/apt.rb",
|
26
|
+
"lib/sprinkle/installers/deb.rb", "lib/sprinkle/installers/gem.rb", "lib/sprinkle/installers/installer.rb",
|
27
|
+
"lib/sprinkle/installers/rake.rb", "lib/sprinkle/installers/rpm.rb", "lib/sprinkle/installers/source.rb",
|
28
|
+
"lib/sprinkle/installers/yum.rb", "lib/sprinkle/installers/freebsd_pkg.rb", "lib/sprinkle/installers/openbsd_pkg.rb",
|
29
|
+
"lib/sprinkle/installers/opensolaris_pkg.rb", "lib/sprinkle/installers/bsd_port.rb", "lib/sprinkle/installers/mac_port.rb", "lib/sprinkle/installers/push_text.rb",
|
30
|
+
"lib/sprinkle/package.rb", "lib/sprinkle/policy.rb", "lib/sprinkle/script.rb", "lib/sprinkle/verifiers/directory.rb",
|
31
|
+
"lib/sprinkle/verifiers/executable.rb", "lib/sprinkle/verifiers/file.rb", "lib/sprinkle/verifiers/process.rb",
|
32
|
+
"lib/sprinkle/verifiers/ruby.rb", "lib/sprinkle/verifiers/symlink.rb", "lib/sprinkle/verify.rb", "lib/sprinkle/version.rb",
|
33
|
+
"script/destroy", "script/generate", "sprinkle.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
|
34
|
+
|
35
|
+
s.test_files = ["spec/spec.opts", "spec/spec_helper.rb", "spec/sprinkle/actors/capistrano_spec.rb",
|
36
|
+
"spec/sprinkle/actors/local_spec.rb", "spec/sprinkle/configurable_spec.rb", "spec/sprinkle/deployment_spec.rb",
|
37
|
+
"spec/sprinkle/extensions/array_spec.rb", "spec/sprinkle/extensions/string_spec.rb", "spec/sprinkle/installers/apt_spec.rb",
|
38
|
+
"spec/sprinkle/installers/gem_spec.rb", "spec/sprinkle/installers/installer_spec.rb", "spec/sprinkle/installers/rpm_spec.rb",
|
39
|
+
"spec/sprinkle/installers/yum_spec.rb", "spec/sprinkle/installers/source_spec.rb", "spec/sprinkle/installers/freebsd_pkg_spec.rb",
|
40
|
+
"spec/sprinkle/installers/openbsd_pkg_spec.rb", "spec/sprinkle/installers/opensolaris_pkg_spec.rb",
|
41
|
+
"spec/sprinkle/installers/mac_port_spec.rb", "spec/sprinkle/installers/push_text_spec.rb", "spec/sprinkle/installers/bsd_port_spec.rb", "spec/sprinkle/policy_spec.rb",
|
42
|
+
"spec/sprinkle/script_spec.rb", "spec/sprinkle/sprinkle_spec.rb", "spec/sprinkle/installers/rake_spec.rb", "spec/sprinkle/verify_spec.rb"]
|
14
43
|
s.has_rdoc = true
|
15
44
|
s.homepage = %q{http://sprinkle.rubyforge.org}
|
16
45
|
s.rdoc_options = ["--main", "README.txt"]
|
17
46
|
s.require_paths = ["lib"]
|
18
47
|
s.rubyforge_project = %q{sprinkle}
|
19
|
-
s.rubygems_version = %q{1.
|
48
|
+
s.rubygems_version = %q{1.3.0}
|
20
49
|
s.summary = %q{Ruby DSL based software provisioning tool}
|
21
50
|
|
22
51
|
if s.respond_to? :specification_version then
|
@@ -26,18 +55,19 @@ Gem::Specification.new do |s|
|
|
26
55
|
if current_version >= 3 then
|
27
56
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
|
28
57
|
s.add_runtime_dependency(%q<highline>, [">= 1.4.0"])
|
29
|
-
s.add_runtime_dependency(%q<capistrano>, [">= 2.
|
58
|
+
s.add_runtime_dependency(%q<capistrano>, [">= 2.5.5"])
|
30
59
|
s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
|
60
|
+
s.add_development_dependency(%q<echoe>, [">= 3.0.2"])
|
31
61
|
else
|
32
62
|
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
33
63
|
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
34
|
-
s.add_dependency(%q<capistrano>, [">= 2.
|
64
|
+
s.add_dependency(%q<capistrano>, [">= 2.5.5"])
|
35
65
|
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
36
66
|
end
|
37
67
|
else
|
38
68
|
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
39
69
|
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
40
|
-
s.add_dependency(%q<capistrano>, [">= 2.
|
70
|
+
s.add_dependency(%q<capistrano>, [">= 2.5.5"])
|
41
71
|
s.add_dependency(%q<hoe>, [">= 1.8.2"])
|
42
72
|
end
|
43
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprinkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Crafter
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-03-05 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: 2.5.5
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: hoe
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.8.
|
53
|
+
version: 1.8.0
|
54
54
|
version:
|
55
55
|
description: Ruby DSL based software provisioning tool
|
56
56
|
email:
|
@@ -115,6 +115,11 @@ files:
|
|
115
115
|
- lib/sprinkle/installers/rpm.rb
|
116
116
|
- lib/sprinkle/installers/source.rb
|
117
117
|
- lib/sprinkle/installers/yum.rb
|
118
|
+
- lib/sprinkle/installers/freebsd_pkg.rb
|
119
|
+
- lib/sprinkle/installers/openbsd_pkg.rb
|
120
|
+
- lib/sprinkle/installers/opensolaris_pkg.rb
|
121
|
+
- lib/sprinkle/installers/bsd_port.rb
|
122
|
+
- lib/sprinkle/installers/mac_port.rb
|
118
123
|
- lib/sprinkle/package.rb
|
119
124
|
- lib/sprinkle/policy.rb
|
120
125
|
- lib/sprinkle/script.rb
|
@@ -142,6 +147,10 @@ files:
|
|
142
147
|
- spec/sprinkle/installers/rpm_spec.rb
|
143
148
|
- spec/sprinkle/installers/yum_spec.rb
|
144
149
|
- spec/sprinkle/installers/source_spec.rb
|
150
|
+
- spec/sprinkle/installers/openbsd_pkg_spec.rb
|
151
|
+
- spec/sprinkle/installers/freebsd_pkg_spec.rb
|
152
|
+
- spec/sprinkle/installers/bsd_port_spec.rb
|
153
|
+
- spec/sprinkle/installers/mac_port_spec.rb
|
145
154
|
- spec/sprinkle/package_spec.rb
|
146
155
|
- spec/sprinkle/policy_spec.rb
|
147
156
|
- spec/sprinkle/script_spec.rb
|
@@ -174,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
183
|
requirements: []
|
175
184
|
|
176
185
|
rubyforge_project: sprinkle
|
177
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.3.1
|
178
187
|
signing_key:
|
179
188
|
specification_version: 2
|
180
189
|
summary: Ruby DSL based software provisioning tool
|