appbundle-updater 1.0.36 → 19.0.2.rc.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0171110448530a18147369da16dce8eb93e307f41612ec64ff6b6bb9afeaacb2'
4
- data.tar.gz: 51007a24f2ddc9acf07ada87d8bc1569957793a379a873bd86c8b4b8e5834c18
3
+ metadata.gz: 7177a13d677886a6995b214512033d4aa3a4966c2d8907e384b8b850b46ae9d0
4
+ data.tar.gz: '072191040ef2bb340735b9a59c30bf3c8c31f9b88c937e3b934268d7635a1746'
5
5
  SHA512:
6
- metadata.gz: c2988440b0f9b6f59749ed7fc26e2064945a23de755496d200bbb091915d846f2281c68e168022deec0a2aea129f1756b84c31af626f5a481e24eee25edd15a0
7
- data.tar.gz: 27c221bf29327bbab60560bf79be31eddce5b7717a19d1fdaece80c62741eed1e974fbd8e49d55e94eb0ccb1b00ae82641c2729f81ed7d0b53ff0e97ae6d550c
6
+ metadata.gz: 739c787f03c12ae9e9c8bad8417c4ab46f16764bea6595068031a6cd327ebd1bc45f63b67274c74e38b0775514034204f2719f25b4c77e1c8193bc221e2c9958
7
+ data.tar.gz: 6dec822ffbbde1ca3ea323dd6d59b49a0bd89aab050cf9036d318d2776b5739d897a49c93073c0ef9dfe06e81e8e1b966ce485394ba4ff81cf33392898b3f40f
data/CHANGELOG.md CHANGED
@@ -1,32 +1,44 @@
1
1
  # appbundle-updater Change Log
2
2
 
3
- <!-- latest_release 1.0.36 -->
4
- ## [v1.0.36](https://github.com/chef/appbundle-updater/tree/v1.0.36) (2022-02-09)
3
+ <!-- latest_release 19.0.2 -->
4
+ ## [v19.0.2](https://github.com/chef/appbundle-updater/tree/v19.0.2) (2025-02-11)
5
5
 
6
6
  #### Merged Pull Requests
