berktacular 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGYzNTEyMDVhOTg4NzViYWQxOTM3MjNlZDI2NWQ0MWQzY2E2MDIxZQ==
4
+ ZTZkZDMxZjZhNjhhMTE4OGFiOThiZGY4NzYzZDY0Y2UxNTBhMDhlYQ==
5
5
  data.tar.gz: !binary |-
6
- YTIyZTIyODlkM2JiNmY1N2IyZWY5NGViOTEzY2ZhZGUwMDM3ZTBmZQ==
6
+ ZDY2ODBmYTkyM2Y4ZGI2OTVlMWM0MTI0NjYzNTNmYWIwMjE2MjkwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTEyYjcwZjQ4ZjEwMTc1ZGMxYzcwYWYwYzZiNDFmZDI2N2M1YmIwN2FhMDk4
10
- ZDdkOTVkY2E1ZjYzM2E1MWYyOTVhZWM5NTI2OGJjZGMyMWM1YzJhNTJlYjkx
11
- MDMzMDk1NDYzNmZjOTQ0YTk0MGZjMTBlMTBmMzNmMTA0OTAxOGI=
9
+ NWU4ZDJiMWQxZTliYWVhMWRiZjQzNDU4NGJjZTIxYzAwZjFhYWUyODk3ZmIx
10
+ OWZiOGJmYjllM2RlZTA4YmNiZTJiNGU1YWE3NzI0OGMyMmM0ZDAzMmI3MGM1
11
+ MDNiM2ZjNWFhMWI4ZWFhYTI3NTQyMzM0YzMxMTYxNDMxMmRhYTA=
12
12
  data.tar.gz: !binary |-
13
- NjJhM2EzYzczMDczMWE1OTQxNjFhNGM5NTBkZGYwYTBiMTM0NDJlNWEyYWYx
14
- YzZiMzY5OWUzMmVlYjU2NThhNGE5YjI0OWQ0ZDQyMjk0MDU4OTY1ODQ2NTNl
15
- ZTZkM2JlNjYyYzkzMzI0ZDQxYzk3ODg0YzQ4M2YyNWZjNGM4MzA=
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 ||= upload
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 #{workdir}")
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.write(File.join(workdir, @name + ".rb"), env_file_json )
134
- Berktacular.run_command("berks upload --berksfile #{@installed[workdir][:berksfile]} --c #{berks_conf}")
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
 
@@ -1,4 +1,4 @@
1
1
  module Berktacular
2
2
  # the gem version.
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berktacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Harvey-Smith