sprinkle 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -0
- data/Rakefile +18 -9
- data/VERSION +1 -1
- data/lib/sprinkle/actors/capistrano.rb +2 -2
- data/lib/sprinkle/installers/installer.rb +1 -1
- data/lib/sprinkle/installers/pacman.rb +23 -0
- data/lib/sprinkle/installers/source.rb +7 -3
- data/lib/sprinkle/installers/transfer.rb +87 -87
- data/lib/sprinkle/package.rb +4 -0
- data/lib/sprinkle/verifiers/user.rb +15 -0
- data/spec/sprinkle/installers/source_spec.rb +13 -13
- data/spec/sprinkle/installers/transfer_spec.rb +47 -25
- data/sprinkle.gemspec +165 -0
- metadata +8 -7
data/README.markdown
CHANGED
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
require 'rspec/core/rake_task'
|
3
4
|
|
4
5
|
begin
|
5
6
|
require 'jeweler'
|
@@ -15,7 +16,7 @@ begin
|
|
15
16
|
gem.add_dependency('activesupport', '>= 2.0.2')
|
16
17
|
gem.add_dependency('highline', '>= 1.4.0')
|
17
18
|
gem.add_dependency('capistrano', '>= 2.5.5')
|
18
|
-
|
19
|
+
|
19
20
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
21
|
end
|
21
22
|
Jeweler::GemcutterTasks.new
|
@@ -23,21 +24,29 @@ rescue LoadError
|
|
23
24
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
25
|
end
|
25
26
|
|
26
|
-
task "inst"=>[:clobber, :build] do
|
27
|
+
task "inst" => [:clobber, :build] do
|
27
28
|
puts `gem install pkg/sprinkle-*.gem`
|
28
29
|
end
|
29
30
|
|
30
|
-
require 'rspec/core/rake_task'
|
31
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
-
spec.rspec_opts = ['--backtrace']
|
34
|
-
# spec.rcov = true
|
35
|
-
end
|
36
|
-
|
37
31
|
task :spec => :check_dependencies
|
38
32
|
|
33
|
+
desc 'Default: run specs.'
|
39
34
|
task :default => :spec
|
40
35
|
|
36
|
+
desc "Run specs"
|
37
|
+
RSpec::Core::RakeTask.new do |t|
|
38
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
39
|
+
# Put spec opts in a file named .rspec in root
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Generate code coverage"
|
43
|
+
RSpec::Core::RakeTask.new(:coverage) do |t|
|
44
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
45
|
+
t.rcov = true
|
46
|
+
t.rcov_opts = ['--exclude', 'spec']
|
47
|
+
end
|
48
|
+
|
49
|
+
|
41
50
|
require 'rake/rdoctask'
|
42
51
|
Rake::RDocTask.new do |rdoc|
|
43
52
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
@@ -76,7 +76,7 @@ module Sprinkle
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
def transfer(name, source, destination, roles, recursive = true, suppress_and_return_failures = false)
|
80
80
|
define_task(name, roles) do
|
81
81
|
upload source, destination, :via => :scp, :recursive => recursive
|
82
82
|
end
|
@@ -90,7 +90,7 @@ module Sprinkle
|
|
90
90
|
# Reraise error if we're not suppressing it
|
91
91
|
raise
|
92
92
|
end
|
93
|
-
|
93
|
+
end
|
94
94
|
|
95
95
|
private
|
96
96
|
|
@@ -6,7 +6,7 @@ module Sprinkle
|
|
6
6
|
#
|
7
7
|
# = Pre/Post Installation Hooks
|
8
8
|
#
|
9
|
-
# With all
|
9
|
+
# With all installation methods you have the ability to specify multiple
|
10
10
|
# pre/post installation hooks. This gives you the ability to specify
|
11
11
|
# commands to run before and after an installation takes place. All
|
12
12
|
# commands by default are sudo'd so there is no need to include "sudo"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Installers
|
3
|
+
class Pacman < Installer
|
4
|
+
attr_accessor :packages
|
5
|
+
|
6
|
+
def initialize(parent, *packages, &block)
|
7
|
+
super parent, options, &block
|
8
|
+
|
9
|
+
packages = [packages] unless packages.is_a?(Array)
|
10
|
+
packages.flatten!
|
11
|
+
|
12
|
+
|
13
|
+
@packages = packages
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def install_commands
|
19
|
+
"pacman -Sy #{@packages.join(' ')} --no-confirm --needed"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -100,7 +100,7 @@ module Sprinkle
|
|
100
100
|
if File.exist? @source
|
101
101
|
[ "cp #{@source} #{@options[:archives].first}/#{archive_name}" ]
|
102
102
|
else
|
103
|
-
[ "wget -cq
|
103
|
+
[ "wget -cq -O '#{@options[:archives].first}/#{archive_name}' #{@source}" ]
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -120,7 +120,7 @@ module Sprinkle
|
|
120
120
|
}
|
121
121
|
|
122
122
|
extras.inject(command) { |m, (k, v)| m << create_options(k, v) if options[k]; m }
|
123
|
-
|
123
|
+
|
124
124
|
[ command << " > #{@package.name}-configure.log 2>&1'" ]
|
125
125
|
end
|
126
126
|
|
@@ -173,7 +173,11 @@ module Sprinkle
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def archive_name #:nodoc:
|
176
|
-
name = @
|
176
|
+
name = @source.split('/').last
|
177
|
+
if options[:custom_archive]
|
178
|
+
name = options[:custom_archive]
|
179
|
+
name = name.join if name.is_a? Array
|
180
|
+
end
|
177
181
|
raise "Unable to determine archive name for source: #{source}, please update code knowledge" unless name
|
178
182
|
name
|
179
183
|
end
|
@@ -2,26 +2,26 @@
|
|
2
2
|
class TemplateError < RuntimeError
|
3
3
|
attr_reader :original_exception, :context
|
4
4
|
SOURCE_CONTEXT_WINDOW = 2 unless defined? SOURCE_CONTEXT_WINDOW
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(original_exception, template, context)
|
7
7
|
@original_exception, @template, @context = original_exception, template, context
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def message
|
11
11
|
@original_exception.message
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def line_number
|
15
15
|
@line_number ||= $1.to_i if original_exception.backtrace.find {|line| line =~ /\(erubis\):(\d+)/ }
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def source_location
|
19
19
|
"on line ##{line_number}"
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def source_listing
|
23
|
-
|
24
|
-
|
23
|
+
return nil if line_number.nil?
|
24
|
+
|
25
25
|
@source_listing ||= begin
|
26
26
|
line_index = line_number - 1
|
27
27
|
beginning_line = line_index <= SOURCE_CONTEXT_WINDOW ? 0 : line_index - SOURCE_CONTEXT_WINDOW
|
@@ -36,7 +36,7 @@ class TemplateError < RuntimeError
|
|
36
36
|
output.join("\n")
|
37
37
|
end
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def to_s
|
41
41
|
"\n\n#{self.class} (#{message}) #{source_location}:\n\n" +
|
42
42
|
"#{source_listing}\n\n #{original_exception.backtrace.join("\n ")}\n\n"
|
@@ -50,7 +50,7 @@ module Sprinkle
|
|
50
50
|
# = File transfer installer
|
51
51
|
#
|
52
52
|
# This installer pushes files from the local disk to remote servers.
|
53
|
-
#
|
53
|
+
#
|
54
54
|
# == Example Usage
|
55
55
|
#
|
56
56
|
# Installing a nginx.conf onto remote servers
|
@@ -60,29 +60,29 @@ module Sprinkle
|
|
60
60
|
# end
|
61
61
|
#
|
62
62
|
# If you user has access to 'sudo' and theres a file that requires
|
63
|
-
# priveledges, you can pass :sudo => true
|
63
|
+
# priveledges, you can pass :sudo => true
|
64
64
|
#
|
65
65
|
# package :nginx_conf do
|
66
66
|
# transfer 'files/nginx.conf', '/etc/nginx.conf', :sudo => true
|
67
67
|
# end
|
68
68
|
#
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
# By default, transfers are recursive and you can move whole directories
|
70
|
+
# via this method. If you wish to disable recursive transfers, you can pass
|
71
|
+
# recursive => false, although it will not be obeyed when using the Vlad actor.
|
72
|
+
#
|
73
|
+
# If you pass the option :render => true, this tells transfer that the source file
|
74
|
+
# is an ERB template to be rendered locally before being transferred (you can declare
|
75
|
+
# variables in the package scope). When render is true, recursive is turned off. Note
|
76
|
+
# you can also explicitly pass locals in to render with the :locals option.
|
77
|
+
#
|
78
|
+
# package :nginx_conf do
|
79
|
+
# nginx_port = 8080
|
80
|
+
# transfer 'files/nginx.conf', '/etc/nginx.conf', :render => true
|
81
|
+
# end
|
72
82
|
#
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
# you can also explicitly pass locals in to render with the :locals option.
|
77
|
-
#
|
78
|
-
# package :nginx_conf do
|
79
|
-
# nginx_port = 8080
|
80
|
-
# transfer 'files/nginx.conf', '/etc/nginx.conf', :render => true
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# Finally, should you need to run commands before or after the file transfer (making
|
84
|
-
# directories or changing permissions), you can use the pre/post :install directives
|
85
|
-
# and they will be run.
|
83
|
+
# Finally, should you need to run commands before or after the file transfer (making
|
84
|
+
# directories or changing permissions), you can use the pre/post :install directives
|
85
|
+
# and they will be run.
|
86
86
|
class Transfer < Installer
|
87
87
|
attr_accessor :source, :destination #:nodoc:
|
88
88
|
|
@@ -92,37 +92,37 @@ module Sprinkle
|
|
92
92
|
@destination = destination
|
93
93
|
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
def self.render_template(template, context, prefix)
|
100
|
-
require 'tempfile'
|
101
|
-
require 'erubis'
|
95
|
+
def install_commands
|
96
|
+
nil
|
97
|
+
end
|
102
98
|
|
103
|
-
|
99
|
+
def self.render_template(template, context, prefix)
|
100
|
+
require 'tempfile'
|
101
|
+
require 'erubis'
|
102
|
+
|
103
|
+
begin
|
104
104
|
eruby = Erubis::Eruby.new(template)
|
105
105
|
output = eruby.result(context)
|
106
106
|
rescue Object => e
|
107
107
|
raise TemplateError.new(e, template, context)
|
108
108
|
end
|
109
109
|
|
110
|
-
final_tempfile = Tempfile.new(prefix)
|
110
|
+
final_tempfile = Tempfile.new(prefix.to_s)
|
111
111
|
final_tempfile.print(output)
|
112
112
|
final_tempfile.close
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
113
|
+
final_tempfile
|
114
|
+
end
|
115
|
+
|
116
|
+
def render_template(template, context, prefix)
|
117
|
+
self.class.render_template(template, context, prefix)
|
118
|
+
end
|
119
|
+
|
120
|
+
def render_template_file(path, context, prefix)
|
121
|
+
template = File.read(path)
|
122
|
+
tempfile = render_template(template, context, @package.name)
|
123
|
+
tempfile
|
124
|
+
end
|
125
|
+
|
126
126
|
def process(roles) #:nodoc:
|
127
127
|
assert_delivery
|
128
128
|
|
@@ -131,46 +131,46 @@ module Sprinkle
|
|
131
131
|
end
|
132
132
|
|
133
133
|
unless Sprinkle::OPTIONS[:testing]
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
134
|
+
pre = pre_commands(:install)
|
135
|
+
unless pre.empty?
|
136
|
+
sequence = pre; sequence = sequence.join('; ') if sequence.is_a? Array
|
137
|
+
logger.info "#{@package.name} pre-transfer commands: #{sequence} for roles: #{roles}\n"
|
138
|
+
@delivery.process @package.name, [pre].flatten, roles
|
139
|
+
end
|
140
|
+
|
141
|
+
recursive = @options[:recursive]
|
142
|
+
|
143
|
+
if options[:render]
|
144
|
+
if options[:locals]
|
145
|
+
context = {}
|
146
|
+
options[:locals].each_pair do |k,v|
|
147
|
+
if v.respond_to?(:call)
|
148
|
+
context[k] = v.call
|
149
|
+
else
|
150
|
+
context[k] = v
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else
|
154
|
+
context = binding()
|
155
|
+
end
|
156
|
+
|
157
|
+
tempfile = render_template_file(@source, context, @package.name)
|
158
|
+
sourcepath = tempfile.path
|
159
|
+
logger.info "Rendering template #{@source} to temporary file #{sourcepath}"
|
160
|
+
recursive = false
|
161
|
+
else
|
162
|
+
sourcepath = @source
|
163
|
+
end
|
164
|
+
|
165
|
+
logger.info "--> Transferring #{sourcepath} to #{@destination} for roles: #{roles}"
|
166
166
|
@delivery.transfer(@package.name, sourcepath, @destination, roles, recursive)
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
167
|
+
|
168
|
+
post = post_commands(:install)
|
169
|
+
unless post.empty?
|
170
|
+
sequence = post; sequence = sequence.join('; ') if sequence.is_a? Array
|
171
|
+
logger.info "#{@package.name} post-transfer commands: #{sequence} for roles: #{roles}\n"
|
172
|
+
@delivery.process @package.name, [post].flatten, roles
|
173
|
+
end
|
174
174
|
end
|
175
175
|
end
|
176
176
|
end
|
data/lib/sprinkle/package.rb
CHANGED
@@ -210,6 +210,10 @@ module Sprinkle
|
|
210
210
|
def verify(description = '', &block)
|
211
211
|
@verifications << Sprinkle::Verify.new(self, description, &block)
|
212
212
|
end
|
213
|
+
|
214
|
+
def pacman(*names, &block)
|
215
|
+
@installers << Sprinkle::Installers::Pacman.new(self, *names, &block)
|
216
|
+
end
|
213
217
|
|
214
218
|
def process(deployment, roles)
|
215
219
|
return if meta_package?
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Sprinkle
|
2
|
+
module Verifiers
|
3
|
+
# = User Verifier
|
4
|
+
# This was added so we dont have to verify a file to see if user was created
|
5
|
+
# Defines a verify which can be used to test the existence of a user.
|
6
|
+
module Users
|
7
|
+
Sprinkle::Verify.register(Sprinkle::Verifiers::Users)
|
8
|
+
|
9
|
+
# Tests that the user exists
|
10
|
+
def has_user(user)
|
11
|
+
@commands << "id #{user}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -36,7 +36,7 @@ describe Sprinkle::Installers::Source do
|
|
36
36
|
|
37
37
|
def create_source(source, version = nil, &block)
|
38
38
|
@package = mock(Sprinkle::Package, :name => 'package', :version => version)
|
39
|
-
|
39
|
+
|
40
40
|
Sprinkle::Installers::Source.new(@package, source, &block)
|
41
41
|
end
|
42
42
|
|
@@ -113,27 +113,27 @@ describe Sprinkle::Installers::Source do
|
|
113
113
|
it 'should prepare the build, installation and source archives area' do
|
114
114
|
@installer.should_receive(:prepare).and_return []
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
it "should prepare the build, installation and source archives area with correct paths" do
|
118
|
-
@installer.send(:prepare).should ==
|
118
|
+
@installer.send(:prepare).should ==
|
119
119
|
[
|
120
120
|
'mkdir -p /usr/local',
|
121
121
|
'mkdir -p /usr/local/builds',
|
122
|
-
'mkdir -p /usr/local/archives'
|
122
|
+
'mkdir -p /usr/local/archives'
|
123
123
|
]
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
it 'should download the source archive' do
|
127
127
|
@installer.should_receive(:download).and_return []
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'should download the source archive to the correct path' do
|
131
|
-
@installer.send(:download).should ==
|
131
|
+
@installer.send(:download).should ==
|
132
132
|
[
|
133
|
-
"wget -cq
|
133
|
+
"wget -cq -O '/usr/local/archives/#{@source.split('/').last}' #{@source}"
|
134
134
|
]
|
135
135
|
end
|
136
|
-
|
136
|
+
|
137
137
|
it 'should extract the source archive' do
|
138
138
|
@installer.should_receive(:extract).and_return []
|
139
139
|
end
|
@@ -148,7 +148,7 @@ describe Sprinkle::Installers::Source do
|
|
148
148
|
it 'should configure the source' do
|
149
149
|
@installer.should_receive(:configure).and_return []
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
it 'should configure the source in the correct path and with the correct prefix and options' do
|
153
153
|
enable = %w( headers ssl deflate so ).inject([]) { |m, value| m << "--enable-#{value}"; m }
|
154
154
|
disable = %w( cache proxy rewrite ).inject([]) { |m, value| m << "--disable-#{value}"; m }
|
@@ -159,10 +159,10 @@ describe Sprinkle::Installers::Source do
|
|
159
159
|
option = %w( foo bar baz ).inject([]) { |m, value| m << "--#{value}"; m }
|
160
160
|
|
161
161
|
configure_command = @installer.send(:configure).first
|
162
|
-
|
162
|
+
|
163
163
|
configure_command.should =~ %r{^bash -c 'cd /usr/local/builds/#{@filename} && ./configure --prefix=/usr/local}
|
164
164
|
configure_command.should =~ %r{ > #{@package.name}-configure.log 2>&1'$}
|
165
|
-
|
165
|
+
|
166
166
|
# order of options is arbitrary in ruby 1.8 !
|
167
167
|
configure_command.should =~ /#{enable.join(' ')}/
|
168
168
|
configure_command.should =~ /#{disable.join(' ')}/
|
@@ -170,11 +170,11 @@ describe Sprinkle::Installers::Source do
|
|
170
170
|
configure_command.should =~ /#{without.join(' ')}/
|
171
171
|
configure_command.should =~ /#{option.join(' ')}/
|
172
172
|
end
|
173
|
-
|
173
|
+
|
174
174
|
it 'should build the source' do
|
175
175
|
@installer.should_receive(:build).and_return []
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
it 'should build the source in the correct build path' do
|
179
179
|
@installer.send(:build).should ==
|
180
180
|
[
|
@@ -17,41 +17,63 @@ describe Sprinkle::Installers::Transfer do
|
|
17
17
|
installer do; prefix '/usr/bin'; end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def create_transfer(source, dest, options={}, &block)
|
22
22
|
i = Sprinkle::Installers::Transfer.new(@package, source, dest, options, &block)
|
23
23
|
i.delivery = @delivery
|
24
24
|
i
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
describe 'when created' do
|
28
28
|
it 'should accept a source and destination to install' do
|
29
29
|
@installer.source.should == @source
|
30
30
|
@installer.destination.should == @destination
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
describe 'during installation' do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
|
36
|
+
context 'single pre/post commands' do
|
37
|
+
before do
|
38
|
+
@installer = create_transfer @source, @destination do
|
39
|
+
pre :install, 'op1'
|
40
|
+
post :install, 'op2'
|
41
|
+
end
|
42
|
+
|
43
|
+
@delivery = @installer.delivery
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should call the pre and post install commands around the file transfer" do
|
47
|
+
@delivery.should_receive(:process).with(@package.name, ['op1'], @roles).and_return
|
48
|
+
@delivery.should_receive(:transfer).and_return
|
49
|
+
@delivery.should_receive(:process).with(@package.name, ['op2'], @roles).and_return
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should call transfer with recursive defaulted to nil" do
|
53
|
+
@delivery.should_receive(:process).and_return
|
54
|
+
@delivery.should_receive(:transfer).with(@package.name, @source, @destination, @roles, nil)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'multiple pre/post commands' do
|
60
|
+
before do
|
61
|
+
@installer = create_transfer @source, @destination do
|
62
|
+
pre :install, 'op1', 'op1-1'
|
63
|
+
post :install, 'op2', 'op2-1'
|
64
|
+
end
|
65
|
+
|
66
|
+
@delivery = @installer.delivery
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should call the pre and post install commands around the file transfer" do
|
70
|
+
@delivery.should_receive(:process).with(@package.name, ['op1', 'op1-1'], @roles).and_return
|
71
|
+
@delivery.should_receive(:transfer).and_return
|
72
|
+
@delivery.should_receive(:process).with(@package.name, ['op2', 'op2-1'], @roles).and_return
|
39
73
|
end
|
40
74
|
|
41
|
-
@delivery = @installer.delivery
|
42
75
|
end
|
43
76
|
|
44
|
-
it "should call the pre and post install commands around the file transfer" do
|
45
|
-
@delivery.should_receive(:process).with(@package.name, 'op1', @roles).once.ordered.and_return
|
46
|
-
@delivery.should_receive(:transfer).ordered.and_return
|
47
|
-
@delivery.should_receive(:process).with(@package.name, 'op2', @roles).once.ordered.and_return
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should call transfer with recursive defaulted to nil" do
|
51
|
-
@delivery.should_receive(:process).and_return
|
52
|
-
@delivery.should_receive(:transfer).with(@package.name, @source, @destination, @roles, nil)
|
53
|
-
end
|
54
|
-
|
55
77
|
after do
|
56
78
|
@installer.process @roles
|
57
79
|
end
|
@@ -65,22 +87,22 @@ describe Sprinkle::Installers::Transfer do
|
|
65
87
|
end
|
66
88
|
|
67
89
|
it "should render the source file as a template to a tempfile" do
|
68
|
-
@tempfile = Tempfile.new("foo")
|
90
|
+
@tempfile = Tempfile.new("foo")
|
69
91
|
@installer.should_receive(:render_template_file).with(@source, anything, @package.name).and_return(@tempfile)
|
70
92
|
@delivery.stub!(:transfer)
|
71
93
|
end
|
72
|
-
|
94
|
+
|
73
95
|
it "should call transfer with recursive set to false" do
|
74
|
-
@tempfile = Tempfile.new("foo")
|
96
|
+
@tempfile = Tempfile.new("foo")
|
75
97
|
@installer.should_receive(:render_template_file).with(@source, anything, @package.name).and_return(@tempfile)
|
76
98
|
@delivery.should_receive(:transfer).with(@package.name, @tempfile.path, @destination, @roles, false).ordered.and_return
|
77
99
|
end
|
78
|
-
|
100
|
+
|
79
101
|
after do
|
80
102
|
@installer.process @roles
|
81
103
|
end
|
82
104
|
end
|
83
|
-
|
105
|
+
|
84
106
|
describe "if the :recursive flag is explicitly set to false" do
|
85
107
|
before do
|
86
108
|
@installer = create_transfer @source, @destination, :recursive => false
|
@@ -90,7 +112,7 @@ describe Sprinkle::Installers::Transfer do
|
|
90
112
|
delivery = @installer.delivery
|
91
113
|
delivery.should_receive(:transfer).with(@package.name, @source, @destination, @roles, false).ordered.and_return
|
92
114
|
end
|
93
|
-
|
115
|
+
|
94
116
|
after do
|
95
117
|
@installer.process @roles
|
96
118
|
end
|
data/sprinkle.gemspec
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "sprinkle"
|
8
|
+
s.version = "0.3.5"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Marcus Crafter"]
|
12
|
+
s.date = "2011-09-09"
|
13
|
+
s.description = "Ruby DSL based software provisioning tool"
|
14
|
+
s.email = "crafterm@redartisan.com"
|
15
|
+
s.executables = ["sprinkle"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"README.markdown",
|
18
|
+
"TODO"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
"CREDITS",
|
22
|
+
"MIT-LICENSE",
|
23
|
+
"README.markdown",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"bin/sprinkle",
|
27
|
+
"examples/packages/build_essential.rb",
|
28
|
+
"examples/packages/databases/mysql.rb",
|
29
|
+
"examples/packages/databases/sqlite3.rb",
|
30
|
+
"examples/packages/phusion.rb",
|
31
|
+
"examples/packages/ruby/rails.rb",
|
32
|
+
"examples/packages/ruby/ruby.rb",
|
33
|
+
"examples/packages/ruby/rubygems.rb",
|
34
|
+
"examples/packages/scm/git.rb",
|
35
|
+
"examples/packages/scm/subversion.rb",
|
36
|
+
"examples/packages/servers/apache.rb",
|
37
|
+
"examples/rails/README",
|
38
|
+
"examples/rails/deploy.rb",
|
39
|
+
"examples/rails/packages/database.rb",
|
40
|
+
"examples/rails/packages/essential.rb",
|
41
|
+
"examples/rails/packages/rails.rb",
|
42
|
+
"examples/rails/packages/scm.rb",
|
43
|
+
"examples/rails/packages/search.rb",
|
44
|
+
"examples/rails/packages/server.rb",
|
45
|
+
"examples/rails/rails.rb",
|
46
|
+
"examples/sprinkle/sprinkle.rb",
|
47
|
+
"lib/sprinkle.rb",
|
48
|
+
"lib/sprinkle/actors/actors.rb",
|
49
|
+
"lib/sprinkle/actors/capistrano.rb",
|
50
|
+
"lib/sprinkle/actors/local.rb",
|
51
|
+
"lib/sprinkle/actors/ssh.rb",
|
52
|
+
"lib/sprinkle/actors/vlad.rb",
|
53
|
+
"lib/sprinkle/configurable.rb",
|
54
|
+
"lib/sprinkle/deployment.rb",
|
55
|
+
"lib/sprinkle/extensions/arbitrary_options.rb",
|
56
|
+
"lib/sprinkle/extensions/array.rb",
|
57
|
+
"lib/sprinkle/extensions/blank_slate.rb",
|
58
|
+
"lib/sprinkle/extensions/dsl_accessor.rb",
|
59
|
+
"lib/sprinkle/extensions/string.rb",
|
60
|
+
"lib/sprinkle/extensions/symbol.rb",
|
61
|
+
"lib/sprinkle/installers/apt.rb",
|
62
|
+
"lib/sprinkle/installers/binary.rb",
|
63
|
+
"lib/sprinkle/installers/bsd_port.rb",
|
64
|
+
"lib/sprinkle/installers/deb.rb",
|
65
|
+
"lib/sprinkle/installers/freebsd_pkg.rb",
|
66
|
+
"lib/sprinkle/installers/freebsd_portinstall.rb",
|
67
|
+
"lib/sprinkle/installers/gem.rb",
|
68
|
+
"lib/sprinkle/installers/install_package.rb",
|
69
|
+
"lib/sprinkle/installers/installer.rb",
|
70
|
+
"lib/sprinkle/installers/mac_port.rb",
|
71
|
+
"lib/sprinkle/installers/noop.rb",
|
72
|
+
"lib/sprinkle/installers/openbsd_pkg.rb",
|
73
|
+
"lib/sprinkle/installers/opensolaris_pkg.rb",
|
74
|
+
"lib/sprinkle/installers/pacman.rb",
|
75
|
+
"lib/sprinkle/installers/push_text.rb",
|
76
|
+
"lib/sprinkle/installers/rake.rb",
|
77
|
+
"lib/sprinkle/installers/replace_text.rb",
|
78
|
+
"lib/sprinkle/installers/rpm.rb",
|
79
|
+
"lib/sprinkle/installers/runner.rb",
|
80
|
+
"lib/sprinkle/installers/smart.rb",
|
81
|
+
"lib/sprinkle/installers/source.rb",
|
82
|
+
"lib/sprinkle/installers/transfer.rb",
|
83
|
+
"lib/sprinkle/installers/user.rb",
|
84
|
+
"lib/sprinkle/installers/yum.rb",
|
85
|
+
"lib/sprinkle/installers/zypper.rb",
|
86
|
+
"lib/sprinkle/package.rb",
|
87
|
+
"lib/sprinkle/policy.rb",
|
88
|
+
"lib/sprinkle/script.rb",
|
89
|
+
"lib/sprinkle/verifiers/apt.rb",
|
90
|
+
"lib/sprinkle/verifiers/directory.rb",
|
91
|
+
"lib/sprinkle/verifiers/executable.rb",
|
92
|
+
"lib/sprinkle/verifiers/file.rb",
|
93
|
+
"lib/sprinkle/verifiers/package.rb",
|
94
|
+
"lib/sprinkle/verifiers/process.rb",
|
95
|
+
"lib/sprinkle/verifiers/rpm.rb",
|
96
|
+
"lib/sprinkle/verifiers/ruby.rb",
|
97
|
+
"lib/sprinkle/verifiers/symlink.rb",
|
98
|
+
"lib/sprinkle/verifiers/user.rb",
|
99
|
+
"lib/sprinkle/verify.rb",
|
100
|
+
"script/console",
|
101
|
+
"script/destroy",
|
102
|
+
"script/generate",
|
103
|
+
"spec/spec.opts",
|
104
|
+
"spec/spec_helper.rb",
|
105
|
+
"spec/sprinkle/actors/capistrano_spec.rb",
|
106
|
+
"spec/sprinkle/actors/local_spec.rb",
|
107
|
+
"spec/sprinkle/configurable_spec.rb",
|
108
|
+
"spec/sprinkle/deployment_spec.rb",
|
109
|
+
"spec/sprinkle/extensions/array_spec.rb",
|
110
|
+
"spec/sprinkle/extensions/string_spec.rb",
|
111
|
+
"spec/sprinkle/installers/apt_spec.rb",
|
112
|
+
"spec/sprinkle/installers/binary_spec.rb",
|
113
|
+
"spec/sprinkle/installers/bsd_port_spec.rb",
|
114
|
+
"spec/sprinkle/installers/freebsd_pkg_spec.rb",
|
115
|
+
"spec/sprinkle/installers/freebsd_portinstall_spec.rb",
|
116
|
+
"spec/sprinkle/installers/gem_spec.rb",
|
117
|
+
"spec/sprinkle/installers/installer_spec.rb",
|
118
|
+
"spec/sprinkle/installers/mac_port_spec.rb",
|
119
|
+
"spec/sprinkle/installers/noop_spec.rb",
|
120
|
+
"spec/sprinkle/installers/openbsd_pkg_spec.rb",
|
121
|
+
"spec/sprinkle/installers/opensolaris_pkg_spec.rb",
|
122
|
+
"spec/sprinkle/installers/push_text_spec.rb",
|
123
|
+
"spec/sprinkle/installers/rake_spec.rb",
|
124
|
+
"spec/sprinkle/installers/replace_text_spec.rb",
|
125
|
+
"spec/sprinkle/installers/rpm_spec.rb",
|
126
|
+
"spec/sprinkle/installers/runner_spec.rb",
|
127
|
+
"spec/sprinkle/installers/source_spec.rb",
|
128
|
+
"spec/sprinkle/installers/transfer_spec.rb",
|
129
|
+
"spec/sprinkle/installers/yum_spec.rb",
|
130
|
+
"spec/sprinkle/installers/zypper_spec.rb",
|
131
|
+
"spec/sprinkle/package_spec.rb",
|
132
|
+
"spec/sprinkle/policy_spec.rb",
|
133
|
+
"spec/sprinkle/script_spec.rb",
|
134
|
+
"spec/sprinkle/sprinkle_spec.rb",
|
135
|
+
"spec/sprinkle/verify_spec.rb",
|
136
|
+
"sprinkle.gemspec"
|
137
|
+
]
|
138
|
+
s.homepage = "http://github.com/crafterm/sprinkle"
|
139
|
+
s.require_paths = ["lib"]
|
140
|
+
s.rubyforge_project = "sprinkle"
|
141
|
+
s.rubygems_version = "1.8.10"
|
142
|
+
s.summary = "Ruby DSL based software provisioning tool"
|
143
|
+
|
144
|
+
if s.respond_to? :specification_version then
|
145
|
+
s.specification_version = 3
|
146
|
+
|
147
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
148
|
+
s.add_development_dependency(%q<rspec>, [">= 2.5"])
|
149
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
|
150
|
+
s.add_runtime_dependency(%q<highline>, [">= 1.4.0"])
|
151
|
+
s.add_runtime_dependency(%q<capistrano>, [">= 2.5.5"])
|
152
|
+
else
|
153
|
+
s.add_dependency(%q<rspec>, [">= 2.5"])
|
154
|
+
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
155
|
+
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
156
|
+
s.add_dependency(%q<capistrano>, [">= 2.5.5"])
|
157
|
+
end
|
158
|
+
else
|
159
|
+
s.add_dependency(%q<rspec>, [">= 2.5"])
|
160
|
+
s.add_dependency(%q<activesupport>, [">= 2.0.2"])
|
161
|
+
s.add_dependency(%q<highline>, [">= 1.4.0"])
|
162
|
+
s.add_dependency(%q<capistrano>, [">= 2.5.5"])
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprinkle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 5
|
10
|
+
version: 0.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcus Crafter
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable: sprinkle
|
18
|
+
date: 2011-09-09 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rspec
|
@@ -144,6 +143,7 @@ files:
|
|
144
143
|
- lib/sprinkle/installers/noop.rb
|
145
144
|
- lib/sprinkle/installers/openbsd_pkg.rb
|
146
145
|
- lib/sprinkle/installers/opensolaris_pkg.rb
|
146
|
+
- lib/sprinkle/installers/pacman.rb
|
147
147
|
- lib/sprinkle/installers/push_text.rb
|
148
148
|
- lib/sprinkle/installers/rake.rb
|
149
149
|
- lib/sprinkle/installers/replace_text.rb
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- lib/sprinkle/verifiers/rpm.rb
|
168
168
|
- lib/sprinkle/verifiers/ruby.rb
|
169
169
|
- lib/sprinkle/verifiers/symlink.rb
|
170
|
+
- lib/sprinkle/verifiers/user.rb
|
170
171
|
- lib/sprinkle/verify.rb
|
171
172
|
- script/console
|
172
173
|
- script/destroy
|
@@ -204,8 +205,8 @@ files:
|
|
204
205
|
- spec/sprinkle/script_spec.rb
|
205
206
|
- spec/sprinkle/sprinkle_spec.rb
|
206
207
|
- spec/sprinkle/verify_spec.rb
|
208
|
+
- sprinkle.gemspec
|
207
209
|
- TODO
|
208
|
-
has_rdoc: true
|
209
210
|
homepage: http://github.com/crafterm/sprinkle
|
210
211
|
licenses: []
|
211
212
|
|
@@ -235,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
236
|
requirements: []
|
236
237
|
|
237
238
|
rubyforge_project: sprinkle
|
238
|
-
rubygems_version: 1.
|
239
|
+
rubygems_version: 1.8.10
|
239
240
|
signing_key:
|
240
241
|
specification_version: 3
|
241
242
|
summary: Ruby DSL based software provisioning tool
|