Sha256: 0d051dbbbf7e81b46b575c73ca43a19f02bd8d9ac0ef86640567c3fb22608c96

Contents?: true

Size: 1.28 KB

Versions: 23

Compression:

Stored size: 1.28 KB

Contents

module Gym
  class XcodebuildFixes
    class << self
      # Determine whether this app has WatchKit support and manually package up the WatchKit framework
      def watchkit_fix
        return unless watchkit?

        Helper.log.info "Adding WatchKit support" if $verbose

        Dir.mktmpdir do |tmpdir|
          # Make watchkit support directory
          watchkit_support = File.join(tmpdir, "WatchKitSupport")
          Dir.mkdir(watchkit_support)

          # Copy WK from Xcode into WatchKitSupport
          FileUtils.copy_file("#{Xcode.xcode_path}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/WK", File.join(watchkit_support, "WK"))

          # Add "WatchKitSupport" to the .ipa archive
          Dir.chdir(tmpdir) do
            abort unless system %(zip --recurse-paths "#{PackageCommandGenerator.ipa_path}" "WatchKitSupport" > /dev/null)
          end

          Helper.log.info "Successfully added WatchKit support" if $verbose
        end
      end

      # Does this application have a WatchKit target
      def watchkit?
        Dir["#{PackageCommandGenerator.appfile_path}/**/*.plist"].any? do |plist_path|
          `/usr/libexec/PlistBuddy -c 'Print WKWatchKitApp' '#{plist_path}' 2>&1`.strip == 'true'
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
gym-1.1.6 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.1.5 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.1.4 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.1.3 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.1.2 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.1.1 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.1.0 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-1.0.0 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.9.1 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.9.0 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.8.5 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.8.4 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.8.3 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.8.2 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.8.1 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.8.0 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.7.3 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.7.2 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.7.1 lib/gym/xcodebuild_fixes/watchkit_fix.rb
gym-0.7.0 lib/gym/xcodebuild_fixes/watchkit_fix.rb