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.



102
103
104
105
106
107
# File 'lib/bundle_update_interactive/cli/options.rb', line 102

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

Instance Attribute Details

#commit=(value) ⇒ Object (writeonly)

Sets the attribute commit

Parameters:

  • value

    the value to set the attribute commit to.



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

def commit=(value)
  @commit = value
end

#exclusivelyObject

Returns the value of attribute exclusively.



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

def exclusively
  @exclusively
end

#latest=(value) ⇒ Object (writeonly)

Sets the attribute latest

Parameters:

  • value

    the value to set the attribute latest to.



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

def latest=(value)
  @latest = value
end

#only_explicit=(value) ⇒ Object (writeonly)

Sets the attribute only_explicit

Parameters:

  • value

    the value to set the attribute only_explicit to.



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

def only_explicit=(value)
  @only_explicit = value
end

Class Method Details

.helpObject

rubocop:disable Metrics/AbcSize



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
56
# File 'lib/bundle_update_interactive/cli/options.rb', line 21

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:



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

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

  options.freeze
end

.summaryObject



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

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

Instance Method Details

#commit?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/bundle_update_interactive/cli/options.rb', line 109

def commit?
  @commit
end

#latest?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/bundle_update_interactive/cli/options.rb', line 113

def latest?
  @latest
end

#only_explicit?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/bundle_update_interactive/cli/options.rb', line 117

def only_explicit?
  @only_explicit
end