Class: Stevenson::Template::Local
- Defined in:
- lib/stevenson/templates/local.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(template_path, options) ⇒ Local
constructor
A new instance of Local.
- #local_directory ⇒ Object
Methods inherited from Base
#close, #place_config, #place_files
Constructor Details
#initialize(template_path, options) ⇒ Local
Returns a new instance of Local.
6 7 8 |
# File 'lib/stevenson/templates/local.rb', line 6 def initialize(template_path, ) @template_path, = template_path, end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/stevenson/templates/local.rb', line 4 def end |
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
4 5 6 |
# File 'lib/stevenson/templates/local.rb', line 4 def template_path @template_path end |
Instance Method Details
#local_directory ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/stevenson/templates/local.rb', line 10 def local_directory raise InvalidTemplateException.new('The given path is not a directory') unless File.directory?(template_path) @_local_directory ||= Dir.mktmpdir.tap do |dir| directories = [template_path, [:subdirectory], '.'].compact FileUtils.cp_r File.join(*directories), dir end end |