Class: Tooler::CLI
Instance Method Summary collapse
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
- #start ⇒ Object
Methods included from Template
#config_ru, #copy_template_cuba, #copy_template_sinatra, #create_dir, #file_read, #file_write, #gemfile, #gitignore, #license, #procfile, #readme, #template
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
6 7 8 9 10 11 12 13 |
# File 'lib/tooler/cli.rb', line 6 def initialize args = {template: "", name: ""} parse args[:arguments] [:pwd] = ::FileUtils.pwd + "/" [:name] = [:pwd].split('/').last [:root_path] = Tooler.root [:template_path] = [:root_path] + "/templates/" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
33 34 35 36 37 38 39 40 |
# 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 |
Instance Method Details
#start ⇒ Object
15 16 17 18 19 20 21 22 |
# 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 |