Class: Bunup::CLI

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

Overview

Parse args, run services, handle output, and handle exits

Constant Summary collapse

COMMITING_MSG =
'Commiting Gemfile and Gemfile.lock changes'
E_DIRTY_GEMFILE =
'Gemfile and/or Gemfile.lock has changes that would ' \
'be overwritten. Please stash or commit your changes before running ' \
'bunup.'
GIT_REF_UPDATE_WARNING =
'WARNING: %<gem_name>s is installed from a git ' \
'repo and is being updated from %<installed_version>s to ' \
'%<newest_version>s. This update could include breaking changes. ' \
'Continue? [y/N] '
MAJOR_VERSION_UPDATE_WARNING_FMT =
'WARNING: %<gem_name>s is being ' \
'updated from %<installed_version>s to %<newest_version>s. This is ' \
'a major version update with possible breaking changes. ' \
'Continue? [y/N] '
UPDATING_MSG_FMT =
'(%<remaining>s) Updating %<gem_name>s ' \
'%<installed_version>s -> %<newest_version>s'

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CLI

Returns a new instance of CLI.



21
22
23
24
25
# File 'lib/bunup/cli.rb', line 21

def initialize(args)
  @options = ::Bunup::Options.parse!(args)
  @args = args
  @exit_status = true
end

Instance Method Details

#runObject



27
28
29
30
31
32
# File 'lib/bunup/cli.rb', line 27

def run
  abort(E_DIRTY_GEMFILE) unless ::Bunup::Services::Commiter.clean_gemfile?
  @gems = build_gems
  update_and_commit_changes
  exit @exit_status
end