Class: YARD::CLI::LinkStdlib::Add

Inherits:
Command
  • Object
show all
Includes:
CommandHelper
Defined in:
lib/yard/cli/link_stdlib/add.rb

Overview

Definitions

Constant Summary collapse

DESCRIPTION =
"Download version source and build object map"
USAGE =
"yard stdlib add [OPTIONS] RUBY_VERSION"

Instance Method Summary collapse

Methods included from CommandHelper

#add_header, #add_version_opt, #check_args!, #description, #opts, #usage

Instance Method Details

#run(*args) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/yard/cli/link_stdlib/add.rb', line 39

def run *args
  # Want to see what's going on by default here...
  log.level = Logger::INFO
  
  opts[ :force ] = false

  OptionParser.new { |op|
    add_header op
    
    op.on( '-f', '--force',
            %(Force building of map data when already present)
    ) { |force| opts[ :force ] = force }
    
  }.parse! args
  
  args.each do |version|    
    log.info "Adding object map for Ruby #{ version }..."
    YARD::LinkStdlib::ObjectMap.add version, force: opts[ :force ]
  end
  
  exit true
end