lib/appbundler/app.rb in appbundler-0.12.5 vs lib/appbundler/app.rb in appbundler-0.13.1

- old
+ new

@@ -15,29 +15,27 @@ BINSTUB_FILE_VERSION = 1 attr_reader :bundle_path attr_reader :target_bin_dir attr_reader :name - attr_reader :extra_bin_files - # The bundle_path is always the path to the directory containing the Gemfile.lock - # being used, e.g. /var/cache/omnibus/src/chef/chefor whatever. If + # The bundle_path is always the path to the Gemfile.lock being used, e.g. + # /var/cache/omnibus/src/chef/chef-14.10.9/Gemfile.lock or whatever. If # the name if the gem is not set then we behave like old style 2-arg appbundling # where the gem we are appbundling is in the gemspec in that directory. # # If the name is not nil, then we are doing a multiple-app appbundle where # the Gemfile.lock is the omnibus Gemfile.lock and multiple app gems may be # appbundled against the same Gemfile.lock. # # @param bundle_path [String] the directory path of the Gemfile.lock # @param target_bin_dir [String] the binstub dir, e.g. /opt/chefdk/bin # @param name [String] name of the gem - def initialize(bundle_path, target_bin_dir, name, extra_bin_files = []) + def initialize(bundle_path, target_bin_dir, name) @bundle_path = bundle_path @target_bin_dir = target_bin_dir @name = name - @extra_bin_files = extra_bin_files end # For the 2-arg version this is the gemfile in the omnibus build directory: # /var/cache/omnibus/src/chef/chef-14.10.9/Gemfile # @@ -134,20 +132,10 @@ FileUtils.cp_r(dot_bundle_dir, gem_path) FileUtils.chmod_R("ugo+rX", File.join(gem_path, ".bundle")) end end - # This is used to copy the binstubs from the binstub source directory to the actual - # binstub location. - # - def copy_binstubs(binstubs_source) - gem_path = installed_spec.gem_dir - dst = "#{gem_path}/bin" - src = File.join(bundle_path, binstubs_source, "*") - FileUtils.cp_r(Dir.glob(src), dst) - end - # This is the implementation of the 3-arg version of writing the merged lockfiles, # when called with the 2-arg version it short-circuits, however, to the copy_bundler_env # version above. # # This code does not affect the generated binstubs at all. @@ -335,22 +323,29 @@ def load_statement_for(bin_file) name, version = app_spec.name, app_spec.version bin_basename = File.basename(bin_file) <<~E gem "#{name}", "= #{version}" + gem "bundler" # force activation of bundler to avoid unresolved specs if there are multiple bundler versions spec = Gem::Specification.find_by_name("#{name}", "= #{version}") else spec = Gem::Specification.find_by_name("#{name}") end + unless Gem::Specification.unresolved_deps.empty? + $stderr.puts "APPBUNDLER WARNING: unresolved deps are CRITICAL performance bug, this MUST be fixed" + Gem::Specification.reset + end + bin_file = spec.bin_file("#{bin_basename}") Kernel.load(bin_file) E end def executables - installed_spec.executables.map { |e| installed_spec.bin_file(e) } + extra_bin_files + spec = installed_spec + spec.executables.map { |e| spec.bin_file(e) } end def runtime_dep_specs if external_lockfile? local_gemfile_lock_specs