Class: Teapot::Build::Component
- Inherits:
-
Object
- Object
- Teapot::Build::Component
- Defined in:
- lib/teapot/build/component.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parts ⇒ Object
readonly
Returns the value of attribute parts.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #add(path) ⇒ Object
- #destination_path ⇒ Object
-
#initialize(root, name, environment) ⇒ Component
constructor
A new instance of Component.
- #prepare! ⇒ Object
- #variant ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
35 36 37 |
# File 'lib/teapot/build/component.rb', line 35 def name @name end |
#parts ⇒ Object (readonly)
Returns the value of attribute parts.
36 37 38 |
# File 'lib/teapot/build/component.rb', line 36 def parts @parts end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
34 35 36 |
# File 'lib/teapot/build/component.rb', line 34 def root @root end |
Instance Method Details
#add(path) ⇒ Object
38 39 40 |
# File 'lib/teapot/build/component.rb', line 38 def add(path) @parts << path end |
#destination_path ⇒ Object
46 47 48 |
# File 'lib/teapot/build/component.rb', line 46 def destination_path @environment[:build_prefix] + "source" end |
#prepare! ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/teapot/build/component.rb', line 50 def prepare! source_path = destination_path + @name if source_path.exist? source_path.rmtree end source_path.mkpath @parts.each do |path| full_path = @root + path FileUtils.cp_r(full_path.children, source_path.to_s) end return source_path end |
#variant ⇒ Object
42 43 44 |
# File 'lib/teapot/build/component.rb', line 42 def variant @environment[:variant] end |