Class: Rubuild::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/rubuild/options.rb

Overview

Rubuild::Options Command-line processing.

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Options

Returns a new instance of Options.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rubuild/options.rb', line 13

def initialize(args)
  self.rubuild_options__inc_paths = []
  self.rubuild_options__file = 'Rutop'
  self.rubuild_options__args_left = args.dup

  OptionParser.new do |opts|
    opts.banner = 'Usage: rubuild [options]'
    opts.separator ''
    opts.on(
      '-f', '--file FILE',
      "Run Rubuild script from FILE.  Defaults to #{self.file}") do |file|
      self.rubuild_options__file = file
    end
    opts.on(
      '-I', '--include-path PATH',
      'Add PATH to the list of directories to search for Rubuild files.') do |path|
      self.rubuild_options__inc_paths << path
    end
  end.order!(self.rubuild_options__args_left)
end