diff --git a/xcode/build_phases/multiple_swiftlint/setting_option.rb b/xcode/build_phases/multiple_swiftlint/setting_option.rb index 998cd83..0941e28 100644 --- a/xcode/build_phases/multiple_swiftlint/setting_option.rb +++ b/xcode/build_phases/multiple_swiftlint/setting_option.rb @@ -7,8 +7,8 @@ class SettingOption def initialize @options = OpenStruct.new OptionParser.new do |opt| - opt.on('-s', '--source_directory STRING', 'The directory of source') { |option| @options.source_directory = option } - opt.on('-l', '--swiftlint_executable_path STRING', 'The executable path of swiftlint') { |option| @options.swiftlint_executable_path = option } + opt.on('-p', '--project_directory STRING', 'The directory of project') { |option| @options.project_directory = option } + opt.on('-s', '--swiftlint_executable_path STRING', 'The executable path of swiftlint') { |option| @options.swiftlint_executable_path = option } opt.on('-g', '--git_directory STRING', 'The directory of git') { |option| @options.git_directory = 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 } @@ -25,7 +25,7 @@ class SettingOption end if @options.git_directory.to_s.nilOrEmpty? - @options.git_directory = @options.source_directory + @options.git_directory = @options.project_directory end if @options.touchin_swiftlint_yaml_path.to_s.nilOrEmpty? @@ -33,8 +33,8 @@ class SettingOption end end - def source_directory - @options.source_directory + def project_directory + @options.project_directory end def source_date @@ -60,4 +60,4 @@ class SettingOption def touchin_swiftlint_yaml_path @options.touchin_swiftlint_yaml_path end -end \ No newline at end of file +end diff --git a/xcode/build_phases/multiple_swiftlint/strategy_maker.rb b/xcode/build_phases/multiple_swiftlint/strategy_maker.rb index e92c0bb..a289f5f 100644 --- a/xcode/build_phases/multiple_swiftlint/strategy_maker.rb +++ b/xcode/build_phases/multiple_swiftlint/strategy_maker.rb @@ -7,17 +7,17 @@ require_relative 'swift_file_manager.rb' require_relative 'yaml_manager.rb' class StrategyMaker - 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' + def initialize(project_directory, swiftlint_executable_path, touchin_swiftlint_yaml_path) + @project_directory = project_directory + @touchin_swiftlint_yaml_path = project_directory + touchin_swiftlint_yaml_path + @old_swiftlint_yaml_path = project_directory + '/.swiftlint.yml' - @temporary_swiftlint_folder_name = source_directory + '/temporary_swiftlint' + @temporary_swiftlint_folder_name = project_directory + '/temporary_swiftlint' @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_executable_path + ' autocorrect --path ' + @source_directory + ' --config ' - @swiftlint_lint_command = swiftlint_executable_path + ' --path ' + @source_directory + ' --config ' + @swiftlint_autocorrect_command = swiftlint_executable_path + ' autocorrect --path ' + @project_directory + ' --config ' + @swiftlint_lint_command = swiftlint_executable_path + ' --path ' + @project_directory + ' --config ' end def run_fully_multiple_strategy(source_date) @@ -26,7 +26,7 @@ class StrategyMaker exclude_files = unique_exclude_files(@touchin_swiftlint_yaml_manager, @old_swiftlint_yaml_manager) swift_files = SwiftFileManager.new(exclude_files, source_date) - swift_files.find_list_file_paths(@source_directory) + swift_files.find_list_file_paths(@project_directory) total_touchin_excluded_files = exclude_files + swift_files.old_files total_old_excluded_files = exclude_files + swift_files.new_files diff --git a/xcode/build_phases/multiple_swiftlint/swift_file_manager.rb b/xcode/build_phases/multiple_swiftlint/swift_file_manager.rb index dd0d0f7..b8edf6c 100644 --- a/xcode/build_phases/multiple_swiftlint/swift_file_manager.rb +++ b/xcode/build_phases/multiple_swiftlint/swift_file_manager.rb @@ -52,13 +52,12 @@ class SwiftFileManager def compare_timestamp(file_path) wrapped_whitespace_file_path = file_path.with_wrapped_whitespace creation_date_string = GitСaretaker.get_creation_date(wrapped_whitespace_file_path) - puts file_path if creation_date_string.nilOrEmpty? @old_files.push(file_path) - puts 'Not found the creation date' + puts ('Creation date of ' + file_path + ' was not found') else creation_date = Date.parse(creation_date_string) - puts creation_date + puts ('Creation date of ' + file_path + ' is ' + creation_date.to_s) if @source_date < creation_date @new_files.push(file_path) else diff --git a/xcode/build_phases/multiple_swiftlint/swiftlint.rb b/xcode/build_phases/multiple_swiftlint/swiftlint.rb index 74d1f6c..e9cc0d2 100644 --- a/xcode/build_phases/multiple_swiftlint/swiftlint.rb +++ b/xcode/build_phases/multiple_swiftlint/swiftlint.rb @@ -2,11 +2,8 @@ require_relative 'setting_option.rb' require_relative 'strategy_maker.rb' -Encoding.default_external = Encoding::UTF_8 -Encoding.default_internal = Encoding::UTF_8 - setting = SettingOption.new -strategy_maker = StrategyMaker.new(setting.source_directory, setting.swiftlint_executable_path, setting.touchin_swiftlint_yaml_path) +strategy_maker = StrategyMaker.new(setting.project_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)