Class: MiddlemanEmberScaffold::Generators::Generate

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/middleman_ember_scaffold/generators/generate.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



10
11
12
# File 'lib/middleman_ember_scaffold/generators/generate.rb', line 10

def self.source_root
  File.expand_path(File.dirname(__FILE__), "../template")
end

Instance Method Details

#generate(*args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/middleman_ember_scaffold/generators/generate.rb', line 15

def generate(*args)
  type = args[0]
  file = args[1]
  throw 'not implemented'
  case type
  when 'model'
    
    mg = ModelGenerator.new
    mg.invoke :generate [path, name]

  when 'view'
    
    vg = ViewGenerator.new
    vg.invoke :generate [path, name]
  
  when 'controller'

    cg = ControllerGenerator.new
    cg.invoke :generate [path, name]
  
  when 'template'

    tg = TemplateGenerator.new
    tg.invoke :generate [path, name]

  else
    puts "Type must be one of the following: [model,view,controller,template]"
  end
end