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.



95
96
97
98
# File 'lib/bundle_update_interactive/cli/options.rb', line 95

def initialize
  @exclusively = []
  @latest = false
end

Instance Attribute Details

#exclusivelyObject

Returns the value of attribute exclusively.



92
93
94
# File 'lib/bundle_update_interactive/cli/options.rb', line 92

def exclusively
  @exclusively
end

#latest=(value) ⇒ Object (writeonly)

Sets the attribute latest

Parameters:

  • value

    the value to set the attribute latest to.



93
94
95
# File 'lib/bundle_update_interactive/cli/options.rb', line 93

def latest=(value)
  @latest = value
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
53
54
55
# 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')}

      Allow the latest gem versions, ignoring Gemfile pins. May modify the Gemfile.
      #{pastel.green('bundle update-interactive')} #{pastel.yellow('--latest')}

  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

Instance Method Details

#latest?Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/bundle_update_interactive/cli/options.rb', line 100

def latest?
  @latest
end