mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-24 04:46:05 +08:00
move icons, prerendered_icon and fonts to ios config, add icon to osx config
This commit is contained in:
@@ -28,7 +28,7 @@ module Motion; module Project;
|
||||
register :ios
|
||||
|
||||
variable :device_family, :interface_orientations, :background_modes,
|
||||
:status_bar_style
|
||||
:status_bar_style, :icons, :prerendered_icon, :fonts
|
||||
|
||||
def initialize(project_dir, build_mode)
|
||||
super
|
||||
@@ -37,12 +37,23 @@ module Motion; module Project;
|
||||
@interface_orientations = [:portrait, :landscape_left, :landscape_right]
|
||||
@background_modes = []
|
||||
@status_bar_style = :default
|
||||
@icons = []
|
||||
@prerendered_icon = false
|
||||
end
|
||||
|
||||
def platforms; ['iPhoneSimulator', 'iPhoneOS']; end
|
||||
def local_platform; 'iPhoneSimulator'; end
|
||||
def deploy_platform; 'iPhoneOS'; end
|
||||
|
||||
def validate
|
||||
# icons
|
||||
if !(icons.is_a?(Array) and icons.all? { |x| x.is_a?(String) })
|
||||
App.fail "app.icons should be an array of strings."
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def locate_compiler(platform, *execs)
|
||||
paths = [File.join(platform_dir(platform), 'Developer/usr/bin')]
|
||||
paths.unshift File.join(xcode_dir, 'Toolchains/XcodeDefault.xctoolchain/usr/bin')
|
||||
@@ -164,6 +175,20 @@ module Motion; module Project;
|
||||
app_bundle(platform)
|
||||
end
|
||||
|
||||
def fonts
|
||||
@fonts ||= begin
|
||||
resources_dirs.flatten.inject([]) do |fonts, dir|
|
||||
if File.exist?(dir)
|
||||
Dir.chdir(dir) do
|
||||
fonts.concat(Dir.glob('*.{otf,ttf}'))
|
||||
end
|
||||
else
|
||||
fonts
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def info_plist_data
|
||||
ios_version_to_build = lambda do |vers|
|
||||
# XXX we should retrieve these values programmatically.
|
||||
|
||||
@@ -29,11 +29,12 @@ module Motion; module Project;
|
||||
class OSXConfig < XcodeConfig
|
||||
register :osx
|
||||
|
||||
variable :copyright
|
||||
variable :icon, :copyright
|
||||
|
||||
def initialize(project_dir, build_mode)
|
||||
super
|
||||
@copyright = "Copyright © #{Time.now.year} #{`whoami`.strip}. All rights reserved."
|
||||
@icon = ''
|
||||
@frameworks = ['AppKit', 'Foundation', 'CoreGraphics']
|
||||
end
|
||||
|
||||
@@ -68,7 +69,8 @@ module Motion; module Project;
|
||||
def info_plist_data
|
||||
Motion::PropertyList.to_s({
|
||||
'NSHumanReadableCopyright' => copyright,
|
||||
'NSPrincipalClass' => 'NSApplication'
|
||||
'NSPrincipalClass' => 'NSApplication',
|
||||
'CFBundleIconFile' => (icon or '')
|
||||
}.merge(generic_info_plist).merge(dt_info_plist).merge(info_plist))
|
||||
end
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ module Motion; module Project;
|
||||
variable :xcode_dir, :sdk_version, :deployment_target, :frameworks,
|
||||
:weak_frameworks, :framework_search_paths, :libs, :resources_dirs,
|
||||
:identifier, :codesign_certificate, :provisioning_profile,
|
||||
:short_version, :icons, :prerendered_icon, :seed_id, :entitlements,
|
||||
:fonts, :delegate_class
|
||||
:short_version, :seed_id, :entitlements, :delegate_class
|
||||
|
||||
def initialize(project_dir, build_mode)
|
||||
super
|
||||
@@ -39,8 +38,6 @@ module Motion; module Project;
|
||||
@libs = []
|
||||
@bundle_signature = '????'
|
||||
@short_version = '1'
|
||||
@icons = []
|
||||
@prerendered_icon = false
|
||||
@vendor_projects = []
|
||||
@entitlements = {}
|
||||
@delegate_class = 'AppDelegate'
|
||||
@@ -115,11 +112,6 @@ EOS
|
||||
App.fail "iOS deployment target #{deployment_target} is not supported by this version of RubyMotion"
|
||||
end
|
||||
|
||||
# icons
|
||||
if !(icons.is_a?(Array) and icons.all? { |x| x.is_a?(String) })
|
||||
App.fail "app.icons should be an array of strings."
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
@@ -347,20 +339,6 @@ EOS
|
||||
Motion::PropertyList.to_s(dict)
|
||||
end
|
||||
|
||||
def fonts
|
||||
@fonts ||= begin
|
||||
resources_dirs.flatten.inject([]) do |fonts, dir|
|
||||
if File.exist?(dir)
|
||||
Dir.chdir(dir) do
|
||||
fonts.concat(Dir.glob('*.{otf,ttf}'))
|
||||
end
|
||||
else
|
||||
fonts
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def gen_bridge_metadata(headers, bs_file, c_flags, exceptions)
|
||||
sdk_path = self.sdk(local_platform)
|
||||
includes = headers.map { |header| "-I'#{File.dirname(header)}'" }.uniq
|
||||
|
||||
Reference in New Issue
Block a user