Class: Bundler::Restrict::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/restrict/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



7
8
9
# File 'lib/bundler/restrict/cli.rb', line 7

def self.start
  new.call
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bundler/restrict/cli.rb', line 11

def call
  errors = []

  BundlerGems.new.each do |gem|
    [
      Checks::DateCheck
    ].map { |ch| ch.new(gem) }.each do |check|
      next if ignore?(gem)

      unless check.valid?
        print "\n"
        puts check.error

        errors << check.error 
      end
    end

    print '.'
  end

  if errors.empty?
    print "\n"
    puts "OK"
  else
    exit 1
  end
end

#ignore?(gem) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/bundler/restrict/cli.rb', line 39

def ignore?(gem)
  ignored_gems.include? gem.name
end

#ignored_gemsObject



43
44
45
# File 'lib/bundler/restrict/cli.rb', line 43

def ignored_gems
  ['bundler-restrict'] + ENV.fetch('BUNDLE_RESTRICT_IGNORE_GEMS', '').split(',')
end