class Object

Constants

Options

docs.ruby-lang.org/en/2.1.0/OptionParser.html

SCRIPT_NAME

Public Instance Methods

find_files(ignore_regex_string, base_path, extension) click to toggle source

Convenience utilities.

# File lib/check_xcode_xmls/helpers.rb, line 49
def find_files(ignore_regex_string, base_path, extension)
  file_paths = []
  ignore_regex = Regexp.new(ignore_regex_string) unless ignore_regex_string.nil?
  # puts ignore_regex
  Find.find(base_path) do |path|
    next if File.directory? path
    next if path !~ extension
    if ignore_regex
      next if path =~ ignore_regex
    end

    file_paths << path
  end
  file_paths
end
parse_xml( check_constraints_identifiers, check_use_autolayout, file ) click to toggle source
# File lib/check_xcode_xmls/helpers.rb, line 66
def parse_xml(
  check_constraints_identifiers,
  check_use_autolayout,
  file
)
  string = File.open(file, 'r:UTF-8').read
  doc = Nokogiri::XML(string)
  # puts doc.xpath('document').attribute('type')
  result = []

  [Xib,
   Storyboard].each do |item|

    next if file !~ item.extension

    if check_constraints_identifiers
      constraintsValues = item.search_constraints_without_identifiers(file, doc.xpath('document'))
      result += constraintsValues unless constraintsValues.nil?
    end

    if check_use_autolayout
      autolayoutValue = item.check_if_file_uses_autolayout(file, doc.xpath('document'))
      result += autolayoutValue unless autolayoutValue.nil?
    end
  end
  # result = search_constraints_without_identifiers(file, doc.xpath('document'))
  result
end