Class: BitClust::Subcommands::UpdateCommand
- Inherits:
-
BitClust::Subcommand
- Object
- BitClust::Subcommand
- BitClust::Subcommands::UpdateCommand
- Defined in:
- lib/bitclust/subcommands/update_command.rb
Instance Method Summary collapse
- #exec(argv, options) ⇒ Object
-
#initialize ⇒ UpdateCommand
constructor
A new instance of UpdateCommand.
- #parse(argv) ⇒ Object
Methods inherited from BitClust::Subcommand
#align_progress_bar_title, #error, #help, #option_error, #srcdir_root
Constructor Details
#initialize ⇒ UpdateCommand
Returns a new instance of UpdateCommand.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bitclust/subcommands/update_command.rb', line 16 def initialize super @root = nil @library = nil @parser. = "Usage: #{File.basename($0, '.*')} update [<file>...]" @parser.on('--stdlibtree=ROOT', 'Process stdlib source directory tree.') {|path| @root = path } @parser.on('--library-name=NAME', 'Use NAME for library name in file mode.') {|name| @library = name } end |
Instance Method Details
#exec(argv, options) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bitclust/subcommands/update_command.rb', line 36 def exec(argv, ) super @db.transaction { if @root @db.update_by_stdlibtree @root end argv.each do |path| @db.update_by_file path, @library || guess_library_name(path) end } end |
#parse(argv) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/bitclust/subcommands/update_command.rb', line 29 def parse(argv) super if not @root and argv.empty? error "no input file given" end end |