Class: Mines::Cli
- Inherits:
-
Thor
- Object
- Thor
- Mines::Cli
- Defined in:
- bin/mines
Overview
The mines executable. It subclasses Thor and invocates generators according to parameters
Instance Method Summary collapse
-
#generate(type, name) ⇒ Object
method_option :evented, :type => :boolean, :default => false generate a miner.
-
#help(*args) ⇒ Object
help.
-
#initialize(*args) ⇒ Cli
constructor
include Logging.
-
#new(name) ⇒ Object
Define the ‘new’ action.
Constructor Details
#initialize(*args) ⇒ Cli
include Logging
21 22 23 |
# File 'bin/mines', line 21 def initialize *args super end |
Instance Method Details
#generate(type, name) ⇒ Object
method_option :evented, :type => :boolean, :default => false generate a miner
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'bin/mines', line 51 def generate(type,name) Mines.mines_app_check #TODO Test types = %w{twitter network process metrics} unless types.include? type puts "The type of the miner could be either twitter or network or process or metrics" puts "you typed: #{type}" exit 0 end puts "Generate a #{type} miner with name: #{name}" Generator::Miner.start [type, name] end |
#help(*args) ⇒ Object
help
36 37 38 39 40 41 42 43 44 45 |
# File 'bin/mines', line 36 def help *args if args.empty? #@log.debug "command 'help' with no arguments" else #@log.debug "command 'help' with arguments: #{args.join(', ').to_s}" end puts "Summary:" super puts "Now print my help :)\nYeah!" end |
#new(name) ⇒ Object
Define the ‘new’ action. Invocate the new generator
29 30 31 32 33 |
# File 'bin/mines', line 29 def new(name) ARGV.shift #@log.debug "command 'new' with arguments: #{ARGV.join(', ')}" Generator::Application.start ARGV end |