Sha256: 2edb4c259e42f82cea0f1e9fd69dfd0b4b7e96647a9732f0f3c0fd72b8c3aa77

Contents?: true

Size: 1.45 KB

Versions: 11

Compression:

Stored size: 1.45 KB

Contents

#!/usr/bin/env ruby

# Check if Overcommit should invoke a Bundler context for loading gems
require 'yaml'
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
  ENV['BUNDLE_GEMFILE'] = gemfile
  require 'bundler'

  begin
    # We need to temporarily silence STDERR to remove annoying Gem specification
    # warnings that ultimately don't matter, e.g.
    # https://github.com/rubygems/rubygems/issues/1070
    old_stderr = $stderr
    begin
      $stderr = File.new(File::NULL, 'w')
      Bundler.setup
    ensure
      $stderr = old_stderr
    end
  rescue Bundler::BundlerError => ex
    puts "Problem loading '#{gemfile}': #{ex.message}"
    puts "Try running:\nbundle install --gemfile=#{gemfile}" if ex.is_a?(Bundler::GemNotFound)
    exit 78 # EX_CONFIG
  rescue Gem::LoadError => ex
    # Handle case where user is executing overcommit without `bundle exec` and
    # whose local Gemfile has a gem requirement that does not match a gem
    # requirement of the installed version of Overcommit.
    raise unless ex.message =~ /already activated/i
    exec('bundle', 'exec', $0, *ARGV)
  end
end

begin
  require 'overcommit/cli'
rescue LoadError
  if gemfile
    puts 'You have specified the `gemfile` option in your Overcommit ' \
         'configuration but have not added the `overcommit` gem to ' \
         "#{gemfile}."
  else
    raise
  end

  exit 64 # EX_USAGE
end

logger = Overcommit::Logger.new(STDOUT)

Overcommit::CLI.new(ARGV, STDIN, logger).run

Version data entries

11 entries across 9 versions & 2 rubygems

Version Path
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/bin/overcommit
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/bin/overcommit
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/bin/overcommit
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/bin/overcommit
overcommit-0.46.0 bin/overcommit
overcommit-0.45.0 bin/overcommit
overcommit-0.44.0 bin/overcommit
overcommit-0.43.0 bin/overcommit
overcommit-0.42.0 bin/overcommit
overcommit-0.41.0 bin/overcommit
overcommit-0.40.0 bin/overcommit