vagrant_bootstrap 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ module VagrantBootstrap
|
|
11
11
|
FileUtils.mkdir_p dir
|
12
12
|
rescue
|
13
13
|
STDERR.puts "FATAL: #{dir} already exists!"
|
14
|
-
exit
|
14
|
+
exit false
|
15
15
|
end
|
16
16
|
render opts.template_file, "#{dir}/Vagrantfile", opts
|
17
17
|
end
|
@@ -19,16 +19,25 @@ module VagrantBootstrap
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def render(template_file, target, opts)
|
22
|
-
|
23
|
-
file
|
22
|
+
file = template_path(template_file)
|
23
|
+
if file.nil?
|
24
|
+
STDERR.puts "FATAL: Couldn't find a template matching `#{template_file}'!"
|
25
|
+
exit false
|
26
|
+
end
|
27
|
+
puts "Rendering #{target} from #{file}..." if opts.verbose
|
24
28
|
template = open(file, 'r') {|f| f.read}
|
25
29
|
render = ERB.new(template).result(opts.instance_eval {binding})
|
26
30
|
open(target, 'w') {|f| f.write render}
|
27
31
|
puts "Done rendering #{target}." if opts.verbose
|
28
32
|
end
|
29
33
|
|
30
|
-
def template_path
|
31
|
-
|
34
|
+
def template_path(file)
|
35
|
+
tpath = File.expand_path "#{File.dirname __FILE__}/../../templates/#{file}"
|
36
|
+
ret = nil
|
37
|
+
[file, file+'.erb', tpath, tpath+'.erb'].each do |f|
|
38
|
+
ret = f and break if File.exists? f
|
39
|
+
end
|
40
|
+
ret
|
32
41
|
end
|
33
42
|
end
|
34
43
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|
@@ -45,7 +45,7 @@ files:
|
|
45
45
|
- lib/vagrant_bootstrap/bootstrap.rb
|
46
46
|
- lib/vagrant_bootstrap/cli.rb
|
47
47
|
- lib/vagrant_bootstrap/version.rb
|
48
|
-
- templates/
|
48
|
+
- templates/default.erb
|
49
49
|
- vagrant_bootstrap.gemspec
|
50
50
|
homepage: https://github.com/SmartReceipt/vagrant_bootstrap
|
51
51
|
licenses: []
|