class Xcodeproj::Command::ProjectDiff

Public Class Methods

new(argv) click to toggle source
Calls superclass method Xcodeproj::Command::new
# File lib/xcodeproj/command/project_diff.rb, line 25
def initialize(argv)
  @path_project1  = argv.shift_argument
  @path_project2  = argv.shift_argument
  @keys_to_ignore = argv.all_options('ignore')
  super
end
options() click to toggle source
Calls superclass method
# File lib/xcodeproj/command/project_diff.rb, line 14
def self.options
  [
    ['--ignore=KEY', 'A key to ignore in the comparison. Can be specified multiple times.'],
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/xcodeproj/command/project_diff.rb, line 37
def run
  hash_1 = @project1.to_tree_hash.dup
  hash_2 = @project2.to_tree_hash.dup
  @keys_to_ignore.each do |key|
    Differ.clean_hash!(hash_1, key)
    Differ.clean_hash!(hash_2, key)
  end

  diff = Differ.project_diff(hash_1, hash_2, @path_project1, @path_project2)

  require 'yaml'
  yaml = diff.to_yaml
  yaml.gsub!(@path_project1, @path_project1.cyan)
  yaml.gsub!(@path_project2, @path_project2.magenta)
  yaml.gsub!(':diff:', 'diff:'.yellow)
  puts yaml
end
validate!() click to toggle source
Calls superclass method
# File lib/xcodeproj/command/project_diff.rb, line 32
def validate!
  super
  @project1, @project2 = open_project!(@path_project1, @path_project2)
end