Class: Middleman::Scaffold::Template

Inherits:
Templates::Base
  • Object
show all
Defined in:
lib/middleman-scaffold/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



17
18
19
# File 'lib/middleman-scaffold/template.rb', line 17

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

Instance Method Details

#build_scaffoldObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/middleman-scaffold/template.rb', line 21

def build_scaffold
  template 'shared/Gemfile', File.join(location, 'Gemfile')
  template 'shared/config.rb', File.join(location, 'config.rb')
  copy_file 'shared/bower.json', File.join(location, 'bower.json')
  copy_file 'shared/.bowerrc', File.join(location, '.bowerrc')
  copy_file 'source/index.html.slim', File.join(location, 'source/index.html.slim')
  copy_file 'source/layouts/layout.slim', File.join(location, 'source/layouts/layout.slim')
  copy_file 'source/layouts/_header.slim', File.join(location, 'source/layouts/_header.slim')
  copy_file 'source/layouts/_footer.slim', File.join(location, 'source/layouts/_footer.slim')

  empty_directory File.join(location, 'source', options[:css_dir])
  copy_file 'source/css/all.css.sass', File.join(location, 'source', options[:css_dir], 'all.css.sass')
  copy_file 'source/css/reset.css.sass', File.join(location, 'source', options[:css_dir], 'reset.css.sass')

  empty_directory File.join(location, 'source', options[:js_dir])
  copy_file 'source/js/all.js.coffee', File.join(location, 'source', options[:js_dir], 'all.js.coffee')

  empty_directory File.join(location, 'source', options[:images_dir])
  copy_file 'source/img/background.png', File.join(location, 'source', options[:images_dir], 'background.png')
  copy_file 'source/img/middleman.png', File.join(location, 'source', options[:images_dir], 'middleman.png')
  replace_css_img_dir
end