Class: Stevenson::Template::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/stevenson/template.rb

Direct Known Subclasses

Local

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @name, @options = name, options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/stevenson/template.rb', line 13

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



13
14
15
# File 'lib/stevenson/template.rb', line 13

def options
  @options
end

Instance Method Details

#closeObject



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