# File lib/rubygems-bundler/noexec.rb, line 80
  def setup
    puts "Noexec - starting check" if Noexec::DEBUG
    require "bundler-unload"

    @rubygems_specs = Bundler.rubygems.plain_specs # save it for unloading and checking binary
    log2(){ "rubygems_specs: #{rubygems_specs.map{|g| "#{g.name}-#{g.version}"}*" "}" }

    @gemfile = ENV['BUNDLE_GEMFILE'] || File.join(Noexec::CURRENT, "Gemfile")
    initial_env_gemfile = ENV['BUNDLE_GEMFILE']

    while true
      ENV['BUNDLE_GEMFILE'] = gemfile
      if File.file?(gemfile) && candidate?
        log "Keeping #{gemfile} loaded"
        Bundler.setup
        return
      end
      new_gemfile = File.expand_path("../../Gemfile", gemfile)
      break if new_gemfile == gemfile
      @gemfile = new_gemfile
    end
    log "No valid Gemfile found, moving on"
    ENV['BUNDLE_GEMFILE'] = initial_env_gemfile
  rescue LoadError
    warn "bundler not being used, unable to load" if Noexec::DEBUG
    ENV['BUNDLE_GEMFILE'] = initial_env_gemfile
  end