Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 42 lines (37 sloc) 1.075 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
module Xcodeproj
  class Command
    class TargetDiff < Command
      def self.banner
%{Installing dependencies of a project:

$ targets-diff [target 1] [target 2]

Shows the difference between two targets. (Only build source files atm.)
}
      end

      def self.options
        [
          ["--project PATH", "The Xcode project document to use."],
        ].concat(super)
      end

      def initialize(argv)
        @target1 = argv.shift_argument
        @target2 = argv.shift_argument
        if argv.option('--project')
          @xcodeproj_path = File.expand_path(argv.shift_argument)
        end
        super unless argv.empty?
      end

      def run
        require 'yaml'
        differ = Helper::TargetDiff.new(xcodeproj, @target1, @target2)
        files = differ.new_source_build_files.map do |build_file|
          {
            'Name' => build_file.file_ref.name,
            'Path' => build_file.file_ref.path,
            'Build settings' => build_file.settings,
          }
        end
        puts files.to_yaml
      end
    end
  end
end
Something went wrong with that request. Please try again.