61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/milk_tea/packages/manifest.rb', line 61
def load
manifest_path, root_dir = resolve_manifest_path(@path)
raise PackageManifestError, "package manifest not found for #{@path}" unless manifest_path
config = parse_manifest(manifest_path)
package = config.fetch("package", {})
build = config.fetch("build", {})
profile_config = config.fetch("profile", {})
platform_config = config.fetch("platform", {})
package_name = package["name"]
if package_name.nil? || package_name.empty?
package_name = self.class.default_package_name_for_root(root_dir)
end
package_version = package["version"]
package_version = package_version.to_s unless package_version.nil?
package_version = nil if package_version == ""
package_kind = normalize_package_kind(package["kind"] || build["type"] || default_package_kind(build))
source_root_value = package["source_root"] || default_source_root(root_dir)
source_root = File.expand_path(source_root_value.to_s, root_dir)
unless File.directory?(source_root)
raise PackageManifestError, "package.source_root not found: #{source_root_value} (resolved to #{source_root})"
end
profile_name = normalize_profile_name(build["profile"] || profile_config["default"])
platform_name = normalize_platform_name(build["platform"] || platform_config["default"])
source_path = resolve_source_path(root_dir, build, package_kind)
output_path = build["output"]
output_path = File.expand_path(output_path.to_s, root_dir) if output_path
assets_paths = parse_assets_paths(build["assets"], root_dir)
html_template_path = build["html_template"]
if html_template_path
html_template_path = File.expand_path(html_template_path.to_s, root_dir)
unless File.file?(html_template_path)
raise PackageManifestError, "build.html_template not found: #{build["html_template"]} (resolved to #{html_template_path})"
end
end
dependencies = parse_dependencies(config.fetch("dependencies", {}), root_dir:, manifest_path:)
DataView.new(
root_dir:,
manifest_path:,
package_name:,
package_version:,
package_kind:,
source_root:,
source_path:,
profile: profile_name,
platform: platform_name,
output_path:,
assets_paths:,
html_template_path:,
dependencies:,
)
end
|