Class: Stevenson::Template::Base
- Inherits:
-
Object
- Object
- Stevenson::Template::Base
- Defined in:
- lib/stevenson/template.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(name, options = {}) ⇒ Base
constructor
A new instance of Base.
- #place_config(config_file) ⇒ Object
- #place_files(files, directory) ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Base
Returns a new instance of Base.
15 16 17 |
# File 'lib/stevenson/template.rb', line 15 def initialize(name, = {}) @name, @options = name, end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/stevenson/template.rb', line 13 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/stevenson/template.rb', line 13 def @options end |
Instance Method Details
#close ⇒ Object
28 29 30 |
# File 'lib/stevenson/template.rb', line 28 def close FileUtils.rm_rf local_directory if local_directory end |
#place_config(config_file) ⇒ Object
19 20 21 |
# File 'lib/stevenson/template.rb', line 19 def place_config(config_file) place_files(config_file, '_config.yml') end |
#place_files(files, directory) ⇒ Object
23 24 25 26 |
# File 'lib/stevenson/template.rb', line 23 def place_files(files, directory) action = File.directory?(files) ? :cp_r : :cp FileUtils.send(action, files, File.join(local_directory, directory)) end |