class Middleman::Templates::Base
Base
Template class. Handles basic options and paths.
Public Class Methods
gemfile_template()
click to toggle source
The gemfile template to use. Individual templates can define this class method to override the template path.
# File lib/middleman-core/templates.rb, line 37 def self.gemfile_template 'shared/Gemfile.tt' end
new(names, options)
click to toggle source
Calls superclass method
# File lib/middleman-core/templates.rb, line 30 def initialize(names, options) super source_paths << File.join(File.dirname(__FILE__), 'templates') end
Public Instance Methods
generate_bundler!()
click to toggle source
Write a Bundler Gemfile file for project @return [void]
# File lib/middleman-core/templates.rb, line 62 def generate_bundler! return if options[:'skip-gemfile'] template self.class.gemfile_template, File.join(location, 'Gemfile') return if options[:'skip-bundle'] inside(location) do ::Middleman::Cli::Bundle.new.invoke(:bundle) end unless ENV['TEST'] end
generate_gitignore!()
click to toggle source
Write a .gitignore file for project @return [void]
# File lib/middleman-core/templates.rb, line 77 def generate_gitignore! return if options[:'skip-git'] copy_file 'shared/gitignore', File.join(location, '.gitignore') end
generate_rack!()
click to toggle source
Write a Rack config.ru file for project @return [void]
# File lib/middleman-core/templates.rb, line 52 def generate_rack! return unless options[:rack] template 'shared/config.ru', File.join(location, 'config.ru') end