crafterm-sprinkle 0.1.4 → 0.1.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/CREDITS +11 -9
- data/Manifest.txt +1 -1
- data/{README.txt → README.rdoc} +19 -19
- data/lib/sprinkle/installers/apt.rb +8 -3
- data/lib/sprinkle/installers/source.rb +2 -1
- data/lib/sprinkle/package.rb +4 -4
- data/lib/sprinkle/version.rb +1 -1
- data/spec/sprinkle/installers/apt_spec.rb +23 -2
- data/spec/sprinkle/installers/source_spec.rb +20 -4
- data/spec/sprinkle/package_spec.rb +38 -0
- data/sprinkle.gemspec +4 -4
- metadata +3 -4
data/CREDITS
CHANGED
@@ -3,12 +3,14 @@
|
|
3
3
|
Many thanks to the following people who have submitted ideas, patches, helped with testing
|
4
4
|
and/or generally provided support to Sprinke, I really appreciate your help:
|
5
5
|
|
6
|
-
Kristin Baumann
|
7
|
-
Ben Schwarz
|
8
|
-
Jim Freeze
|
9
|
-
Matthew Tanase
|
10
|
-
Jared Kuolt
|
11
|
-
Jamis Buck
|
12
|
-
Matt Allen
|
13
|
-
Eric Hodel
|
14
|
-
Pete Yandell
|
6
|
+
Kristin Baumann (http://crafterm.net/kristin/blog/)
|
7
|
+
Ben Schwarz (http://germanforblack.com/)
|
8
|
+
Jim Freeze (http://www.artima.com/rubycs/articles/ruby_as_dslP.html)
|
9
|
+
Matthew Tanase (http://www.slicehost.com)
|
10
|
+
Jared Kuolt (http://www.slicehost.com)
|
11
|
+
Jamis Buck (http://www.capify.org)
|
12
|
+
Matt Allen (http://blog.allen.com.au)
|
13
|
+
Eric Hodel (http://blog.segment7.net)
|
14
|
+
Pete Yandell (http://notahat.com)
|
15
|
+
Adam Meehan (http://duckpunching.com)
|
16
|
+
Mitchell Hashimoto (http://mitchellhashimoto.com)
|
data/Manifest.txt
CHANGED
data/{README.txt → README.rdoc}
RENAMED
@@ -1,5 +1,6 @@
|
|
1
1
|
= SPRINKLE
|
2
2
|
|
3
|
+
http://redartisan.com/2008/5/27/sprinkle-intro
|
3
4
|
http://github.com/crafterm/sprinkle
|
4
5
|
|
5
6
|
== DESCRIPTION:
|
@@ -17,7 +18,7 @@ An example package description follows:
|
|
17
18
|
package :ruby do
|
18
19
|
description 'Ruby Virtual Machine'
|
19
20
|
version '1.8.6'
|
20
|
-
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz"
|
21
|
+
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz"
|
21
22
|
requires :ruby_dependencies
|
22
23
|
end
|
23
24
|
|
@@ -31,7 +32,8 @@ Since packages come in many forms (eg. gems, pre-compiled debs, compressed sourc
|
|
31
32
|
many different installer types, giving you the most amount of flexibility of how you'd like software installed.
|
32
33
|
New installer types can be added into the system easily.
|
33
34
|
|
34
|
-
For example, you could install Rails via gems, nginx via source, and mysql via APT
|
35
|
+
For example, you could install Rails via gems, nginx via source, and mysql via APT, while retaining the flexibility
|
36
|
+
of changing installer types as software is updated upstream.
|
35
37
|
|
36
38
|
Sprinkle also supports dependencies between packages, allowing you specify pre-requisites that need to be
|
37
39
|
installed in order.
|
@@ -41,28 +43,29 @@ Packages can be grouped into polices to define several packages that should be i
|
|
41
43
|
An example policy:
|
42
44
|
|
43
45
|
policy :rails, :roles => :app do
|
44
|
-
requires :rails, :version => '2.0
|
46
|
+
requires :rails, :version => '2.1.0'
|
45
47
|
requires :appserver
|
46
48
|
requires :database
|
47
49
|
requires :webserver
|
48
50
|
end
|
49
51
|
|
50
52
|
This defines a policy called Rails, that applies to machines of role :app. The policy includes the packages
|
51
|
-
rails (version 2.0
|
53
|
+
rails (version 2.1.0), appserver, database and webserver.
|
52
54
|
|
53
55
|
appserver, database and webserver can be virtual packages, where the user will be prompted for selection if
|
54
56
|
multiple choices for the virtual package exist.
|
55
57
|
|
56
58
|
Sprinkle is architected to be extendable in many ways, one of those areas is in its deployment of commands to
|
57
|
-
remote hosts. Currently Sprinkle
|
58
|
-
|
59
|
+
remote hosts. Currently Sprinkle supports the use of Capistrano or Vlad to issue commands on remote hosts via ssh,
|
60
|
+
but could also be extended to use any other command transport mechanism or be used to simply issue installation
|
61
|
+
commands on the local system.
|
59
62
|
|
60
63
|
An full example Sprinkle deployment script for deploying Rails (via gems), MySQL (via APT), and Apache (via source):
|
61
64
|
|
62
65
|
# Sprinkle Rails deployment script
|
63
66
|
#
|
64
67
|
# This is an example Sprinkle script, configured to install Rails from gems, Apache and Ruby from source,
|
65
|
-
# and mysql from apt on an Ubuntu system. Installation is configured to run via
|
68
|
+
# and mysql from apt on an Ubuntu system. Installation is configured to run via Capistrano (and
|
66
69
|
# an accompanying deploy.rb recipe script). Source based packages are downloaded and built into
|
67
70
|
# /usr/local on the remote system.
|
68
71
|
#
|
@@ -85,15 +88,10 @@ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL
|
|
85
88
|
|
86
89
|
# Packages
|
87
90
|
|
88
|
-
package :build_essential do # special package, anything that uses a 'source' installer will have build-essential installed for Ubuntu
|
89
|
-
description 'Build tools'
|
90
|
-
apt 'build-essential'
|
91
|
-
end
|
92
|
-
|
93
91
|
package :ruby do
|
94
92
|
description 'Ruby Virtual Machine'
|
95
93
|
version '1.8.6'
|
96
|
-
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz"
|
94
|
+
source "ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p111.tar.gz"
|
97
95
|
requires :ruby_dependencies
|
98
96
|
end
|
99
97
|
|
@@ -109,7 +107,7 @@ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL
|
|
109
107
|
|
110
108
|
package :apache, :provides => :webserver do
|
111
109
|
description 'Apache 2 HTTP Server'
|
112
|
-
version '2.2.
|
110
|
+
version '2.2.9'
|
113
111
|
source "http://apache.wildit.net.au/httpd/httpd-#{version}.tar.bz2" do
|
114
112
|
enable %w( mods-shared=all proxy proxy-balancer proxy-http rewrite cache headers ssl deflate so )
|
115
113
|
prefix "/opt/local/apache2-#{version}"
|
@@ -125,8 +123,8 @@ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL
|
|
125
123
|
|
126
124
|
package :rubygems do
|
127
125
|
description 'Ruby Gems Package Management System'
|
128
|
-
version '1.0
|
129
|
-
source "http://rubyforge.org/frs/download.php/
|
126
|
+
version '1.2.0'
|
127
|
+
source "http://rubyforge.org/frs/download.php/38646/rubygems-#{version}.tgz" do
|
130
128
|
custom_install 'ruby setup.rb'
|
131
129
|
end
|
132
130
|
requires :ruby
|
@@ -135,13 +133,13 @@ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL
|
|
135
133
|
package :rails do
|
136
134
|
description 'Ruby on Rails'
|
137
135
|
gem 'rails'
|
138
|
-
version '2.0
|
136
|
+
version '2.1.0'
|
139
137
|
end
|
140
138
|
|
141
139
|
package :mongrel do
|
142
140
|
description 'Mongrel Application Server'
|
143
141
|
gem 'mongrel'
|
144
|
-
version '1.1.
|
142
|
+
version '1.1.5'
|
145
143
|
end
|
146
144
|
|
147
145
|
package :mongrel_cluster, :provides => :appserver do
|
@@ -159,7 +157,7 @@ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL
|
|
159
157
|
# the user is requested to select which one to use.
|
160
158
|
|
161
159
|
policy :rails, :roles => :app do
|
162
|
-
requires :rails, :version => '2.0
|
160
|
+
requires :rails, :version => '2.1.0'
|
163
161
|
requires :appserver
|
164
162
|
requires :database
|
165
163
|
requires :webserver
|
@@ -187,6 +185,8 @@ An full example Sprinkle deployment script for deploying Rails (via gems), MySQL
|
|
187
185
|
|
188
186
|
end
|
189
187
|
|
188
|
+
Please see the examples directory for more complete examples of Sprinkle deployment scripts.
|
189
|
+
|
190
190
|
Sprinkle is a work in progress and I'm excited to hear if anyone finds it useful - please feel free to
|
191
191
|
comment, ask any questions, or send in any ideas, patches, bugs. All most welcome.
|
192
192
|
|
@@ -3,16 +3,21 @@ module Sprinkle
|
|
3
3
|
class Apt < Installer
|
4
4
|
attr_accessor :packages
|
5
5
|
|
6
|
-
def initialize(parent, packages, &block)
|
6
|
+
def initialize(parent, *packages, &block)
|
7
7
|
super parent, &block
|
8
|
-
packages
|
8
|
+
packages.flatten!
|
9
|
+
|
10
|
+
options = { :dependencies_only => false }
|
11
|
+
options.update(packages.pop) if packages.last.is_a?(Hash)
|
12
|
+
|
13
|
+
@command = options[:dependencies_only] ? 'build-dep' : 'install'
|
9
14
|
@packages = packages
|
10
15
|
end
|
11
16
|
|
12
17
|
protected
|
13
18
|
|
14
19
|
def install_commands
|
15
|
-
"DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get -qyu
|
20
|
+
"DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get -qyu #{@command} #{@packages.join(' ')}"
|
16
21
|
end
|
17
22
|
|
18
23
|
end
|
@@ -106,7 +106,7 @@ module Sprinkle
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def build_dir
|
109
|
-
"#{@options[:builds]}/#{base_dir}"
|
109
|
+
"#{@options[:builds]}/#{options[:custom_dir] || base_dir}"
|
110
110
|
end
|
111
111
|
|
112
112
|
def base_dir
|
@@ -115,6 +115,7 @@ module Sprinkle
|
|
115
115
|
end
|
116
116
|
raise "Unknown base path for source archive: #{@source}, please update code knowledge"
|
117
117
|
end
|
118
|
+
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
data/lib/sprinkle/package.rb
CHANGED
@@ -27,12 +27,12 @@ module Sprinkle
|
|
27
27
|
self.instance_eval &block
|
28
28
|
end
|
29
29
|
|
30
|
-
def apt(*names)
|
31
|
-
@installer = Sprinkle::Installers::Apt.new(self, *names)
|
30
|
+
def apt(*names, &block)
|
31
|
+
@installer = Sprinkle::Installers::Apt.new(self, *names, &block)
|
32
32
|
end
|
33
33
|
|
34
|
-
def rpm(*names)
|
35
|
-
@installer = Sprinkle::Installers::Rpm.new(self, *names)
|
34
|
+
def rpm(*names, &block)
|
35
|
+
@installer = Sprinkle::Installers::Rpm.new(self, *names, &block)
|
36
36
|
end
|
37
37
|
|
38
38
|
def gem(name, options = {}, &block)
|
data/lib/sprinkle/version.rb
CHANGED
@@ -6,8 +6,8 @@ describe Sprinkle::Installers::Apt do
|
|
6
6
|
@package = mock(Sprinkle::Package, :name => 'package')
|
7
7
|
end
|
8
8
|
|
9
|
-
def create_apt(debs, &block)
|
10
|
-
Sprinkle::Installers::Apt.new(@package, debs, &block)
|
9
|
+
def create_apt(*debs, &block)
|
10
|
+
Sprinkle::Installers::Apt.new(@package, *debs, &block)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'when created' do
|
@@ -24,6 +24,15 @@ describe Sprinkle::Installers::Apt do
|
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
|
+
describe 'when created for dependencies only install' do
|
28
|
+
|
29
|
+
it 'should remove options from packages list' do
|
30
|
+
@installer = create_apt 'ruby', :dependencies_only => true
|
31
|
+
@installer.packages.should == [ 'ruby' ]
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
27
36
|
describe 'during installation' do
|
28
37
|
|
29
38
|
before do
|
@@ -49,5 +58,17 @@ describe Sprinkle::Installers::Apt do
|
|
49
58
|
it 'should install a specific version if defined'
|
50
59
|
|
51
60
|
end
|
61
|
+
|
62
|
+
describe 'during dependencies only installation' do
|
52
63
|
|
64
|
+
before do
|
65
|
+
@installer = create_apt 'ruby', :dependencies_only => true
|
66
|
+
@install_commands = @installer.send :install_commands
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should invoke the apt installer with build-dep command for all specified packages' do
|
70
|
+
@install_commands.should =~ /apt-get -qyu build-dep ruby/
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
53
74
|
end
|
@@ -171,10 +171,10 @@ describe Sprinkle::Installers::Source do
|
|
171
171
|
@installer.defaults(@deployment)
|
172
172
|
end
|
173
173
|
|
174
|
-
it 'should store the custom
|
174
|
+
it 'should store the custom install commands' do
|
175
175
|
@installer.options[:custom_install].should == 'ruby setup.rb'
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
it 'should identify as having a custom install command' do
|
179
179
|
@installer.should be_custom_install
|
180
180
|
end
|
@@ -188,12 +188,28 @@ describe Sprinkle::Installers::Source do
|
|
188
188
|
end
|
189
189
|
|
190
190
|
it 'should install the source using a custom installation command' do
|
191
|
-
@installer.send(:custom_install_commands).should
|
191
|
+
@installer.send(:custom_install_commands).first.should =~ /ruby setup.rb/
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
it 'should be run relative to the source build area' do
|
195
195
|
@installer.send(:custom_install_commands).first.should =~ %r{cd /usr/builds/ruby-1.8.6-p111}
|
196
196
|
end
|
197
|
+
|
198
|
+
describe 'with a customized directory' do
|
199
|
+
|
200
|
+
before do
|
201
|
+
@installer.options[:custom_dir] = 'test'
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'should install the source from the custom dir path' do
|
205
|
+
@installer.send(:custom_install_commands).first.should =~ /test/
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'should store the custom build dir path' do
|
209
|
+
@installer.options[:custom_dir].should == 'test'
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
197
213
|
|
198
214
|
end
|
199
215
|
|
@@ -8,6 +8,24 @@ describe Sprinkle::Package do
|
|
8
8
|
@empty = Proc.new { }
|
9
9
|
@opts = { }
|
10
10
|
end
|
11
|
+
|
12
|
+
# Kind of a messy way to do this but it works and DRYs out
|
13
|
+
# the specs. Checks to make sure an installer is receiving
|
14
|
+
# the block passed to it throught the package block.
|
15
|
+
def check_block_forwarding_on(installer)
|
16
|
+
eval(<<CODE)
|
17
|
+
pre_count = 0
|
18
|
+
lambda {
|
19
|
+
pkg = package @name do
|
20
|
+
#{installer} 'archive' do
|
21
|
+
pre :install, 'preOp'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
pre_count = pkg.installer.instance_variable_get(:@pre)[:install].length
|
26
|
+
}.should change { pre_count }.by(1)
|
27
|
+
CODE
|
28
|
+
end
|
11
29
|
|
12
30
|
describe 'when created' do
|
13
31
|
|
@@ -126,6 +144,10 @@ describe Sprinkle::Package do
|
|
126
144
|
pkg.should respond_to(:source)
|
127
145
|
pkg.installer.class.should == Sprinkle::Installers::Source
|
128
146
|
end
|
147
|
+
|
148
|
+
it 'should forward block to installer superclass' do
|
149
|
+
check_block_forwarding_on(:source)
|
150
|
+
end
|
129
151
|
|
130
152
|
it 'should automatically add a build essential recommendation' do
|
131
153
|
pkg = package @name do
|
@@ -135,6 +157,18 @@ describe Sprinkle::Package do
|
|
135
157
|
end
|
136
158
|
|
137
159
|
end
|
160
|
+
|
161
|
+
describe 'with an apt installer' do
|
162
|
+
it 'should forward block to installer superclass' do
|
163
|
+
check_block_forwarding_on(:apt)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe 'with an rpm installer' do
|
168
|
+
it 'should forward block to installer superclass' do
|
169
|
+
check_block_forwarding_on(:rpm)
|
170
|
+
end
|
171
|
+
end
|
138
172
|
|
139
173
|
describe 'with an gem installer' do
|
140
174
|
|
@@ -144,6 +178,10 @@ describe Sprinkle::Package do
|
|
144
178
|
end
|
145
179
|
pkg.recommends.should include(:rubygems)
|
146
180
|
end
|
181
|
+
|
182
|
+
it 'should forward block to installer superclass' do
|
183
|
+
check_block_forwarding_on(:gem)
|
184
|
+
end
|
147
185
|
|
148
186
|
end
|
149
187
|
|
data/sprinkle.gemspec
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{sprinkle}
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.5"
|
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"]
|
7
|
-
s.date = %q{2008-07-
|
7
|
+
s.date = %q{2008-07-16}
|
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"]
|
11
11
|
s.executables = ["sprinkle"]
|
12
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt"
|
13
|
-
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
|
13
|
+
s.files = ["CREDITS", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "bin/sprinkle", "config/hoe.rb", "config/requirements.rb", "examples/merb/deploy.rb", "examples/rails/README", "examples/rails/deploy.rb", "examples/rails/packages/database.rb", "examples/rails/packages/essential.rb", "examples/rails/packages/rails.rb", "examples/rails/packages/search.rb", "examples/rails/packages/server.rb", "examples/rails/rails.rb", "examples/sprinkle/sprinkle.rb", "lib/sprinkle.rb", "lib/sprinkle/actors/capistrano.rb", "lib/sprinkle/actors/vlad.rb", "lib/sprinkle/deployment.rb", "lib/sprinkle/extensions/arbitrary_options.rb", "lib/sprinkle/extensions/array.rb", "lib/sprinkle/extensions/blank_slate.rb", "lib/sprinkle/extensions/dsl_accessor.rb", "lib/sprinkle/extensions/string.rb", "lib/sprinkle/extensions/symbol.rb", "lib/sprinkle/installers/apt.rb", "lib/sprinkle/installers/gem.rb", "lib/sprinkle/installers/installer.rb", "lib/sprinkle/installers/rake.rb", "lib/sprinkle/installers/rpm.rb", "lib/sprinkle/installers/source.rb", "lib/sprinkle/package.rb", "lib/sprinkle/policy.rb", "lib/sprinkle/script.rb", "lib/sprinkle/version.rb", "script/destroy", "script/generate", "spec/spec.opts", "spec/spec_helper.rb", "spec/sprinkle/actors/capistrano_spec.rb", "spec/sprinkle/deployment_spec.rb", "spec/sprinkle/extensions/array_spec.rb", "spec/sprinkle/extensions/string_spec.rb", "spec/sprinkle/installers/apt_spec.rb", "spec/sprinkle/installers/gem_spec.rb", "spec/sprinkle/installers/installer_spec.rb", "spec/sprinkle/installers/rpm_spec.rb", "spec/sprinkle/installers/source_spec.rb", "spec/sprinkle/package_spec.rb", "spec/sprinkle/policy_spec.rb", "spec/sprinkle/script_spec.rb", "spec/sprinkle/sprinkle_spec.rb", "sprinkle.gemspec", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://sprinkle.rubyforge.org}
|
16
16
|
s.rdoc_options = ["--main", "README.txt"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crafterm-sprinkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
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: 2008-07-
|
12
|
+
date: 2008-07-16 00:00:00 -07:00
|
13
13
|
default_executable: sprinkle
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -58,13 +58,12 @@ extensions: []
|
|
58
58
|
extra_rdoc_files:
|
59
59
|
- History.txt
|
60
60
|
- Manifest.txt
|
61
|
-
- README.txt
|
62
61
|
files:
|
63
62
|
- CREDITS
|
64
63
|
- History.txt
|
65
64
|
- MIT-LICENSE
|
66
65
|
- Manifest.txt
|
67
|
-
- README.
|
66
|
+
- README.rdoc
|
68
67
|
- Rakefile
|
69
68
|
- bin/sprinkle
|
70
69
|
- config/hoe.rb
|