Class: LicenseGenerator::App
- Inherits:
-
Thor
- Object
- Thor
- LicenseGenerator::App
- Includes:
- Thor::Actions
- Defined in:
- lib/license-generator/app.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
Returns the value of attribute authors.
Class Method Summary collapse
-
.source_root ⇒ Object
Path to the templates.
Instance Method Summary collapse
-
#help(task = nil) ⇒ Object
Override Thor#help to include templates.
- #list ⇒ Object
- #method_missing(meth, *args) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
20 21 22 23 |
# File 'lib/license-generator/app.rb', line 20 def method_missing(meth, *args) self. = args.empty? ? option(:authors) : args.join(', ') template "#{meth}.erb", "LICENSE" end |
Instance Attribute Details
#authors ⇒ Object
Returns the value of attribute authors.
6 7 8 |
# File 'lib/license-generator/app.rb', line 6 def @authors end |
Class Method Details
.source_root ⇒ Object
Path to the templates
9 10 11 |
# File 'lib/license-generator/app.rb', line 9 def self.source_root File.('../../templates', File.dirname(__FILE__)) end |
Instance Method Details
#help(task = nil) ⇒ Object
Override Thor#help to include templates.
26 27 28 29 30 31 32 33 34 |
# File 'lib/license-generator/app.rb', line 26 def help(task = nil) super unless task say "Templates:" templates.each do |template| say " licgen #{template}\t# Generate #{template} license" end end end |
#list ⇒ Object
14 15 16 17 18 |
# File 'lib/license-generator/app.rb', line 14 def list templates.each do |template| say template end end |