Class: Gem::Commands::KeepCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::KeepCommand
- Includes:
- Prune::Util
- Defined in:
- lib/gem/commands/keep_command.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ KeepCommand
constructor
A new instance of KeepCommand.
Methods included from Prune::Util
#gems_to_keep, #load_configuration, #save_configuration, #settings_filename
Constructor Details
#initialize ⇒ KeepCommand
Returns a new instance of KeepCommand.
9 10 11 12 13 14 15 16 |
# File 'lib/gem/commands/keep_command.rb', line 9 def initialize super 'keep', 'Mark a gem for keeping' add_option('-v', '--version VERSION', 'Which version to keep', '(3.0, >=2.5, ~>1.5)') do |value, | [:version] = value end end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/gem/commands/keep_command.rb', line 18 def execute keep_gem = get_one_gem_name load_configuration entry = gems_to_keep.detect { |(gem, versions)| gem == keep_gem } entry[1] << [:version] entry[1] = entry[1].uniq.compact save_configuration end |