Class: LibyearBundler::CLI

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

Overview

The ‘libyear-bundler` command line program

Constant Summary collapse

E_BUNDLE_OUTDATED_FAILED =
1
E_NO_GEMFILE =
2
E_INVALID_CLI_ARG =
3

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



16
17
18
19
20
21
22
23
# File 'lib/libyear_bundler/cli.rb', line 16

def initialize(argv)
  @options = ::LibyearBundler::Options.new(argv).parse
  # Command line flags are removed form `argv` in `Options` by
  # `OptionParser`, leaving non-flag command line arguments,
  # such as a Gemfile path
  @argv = argv
  @gemfile_path = load_gemfile_path
end

Instance Method Details

#runObject



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/libyear_bundler/cli.rb', line 25

def run
  if @options.grand_total?
    grand_total
  else
    report.write
  end

  # Update cache
  cache_path = @options.cache_path
  if cache_path && release_date_cache
    release_date_cache.save(cache_path)
  end
end