`app.resources_dir' will be deprecated

This commit is contained in:
Watson
2013-02-26 01:00:51 +09:00
parent fa28dd86e3
commit b17e5bb7e4
3 changed files with 16 additions and 11 deletions

View File

@@ -152,7 +152,7 @@ task :clean do
App.info 'Delete', App.config.build_dir
rm_rf(App.config.build_dir)
App.config.vendor_projects.each { |vendor| vendor.clean }
Dir.glob(App.config.resources_dir.flatten.map{ |x| x + '/**/*.{nib,storyboardc,momd}' }).each do |p|
Dir.glob(App.config.resources_dirs.flatten.map{ |x| x + '/**/*.{nib,storyboardc,momd}' }).each do |p|
App.info 'Delete', p
rm_rf p
end

View File

@@ -40,7 +40,7 @@ module Motion; module Project;
App.fail "No spec files in `#{config.specs_dir}'"
end
config.resources_dir.flatten!
config.resources_dirs.flatten!
# Locate SDK and compilers.
sdk = config.sdk(platform)
@@ -405,7 +405,7 @@ EOS
end
# Compile IB resources.
config.resources_dir.each do |dir|
config.resources_dirs.each do |dir|
if File.exist?(dir)
ib_resources = []
ib_resources.concat((Dir.glob(File.join(dir, '**', '*.xib')) + Dir.glob(File.join(dir, '*.lproj', '*.xib'))).map { |xib| [xib, xib.sub(/\.xib$/, '.nib')] })
@@ -420,7 +420,7 @@ EOS
end
# Compile CoreData Model resources.
config.resources_dir.each do |dir|
config.resources_dirs.each do |dir|
if File.exist?(dir)
Dir.glob(File.join(dir, '*.xcdatamodeld')).each do |model|
momd = model.sub(/\.xcdatamodeld$/, '.momd')
@@ -441,7 +441,7 @@ EOS
config.name
]
resources_paths = []
config.resources_dir.each do |dir|
config.resources_dirs.each do |dir|
if File.exist?(dir)
resources_paths << Dir.chdir(dir) do
Dir.glob('*').reject { |x| ['.xib', '.storyboard', '.xcdatamodeld', '.lproj'].include?(File.extname(x)) }.map { |file| File.join(dir, file) }
@@ -470,7 +470,7 @@ EOS
next if File.directory?(bundle_res)
next if reserved_app_bundle_files.include?(bundle_res)
next if resources_files.include?(bundle_res)
App.warn "File `#{bundle_res}' found in app bundle but not in `#{config.resources_dir}', removing"
App.warn "File `#{bundle_res}' found in app bundle but not in resource directories, removing"
FileUtils.rm_rf(bundle_res)
end
end

View File

@@ -49,7 +49,7 @@ module Motion; module Project
variable :files, :xcode_dir, :sdk_version, :deployment_target, :frameworks,
:weak_frameworks, :framework_search_paths, :libs, :delegate_class, :name, :build_dir,
:resources_dir, :specs_dir, :identifier, :codesign_certificate,
:resources_dirs, :specs_dir, :identifier, :codesign_certificate,
:provisioning_profile, :device_family, :interface_orientations, :version,
:short_version, :icons, :prerendered_icon, :background_modes, :seed_id,
:entitlements, :fonts, :status_bar_style, :motiondir, :detect_dependencies
@@ -69,7 +69,7 @@ module Motion; module Project
@libs = []
@delegate_class = 'AppDelegate'
@name = 'Untitled'
@resources_dir = [File.join(project_dir, 'resources')]
@resources_dirs = [File.join(project_dir, 'resources')]
@build_dir = File.join(project_dir, 'build')
@specs_dir = File.join(project_dir, 'spec')
@device_family = :iphone
@@ -207,9 +207,14 @@ EOS
end
end
def resources_dir
warn("`app.resources_dir' is deprecated; use `app.resources_dirs'");
@resources_dirs.first
end
def resources_dir=(dir)
dir = [dir] if dir.is_a?(String)
@resources_dir = dir
warn("`app.resources_dir' is deprecated; use `app.resources_dirs'");
@resources_dirs = [dir]
end
def build_dir
@@ -709,7 +714,7 @@ EOS
def fonts
@fonts ||= begin
resources_dir.flatten.inject([]) do |fonts, dir|
resources_dirs.flatten.inject([]) do |fonts, dir|
if File.exist?(dir)
Dir.chdir(dir) do
fonts.concat(Dir.glob('*.{otf,ttf}'))