Class: HighFive::Thor::Runner

Inherits:
Thor::Runner
  • Object
show all
Defined in:
lib/high_five/thor/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Runner

Returns a new instance of Runner.



28
29
30
31
32
33
34
35
# File 'lib/high_five/thor/runner.rb', line 28

def initialize(*args)
  super
  #override version task
  if args[2][:current_task][:name] == "version"
    puts "HighFive #{HighFive::VERSION}" 
    Process.exit(0)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object

Note: because of the way task.run works, there has to be a local definition. Also, we want tasks to work WITH our base namespace if it is included, so that we can use our binary with the same signature we would use thor



18
19
20
21
22
23
24
25
# File 'lib/high_five/thor/runner.rb', line 18

def method_missing(meth, *args)
  meth = meth.to_s
  #meth.sub!(/^high_five:/, '')
  if (!meth.match(/:/))
    meth = "high_five:#{meth}"
  end
  super meth, *args
end