Class: RokuBuilder::Manifest
- Inherits:
-
Object
- Object
- RokuBuilder::Manifest
show all
- Defined in:
- lib/roku_builder/manifest.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config:) ⇒ Manifest
Returns a new instance of Manifest.
15
16
17
18
19
20
|
# File 'lib/roku_builder/manifest.rb', line 15
def initialize(config:)
@config = config
@attributes = {}
check_for_manifest
read
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
43
44
45
|
# File 'lib/roku_builder/manifest.rb', line 43
def method_missing(method)
@attributes[method]
end
|
Class Method Details
.generate(config:, attributes:) ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/roku_builder/manifest.rb', line 6
def self.generate(config:, attributes:)
root_dir = config.build_dir
root_dir ||= config.root_dir
FileUtils.touch(File.join(root_dir, "manifest"))
manifest = new(config: config)
manifest.update(attributes: default_params.merge(attributes))
manifest
end
|
Instance Method Details
#get_attributes ⇒ Object
27
28
29
|
# File 'lib/roku_builder/manifest.rb', line 27
def get_attributes
@attributes
end
|
#increment_build_version ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/roku_builder/manifest.rb', line 31
def increment_build_version
build_version_parts = @attributes[:build_version].split(".")
if build_version_parts.length == 2
build_version_parts[0] = Time.now.strftime("%m%d%y")
build_version_parts[1] = build_version_parts[1].to_i + 1
@attributes[:build_version] = build_version_parts.join(".")
else
@attributes[:build_version] = build_version_parts[0].to_i + 1
end
write_file
end
|
#update(attributes:) ⇒ Object
22
23
24
25
|
# File 'lib/roku_builder/manifest.rb', line 22
def update(attributes:)
update_attributes(attributes)
write_file
end
|