sprinkle 0.2.3 → 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 +4 -1
- data/Manifest.txt +1 -1
- data/{README.txt → README.markdown} +10 -10
- data/examples/rails/packages/rails.rb +5 -4
- data/examples/rails/packages/scm.rb +1 -1
- data/examples/rails/packages/search.rb +1 -1
- data/examples/rails/packages/server.rb +2 -2
- data/examples/rails/rails.rb +1 -1
- data/lib/sprinkle/installers/apt.rb +1 -1
- data/lib/sprinkle/installers/transfer.rb +6 -1
- data/lib/sprinkle/package.rb +16 -1
- data/lib/sprinkle/verifiers/executable.rb +17 -0
- data/lib/sprinkle/version.rb +1 -1
- data/spec/sprinkle/installers/apt_spec.rb +4 -4
- data/spec/sprinkle/package_spec.rb +22 -1
- data/sprinkle.gemspec +4 -4
- metadata +3 -4
data/CREDITS
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= CREDITS
|
2
2
|
|
3
3
|
Many thanks to the following people who have submitted ideas, patches, helped with testing
|
4
|
-
and/or generally provided support to
|
4
|
+
and/or generally provided support to Sprinkle, I really appreciate your help:
|
5
5
|
|
6
6
|
Kristin Baumann (http://crafterm.net/kristin/blog/)
|
7
7
|
Ben Schwarz (http://germanforblack.com/)
|
@@ -24,3 +24,6 @@ Jacob Harris (http://open.nytimes.com)
|
|
24
24
|
Justin Pease (http://jit.nuance9.com)
|
25
25
|
Tobias Lütke (http://blog.leetsoft.com)
|
26
26
|
Josh Reynolds (http://github.com/jreynolds)
|
27
|
+
Jan Ulbrich (http://www.ulbrich.net)
|
28
|
+
|
29
|
+
The transfer installer contains a piece of exception reporting code copied from the Chef library (http://wiki.opscode.com/display/chef/Home)
|
data/Manifest.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
1
|
+
# SPRINKLE
|
2
2
|
|
3
|
-
http://redartisan.com/2008/5/27/sprinkle-intro
|
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
|
3
|
+
* <http://redartisan.com/2008/5/27/sprinkle-intro>
|
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>
|
8
8
|
|
9
|
-
|
9
|
+
## DESCRIPTION:
|
10
10
|
|
11
11
|
Sprinkle is a software provisioning tool you can use to build remote servers with, after the base operating
|
12
12
|
system has been installed. For example, to install a Rails or Merb stack on a brand new slice directly after
|
@@ -208,18 +208,18 @@ and Git (via source with dependencies from APT):
|
|
208
208
|
|
209
209
|
end
|
210
210
|
|
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).
|
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).
|
212
212
|
|
213
213
|
Sprinkle is a work in progress and I'm excited to hear if anyone finds it useful - please feel free to
|
214
214
|
comment, ask any questions, or send in any ideas, patches, bugs. All most welcome.
|
215
215
|
|
216
216
|
Marcus Crafter <crafterm@redartisan.com>
|
217
217
|
|
218
|
-
|
218
|
+
## LICENSE:
|
219
219
|
|
220
220
|
(The MIT License)
|
221
221
|
|
222
|
-
Copyright (c) 2008 Marcus Crafter <crafterm@redartisan.com>
|
222
|
+
Copyright (c) 2008-2009 Marcus Crafter <crafterm@redartisan.com>
|
223
223
|
|
224
224
|
Permission is hereby granted, free of charge, to any person obtaining
|
225
225
|
a copy of this software and associated documentation files (the
|
@@ -3,7 +3,8 @@
|
|
3
3
|
package :ruby do
|
4
4
|
description 'Ruby Virtual Machine'
|
5
5
|
version '1.8.6'
|
6
|
-
|
6
|
+
patchlevel '369'
|
7
|
+
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p#{patchlevel}.tar.gz" # implicit :style => :gnu
|
7
8
|
requires :ruby_dependencies
|
8
9
|
end
|
9
10
|
|
@@ -14,8 +15,8 @@ end
|
|
14
15
|
|
15
16
|
package :rubygems do
|
16
17
|
description 'Ruby Gems Package Management System'
|
17
|
-
version '1.
|
18
|
-
source "http://rubyforge.org/frs/download.php/
|
18
|
+
version '1.3.5'
|
19
|
+
source "http://rubyforge.org/frs/download.php/60718/rubygems-#{version}.tgz" do
|
19
20
|
custom_install 'ruby setup.rb'
|
20
21
|
end
|
21
22
|
requires :ruby
|
@@ -24,5 +25,5 @@ end
|
|
24
25
|
package :rails do
|
25
26
|
description 'Ruby on Rails'
|
26
27
|
gem 'rails'
|
27
|
-
version '2.
|
28
|
+
version '2.3.3'
|
28
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
package :mongrel do
|
2
2
|
description 'Mongrel Application Server'
|
3
3
|
gem 'mongrel'
|
4
|
-
version '1.1.
|
4
|
+
version '1.1.5'
|
5
5
|
end
|
6
6
|
|
7
7
|
package :mongrel_cluster, :provides => :appserver do
|
@@ -13,7 +13,7 @@ end
|
|
13
13
|
|
14
14
|
package :apache, :provides => :webserver do
|
15
15
|
description 'Apache 2 HTTP Server'
|
16
|
-
version '2.2.
|
16
|
+
version '2.2.11'
|
17
17
|
source "http://www.apache.org/dist/httpd/httpd-#{version}.tar.bz2" do
|
18
18
|
enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
|
19
19
|
prefix "/opt/local/apache2-#{version}"
|
data/examples/rails/rails.rb
CHANGED
@@ -35,7 +35,7 @@ require 'packages/scm'
|
|
35
35
|
# the user is requested to select which one to use.
|
36
36
|
|
37
37
|
policy :rails, :roles => :app do
|
38
|
-
requires :rails, :version => '2.
|
38
|
+
requires :rails, :version => '2.3.3'
|
39
39
|
requires :appserver
|
40
40
|
requires :database
|
41
41
|
requires :webserver
|
@@ -44,7 +44,7 @@ module Sprinkle
|
|
44
44
|
|
45
45
|
def install_commands #:nodoc:
|
46
46
|
command = @options[:dependencies_only] ? 'build-dep' : 'install'
|
47
|
-
"DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get -qyu #{command} #{@packages.join(' ')}"
|
47
|
+
"env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qyu #{command} #{@packages.join(' ')}"
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
module Sprinkle
|
47
47
|
module Installers
|
48
|
-
# Beware, strange "installer" coming your way.
|
48
|
+
# Beware, another strange "installer" coming your way.
|
49
49
|
#
|
50
50
|
# = File transfer installer
|
51
51
|
#
|
@@ -73,6 +73,11 @@ module Sprinkle
|
|
73
73
|
# If you pass the option :render => true, this tells transfer that the source file
|
74
74
|
# is an ERB template to be rendered locally before being transferred (you can declare
|
75
75
|
# variables in the package scope). When render is true, recursive is turned off.
|
76
|
+
#
|
77
|
+
# package :nginx_conf do
|
78
|
+
# nginx_port = 8080
|
79
|
+
# transfer 'files/nginx.conf', '/etc/nginx.conf', :render => true
|
80
|
+
# end
|
76
81
|
#
|
77
82
|
# Finally, should you need to run commands before or after the file transfer (making
|
78
83
|
# directories or changing permissions), you can use the pre/post :install directives
|
data/lib/sprinkle/package.rb
CHANGED
@@ -116,6 +116,7 @@ module Sprinkle
|
|
116
116
|
@provides = metadata[:provides]
|
117
117
|
@dependencies = []
|
118
118
|
@recommends = []
|
119
|
+
@optional = []
|
119
120
|
@verifications = []
|
120
121
|
self.instance_eval &block
|
121
122
|
end
|
@@ -233,12 +234,17 @@ module Sprinkle
|
|
233
234
|
@recommends.flatten!
|
234
235
|
end
|
235
236
|
|
237
|
+
def optional(*packages)
|
238
|
+
@optional << packages
|
239
|
+
@optional.flatten!
|
240
|
+
end
|
241
|
+
|
236
242
|
def tree(depth = 1, &block)
|
237
243
|
packages = []
|
238
244
|
|
239
245
|
@recommends.each do |dep|
|
240
246
|
package = PACKAGES[dep]
|
241
|
-
next unless package # skip missing recommended packages as they
|
247
|
+
next unless package # skip missing recommended packages as they're allowed to not exist
|
242
248
|
block.call(self, package, depth) if block
|
243
249
|
packages << package.tree(depth + 1, &block)
|
244
250
|
end
|
@@ -253,6 +259,15 @@ module Sprinkle
|
|
253
259
|
end
|
254
260
|
|
255
261
|
packages << self
|
262
|
+
|
263
|
+
@optional.each do |dep|
|
264
|
+
package = PACKAGES[dep]
|
265
|
+
next unless package # skip missing optional packages as they're allow to not exist
|
266
|
+
block.call(self, package, depth) if block
|
267
|
+
packages << package.tree(depth + 1, &block)
|
268
|
+
end
|
269
|
+
|
270
|
+
packages
|
256
271
|
end
|
257
272
|
|
258
273
|
def to_s; @name; end
|
@@ -31,6 +31,23 @@ module Sprinkle
|
|
31
31
|
@commands << "[ -n \"`echo \\`which #{path}\\``\" ]"
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
# Same as has_executable but with checking for e certain version number.
|
36
|
+
# Last option is the parameter to append for getting the version (which
|
37
|
+
# defaults to "-v").
|
38
|
+
def has_executable_with_version(path, version, get_version = '-v')
|
39
|
+
if path.include?('/')
|
40
|
+
@commands << "[ -x #{path} -a -n \"`#{path} #{get_version} 2> /dev/null | egrep -e \\\"#{version}\\\"`\" ]"
|
41
|
+
else
|
42
|
+
@commands << "[ -n \"`echo \\`which #{path}\\``\" -a -n \"`\\`which #{path}\\` #{get_version} 2>&1 | egrep -e \\\"#{version}\\\"`\" ]"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Same as has_executable but checking output of a certain command
|
47
|
+
# with grep.
|
48
|
+
def has_version_in_grep(cmd, version)
|
49
|
+
@commands << "[ -n \"`#{cmd} 2> /dev/null | egrep -e \\\"#{version}\\\"`\" ]"
|
50
|
+
end
|
34
51
|
end
|
35
52
|
end
|
36
53
|
end
|
data/lib/sprinkle/version.rb
CHANGED
@@ -40,15 +40,15 @@ describe Sprinkle::Installers::Apt do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should invoke the apt installer for all specified packages' do
|
43
|
-
@install_commands.should =~ /apt-get -qyu install ruby/
|
43
|
+
@install_commands.should =~ /apt-get --force-yes -qyu install ruby/
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should specify a non interactive mode to the apt installer' do
|
47
|
-
@install_commands.should =~ /DEBIAN_FRONTEND=noninteractive/
|
47
|
+
@install_commands.should =~ /env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive/
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'should automatically insert pre/post commands for the specified package' do
|
51
|
-
@installer.send(:install_sequence).should == [ 'op1', %(DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get -qyu install ruby), 'op2' ]
|
51
|
+
@installer.send(:install_sequence).should == [ 'op1', %(env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qyu install ruby), 'op2' ]
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should install a specific version if defined'
|
@@ -63,7 +63,7 @@ describe Sprinkle::Installers::Apt do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should invoke the apt installer with build-dep command for all specified packages' do
|
66
|
-
@install_commands.should =~ /apt-get -qyu build-dep ruby/
|
66
|
+
@install_commands.should =~ /apt-get --force-yes -qyu build-dep ruby/
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
@@ -83,6 +83,13 @@ CODE
|
|
83
83
|
pkg.recommends.should == [:webserver, :database]
|
84
84
|
end
|
85
85
|
|
86
|
+
it 'should optionally accept optional dependencies' do
|
87
|
+
pkg = package @name do
|
88
|
+
optional :webserver_configuration, :database_configuration
|
89
|
+
end
|
90
|
+
pkg.optional.should == [:webserver_configuration, :database_configuration]
|
91
|
+
end
|
92
|
+
|
86
93
|
it 'should optionally define a virtual package implementation' do
|
87
94
|
pkg = package @name, :provides => :database do; end
|
88
95
|
pkg.provides.should == :database
|
@@ -338,6 +345,7 @@ CODE
|
|
338
345
|
@b = package :b do; requires :c; end
|
339
346
|
@c = package :c do; recommends :d; end
|
340
347
|
@d = package :d do; end
|
348
|
+
@e = package :e do; optional :d; end
|
341
349
|
end
|
342
350
|
|
343
351
|
it 'should be able to return a dependency hierarchy tree' do
|
@@ -345,12 +353,25 @@ CODE
|
|
345
353
|
@b.tree.flatten.should == [ @d, @c, @b ]
|
346
354
|
@c.tree.flatten.should == [ @d, @c ]
|
347
355
|
@d.tree.flatten.should == [ @d ]
|
356
|
+
@e.tree.flatten.should == [ @e, @d ]
|
348
357
|
end
|
349
358
|
|
350
359
|
describe 'with missing recommendations' do
|
351
360
|
|
352
361
|
before do
|
353
|
-
@d.recommends :
|
362
|
+
@d.recommends :z
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'should ignore missing recommendations' do
|
366
|
+
@d.tree.flatten.should == [ @d ]
|
367
|
+
end
|
368
|
+
|
369
|
+
end
|
370
|
+
|
371
|
+
describe 'with missing optional packages' do
|
372
|
+
|
373
|
+
before do
|
374
|
+
@d.optional :z
|
354
375
|
end
|
355
376
|
|
356
377
|
it 'should ignore missing recommendations' do
|
data/sprinkle.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{sprinkle}
|
3
|
-
s.version = "0.2.
|
3
|
+
s.version = "0.2.4"
|
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"]
|
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
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
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.
|
13
|
-
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.markdown"]
|
13
|
+
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.markdown", "Rakefile", "bin/sprinkle",
|
14
14
|
"config/hoe.rb", "config/requirements.rb", "examples/packages/build_essential.rb",
|
15
15
|
"examples/packages/databases/mysql.rb", "examples/packages/databases/sqlite3.rb",
|
16
16
|
"examples/packages/phusion.rb", "examples/packages/ruby/rails.rb", "examples/packages/ruby/ruby.rb",
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
"spec/sprinkle/script_spec.rb", "spec/sprinkle/sprinkle_spec.rb", "spec/sprinkle/installers/rake_spec.rb", "spec/sprinkle/verify_spec.rb"]
|
43
43
|
s.has_rdoc = true
|
44
44
|
s.homepage = %q{http://sprinkle.rubyforge.org}
|
45
|
-
s.rdoc_options = ["--main", "README.
|
45
|
+
s.rdoc_options = ["--main", "README.markdown"]
|
46
46
|
s.require_paths = ["lib"]
|
47
47
|
s.rubyforge_project = %q{sprinkle}
|
48
48
|
s.rubygems_version = %q{1.3.0}
|
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.2.
|
4
|
+
version: 0.2.4
|
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: 2009-07-
|
12
|
+
date: 2009-07-25 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -62,13 +62,12 @@ extensions: []
|
|
62
62
|
extra_rdoc_files:
|
63
63
|
- History.txt
|
64
64
|
- Manifest.txt
|
65
|
-
- README.txt
|
66
65
|
files:
|
67
66
|
- CREDITS
|
68
67
|
- History.txt
|
69
68
|
- MIT-LICENSE
|
70
69
|
- Manifest.txt
|
71
|
-
- README.
|
70
|
+
- README.markdown
|
72
71
|
- Rakefile
|
73
72
|
- bin/sprinkle
|
74
73
|
- config/hoe.rb
|