From 0f6d698bd3c5f38efab4f39b046ceef55e646c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Mon, 20 Oct 2014 16:16:40 +0200 Subject: [PATCH] [OSX] Refactor codesigning code from last commit. --- lib/motion/project/template/osx/builder.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/motion/project/template/osx/builder.rb b/lib/motion/project/template/osx/builder.rb index e3c9f33a..f66e3e4a 100644 --- a/lib/motion/project/template/osx/builder.rb +++ b/lib/motion/project/template/osx/builder.rb @@ -56,22 +56,19 @@ module Motion; module Project # @todo Do we really need the platform parameter when it's always the same? # def codesign(config, platform) - frameworks_path = File.join(config.app_bundle(platform), 'Frameworks') - if File.exist?(frameworks_path) - Dir.entries(frameworks_path).each do |framework| - next if framework.start_with?('.') - versions_path = File.join(frameworks_path, framework, 'Versions') - Dir.entries(versions_path).each do |version| - next if version.start_with?('.') || version == 'Current' - codesign_bundle(config, File.join(versions_path, version)) - end + app_bundle = config.app_bundle(platform) + framework_versions = 'Frameworks/*.framework/Versions/*' + Dir.glob(File.join(app_bundle, framework_versions)) do |version| + unless version == File.basename('Current') + codesign_bundle(config, version) end end codesign_bundle(config, config.app_bundle_raw(platform)) do - entitlements_path = File.join(config.versionized_build_dir(platform), "Entitlements.plist") - File.open(entitlements_path, 'w') { |io| io.write(config.entitlements_data) } - entitlements_path + build_dir = config.versionized_build_dir(platform) + entitlements = File.join(build_dir, "Entitlements.plist") + File.open(entitlements, 'w') { |io| io.write(config.entitlements_data) } + entitlements end end