mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-24 04:46:05 +08:00
add support for manifest plist file (ios only)
This commit is contained in:
@@ -41,6 +41,14 @@ module Motion; module Project
|
||||
end
|
||||
sh "/bin/cp #{tmp}/archive.zip \"#{archive}\""
|
||||
end
|
||||
|
||||
# Create manifest file (if needed).
|
||||
manifest_plist = File.join(config.versionized_build_dir('iPhoneOS'), 'manifest.plist')
|
||||
manifest_plist_data = config.manifest_plist_data
|
||||
if manifest_plist_data and (!File.exist?(manifest_plist) or File.mtime(config.project_file) > File.mtime(manifest_plist))
|
||||
App.info 'Create', manifest_plist
|
||||
File.open(manifest_plist, 'w') { |io| io.write(manifest_plist_data) }
|
||||
end
|
||||
end
|
||||
|
||||
def codesign(config, platform)
|
||||
|
||||
@@ -29,7 +29,7 @@ module Motion; module Project;
|
||||
|
||||
variable :device_family, :interface_orientations, :background_modes,
|
||||
:status_bar_style, :icons, :prerendered_icon, :fonts, :seed_id,
|
||||
:provisioning_profile
|
||||
:provisioning_profile, :manifest_assets
|
||||
|
||||
def initialize(project_dir, build_mode)
|
||||
super
|
||||
@@ -40,6 +40,7 @@ module Motion; module Project;
|
||||
@status_bar_style = :default
|
||||
@icons = []
|
||||
@prerendered_icon = false
|
||||
@manifest_assets = []
|
||||
end
|
||||
|
||||
def platforms; ['iPhoneSimulator', 'iPhoneOS']; end
|
||||
@@ -52,6 +53,11 @@ module Motion; module Project;
|
||||
App.fail "app.icons should be an array of strings."
|
||||
end
|
||||
|
||||
# manifest_assets
|
||||
if !(manifest_assets.is_a?(Array) and manifest_assets.all? { |x| x.is_a?(Hash) and x.keys.include?(:kind) and x.keys.include?(:url) })
|
||||
App.fail "app.manifest_assets should be an array of hashes with values for the :kind and :url keys"
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
@@ -292,6 +298,21 @@ module Motion; module Project;
|
||||
}.merge(generic_info_plist).merge(dt_info_plist).merge(info_plist))
|
||||
end
|
||||
|
||||
def manifest_plist_data
|
||||
return nil if manifest_assets.empty?
|
||||
Motion::PropertyList.to_s({
|
||||
'items' => [
|
||||
{ 'assets' => manifest_assets,
|
||||
'metadata' => {
|
||||
'bundle-identifier' => identifier,
|
||||
'bundle-version' => @version,
|
||||
'kind' => 'software',
|
||||
'title' => @name
|
||||
} }
|
||||
]
|
||||
})
|
||||
end
|
||||
|
||||
def supported_sdk_versions(versions)
|
||||
versions.reverse.find { |vers| File.exist?(datadir(vers)) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user