class Tooler::CLI

Public Class Methods

new(args) click to toggle source
# File lib/tooler/cli.rb, line 6
def initialize args
  @options = {template: "", name: ""}
  parse args[:arguments]
  @options[:pwd] = ::FileUtils.pwd + "/"
  @options[:name] = @options[:pwd].split('/').last
  @options[:root_path] = Tooler.root
  @options[:template_path] = @options[:root_path] + "/templates/"
end

Public Instance Methods

start() click to toggle source
# File lib/tooler/cli.rb, line 15
def start
  begin
    require "tooler/#{@options[:template]}_template"
  rescue LoadError
    raise Tooler::Error, "Invalid template"
  end
  send("copy_template_#{@options[:template]}")
end

Private Instance Methods

method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/tooler/cli.rb, line 33
def method_missing method_name, *args, &block
  p "method_missing #{method_name}"
  if method_name[/^copy_template_/]
    raise Tooler::Error, "Invalid template"
  else
    super
  end
end
parse(args) click to toggle source
# File lib/tooler/cli.rb, line 26
def parse args
  if args.empty?
    raise Tooler::Error, "Should specify a template"
  end
  @options[:template] = args[0].downcase
end