sprinkle 0.7.1.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.tm_properties +7 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +46 -4
- data/Rakefile +38 -1
- data/examples/rails/packages/database.rb +7 -0
- data/examples/rails/templates/mysql.cnf.erb +3 -0
- data/lib/sprinkle.rb +8 -13
- data/lib/sprinkle/actors/actor.rb +17 -17
- data/lib/sprinkle/actors/capistrano.rb +3 -3
- data/lib/sprinkle/actors/local.rb +10 -6
- data/lib/sprinkle/actors/ssh.rb +8 -8
- data/lib/sprinkle/actors/vlad.rb +7 -7
- data/lib/sprinkle/core.rb +16 -0
- data/lib/sprinkle/deployment.rb +8 -6
- data/lib/sprinkle/errors/pretty_failure.rb +1 -1
- data/lib/sprinkle/errors/template_error.rb +1 -1
- data/lib/sprinkle/installers/brew.rb +0 -2
- data/lib/sprinkle/installers/deb.rb +6 -2
- data/lib/sprinkle/installers/file.rb +38 -39
- data/lib/sprinkle/installers/freebsd_pkg.rb +4 -0
- data/lib/sprinkle/installers/group.rb +11 -12
- data/lib/sprinkle/installers/install_package.rb +5 -5
- data/lib/sprinkle/installers/openbsd_pkg.rb +5 -1
- data/lib/sprinkle/installers/opensolaris_pkg.rb +5 -1
- data/lib/sprinkle/installers/package_installer.rb +7 -3
- data/lib/sprinkle/installers/pacman.rb +4 -0
- data/lib/sprinkle/installers/push_text.rb +1 -1
- data/lib/sprinkle/installers/rake.rb +14 -6
- data/lib/sprinkle/installers/rpm.rb +5 -0
- data/lib/sprinkle/installers/runner.rb +3 -2
- data/lib/sprinkle/installers/thor.rb +14 -15
- data/lib/sprinkle/installers/transfer.rb +0 -1
- data/lib/sprinkle/installers/user.rb +2 -2
- data/lib/sprinkle/installers/yum.rb +9 -8
- data/lib/sprinkle/installers/zypper.rb +5 -1
- data/lib/sprinkle/package.rb +31 -8
- data/lib/sprinkle/package/chooser.rb +1 -1
- data/lib/sprinkle/package/package_repository.rb +1 -1
- data/lib/sprinkle/package/rendering.rb +13 -10
- data/lib/sprinkle/policy.rb +71 -74
- data/lib/sprinkle/script.rb +2 -2
- data/lib/sprinkle/utility/log_recorder.rb +1 -1
- data/lib/sprinkle/verifiers/file.rb +17 -1
- data/lib/sprinkle/verifiers/package.rb +2 -2
- data/lib/sprinkle/verify.rb +2 -2
- data/lib/sprinkle/version.rb +1 -1
- data/spec/sprinkle/deployment_spec.rb +5 -3
- data/spec/sprinkle/extensions/rendering_spec.rb +29 -14
- data/spec/sprinkle/installers/file_spec.rb +1 -1
- data/spec/sprinkle/installers/installer_spec.rb +1 -1
- data/spec/sprinkle/installers/opensolaris_pkg_spec.rb +0 -4
- data/spec/sprinkle/installers/transfer_spec.rb +1 -1
- data/spec/sprinkle/package_spec.rb +31 -0
- data/spec/sprinkle/policy_spec.rb +5 -5
- data/spec/sprinkle/verify_spec.rb +0 -7
- data/spec/templates/locals.erb +1 -0
- data/spec/templates/test.erb +1 -0
- data/templates/test.erb +1 -0
- metadata +10 -4
- data/lib/sprinkle/verifiers/directory.rb +0 -16
- data/lib/sprinkle/verifiers/symlink.rb +0 -30
@@ -1,10 +1,10 @@
|
|
1
1
|
# TODO: remove
|
2
2
|
module Sprinkle
|
3
3
|
module Verifiers
|
4
|
-
module Package
|
4
|
+
module Package #:nodoc:
|
5
5
|
Sprinkle::Verify.register(Sprinkle::Verifiers::Package)
|
6
6
|
|
7
|
-
def has_package(*packages)
|
7
|
+
def has_package(*packages)
|
8
8
|
puts "has_package and has_packages are depreciated"
|
9
9
|
raise "please use has_yum and friends instead"
|
10
10
|
end
|
data/lib/sprinkle/verify.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Sprinkle
|
2
|
-
# =
|
2
|
+
# = Verify Blocks
|
3
3
|
#
|
4
4
|
# As documented in Sprinkle::Package, you may define a block on a package
|
5
5
|
# which verifies that a package was installed correctly. If this verification
|
@@ -49,7 +49,7 @@ module Sprinkle
|
|
49
49
|
#
|
50
50
|
# To register your verifier, call the register method on Sprinkle::Verify:
|
51
51
|
#
|
52
|
-
#
|
52
|
+
# Sprinkle::Verify.register(MagicBeansVerifier)
|
53
53
|
#
|
54
54
|
# And now you may use it like any other verifier:
|
55
55
|
#
|
data/lib/sprinkle/version.rb
CHANGED
@@ -25,7 +25,8 @@ describe Sprinkle::Deployment do
|
|
25
25
|
|
26
26
|
it 'should optionally accept installer defaults' do
|
27
27
|
@deployment = create_deployment
|
28
|
-
@deployment.
|
28
|
+
@deployment.source do; end
|
29
|
+
@deployment.defaults.keys.should == [:source]
|
29
30
|
end
|
30
31
|
|
31
32
|
it 'should provide installer defaults as a proc when requested' do
|
@@ -63,8 +64,9 @@ describe Sprinkle::Deployment do
|
|
63
64
|
describe 'when processing policies' do
|
64
65
|
|
65
66
|
before do
|
66
|
-
@policy = mock(Policy, :process => true)
|
67
|
-
POLICIES
|
67
|
+
@policy = mock(Sprinkle::Policy, :process => true)
|
68
|
+
Sprinkle::POLICIES.clear
|
69
|
+
Sprinkle::POLICIES << @policy
|
68
70
|
@deployment = create_deployment
|
69
71
|
end
|
70
72
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require File.expand_path("../../spec_helper", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
describe Sprinkle::Package::Rendering, 'rendering' do
|
4
|
-
|
4
|
+
|
5
5
|
before do
|
6
|
+
@root = File.expand_path(File.join(File.dirname(__FILE__), "../.."))
|
6
7
|
@package = package :something do
|
7
8
|
end
|
8
9
|
end
|
@@ -10,24 +11,38 @@ describe Sprinkle::Package::Rendering, 'rendering' do
|
|
10
11
|
it "should be able to calculate md5s" do
|
11
12
|
@package.md5("test").should == "098f6bcd4621d373cade4e832627b4f6"
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
it "should allow passing locals to template" do
|
15
|
-
t
|
16
|
+
t = @package.template("hello <%= world %>", :world => "world")
|
16
17
|
t.should == "hello world"
|
17
18
|
end
|
18
|
-
|
19
|
-
it "should
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
|
20
|
+
it "should allow access to the package context by default" do
|
21
|
+
@package = package :new do
|
22
|
+
@wowser = "wowser"
|
23
|
+
end.instance
|
24
|
+
@package.opts[:world]="world"
|
25
|
+
t=@package.template("hello <%= opts[:world] %> <%= @wowser %>")
|
26
|
+
t.should == "hello world wowser"
|
23
27
|
end
|
24
|
-
|
28
|
+
|
25
29
|
it "should be able to render a file from templates" do
|
26
|
-
@
|
27
|
-
|
30
|
+
Dir.chdir(@root) do
|
31
|
+
t = @package.render("test")
|
32
|
+
t.should == "hello "
|
28
33
|
end
|
29
|
-
t=@package.render("test")
|
30
|
-
t.should == "hello world"
|
31
34
|
end
|
32
|
-
|
35
|
+
|
36
|
+
it "should be able to render a file from absolute path" do
|
37
|
+
path = File.join(@root, "templates/test.erb")
|
38
|
+
t = @package.render(path)
|
39
|
+
t.should == "hello "
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should accept binding as second argument" do
|
43
|
+
path = File.join(@root, "templates/locals.erb")
|
44
|
+
t = @package.render(path, :world => "world")
|
45
|
+
t.should == "hello world"
|
46
|
+
end
|
47
|
+
|
33
48
|
end
|
@@ -66,6 +66,37 @@ CODE
|
|
66
66
|
pkg.version.should == '2.0.2'
|
67
67
|
end
|
68
68
|
|
69
|
+
it 'should optionally accept configuration defaults' do
|
70
|
+
pkg = package @name do
|
71
|
+
defaults :some_option => 123, :some_other_option => true
|
72
|
+
end
|
73
|
+
pkg.defaults.should_not be_empty
|
74
|
+
pkg.opts.should eql({:some_option => 123, :some_other_option => true})
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should merge configuration defaults and additional opts' do
|
78
|
+
pkg = package @name do
|
79
|
+
defaults :some_option => 123, :some_other_option => true
|
80
|
+
end
|
81
|
+
instance = pkg.instance({:some_option => 345, :extra_option => false})
|
82
|
+
instance.opts.should eql({:some_option => 345, :some_other_option => true, :extra_option => false})
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should be able to use default option as installer argument' do
|
86
|
+
pkg = package @name do
|
87
|
+
defaults :username => 'deploy'
|
88
|
+
add_user opts[:username]
|
89
|
+
end
|
90
|
+
pkg.installers.first.class.should == Sprinkle::Installers::User
|
91
|
+
install_commands = pkg.installers.first.send :install_commands
|
92
|
+
install_commands.should == 'adduser --gecos ,,, deploy'
|
93
|
+
|
94
|
+
instance = pkg.instance :username => 'deployer'
|
95
|
+
|
96
|
+
install_commands = instance.installers.first.send :install_commands
|
97
|
+
install_commands.should == 'adduser --gecos ,,, deployer'
|
98
|
+
end
|
99
|
+
|
69
100
|
it 'should optionally accept an installer' do
|
70
101
|
pkg = package @name do
|
71
102
|
gem 'rails'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path("../spec_helper", File.dirname(__FILE__))
|
2
2
|
|
3
3
|
describe Sprinkle::Policy do
|
4
|
-
include Sprinkle::
|
4
|
+
include Sprinkle::Core
|
5
5
|
|
6
6
|
before do
|
7
7
|
@name = 'a policy'
|
@@ -14,7 +14,7 @@ describe Sprinkle::Policy do
|
|
14
14
|
|
15
15
|
it "should raise an error" do
|
16
16
|
@deployment = mock(:style => Sprinkle::Actors::Dummy.new {})
|
17
|
-
lambda { @policy.process(@deployment) }.should raise_error(Sprinkle::
|
17
|
+
lambda { @policy.process(@deployment) }.should raise_error(Sprinkle::NoMatchingServersError)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -44,10 +44,10 @@ describe Sprinkle::Policy do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'should add itself to the global policy list' do
|
47
|
-
sz = Sprinkle::
|
47
|
+
sz = Sprinkle::POLICIES.size
|
48
48
|
p = policy @name, :roles => :app do; end
|
49
|
-
Sprinkle::
|
50
|
-
Sprinkle::
|
49
|
+
Sprinkle::POLICIES.size.should == sz + 1
|
50
|
+
Sprinkle::POLICIES.last.should == p
|
51
51
|
end
|
52
52
|
|
53
53
|
end
|
@@ -24,9 +24,6 @@ describe Sprinkle::Verify do
|
|
24
24
|
# Check for a user
|
25
25
|
has_user "bob"
|
26
26
|
|
27
|
-
# Check for user with old API
|
28
|
-
user_present "someuser"
|
29
|
-
|
30
27
|
# Check for user in a group
|
31
28
|
has_user "alf", :in_group => "alien"
|
32
29
|
|
@@ -99,10 +96,6 @@ describe Sprinkle::Verify do
|
|
99
96
|
@verification.commands.should include('id bob')
|
100
97
|
end
|
101
98
|
|
102
|
-
it 'should use id to check for user via user_present' do
|
103
|
-
@verification.commands.should include('id someuser')
|
104
|
-
end
|
105
|
-
|
106
99
|
it 'should use id to check for group' do
|
107
100
|
@verification.commands.should include('id -g bobgroup')
|
108
101
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
hello <%= world %>
|
@@ -0,0 +1 @@
|
|
1
|
+
hello <%= @world %>
|
data/templates/test.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
hello <%= @world %>
|
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.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-06-
|
13
|
+
date: 2013-06-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -149,6 +149,7 @@ extra_rdoc_files:
|
|
149
149
|
- README.md
|
150
150
|
files:
|
151
151
|
- .gitignore
|
152
|
+
- .tm_properties
|
152
153
|
- .travis.yml
|
153
154
|
- CHANGELOG.md
|
154
155
|
- CREDITS
|
@@ -180,6 +181,7 @@ files:
|
|
180
181
|
- examples/rails/packages/search.rb
|
181
182
|
- examples/rails/packages/server.rb
|
182
183
|
- examples/rails/rails.rb
|
184
|
+
- examples/rails/templates/mysql.cnf.erb
|
183
185
|
- examples/sprinkle/sprinkle.rb
|
184
186
|
- inner.rb
|
185
187
|
- lib/sprinkle.rb
|
@@ -189,6 +191,7 @@ files:
|
|
189
191
|
- lib/sprinkle/actors/local.rb
|
190
192
|
- lib/sprinkle/actors/ssh.rb
|
191
193
|
- lib/sprinkle/actors/vlad.rb
|
194
|
+
- lib/sprinkle/core.rb
|
192
195
|
- lib/sprinkle/deployment.rb
|
193
196
|
- lib/sprinkle/errors/pretty_failure.rb
|
194
197
|
- lib/sprinkle/errors/remote_command_failure.rb
|
@@ -238,14 +241,12 @@ files:
|
|
238
241
|
- lib/sprinkle/policy.rb
|
239
242
|
- lib/sprinkle/script.rb
|
240
243
|
- lib/sprinkle/utility/log_recorder.rb
|
241
|
-
- lib/sprinkle/verifiers/directory.rb
|
242
244
|
- lib/sprinkle/verifiers/executable.rb
|
243
245
|
- lib/sprinkle/verifiers/file.rb
|
244
246
|
- lib/sprinkle/verifiers/package.rb
|
245
247
|
- lib/sprinkle/verifiers/permission.rb
|
246
248
|
- lib/sprinkle/verifiers/process.rb
|
247
249
|
- lib/sprinkle/verifiers/ruby.rb
|
248
|
-
- lib/sprinkle/verifiers/symlink.rb
|
249
250
|
- lib/sprinkle/verifiers/test.rb
|
250
251
|
- lib/sprinkle/verify.rb
|
251
252
|
- lib/sprinkle/version.rb
|
@@ -294,7 +295,10 @@ files:
|
|
294
295
|
- spec/sprinkle/script_spec.rb
|
295
296
|
- spec/sprinkle/sprinkle_spec.rb
|
296
297
|
- spec/sprinkle/verify_spec.rb
|
298
|
+
- spec/templates/locals.erb
|
299
|
+
- spec/templates/test.erb
|
297
300
|
- sprinkle.gemspec
|
301
|
+
- templates/test.erb
|
298
302
|
- test.rb
|
299
303
|
- work/inner.rb
|
300
304
|
homepage: https://github.com/sprinkle-tool/sprinkle
|
@@ -365,3 +369,5 @@ test_files:
|
|
365
369
|
- spec/sprinkle/script_spec.rb
|
366
370
|
- spec/sprinkle/sprinkle_spec.rb
|
367
371
|
- spec/sprinkle/verify_spec.rb
|
372
|
+
- spec/templates/locals.erb
|
373
|
+
- spec/templates/test.erb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Sprinkle
|
2
|
-
module Verifiers
|
3
|
-
# = Directory Verifier
|
4
|
-
#
|
5
|
-
# Defines a verify which can be used to test the existence of a
|
6
|
-
# directory.
|
7
|
-
module Directory
|
8
|
-
Sprinkle::Verify.register(Sprinkle::Verifiers::Directory)
|
9
|
-
|
10
|
-
# Tests that the directory <tt>dir</tt> exists.
|
11
|
-
def has_directory(dir)
|
12
|
-
test "-d #{dir}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Sprinkle
|
2
|
-
module Verifiers
|
3
|
-
# = Symlink Verifier
|
4
|
-
#
|
5
|
-
# Contains a verifier to check the existance of a symbolic link.
|
6
|
-
#
|
7
|
-
# == Example Usage
|
8
|
-
#
|
9
|
-
# First, checking for the existence of a symlink:
|
10
|
-
#
|
11
|
-
# verify { has_symlink '/usr/special/secret/pointer' }
|
12
|
-
#
|
13
|
-
# Second, checking that the symlink points to a specific place:
|
14
|
-
#
|
15
|
-
# verify { has_symlink '/usr/special/secret/pointer', '/usr/local/realfile' }
|
16
|
-
module Symlink
|
17
|
-
Sprinkle::Verify.register(Sprinkle::Verifiers::Symlink)
|
18
|
-
|
19
|
-
# Checks that <tt>symlink</tt> is a symbolic link. If <tt>file</tt> is
|
20
|
-
# given, it checks that <tt>symlink</tt> points to <tt>file</tt>
|
21
|
-
def has_symlink(symlink, file = nil)
|
22
|
-
if file.nil?
|
23
|
-
test "-L #{symlink}"
|
24
|
-
else
|
25
|
-
test "'#{file}' = `readlink #{symlink}`"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|