Class: Wukong::Deploy::Templater
- Inherits:
-
Object
- Object
- Wukong::Deploy::Templater
- Includes:
- FileUtils, ConflictResolution, Messaging
- Defined in:
- lib/wukong-deploy/templater.rb
Overview
Templates out a deploy pack repo in a given directory.
Instance Attribute Summary collapse
-
#options ⇒ Object
The Configliere::Param settings.
-
#repo ⇒ Object
The Wukong::Deploy::Repo being templated.
Instance Method Summary collapse
-
#dry_run? ⇒ true?
Is this a dry run in which no files are actually created or modified on disk?.
-
#initialize(root, options = {}) ⇒ Templater
constructor
Initialize a new Templater creating a deploy pack repository at the given
root
using the givenoptions
. -
#run! ⇒ Object
Run this templater.
-
#templates_dir ⇒ Pathname
The directory containing templates used to generate the corresponding files in the new deploy pack repository.
Methods included from ConflictResolution
#always_replace!, #always_replace?, #handle_conflict, #never_replace!, #never_replace?
Methods included from Messaging
#message, #message_conflict, #message_create, #message_replace, #message_same, #message_skip
Constructor Details
Instance Attribute Details
#options ⇒ Object
The Configliere::Param settings.
19 20 21 |
# File 'lib/wukong-deploy/templater.rb', line 19 def @options end |
#repo ⇒ Object
The Wukong::Deploy::Repo being templated.
16 17 18 |
# File 'lib/wukong-deploy/templater.rb', line 16 def repo @repo end |
Instance Method Details
#dry_run? ⇒ true?
Is this a dry run in which no files are actually created or modified on disk?
39 40 41 |
# File 'lib/wukong-deploy/templater.rb', line 39 def dry_run? [:dry_run] end |
#run! ⇒ Object
Run this templater.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/wukong-deploy/templater.rb', line 44 def run! if dry_run? puts "Would perform the following actions in #{repo.root}" else puts "Within #{repo.root}:" end create_dirs create_templates create_gitkeeps create_gitignore end |
#templates_dir ⇒ Pathname
The directory containing templates used to generate the corresponding files in the new deploy pack repository.
60 61 62 |
# File 'lib/wukong-deploy/templater.rb', line 60 def templates_dir @templates_dir ||= Pathname.new(File.('../../../templates', __FILE__)) end |