Module: Delphivm::Generator::ClassMethods
- Defined in:
- lib/delphivm/generator.rb
Instance Method Summary collapse
- #desc(*msg) ⇒ Object
- #get_app_name ⇒ Object
- #output_folder ⇒ Object
- #output_folder=(value) ⇒ Object
- #source_root ⇒ Object
- #subtemplate ⇒ Object
- #subtemplate=(value) ⇒ Object
- #template_subfolder ⇒ Object
Instance Method Details
#desc(*msg) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/delphivm/generator.rb', line 25 def desc(*msg) if msg.size==1 command = name.split(':')[-1].downcase args = self.arguments.map {|arg| arg.usage }.join(' ') # # hide from thor standard list group(' ') Gen.register(self, command, command + ' ' + args, *msg) end super *msg end |
#get_app_name ⇒ Object
21 22 23 |
# File 'lib/delphivm/generator.rb', line 21 def get_app_name @app_name = output_folder.basename.to_s.camelize end |
#output_folder ⇒ Object
41 42 43 |
# File 'lib/delphivm/generator.rb', line 41 def output_folder @output_folder ||= ROOT end |
#output_folder=(value) ⇒ Object
45 46 47 |
# File 'lib/delphivm/generator.rb', line 45 def output_folder=(value) @output_folder = Pathname(value.to_s) end |
#source_root ⇒ Object
49 50 51 |
# File 'lib/delphivm/generator.rb', line 49 def source_root TEMPLATE_ROOT + self.template_subfolder end |
#subtemplate ⇒ Object
13 14 15 |
# File 'lib/delphivm/generator.rb', line 13 def subtemplate @subtemplate end |
#subtemplate=(value) ⇒ Object
17 18 19 |
# File 'lib/delphivm/generator.rb', line 17 def subtemplate=(value) @subtemplate = value end |
#template_subfolder ⇒ Object
36 37 38 39 |
# File 'lib/delphivm/generator.rb', line 36 def template_subfolder subpath = (subtemplate.to_s.empty? ? '' : '/' + subtemplate.to_s) @template_subfolder = self.name.split('::')[-1].snake_case + subpath + '.tt' end |