Class: Middleman::Templates::Base
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Middleman::Templates::Base
- Includes:
- Thor::Actions
- Defined in:
- lib/middleman-core/templates.rb
Overview
Base Template class. Handles basic options and paths.
Class Method Summary collapse
-
.gemfile_template ⇒ Object
The gemfile template to use.
Instance Method Summary collapse
-
#generate_bundler!
Write a Bundler Gemfile file for project.
-
#generate_gitignore!
Write a .gitignore file for project.
-
#generate_rack!
Write a Rack config.ru file for project.
-
#initialize(names, options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(names, options) ⇒ Base
Returns a new instance of Base.
30 31 32 33 |
# File 'lib/middleman-core/templates.rb', line 30 def initialize(names, ) super source_paths << File.join(File.dirname(__FILE__), 'templates') end |
Class Method Details
.gemfile_template ⇒ Object
The gemfile template to use. Individual templates can define this class method to override the template path.
37 38 39 |
# File 'lib/middleman-core/templates.rb', line 37 def self.gemfile_template 'shared/Gemfile.tt' end |
Instance Method Details
#generate_bundler!
This method returns an undefined value.
Write a Bundler Gemfile file for project
62 63 64 65 66 67 68 69 70 |
# File 'lib/middleman-core/templates.rb', line 62 def generate_bundler! return if [:'skip-gemfile'] template self.class.gemfile_template, File.join(location, 'Gemfile') return if [:'skip-bundle'] inside(location) do ::Middleman::Cli::Bundle.new.invoke(:bundle) end unless ENV['TEST'] end |
#generate_gitignore!
This method returns an undefined value.
Write a .gitignore file for project
77 78 79 80 |
# File 'lib/middleman-core/templates.rb', line 77 def generate_gitignore! return if [:'skip-git'] copy_file 'shared/gitignore', File.join(location, '.gitignore') end |
#generate_rack!
This method returns an undefined value.
Write a Rack config.ru file for project
52 53 54 55 |
# File 'lib/middleman-core/templates.rb', line 52 def generate_rack! return unless [:rack] template 'shared/config.ru', File.join(location, 'config.ru') end |