devstructure 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/devstructure/blueprint.rb +21 -17
- metadata +4 -4
@@ -157,8 +157,8 @@ EOF
|
|
157
157
|
end
|
158
158
|
|
159
159
|
# This is the POSIX shell code generator.
|
160
|
-
def sh
|
161
|
-
puts disclaimer
|
160
|
+
def sh(io=StringIO.new)
|
161
|
+
io.puts disclaimer
|
162
162
|
|
163
163
|
# First come packages. The algorithm used to walk the package tree
|
164
164
|
# is pluggable and in this case we only need to take action as each
|
@@ -170,14 +170,14 @@ EOF
|
|
170
170
|
# encountered.
|
171
171
|
walk(
|
172
172
|
:before => lambda { |manager, command|
|
173
|
-
puts "apt-get update" if "apt" == manager
|
173
|
+
io.puts "apt-get update" if "apt" == manager
|
174
174
|
},
|
175
175
|
:package => lambda { |manager, command, package, version|
|
176
176
|
return if manager == package
|
177
|
-
printf "#{command}\n", package, version
|
177
|
+
io.printf "#{command}\n", package, version
|
178
178
|
if "apt" == manager && package =~ /^rubygems(\d+\.\d+(?:\.\d+)?)$/
|
179
|
-
puts "/usr/bin/gem#{$1} install rubygems-update"
|
180
|
-
puts "/usr/bin/ruby#{$1} $(PATH=\"$PATH:/var/lib/gems/#{
|
179
|
+
io.puts "/usr/bin/gem#{$1} install rubygems-update"
|
180
|
+
io.puts "/usr/bin/ruby#{$1} $(PATH=\"$PATH:/var/lib/gems/#{
|
181
181
|
$1}/bin\" which update_rubygems)"
|
182
182
|
end
|
183
183
|
}
|
@@ -189,7 +189,7 @@ EOF
|
|
189
189
|
files.sort.each do |pathname, content|
|
190
190
|
if Hash == content.class
|
191
191
|
if content["_target"]
|
192
|
-
puts "ln -s #{content["_target"]} #{pathname}"
|
192
|
+
io.puts "ln -s #{content["_target"]} #{pathname}"
|
193
193
|
next
|
194
194
|
elsif content["_base64"]
|
195
195
|
content = content["_base64"]
|
@@ -202,26 +202,28 @@ EOF
|
|
202
202
|
end
|
203
203
|
eof = "EOF"
|
204
204
|
eof << "EOF" while content =~ /^#{eof}$/
|
205
|
-
puts "mkdir -p #{File.dirname(pathname)}"
|
206
|
-
puts "#{command} >#{pathname} <<#{eof}"
|
207
|
-
puts content
|
208
|
-
puts eof
|
205
|
+
io.puts "mkdir -p #{File.dirname(pathname)}"
|
206
|
+
io.puts "#{command} >#{pathname} <<#{eof}"
|
207
|
+
io.puts content
|
208
|
+
io.puts eof
|
209
209
|
end if files
|
210
210
|
|
211
211
|
# Source tarballs are downloaded, extracted, and removed. Generally,
|
212
212
|
# the directory in question is `/usr/local` but the future could hold
|
213
213
|
# anything.
|
214
214
|
sources.sort.each do |dirname, filename|
|
215
|
-
puts "wget http://s3.amazonaws.com/blueprint-sources/#{filename}"
|
216
|
-
puts "tar xf #{filename} -C #{dirname}"
|
217
|
-
puts "rm #{filename}"
|
215
|
+
io.puts "wget http://s3.amazonaws.com/blueprint-sources/#{filename}"
|
216
|
+
io.puts "tar xf #{filename} -C #{dirname}"
|
217
|
+
io.puts "rm #{filename}"
|
218
218
|
end if sources
|
219
219
|
|
220
|
+
io.close
|
221
|
+
io
|
220
222
|
end
|
221
223
|
|
222
224
|
# This is the Puppet code generator.
|
223
|
-
def puppet
|
224
|
-
puts disclaimer
|
225
|
+
def puppet(io=StringIO.new)
|
226
|
+
io.puts disclaimer
|
225
227
|
manifest = Puppet::Manifest.new(@name)
|
226
228
|
|
227
229
|
# Right out of the gate, we set a default `PATH` because Puppet does not.
|
@@ -402,7 +404,9 @@ EOF
|
|
402
404
|
end
|
403
405
|
end
|
404
406
|
|
405
|
-
puts manifest
|
407
|
+
io.puts manifest
|
408
|
+
io.close
|
409
|
+
io
|
406
410
|
end
|
407
411
|
|
408
412
|
# This is the Chef code generator. It is the first of its kind in
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Crowley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-01 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|