berktacular 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/berktacular +12 -4
- data/lib/berktacular/berksfile.rb +7 -5
- data/lib/berktacular/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTZkZDMxZjZhNjhhMTE4OGFiOThiZGY4NzYzZDY0Y2UxNTBhMDhlYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDY2ODBmYTkyM2Y4ZGI2OTVlMWM0MTI0NjYzNTNmYWIwMjE2MjkwYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWU4ZDJiMWQxZTliYWVhMWRiZjQzNDU4NGJjZTIxYzAwZjFhYWUyODk3ZmIx
|
10
|
+
OWZiOGJmYjllM2RlZTA4YmNiZTJiNGU1YWE3NzI0OGMyMmM0ZDAzMmI3MGM1
|
11
|
+
MDNiM2ZjNWFhMWI4ZWFhYTI3NTQyMzM0YzMxMTYxNDMxMmRhYTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTIzNzcwOTIyN2ZlZDA2NjkzNDdiYjMyOTA5ZThiMWZjYjdlYTJlNTFlN2Ew
|
14
|
+
NTc0MDMyNDMxNTVlMTM3ZGNlMWI5OTM3ZDEwYzdlZjAxNjZkYzJkM2UyMDdi
|
15
|
+
NjJlNWNkMmNiMmZmNDRjOTk1NDAxZmUyMjk5MWZiZGE5OTNjZDM=
|
data/bin/berktacular
CHANGED
@@ -69,6 +69,10 @@ options = OptionParser.new do |opts|
|
|
69
69
|
opts.on("-v", "--verbose", "Turn on verbose output" ) do
|
70
70
|
verbose = true
|
71
71
|
end
|
72
|
+
opts.on("--version", "Print the version and exit" ) do
|
73
|
+
puts Berktacular::VERSION
|
74
|
+
exit 0
|
75
|
+
end
|
72
76
|
opts.on_tail("-h", "--help", "Print this help message" ) do
|
73
77
|
puts opts
|
74
78
|
exit 0
|
@@ -81,7 +85,7 @@ options = OptionParser.new do |opts|
|
|
81
85
|
end
|
82
86
|
end
|
83
87
|
# Enable verify by default if uploading, unless the user has surpressed it.
|
84
|
-
verify
|
88
|
+
verify = upload if verify.nil?
|
85
89
|
|
86
90
|
require 'json'
|
87
91
|
require 'solve'
|
@@ -105,13 +109,13 @@ unless github_token
|
|
105
109
|
end
|
106
110
|
|
107
111
|
if upload
|
108
|
-
berks_conf ||= "#{File.join(ENV['HOME'], File.basename(env_file, ".json") + "-berkshelf.json" )}"
|
112
|
+
berks_conf ||= "#{File.join(ENV['HOME'], '.chef' , File.basename(env_file, ".json") + "-berkshelf.json" )}"
|
109
113
|
unless File.exists? berks_conf
|
110
114
|
warn "The berkshelf config file could not be found at '#{berks_conf}'"
|
111
115
|
warn options
|
112
116
|
exit 4
|
113
117
|
end
|
114
|
-
knife_conf ||= "#{File.join(ENV['HOME'], File.basename(env_file, ".json") + "-knife.rb" )}"
|
118
|
+
knife_conf ||= "#{File.join(ENV['HOME'], '.chef' , File.basename(env_file, ".json") + "-knife.rb" )}"
|
115
119
|
unless File.exists? knife_conf
|
116
120
|
warn "The knife config file could not be found at '#{knife_conf}'"
|
117
121
|
warn options
|
@@ -119,6 +123,10 @@ if upload
|
|
119
123
|
end
|
120
124
|
end
|
121
125
|
|
126
|
+
# We have to set our work dir now or berktacular will give us a new one each time we pass in nil.
|
127
|
+
workdir = Berktacular.best_temp_dir unless workdir
|
128
|
+
puts "Using workdir: '#{workdir}'" if verbose
|
129
|
+
|
122
130
|
# Create a new berksfile
|
123
131
|
puts "Checking updates, this can take some time..." if check || upgrade
|
124
132
|
b = Berktacular::Berksfile.new(my_env, upgrade: upgrade, github_token: github_token, verbose: verbose)
|
@@ -145,7 +153,7 @@ if verify
|
|
145
153
|
end
|
146
154
|
|
147
155
|
if upload
|
148
|
-
unless b.upload(knife_conf, workdir)
|
156
|
+
unless b.upload(berks_conf, knife_conf, workdir)
|
149
157
|
puts "Upload failed!"
|
150
158
|
exit 11
|
151
159
|
end
|
@@ -68,10 +68,11 @@ module Berktacular
|
|
68
68
|
# remove the Berksfile.lock if it exists (it shouldn't).
|
69
69
|
berksfile = File.join(workdir, "Berksfile")
|
70
70
|
lck = berksfile + ".lock"
|
71
|
+
cookbooks = File.join(workdir, "cookbooks")
|
71
72
|
FileUtils.rm(lck) if File.exists? lck
|
72
73
|
File.write(berksfile, self)
|
73
|
-
Berktacular.run_command("berks install --berksfile #{berksfile} --path #{
|
74
|
-
@installed[workdir] = {berksfile: berksfile, lck: lck}
|
74
|
+
Berktacular.run_command("berks install --berksfile #{berksfile} --path #{cookbooks}")
|
75
|
+
@installed[workdir] = {berksfile: berksfile, lck: lck, cookbooks: cookbooks}
|
75
76
|
end
|
76
77
|
workdir
|
77
78
|
end
|
@@ -84,7 +85,7 @@ module Berktacular
|
|
84
85
|
workdir = install(workdir)
|
85
86
|
versions = {}
|
86
87
|
dependencies = {}
|
87
|
-
Dir["#{workdir}/*"].each do |cookbook_dir|
|
88
|
+
Dir["#{@installed[workdir][:cookbooks]}/*"].each do |cookbook_dir|
|
88
89
|
next unless File.directory?(cookbook_dir)
|
89
90
|
metadata_path = File.join(cookbook_dir, 'metadata.rb')
|
90
91
|
metadata = Ridley::Chef::Cookbook::Metadata.from_file(metadata_path)
|
@@ -130,8 +131,9 @@ module Berktacular
|
|
130
131
|
raise "No berks config, required for upload" unless berks_conf && File.exists?(berks_conf)
|
131
132
|
raise "No knife config, required for upload" unless knife_conf && File.exists?(knife_conf)
|
132
133
|
workdir = install(workdir)
|
133
|
-
new_env_file = File.
|
134
|
-
|
134
|
+
new_env_file = File.join(workdir, @name + ".json")
|
135
|
+
File.write(new_env_file, env_file_json)
|
136
|
+
Berktacular.run_command("berks upload --berksfile #{@installed[workdir][:berksfile]} -c #{berks_conf}")
|
135
137
|
Berktacular.run_command("knife environment from file #{new_env_file} -c #{knife_conf}")
|
136
138
|
end
|
137
139
|
|
data/lib/berktacular/version.rb
CHANGED