Class: BundleUpdateInteractive::CLI::Options

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



88
89
90
# File 'lib/bundle_update_interactive/cli/options.rb', line 88

def initialize
  @exclusively = []
end

Instance Attribute Details

#exclusivelyObject

Returns the value of attribute exclusively.



86
87
88
# File 'lib/bundle_update_interactive/cli/options.rb', line 86

def exclusively
  @exclusively
end

Class Method Details

.helpObject

rubocop:disable Metrics/AbcSize



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/bundle_update_interactive/cli/options.rb', line 20

def help # rubocop:disable Metrics/AbcSize
  <<~HELP
    Provides an easy way to update gems to their latest versions.

    #{pastel.bold.underline('USAGE')}
      #{pastel.green('bundle update-interactive')} #{pastel.yellow('[options]')}
      #{pastel.green('bundle ui')} #{pastel.yellow('[options]')}

    #{pastel.bold.underline('OPTIONS')}
    #{summary}
    #{pastel.bold.underline('DESCRIPTION')}
      Displays the list of gems that would be updated by `bundle update`, allowing you
      to navigate them by keyboard and pick which ones to update. A changelog URL,
      when available, is displayed alongside each update. Gems with known security
      vulnerabilities are also highlighted.

      Your Gemfile.lock will be updated conservatively based on the gems you select.
      Transitive dependencies are not affected.

      More information: #{pastel.blue('https://github.com/mattbrictson/bundle_update_interactive')}

    #{pastel.bold.underline('EXAMPLES')}
      Show all gems that can be updated.
      #{pastel.green('bundle update-interactive')}

      The "ui" command alias can also be used.
      #{pastel.green('bundle ui')}

      Show updates for development and test gems only, leaving production gems untouched.
      #{pastel.green('bundle update-interactive')} #{pastel.yellow('-D')}

  HELP
end

.parse(argv = ARGV) ⇒ Object

Raises:



8
9
10
11
12
13
14
# File 'lib/bundle_update_interactive/cli/options.rb', line 8

def parse(argv=ARGV)
  options = new
  remaining = build_parser(options).parse!(argv.dup)
  raise Error, "update-interactive does not accept arguments. See --help for available options." if remaining.any?

  options.freeze
end

.summaryObject



16
17
18
# File 'lib/bundle_update_interactive/cli/options.rb', line 16

def summary
  build_parser(new).summarize.join.gsub(/^\s+-.*?  /, pastel.yellow('\0'))
end