Class: AnnotateRb::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/annotate_rb/runner.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.runnerObject

Returns the value of attribute runner.



6
7
8
# File 'lib/annotate_rb/runner.rb', line 6

def runner
  @runner
end

Class Method Details

.run(args) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/annotate_rb/runner.rb', line 8

def run(args)
  self.runner = new

  runner.run(args)

  self.runner = nil
end

.running?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/annotate_rb/runner.rb', line 16

def running?
  !!runner
end

Instance Method Details

#run(args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/annotate_rb/runner.rb', line 25

def run(args)
  config_file_options = ConfigLoader.load_config
  parser = Parser.new(args, {})

  parsed_options = parser.parse
  remaining_args = parser.remaining_args

  options = config_file_options.merge(parsed_options)

  @options = Options.from(options, {working_args: remaining_args})
  AnnotateRb::RakeBootstrapper.call(@options)

  if @options[:command]
    @options[:command].call(@options)
  else
    # TODO
    raise "Didn't specify a command"
  end
end