bin/appbundle-updater in appbundle-updater-0.6.18 vs bin/appbundle-updater in appbundle-updater-1.0.0

- old
+ new

@@ -117,11 +117,16 @@ dest = nil end end end -App = Struct.new(:name, :repo, :bundle_without, :install_command) do +App = Struct.new(:name, :repo, :bundle_without, :install_command, :gems) do + def initialize(*) + super + self.gems ||= {} + end + def to_s name end end @@ -141,17 +146,38 @@ ), App.new( "chef", "chef/chef", "development docgen chefstyle", - chef_install_command + "#{bin_dir.join("bundle")} install --without server,docgen,maintenance,pry,travis,integration,ci,chefstyle", + { + "chef" => %w{server docgen maintenance pry travis integration ci chefstyle}, + "chef-bin" => %w{server docgen maintenance pry travis integration ci chefstyle}, + "ohai" => %w{server docgen maintenance pry travis integration ci chefstyle}, + "inspec-core-bin" => %w{server docgen maintenance pry travis integration ci chefstyle}, + }, ), App.new( "chef-dk", "chef/chef-dk", "development test", - "#{bin_dir.join("rake")} install" + "#{bin_dir.join("bundle")} install", + { + "chef" => %w{docgen chefstyle omnibus_package}, + "foodcritic" => %w{development test}, + "test-kitchen" => %w{changelog debug docs development}, + "inspec" => %w{deploy tools maintenance integration}, + "chef-run" => %w{changelog docs debug}, + "chef-cli" => %w{changelog docs debug}, + "berkshelf" => %w{changelog docs debug development}, + "chef-bin" => %w{changelog}, + "chef-apply" => %w{changelog}, + "chef-vault" => %w{changelog}, + "ohai" => %w{changelog}, + "opscode-pushy-client" => %w{changelog}, + "cookstyle" => %w{changelog}, + }, ), App.new( "chef-vault", "chef/chef-vault", "development", @@ -188,19 +214,20 @@ "#{bin_dir.join("rake")} install" ), ].freeze class Updater - attr_reader :app, :ref, :tarball, :repo + attr_reader :app, :ref, :tarball, :repo, :gems def initialize(options) @app = options[:app] @ref = options[:ref] @tarball = options[:tarball] @extra_bin_files = options[:extra_bin_files] @binstubs_source = options[:binstubs_source] @repo = options[:repo] || @app.repo + @gems = @app.gems end def start if !windows? && Process.uid != 0 abort "#{$0} needs to be run as root user or with sudo" @@ -256,14 +283,26 @@ Dir.chdir(app_dir) do ruby("#{bin_dir.join("bundle")} exec #{app.install_command}") end banner("Updating appbundler binstubs for #{app}") - Dir.chdir(app_dir) do - cmd = "#{bin_dir.join("appbundler")} #{app_dir} #{chefdk.join("bin")}" - cmd += " --extra-bin-files #{@extra_bin_files}" if @extra_bin_files - cmd += " --binstubs-source #{@binstubs_source}" if @binstubs_source - ruby(cmd) + if gems.empty? + Dir.chdir(app_dir) do + cmd = "#{bin_dir.join("appbundler")} #{app_dir} #{chefdk.join("bin")}" + cmd += " --extra-bin-files #{@extra_bin_files}" if @extra_bin_files + cmd += " --binstubs-source #{@binstubs_source}" if @binstubs_source + ruby(cmd) + end + else + gems.each do |gem_name, without| + Dir.chdir(app_dir) do + cmd = "#{bin_dir.join("appbundler")} #{app_dir} #{chefdk.join("bin")} #{gem_name}" + cmd += " --without #{@without.join(",")}" if @without + cmd += " --extra-bin-files #{@extra_bin_files}" if @extra_bin_files + cmd += " --binstubs-source #{@binstubs_source}" if @binstubs_source + ruby(cmd) + end + end end banner("Finished!") end