Class: Ember::Middleman::Templates

Inherits:
Middleman::Templates::Base
  • Object
show all
Defined in:
lib/ember/middleman/templates.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



18
19
20
# File 'lib/ember/middleman/templates.rb', line 18

def self.source_root
  File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#build_scaffoldObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ember/middleman/templates.rb', line 22

def build_scaffold
  template 'config.tt', File.join(location, 'config.rb')

  empty_directory File.join(location, 'source', options[:css_dir])
  empty_directory File.join(location, 'source', options[:images_dir])

  js_dir = File.join(location, 'source', options[:js_dir])

  directory File.join('source', 'javascripts'), js_dir

  %w(
    initializers
    models
    controllers
    helpers
    views
    components
    templates
    routes
  ).each do |type|
    empty_directory File.join(js_dir, type)
    copy_file 'gitkeep', File.join(js_dir, type, '.gitkeep')
  end

  %w(
    source/layouts/layout.html.erb
    source/index.html.erb
    source/javascripts/templates/index.js.hbs
  ).each do |file|
    copy_file file, File.join(location, file)
  end
end