changed pods_directory –> swiftlint_executable_path

This commit is contained in:
Maxim Sorokin 2020-07-29 12:40:54 +03:00
parent e819248df2
commit c5cde472dd
3 changed files with 8 additions and 11 deletions

View File

@ -8,7 +8,7 @@ class SettingOption
@options = OpenStruct.new
OptionParser.new do |opt|
opt.on('-s', '--source_directory STRING', 'The directory of source') { |option| @options.source_directory = option }
opt.on('-p', '--pods_directory STRING', 'The directory of pods') { |option| @options.pods_directory = option }
opt.on('-l', '--swiftlint_executable_path STRING', 'The executable path of swiftlint') { |option| @options.swiftlint_executable_path = option }
opt.on('-c', '--check_mode MODE', 'The mode of check is "fully" or "simplified"') { |option| @options.check_mode = option }
opt.on('-u', '--use_multiple BOOL', 'The flag indicates the use of multiple yaml swiftlint configurations') { |option| @options.use_multiple = option }
opt.on('-d', '--source_date DATE', 'The date of grouping files according touchin and old swiftlint rules') { |option| @options.source_date = option }
@ -41,8 +41,8 @@ class SettingOption
@options.source_date
end
def pods_directory
@options.pods_directory
def swiftlint_executable_path
@options.swiftlint_executable_path
end
def check_mode

View File

@ -7,11 +7,8 @@ require_relative 'swift_file_manager.rb'
require_relative 'yaml_manager.rb'
class StrategyMaker
def initialize(source_directory, pods_directory, touchin_swiftlint_yaml_path)
@source_directory = source_directory
@pods_directory = pods_directory
@swiftlint = pods_directory + '/SwiftLint/swiftlint'
def initialize(source_directory, swiftlint_executable_path, touchin_swiftlint_yaml_path)
@source_directory = source_directory
@touchin_swiftlint_yaml_path = source_directory + touchin_swiftlint_yaml_path
@old_swiftlint_yaml_path = source_directory + '/.swiftlint.yml'
@ -19,8 +16,8 @@ class StrategyMaker
@touchin_swiftlint_yaml_temporary_path = @temporary_swiftlint_folder_name + '/.touchin_swiftlint.yml'
@old_swiftlint_yaml_temporary_path = @temporary_swiftlint_folder_name + '/.old_swiftlint.yml'
@swiftlint_autocorrect_command = @swiftlint + ' autocorrect --path ' + @source_directory + ' --config '
@swiftlint_lint_command = @swiftlint + ' --path ' + @source_directory + ' --config '
@swiftlint_autocorrect_command = swiftlint_executable_path + ' autocorrect --path ' + @source_directory + ' --config '
@swiftlint_lint_command = swiftlint_executable_path + ' --path ' + @source_directory + ' --config '
end
def run_fully_multiple_strategy(source_date)

View File

@ -6,7 +6,7 @@ Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
setting = SettingOption.new
strategy_maker = StrategyMaker.new(setting.source_directory, setting.pods_directory, setting.touchin_swiftlint_yaml_path)
strategy_maker = StrategyMaker.new(setting.source_directory, setting.swiftlint_executable_path, setting.touchin_swiftlint_yaml_path)
if setting.check_mode.eql? 'fully' and setting.use_multiple.true?
strategy_maker.run_fully_multiple_strategy(setting.source_date)