7
- - Use rake install:local [#100](https://github.com/chef/appbundle-updater/pull/100) ([lamont-granquist](https://github.com/lamont-granquist))
7
+ - Delimit rc and version no as rc.1 in gemspec as using &#39;rc1&#39; has not pushed the gem to artifactory [#116](https://github.com/chef/appbundle-updater/pull/116) ([neha-p6](https://github.com/neha-p6))
8
8
  <!-- latest_release -->
9
9
 
10
- <!-- release_rollup since=1.0.23 -->
10
+ <!-- release_rollup since=1.0.36 -->
11
11
  ### Changes not yet released to rubygems.org
12
12
 
13
13
  #### Merged Pull Requests
14
- - Use rake install:local [#100](https://github.com/chef/appbundle-updater/pull/100) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 1.0.36 -->
15
- - Update chefstyle requirement from 2.1.3 to 2.2.0 [#98](https://github.com/chef/appbundle-updater/pull/98) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.35 -->
16
- - Need a version bump for release [#97](https://github.com/chef/appbundle-updater/pull/97) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 1.0.34 -->
17
- - remove bundle exec from rake install [#96](https://github.com/chef/appbundle-updater/pull/96) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 1.0.33 -->
18
- - Update chefstyle requirement from 2.1.1 to 2.1.3 [#95](https://github.com/chef/appbundle-updater/pull/95) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.32 -->
19
- - Update chefstyle requirement from 2.1.0 to 2.1.1 [#93](https://github.com/chef/appbundle-updater/pull/93) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.31 -->
20
- - Update chefstyle requirement from 2.0.9 to 2.1.0 [#92](https://github.com/chef/appbundle-updater/pull/92) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.30 -->
21
- - Update chefstyle requirement from 2.0.7 to 2.0.9 [#90](https://github.com/chef/appbundle-updater/pull/90) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.29 -->
22
- - Update chefstyle requirement from 2.0.5 to 2.0.7 [#87](https://github.com/chef/appbundle-updater/pull/87) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.28 -->
23
- - Update chefstyle requirement from 1.7.5 to 2.0.5 [#85](https://github.com/chef/appbundle-updater/pull/85) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.27 -->
24
- - Update parallel requirement from &lt; 1.20 to &lt; 1.21 [#81](https://github.com/chef/appbundle-updater/pull/81) ([dependabot[bot]](https://github.com/dependabot[bot])) <!-- 1.0.26 -->
25
- - Upgrade to GitHub-native Dependabot [#80](https://github.com/chef/appbundle-updater/pull/80) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) <!-- 1.0.25 -->
26
- - Update chefstyle requirement from 1.7.2 to 1.7.5 [#79](https://github.com/chef/appbundle-updater/pull/79) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot])) <!-- 1.0.24 -->
14
+ - Delimit rc and version no as rc.1 in gemspec as using &#39;rc1&#39; has not pushed the gem to artifactory [#116](https://github.com/chef/appbundle-updater/pull/116) ([neha-p6](https://github.com/neha-p6)) <!-- 19.0.2 -->
15
+ - Add rc tag to the gem from gemspec instead of from VERSION file [#115](https://github.com/chef/appbundle-updater/pull/115) ([neha-p6](https://github.com/neha-p6)) <!-- 19.0.1 -->
16
+ - Add rc tag to the gem from gemspec instead of from VERSION file [#113](https://github.com/chef/appbundle-updater/pull/113) ([neha-p6](https://github.com/neha-p6)) <!-- 19.0.1 -->
17
+ - use habitat build instead of omnibus [#107](https://github.com/chef/appbundle-updater/pull/107) ([rishichawda](https://github.com/rishichawda)) <!-- 19.0.1 -->
18
+ - add release branches [#110](https://github.com/chef/appbundle-updater/pull/110) ([rishichawda](https://github.com/rishichawda)) <!-- 19.0.0 -->
19
+ - update ruby images to 3.0 and 3.1 [#108](https://github.com/chef/appbundle-updater/pull/108) ([rishichawda](https://github.com/rishichawda)) <!-- 1.0.38 -->
20
+ - update codeowners to include omnibus team &amp; some cleanup [#103](https://github.com/chef/appbundle-updater/pull/103) ([vkarve-chef](https://github.com/vkarve-chef)) <!-- 1.0.37 -->
27
21
  <!-- release_rollup -->
28
22
 
29
23
  <!-- latest_stable_release -->
24
+ ## [v1.0.36](https://github.com/chef/appbundle-updater/tree/v1.0.36) (2022-02-09)
25
+
26
+ #### Merged Pull Requests
27
+ - Update chefstyle requirement from 1.7.2 to 1.7.5 [#79](https://github.com/chef/appbundle-updater/pull/79) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot]))
28
+ - Upgrade to GitHub-native Dependabot [#80](https://github.com/chef/appbundle-updater/pull/80) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot]))
29
+ - Update parallel requirement from &lt; 1.20 to &lt; 1.21 [#81](https://github.com/chef/appbundle-updater/pull/81) ([dependabot[bot]](https://github.com/dependabot[bot]))
30
+ - Update chefstyle requirement from 1.7.5 to 2.0.5 [#85](https://github.com/chef/appbundle-updater/pull/85) ([dependabot[bot]](https://github.com/dependabot[bot]))
31
+ - Update chefstyle requirement from 2.0.5 to 2.0.7 [#87](https://github.com/chef/appbundle-updater/pull/87) ([dependabot[bot]](https://github.com/dependabot[bot]))
32
+ - Update chefstyle requirement from 2.0.7 to 2.0.9 [#90](https://github.com/chef/appbundle-updater/pull/90) ([dependabot[bot]](https://github.com/dependabot[bot]))
33
+ - Update chefstyle requirement from 2.0.9 to 2.1.0 [#92](https://github.com/chef/appbundle-updater/pull/92) ([dependabot[bot]](https://github.com/dependabot[bot]))
34
+ - Update chefstyle requirement from 2.1.0 to 2.1.1 [#93](https://github.com/chef/appbundle-updater/pull/93) ([dependabot[bot]](https://github.com/dependabot[bot]))
35
+ - Update chefstyle requirement from 2.1.1 to 2.1.3 [#95](https://github.com/chef/appbundle-updater/pull/95) ([dependabot[bot]](https://github.com/dependabot[bot]))
36
+ - remove bundle exec from rake install [#96](https://github.com/chef/appbundle-updater/pull/96) ([lamont-granquist](https://github.com/lamont-granquist))
37
+ - Need a version bump for release [#97](https://github.com/chef/appbundle-updater/pull/97) ([lamont-granquist](https://github.com/lamont-granquist))
38
+ - Update chefstyle requirement from 2.1.3 to 2.2.0 [#98](https://github.com/chef/appbundle-updater/pull/98) ([dependabot[bot]](https://github.com/dependabot[bot]))
39
+ - Use rake install:local [#100](https://github.com/chef/appbundle-updater/pull/100) ([lamont-granquist](https://github.com/lamont-granquist))
40
+ <!-- latest_stable_release -->
41
+
30
42
  ## [v1.0.23](https://github.com/chef/appbundle-updater/tree/v1.0.23) (2021-03-16)
31
43
 
32
44
  #### Merged Pull Requests
@@ -45,7 +57,6 @@
45
57
  - Update chefstyle requirement from 1.6.2 to 1.7.1 [#74](https://github.com/chef/appbundle-updater/pull/74) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot]))
46
58
  - Update chefstyle requirement from 1.7.1 to 1.7.2 [#75](https://github.com/chef/appbundle-updater/pull/75) ([dependabot-preview[bot]](https://github.com/dependabot-preview[bot]))
47
59
  - Add support for post bundle install hook [#76](https://github.com/chef/appbundle-updater/pull/76) ([lamont-granquist](https://github.com/lamont-granquist))
48
- <!-- latest_stable_release -->
49
60
 
50
61
  ## [v1.0.8](https://github.com/chef/appbundle-updater/tree/v1.0.8) (2020-08-12)
51
62
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.36
1
+ 19.0.2
@@ -4,7 +4,7 @@ require "appbundle_updater/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "appbundle-updater"
7
- spec.version = AppbundleUpdater::VERSION
7
+ spec.version = "#{AppbundleUpdater::VERSION}.rc.1"
8
8
  spec.authors = ["lamont-granquist"]
9
9
  spec.email = ["lamont@chef.io"]
10
10
  spec.description = %q{Updates appbundled apps in Chef's omnibus packages}
@@ -24,22 +24,43 @@ require "rubygems/package"
24
24
  require "zlib"
25
25
  require "tempfile"
26
26
 
27
- # FIXME: move to helpers mixin
28
-
29
27
  def windows?
30
28
  @windows ||= RUBY_PLATFORM =~ /mswin|mingw|windows/
31
29
  end
32
30
 
33
- def chefdk
31
+ def habitat
34
32
  if windows?
35
- Pathname.new(File.join(ENV["SYSTEMDRIVE"], "opscode", ARGV[0]))
33
+ Pathname.new(File.join(ENV["SYSTEMDRIVE"], "hab", "pkgs"))
36
34
  else
37
- Pathname.new(File.join("/opt", ARGV[0]))
35
+ Pathname.new(File.join("/hab", "pkgs"))
38
36
  end
39
37
  end
40
38
 
39
+ # find the path to installed package in habitat package directory
40
+ # example, /hab/pkgs/{ARGV[0]}/{ARGV[1]}/x.x.x/xxxxxxxxxxxxxx
41
+ def pkg_path
42
+ pkg_path = habitat.join(ARGV[0], ARGV[1])
43
+ version = Dir.glob("#{pkg_path}/*").max
44
+ raise "No existing installation found for #{ARGV[0]}/#{ARGV[1]} in #{pkg_path}" if version.nil?
45
+
46
+ pkg_path = pkg_path.join(version)
47
+ build_no = Dir.glob("#{pkg_path}/*").max
48
+ raise "No existing installation found for #{ARGV[0]}/#{ARGV[1]}/#{version} in #{pkg_path}" if build_no.nil?
49
+
50
+ pkg_path.join(build_no)
51
+ end
52
+
53
+ def vendor_bin_dir
54
+ pkg_path.join("vendor", "bin")
55
+ end
56
+
41
57
  def bin_dir
42
- chefdk.join("embedded/bin")
58
+ pkg_path.join("bin")
59
+ end
60
+
61
+ def ruby_pkg
62
+ # NOTE: this is sort of a 'hacky' way maybe to find which ruby binary to use?
63
+ File.read("#{pkg_path}/DEPS").split("\n").find { |l| l.start_with?(%r{(core|chef)\/ruby}) }
43
64
  end
44
65
 
45
66
  ENV["PATH"] = ( [ bin_dir ] + ENV["PATH"].split(File::PATH_SEPARATOR) ).join(File::PATH_SEPARATOR)
@@ -50,7 +71,7 @@ ENV_KEYS = %w{
50
71
 
51
72
  def run(cmd)
52
73
  ENV_KEYS.each { |key| ENV["_YOLO_#{key}"] = ENV[key]; ENV.delete(key) }
53
- ENV["PATH"] = bin_dir.to_s + File::PATH_SEPARATOR + ENV["_YOLO_PATH"]
74
+ ENV["PATH"] = habitat.join(ruby_pkg, "bin").to_s + File::PATH_SEPARATOR + ENV["_YOLO_PATH"]
54
75
  puts " running: #{cmd}"
55
76
  output = `#{cmd} 2>&1` # FIXME: bash/zsh-ism, will not work on csh
56
77
  unless $?.exited? && $?.exitstatus == 0
@@ -66,7 +87,7 @@ TAR_LONGLINK = "././@LongLink".freeze
66
87
 
67
88
  def install_package_dependencies
68
89
  banner("Installing Packages")
69
- case `#{bin_dir}/ohai platform_family` # rubocop: disable Lint/LiteralAsCondition
90
+ case `hab pkg exec #{ARGV[0]}/#{ARGV[1]} ohai platform_family` # rubocop: disable Lint/LiteralAsCondition
70
91
  when /debian/
71
92
  ENV["DEBIAN_FRONTEND"] = "noninteractive"
72
93
  run("apt-get -y update")
@@ -118,7 +139,7 @@ def extract_tgz(file, destination = ".")
118
139
  end
119
140
  end
120
141
 
121
- App = Struct.new(:name, :repo, :bundle_without, :install_commands, :gems) do
142
+ App = Struct.new(:name, :origin, :bundle_without, :install_commands, :gems) do
122
143
  def initialize(*)
123
144
  super
124
145
  self.gems ||= {}
@@ -129,18 +150,18 @@ App = Struct.new(:name, :repo, :bundle_without, :install_commands, :gems) do
129
150
  end
130
151
  end
131
152
 
132
- chef_install_command = "#{bin_dir.join("rake")} install:local"
153
+ chef_install_command = "#{vendor_bin_dir.join("rake")} install:local"
133
154
 
134
- CHEFDK_APPS = [
155
+ HABITAT_PACKAGES = [
135
156
  App.new(
136
157
  "berkshelf",
137
- "berkshelf/berkshelf",
158
+ "chef",
138
159
  "docs changelog",
139
- "#{bin_dir.join("rake")} install"
160
+ "#{vendor_bin_dir.join("rake")} install"
140
161
  ),
141
162
  App.new(
163
+ "chef-infra-client",
142
164
  "chef",
143
- "chef/chef",
144
165
  "server docgen maintenance pry integration ci chefstyle profile",
145
166
  chef_install_command,
146
167
  {
@@ -150,67 +171,40 @@ CHEFDK_APPS = [
150
171
  "inspec-core-bin" => %w{development},
151
172
  }
152
173
  ),
153
- App.new(
154
- "chef-dk",
155
- "chef/chef-dk",
156
- "development test",
157
- "#{bin_dir.join("bundle")} install",
158
- {
159
- "chef" => %w{docgen chefstyle omnibus_package},
160
- "foodcritic" => %w{development test},
161
- "test-kitchen" => %w{changelog debug docs development},
162
- "inspec" => %w{deploy tools maintenance integration},
163
- "chef-run" => %w{changelog docs debug},
164
- "chef-cli" => %w{changelog docs debug},
165
- "berkshelf" => %w{changelog docs debug development},
166
- "chef-bin" => %w{changelog},
167
- "chef-apply" => %w{changelog},
168
- "chef-vault" => %w{changelog},
169
- "ohai" => %w{changelog},
170
- "opscode-pushy-client" => %w{changelog},
171
- "cookstyle" => %w{changelog},
172
- }
173
- ),
174
174
  App.new(
175
175
  "chef-vault",
176
- "chef/chef-vault",
176
+ "chef",
177
177
  "development",
178
- "#{bin_dir.join("rake")} install"
178
+ "#{vendor_bin_dir.join("rake")} install"
179
179
  ),
180
180
  App.new(
181
181
  "cookstyle",
182
- "chef/cookstyle",
182
+ "chef",
183
183
  "development debug docs",
184
- "#{bin_dir.join("rake")} install"
185
- ),
186
- App.new(
187
- "foodcritic",
188
- "foodcritic/foodcritic",
189
- "development",
190
- "#{bin_dir.join("rake")} install"
184
+ "#{vendor_bin_dir.join("rake")} install"
191
185
  ),
192
186
  App.new(
193
187
  "inspec",
194
- "chef/inspec",
188
+ "chef",
195
189
  "test integration tools maintenance deploy",
196
- "#{bin_dir.join("rake")} install"
190
+ "#{vendor_bin_dir.join("rake")} install"
197
191
  ),
198
192
  App.new(
199
193
  "ohai",
200
- "chef/ohai",
194
+ "chef",
201
195
  "development docs debug",
202
- "#{bin_dir.join("rake")} install"
196
+ "#{vendor_bin_dir.join("rake")} install"
203
197
  ),
204
198
  App.new(
205
199
  "test-kitchen",
206
- "test-kitchen/test-kitchen",
200
+ "chef",
207
201
  "changelog integration debug chefstyle docs",
208
- "#{bin_dir.join("rake")} install"
202
+ "#{vendor_bin_dir.join("rake")} install"
209
203
  ),
210
204
  ].freeze
211
205
 
212
206
  class Updater
213
- attr_reader :app, :ref, :tarball, :repo, :gems, :install_commands
207
+ attr_reader :app, :ref, :tarball, :origin, :repo, :gems, :install_commands
214
208
 
215
209
  def initialize(options)
216
210
  @app = options[:app]
@@ -219,6 +213,7 @@ class Updater
219
213
  @extra_bin_files = options[:extra_bin_files]
220
214
  @binstubs_source = options[:binstubs_source]
221
215
  @repo = options[:repo] || @app.repo
216
+ @origin = options[:origin] || @app.origin
222
217
  @gems = @app.gems
223
218
  @install_commands = @app.install_commands
224
219
  end
@@ -228,101 +223,100 @@ class Updater
228
223
  abort "#{$0} needs to be run as root user or with sudo"
229
224
  end
230
225
 
231
- banner("Cleaning #{app} checkout")
232
- app_dir.rmtree if app_dir.directory?
233
-
234
- top_dir = chefdk.join("embedded/apps")
235
- unless File.exist?(top_dir)
236
- banner("Creating #{top_dir} directory")
237
- FileUtils.mkdir_p top_dir
238
- end
239
-
240
226
  install_package_dependencies
241
227
 
242
- if tarball
243
- # NOTE: THIS IS DELIBERATELY PURE RUBY USING NO NATIVE GEMS AND ONLY
244
- # THE RUBY STDLIB BY DESIGN
245
- git_url = "https://github.com/#{repo}/archive/#{ref}.tar.gz"
246
- banner("Extracting #{app} from #{git_url}")
247
- Dir.chdir(chefdk.join("embedded/apps")) do
248
- Tempfile.open("appbundle-updater") do |tempfile|
249
- tempfile.binmode
250
- URI.open(git_url) do |uri|
251
- tempfile.write(uri.read)
228
+ tmp_dir = Dir.mktmpdir
229
+ banner("Creating #{tmp_dir}/#{app.name} directory")
230
+ app_dir = File.join(tmp_dir, app.name.to_s)
231
+
232
+ begin
233
+ if tarball
234
+ # NOTE: THIS IS DELIBERATELY PURE RUBY USING NO NATIVE GEMS AND ONLY
235
+ # THE RUBY STDLIB BY DESIGN
236
+ git_url = "https://github.com/#{repo}/archive/#{ref}.tar.gz"
237
+ banner("Extracting #{app} from #{git_url}")
238
+ Dir.chdir(tmp_dir) do
239
+ Tempfile.open("appbundle-updater") do |tempfile|
240
+ tempfile.binmode
241
+ URI.open(git_url) do |uri|
242
+ tempfile.write(uri.read)
243
+ end
244
+ tempfile.close
245
+ extract_tgz(tempfile.path)
252
246
  end
253
- tempfile.close
254
- extract_tgz(tempfile.path)
247
+ base = File.basename repo
248
+ FileUtils.mv Dir.glob("#{base}-*")[0], app.name.to_s
249
+ end
250
+ else
251
+ git_url = "https://github.com/#{repo}.git"
252
+ banner("Cloning #{app} from #{git_url}")
253
+ run("git clone #{git_url} #{app_dir}")
254
+
255
+ banner("Checking out #{app} to #{ref}")
256
+ Dir.chdir(app_dir) do
257
+ run("git checkout #{ref}")
255
258
  end
256
- base = File.basename repo
257
- FileUtils.mv Dir.glob("#{base}-*")[0], "#{app.name}"
258
259
  end
259
- else
260
- git_url = "https://github.com/#{repo}.git"
261
- banner("Cloning #{app} from #{git_url}")
262
- run("git clone #{git_url} #{app_dir}")
263
260
 
264
- banner("Checking out #{app} to #{ref}")
261
+ banner("Installing dependencies")
265
262
  Dir.chdir(app_dir) do
266
- run("git checkout #{ref}")
263
+ cmd = "#{vendor_bin_dir.join("bundle")} install"
264
+ cmd += " --without #{app.bundle_without}" if app.bundle_without
265
+ ruby(cmd)
267
266
  end
268
- end
269
267
 
270
- banner("Installing dependencies")
271
- Dir.chdir(app_dir) do
272
- cmd = "#{bin_dir.join("bundle")} install"
273
- cmd += " --without #{app.bundle_without}" if app.bundle_without
274
- ruby(cmd)
275
- end
276
-
277
- banner("Re-installing git-installed gems")
278
- Dir.chdir(app_dir) do
279
- ruby("post-bundle-install.rb #{chefdk}") if File.exist?("#{app_dir}/post-bundle-install.rb")
280
- end
281
-
282
- banner("Installing gem")
283
- Dir.chdir(app_dir) do
284
- Array(install_commands).each do |command|
285
- ruby(command)
268
+ banner("Re-installing git-installed gems")
269
+ Dir.chdir(app_dir) do
270
+ ruby("post-bundle-install.rb #{bin_dir}") if File.exist?("#{app_dir}/post-bundle-install.rb")
286
271
  end
287
- end
288
272
 
289
- banner("Updating appbundler binstubs for #{app}")
290
- if gems.empty?
273
+ banner("Installing gem")
291
274
  Dir.chdir(app_dir) do
292
- cmd = "#{bin_dir.join("appbundler")} #{app_dir} #{chefdk.join("bin")}"
293
- cmd += " --extra-bin-files #{@extra_bin_files}" if @extra_bin_files
294
- cmd += " --binstubs-source #{@binstubs_source}" if @binstubs_source
295
- ruby(cmd)
275
+ Array(install_commands).each do |command|
276
+ ruby(command)
277
+ end
296
278
  end
297
- else
298
- gems.each do |gem_name, without|
279
+
280
+ banner("Updating appbundler binstubs for #{app}")
281
+ if gems.empty?
299
282
  Dir.chdir(app_dir) do
300
- cmd = "#{bin_dir.join("appbundler")} #{app_dir} #{chefdk.join("bin")} #{gem_name}"
301
- cmd += " --without #{without.join(",")}" if without
283
+ cmd = "#{vendor_bin_dir.join("appbundler")} #{app_dir} #{bin_dir}"
302
284
  cmd += " --extra-bin-files #{@extra_bin_files}" if @extra_bin_files
303
285
  cmd += " --binstubs-source #{@binstubs_source}" if @binstubs_source
304
286
  ruby(cmd)
305
287
  end
288
+ else
289
+ gems.each do |gem_name, without|
290
+ Dir.chdir(app_dir) do
291
+ cmd = "#{vendor_bin_dir.join("appbundler")} #{app_dir} #{bin_dir} #{gem_name}"
292
+ cmd += " --without #{without.join(",")}" if without
293
+ cmd += " --extra-bin-files #{@extra_bin_files}" if @extra_bin_files
294
+ cmd += " --binstubs-source #{@binstubs_source}" if @binstubs_source
295
+ ruby(cmd)
296
+ end
297
+ end
306
298
  end
307
- end
308
299
 
309
- banner("Finished!")
300
+ rescue => e
301
+ puts "aborting!!", e
302
+ else
303
+ banner("Finished!")
304
+ ensure
305
+ banner("Cleaning up #{app_dir}")
306
+ FileUtils.remove_entry app_dir
307
+ banner("Done.")
308
+ end
310
309
  end
311
310
 
312
311
  private
313
312
 
314
- def app_dir
315
- chefdk.join("embedded/apps/#{app}")
316
- end
317
-
318
313
  def banner(msg)
319
314
  puts "-----> #{msg}"
320
315
  end
321
316
 
322
317
  def ruby(script)
323
- ruby = bin_dir.join("ruby").to_s.tap { |p| p.concat(".exe") if windows? }
324
-
325
- run([ruby, script].join(" "))
318
+ ruby_cmd = "hab pkg exec #{ruby_pkg} ruby"
319
+ run([ruby_cmd, script].join(" "))
326
320
  end
327
321
 
328
322
  end
@@ -356,7 +350,7 @@ class CLI
356
350
  end
357
351
  opts.separator("")
358
352
  opts.separator("App names:")
359
- CHEFDK_APPS.each { |a| opts.separator(" * #{a.name}") }
353
+ HABITAT_PACKAGES.each { |a| opts.separator(" * #{a.name}") }
360
354
  end
361
355
  @parser.parse!
362
356
  validate!
@@ -364,7 +358,7 @@ class CLI
364
358
 
365
359
  def validate!
366
360
  die("PROJECT APP_NAME GIT_REF options are all required") if ARGV.length < 3
367
- options[:app] = CHEFDK_APPS.find { |a| a.name == ARGV[1] }
361
+ options[:app] = HABITAT_PACKAGES.find { |a| a.name == ARGV[1] }
368
362
  die("Invalid APP_NAME: #{ARGV[1]}") if options[:app].nil?
369
363
  options[:ref] = ARGV[2]
370
364
  end
@@ -1,3 +1,3 @@
1
1
  module AppbundleUpdater
2
- VERSION = "1.0.36".freeze
2
+ VERSION = "19.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appbundle-updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.36
4
+ version: 19.0.2.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - lamont-granquist
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-09 00:00:00.000000000 Z
11
+ date: 2025-02-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Updates appbundled apps in Chef's omnibus packages
14
14
  email:
@@ -46,11 +46,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
46
  version: '0'
47
47
  required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - ">="
49
+ - - ">"
50
50
  - !ruby/object:Gem::Version
51
- version: '0'
51
+ version: 1.3.1
52
52
  requirements: []
53
- rubygems_version: 3.1.4
53
+ rubygems_version: 3.2.3
54
54
  signing_key:
55
55
  specification_version: 4
56
56
  summary: Updates appbundled apps in Chef's omnibus packages