From 62d5d40f3294890d1aaae0dc7f307e33d514a646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Thu, 27 Nov 2014 14:51:46 +0100 Subject: [PATCH] [Config] Don't use `@name` variable directly and add API to get bundle filename. --- lib/motion/project/template/ios/config.rb | 10 ++++++++-- lib/motion/project/template/osx/config.rb | 2 +- lib/motion/project/xcode_config.rb | 20 ++++++++++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lib/motion/project/template/ios/config.rb b/lib/motion/project/template/ios/config.rb index 1060aa5b..64e8bb37 100644 --- a/lib/motion/project/template/ios/config.rb +++ b/lib/motion/project/template/ios/config.rb @@ -324,8 +324,14 @@ def device_id end end + # @param [String] platform + # The platform identifier that's being build for, such as + # `iPhoneSimulator` or `iPhoneOS`. + # + # @return [String] The path to the app bundle in the build directory. + # def app_bundle(platform) - File.join(versionized_build_dir(platform), bundle_name + '.app') + File.join(versionized_build_dir(platform), bundle_filename) end def app_bundle_executable(platform) @@ -459,7 +465,7 @@ def manifest_plist_data 'bundle-identifier' => identifier, 'bundle-version' => @version, 'kind' => 'software', - 'title' => @name + 'title' => name } } ] }) diff --git a/lib/motion/project/template/osx/config.rb b/lib/motion/project/template/osx/config.rb index fba29443..5bdfad3c 100644 --- a/lib/motion/project/template/osx/config.rb +++ b/lib/motion/project/template/osx/config.rb @@ -122,7 +122,7 @@ def bridgesupport_cflags end def app_bundle_raw(platform) - File.join(versionized_build_dir(platform), bundle_name + '.app') + File.join(versionized_build_dir(platform), bundle_filename) end def app_bundle(platform) diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index d03d032f..49a1c9ca 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -289,8 +289,16 @@ def ldflags(platform) common_flags(platform) + ' -Wl,-no_pie' end + # @return [String] The application bundle name, excluding extname. + # def bundle_name - @name + (spec_mode ? '_spec' : '') + name + (spec_mode ? '_spec' : '') + end + + # @return [String] The application bundle filename, including extname. + # + def bundle_filename + bundle_name + '.app' end def versionized_build_dir(platform) @@ -298,7 +306,7 @@ def versionized_build_dir(platform) end def app_bundle_dsym(platform) - File.join(versionized_build_dir(platform), bundle_name + '.app.dSYM') + File.join(versionized_build_dir(platform), bundle_filename + '.dSYM') end def archive_extension @@ -310,7 +318,7 @@ def archive end def identifier - @identifier ||= "com.yourcompany.#{@name.gsub(/\s/, '')}" + @identifier ||= "com.yourcompany.#{name.gsub(/\s/, '')}" spec_mode ? @identifier + '_spec' : @identifier end @@ -326,10 +334,10 @@ def generic_info_plist { 'BuildMachineOSBuild' => `sw_vers -buildVersion`.strip, 'CFBundleDevelopmentRegion' => 'en', - 'CFBundleName' => @name, - 'CFBundleDisplayName' => @name, + 'CFBundleName' => name, + 'CFBundleDisplayName' => name, 'CFBundleIdentifier' => identifier, - 'CFBundleExecutable' => @name, + 'CFBundleExecutable' => name, 'CFBundleInfoDictionaryVersion' => '6.0', 'CFBundlePackageType' => 'APPL', 'CFBundleShortVersionString' => (@short_version || @version),