Rename ignore to exclude

This commit is contained in:
Юрий Сорокин 2019-08-05 13:15:05 +03:00
parent 7e6a55d72f
commit 82ca5cbbc0
3 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,6 @@
ignored-resources:
excluded-resources:
- Generated/
- Resources/Localization
- Carthage/
- Pods/
- Pods/
- FormattingService.swift

View File

@ -102,24 +102,24 @@ class Unused
options = {}
OptionParser.new do |opts|
options[:ignore] = []
options[:exclude] = []
opts.on("-c", "--config=FileName") { |c| options[:config] = c }
opts.on("-i", "--ignore [a, b, c]", Array) { |i| options[:ignore] += i if !i.nil? }
opts.on("-i", "--exclude [a, b, c]", Array) { |i| options[:exclude] += i if !i.nil? }
end.parse!
# find --config file
if !options[:config].nil?
fileName = options[:config]
resources += YAML.load_file(fileName).fetch("ignored-resources")
resources += YAML.load_file(fileName).fetch("excluded-resources")
elsif
puts "---------\n Warning: Config file is not provided \n---------"
end
# find --ignored files
if !options[:ignore].nil?
resources += options[:ignore]
# find --exclude files
if !options[:exclude].nil?
resources += options[:exclude]
end
# create and return Regexp
@ -137,7 +137,7 @@ class Unused
}
end
# remove files, that maches ignored Regexps array
# remove files, that maches excluded Regexps array
def ignore_files_with_regexps(files, regexps)
files.select { |f| regexps.all? { |r| r.match(f.file).nil? } }
end

View File

@ -1,4 +1,4 @@
arguments=("$@")
ignored_files=$(IFS=, ; echo "${arguments[*]}")
ruby ${PROJECT_DIR}/build-scripts/xcode/build_phases/Unused.rb --config ${PROJECT_DIR}/build-scripts/xcode/UnusedConfig.yml --ignore ${ignored_files}
ruby ${PROJECT_DIR}/build-scripts/xcode/build_phases/Unused.rb --config ${PROJECT_DIR}/build-scripts/xcode/UnusedConfig.yml --exclude ${ignored_files}