def verify_deps_are_accessible!
      inaccessable_gems = inaccessable_git_sourced_gems
      return true if inaccessable_gems.empty?

      message = <<~MESSAGE
        Application '#{name}' contains gems in the lockfile which are
        not accessible by rubygems. This usually occurs when you fetch gems from git in
        your Gemfile and do not install the same version of the gems beforehand.

      MESSAGE

      message << "The Gemfile.lock is located here:\n- #{gemfile_lock}\n\n"

      message << "The offending gems are:\n"
      inaccessable_gems.each do |gemspec|
        message << "- #{gemspec.name} (#{gemspec.version}) from #{gemspec.source}\n"
      end

      message << "\n"

      message << "Rubygems is configured to search the following paths:\n"
      Gem.paths.path.each { |p| message << "- #{p}\n" }

      message << "\n"
      message << "If these seem wrong, you might need to set GEM_HOME or other environment\nvariables before running appbundler\n"

      raise InaccessibleGemsInLockfile, message
    end
def verify_deps_are_accessible!
      inaccessable_gems = inaccessable_git_sourced_gems
      return true if inaccessable_gems.empty?

      message = <<~MESSAGE
        Application '#{name}' contains gems in the lockfile which are
        not accessible by rubygems. This usually occurs when you fetch gems from git in
        your Gemfile and do not install the same version of the gems beforehand.

      MESSAGE

      message << "The Gemfile.lock is located here:\n- #{gemfile_lock}\n\n"

      message << "The offending gems are:\n"
      inaccessable_gems.each do |gemspec|
        message << "- #{gemspec.name} (#{gemspec.version}) from #{gemspec.source}\n"
      end

      message << "\n"

      message << "Rubygems is configured to search the following paths:\n"
      Gem.paths.path.each { |p| message << "- #{p}\n" }

      message << "\n"
      message << "If these seem wrong, you might need to set GEM_HOME or other environment\nvariables before running appbundler\n"

      raise InaccessibleGemsInLockfile, message
    end
Bundler stores gems loaded from git in locations like this:
 `lib/ruby/gems/2.1.0/bundler/gems/chef-b5860b44acdd`. Rubygems cannot
 find these during normal (non-bundler) operation. This will cause
 problems if there is no gem of the same version installed to the "normal"
 gem location, because the appbundler executable will end up containing a
 statement like `gem "foo", "= x.y.z"` which fails.

 However, if this gem/version has been manually installed (by building and
 installing via `gem` commands), then we end up with the correct
 appbundler file, even if it happens somewhat by accident.

 Therefore, this method lists all the git-sourced gems in the
 Gemfile.lock, then it checks if that version of the gem can be loaded via
 `Gem::Specification.find_by_name`. If there are any unloadable gems, then
 the InaccessibleGemsInLockfile error is raised.