sprinkle 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CREDITS +11 -9
- data/Manifest.txt +0 -3
- 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 +2 -5
- data/TODO +0 -56
- data/lib/sprinkle/sequence.rb +0 -21
- data/spec/sprinkle/sequence_spec.rb +0 -44
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
@@ -4,7 +4,6 @@ MIT-LICENSE
|
|
4
4
|
Manifest.txt
|
5
5
|
README.rdoc
|
6
6
|
Rakefile
|
7
|
-
TODO
|
8
7
|
bin/sprinkle
|
9
8
|
config/hoe.rb
|
10
9
|
config/requirements.rb
|
@@ -37,7 +36,6 @@ lib/sprinkle/installers/source.rb
|
|
37
36
|
lib/sprinkle/package.rb
|
38
37
|
lib/sprinkle/policy.rb
|
39
38
|
lib/sprinkle/script.rb
|
40
|
-
lib/sprinkle/sequence.rb
|
41
39
|
lib/sprinkle/version.rb
|
42
40
|
script/destroy
|
43
41
|
script/generate
|
@@ -55,7 +53,6 @@ spec/sprinkle/installers/source_spec.rb
|
|
55
53
|
spec/sprinkle/package_spec.rb
|
56
54
|
spec/sprinkle/policy_spec.rb
|
57
55
|
spec/sprinkle/script_spec.rb
|
58
|
-
spec/sprinkle/sequence_spec.rb
|
59
56
|
spec/sprinkle/sprinkle_spec.rb
|
60
57
|
sprinkle.gemspec
|
61
58
|
tasks/deployment.rake
|
@@ -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: 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 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -69,7 +69,6 @@ files:
|
|
69
69
|
- Manifest.txt
|
70
70
|
- README.rdoc
|
71
71
|
- Rakefile
|
72
|
-
- TODO
|
73
72
|
- bin/sprinkle
|
74
73
|
- config/hoe.rb
|
75
74
|
- config/requirements.rb
|
@@ -102,7 +101,6 @@ files:
|
|
102
101
|
- lib/sprinkle/package.rb
|
103
102
|
- lib/sprinkle/policy.rb
|
104
103
|
- lib/sprinkle/script.rb
|
105
|
-
- lib/sprinkle/sequence.rb
|
106
104
|
- lib/sprinkle/version.rb
|
107
105
|
- script/destroy
|
108
106
|
- script/generate
|
@@ -120,7 +118,6 @@ files:
|
|
120
118
|
- spec/sprinkle/package_spec.rb
|
121
119
|
- spec/sprinkle/policy_spec.rb
|
122
120
|
- spec/sprinkle/script_spec.rb
|
123
|
-
- spec/sprinkle/sequence_spec.rb
|
124
121
|
- spec/sprinkle/sprinkle_spec.rb
|
125
122
|
- sprinkle.gemspec
|
126
123
|
- tasks/deployment.rake
|
data/TODO
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
Version 0.1 plan
|
2
|
-
================
|
3
|
-
|
4
|
-
INSTALLER
|
5
|
-
* Fix up apt so that we can handle it if it asks questions, or fail? Check with Ben
|
6
|
-
* Support alternate gem package sources - DONE
|
7
|
-
* MD5/SHA1 checking on the installation files?
|
8
|
-
|
9
|
-
MISC
|
10
|
-
* Growl support
|
11
|
-
* Do a merb example
|
12
|
-
* Fix up printing of output so that its nice and a bit more like ports - DONE
|
13
|
-
* print ports style output for stages (installing, configuring, etc...)
|
14
|
-
* Add an option to print the hierarchy tree of packages to be installed only - DONE
|
15
|
-
* BlankSlate - active support has one
|
16
|
-
* CREDITS file - DONE
|
17
|
-
* Get #!/usr/bin/env sprinkle working - DONE
|
18
|
-
|
19
|
-
OPERATING SYSTEM
|
20
|
-
* OS abstraction
|
21
|
-
* build essential on Ubuntu only for example
|
22
|
-
|
23
|
-
TESTING
|
24
|
-
* Test on a base system Ubuntu system - DONE
|
25
|
-
* Multiple runs, check system that's partially installed - DONE
|
26
|
-
* Resuming downloads with wget ok - DONE
|
27
|
-
|
28
|
-
ERRORS
|
29
|
-
* Need to think about handling errors nicely
|
30
|
-
* Recovering from an error, and or successive runs of sprinkle
|
31
|
-
* store installed state on the remote server so we can skip installed packages?
|
32
|
-
* what about self healing things later? need to think about it
|
33
|
-
|
34
|
-
DOCUMENTATION
|
35
|
-
* Document the code somewhat, at least review that its all ok
|
36
|
-
* Wiki
|
37
|
-
* Home page somewhere? point to github
|
38
|
-
* Blog post
|
39
|
-
* Screencast - use that cool screenflow tool?
|
40
|
-
|
41
|
-
Post Version 0.1 plan
|
42
|
-
=====================
|
43
|
-
|
44
|
-
CONFIGURATION
|
45
|
-
* Think about it - talk to Lincoln and Ben
|
46
|
-
* Use cap 2.3 send/download file helpers, might be useful somehow for transporting config files
|
47
|
-
|
48
|
-
ACTOR
|
49
|
-
* Investigate a pure net:ssh/gateway delivery mechanism, ie. without cap?
|
50
|
-
* Generate a cap task file as output? not sure if people would be interested in this?
|
51
|
-
* use ruby2ruby to generate the file, nice :)
|
52
|
-
|
53
|
-
MISC
|
54
|
-
* Slicehost API support for creating a slice on the way
|
55
|
-
* active resource
|
56
|
-
* SSH keys, have to deploy them somehow?
|
data/lib/sprinkle/sequence.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Sprinkle
|
2
|
-
class Sequence
|
3
|
-
attr_accessor :stages
|
4
|
-
|
5
|
-
def initialize(&block)
|
6
|
-
self.instance_eval &block if block
|
7
|
-
end
|
8
|
-
|
9
|
-
def method_missing(sym, *args, &block)
|
10
|
-
@stages ||= ActiveSupport::OrderedHash.new
|
11
|
-
@stages[sym] = block
|
12
|
-
end
|
13
|
-
|
14
|
-
def each(&block)
|
15
|
-
@stages.each do |section, commands|
|
16
|
-
block.call section, commands.call
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe Sprinkle::Sequence do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@sequence = Sprinkle::Sequence.new do
|
7
|
-
section1 do
|
8
|
-
'command1'
|
9
|
-
end
|
10
|
-
|
11
|
-
section2 do
|
12
|
-
'command2'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'during initialization' do
|
18
|
-
|
19
|
-
it 'should yield the block, storing all section definitions provided' do
|
20
|
-
@sequence.stages.size.should == 2
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'during iteration' do
|
26
|
-
|
27
|
-
before do
|
28
|
-
@stages = { }
|
29
|
-
@sequence.each do |stage, commands|
|
30
|
-
@stages[stage] = commands
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should yield to a given block with the stage and commands for that stage' do
|
35
|
-
@stages.size.should == 2
|
36
|
-
@stages.keys.should include(:section1)
|
37
|
-
@stages[:section1].should == 'command1'
|
38
|
-
@stages.keys.should include(:section2)
|
39
|
-
@stages[:section2].should == 'command2'
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|