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.
Instance Method Summary collapse
-
#generate_bundler! ⇒ void
Write a Bundler Gemfile file for project.
-
#generate_gitignore! ⇒ void
Write a .gitignore file for project.
-
#generate_rack! ⇒ void
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.
32 33 34 35 |
# File 'lib/middleman-core/templates.rb', line 32 def initialize(names, ) super source_paths << File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#generate_bundler! ⇒ void
This method returns an undefined value.
Write a Bundler Gemfile file for project
58 59 60 61 62 63 64 65 66 |
# File 'lib/middleman-core/templates.rb', line 58 def generate_bundler! return if [:'skip-gemfile'] template "shared/Gemfile.tt", File.join(location, "Gemfile") return if [:'skip-bundle'] inside(location) do ::Middleman::Cli::Bundle.new.invoke(:bundle) end unless ENV["TEST"] end |
#generate_gitignore! ⇒ void
This method returns an undefined value.
Write a .gitignore file for project
73 74 75 76 |
# File 'lib/middleman-core/templates.rb', line 73 def generate_gitignore! return if [:'skip-git'] copy_file "shared/gitignore", File.join(location, ".gitignore") end |
#generate_rack! ⇒ void
This method returns an undefined value.
Write a Rack config.ru file for project
48 49 50 51 |
# File 'lib/middleman-core/templates.rb', line 48 def generate_rack! return unless [:rack] template "shared/config.ru", File.join(location, "config.ru") end |