diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d275b6b..37084ef 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-02-02 13:39:01 UTC using RuboCop version 1.43.0. +# on 2023-12-12 14:55:05 UTC using RuboCop version 1.58.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 4 +# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. # Include: **/*.gemspec @@ -14,25 +14,11 @@ Gemspec/OrderedDependencies: Exclude: - 'ad_localize.gemspec' -# Offense count: 1 -# Configuration parameters: Severity, Include. -# Include: **/*.gemspec -Gemspec/RequiredRubyVersion: - Exclude: - - 'ad_localize.gemspec' - # Offense count: 86 # This cop supports safe autocorrection (--autocorrect). Layout/EmptyLineAfterMagicComment: Enabled: false -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. -Lint/UnusedBlockArgument: - Exclude: - - 'lib/ad_localize/mappers/locale_wording_to_hash.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. @@ -41,30 +27,30 @@ Lint/UnusedMethodArgument: - 'lib/ad_localize/interactors/base_generate_files.rb' - 'lib/ad_localize/serializers/templated_serializer.rb' -# Offense count: 6 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes. +# Offense count: 7 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 35 + Max: 31 -# Offense count: 2 +# Offense count: 4 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: Max: 139 # Offense count: 1 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: - Max: 11 + Max: 9 -# Offense count: 11 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +# Offense count: 13 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 40 + Max: 27 # Offense count: 1 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: - Max: 11 + Max: 9 # Offense count: 1 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. @@ -101,7 +87,7 @@ Naming/VariableName: # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object # FunctionalMethods: let, let!, subject, watch @@ -143,7 +129,7 @@ Style/FormatString: # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods. +# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns. # SupportedStyles: annotated, template, unannotated Style/FormatStringToken: EnforcedStyle: template @@ -161,13 +147,16 @@ Style/GuardClause: Exclude: - 'lib/ad_localize/repositories/drive_repository.rb' -# Offense count: 57 +# Offense count: 15 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys # SupportedShorthandSyntax: always, never, either, consistent Style/HashSyntax: - Enabled: false + Exclude: + - 'Rakefile' + - 'lib/ad_localize/option_handler.rb' + - 'test/interactors/process_export_request_test.rb' # Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -195,14 +184,13 @@ Style/NegatedIf: Exclude: - 'lib/ad_localize/interactors/generate_strings.rb' -# Offense count: 3 +# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods. +# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - 'spec/**/*' - - 'test/interactors/process_export_request_test.rb' - 'test/repositories/drive_repository_test.rb' # Offense count: 1 @@ -218,13 +206,13 @@ Style/RedundantAssignment: Exclude: - 'lib/ad_localize/parsers/csv_parser.rb' -# Offense count: 1 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/RedundantBegin: Exclude: - 'lib/ad_localize/repositories/drive_repository.rb' -# Offense count: 18 +# Offense count: 15 # This cop supports safe autocorrection (--autocorrect). Style/RedundantFreeze: Exclude: @@ -234,7 +222,6 @@ Style/RedundantFreeze: - 'lib/ad_localize/interactors/generate_strings.rb' - 'lib/ad_localize/interactors/merge_wordings.rb' - 'lib/ad_localize/parsers/csv_parser.rb' - - 'lib/ad_localize/parsers/key_parser.rb' - 'lib/ad_localize/serializers/info_plist_serializer.rb' - 'lib/ad_localize/serializers/localizable_strings_serializer.rb' - 'lib/ad_localize/serializers/localizable_stringsdict_serializer.rb' @@ -245,6 +232,12 @@ Style/RedundantPercentQ: Exclude: - 'ad_localize.gemspec' +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpArgument: + Exclude: + - 'lib/ad_localize/sanitizers/ios_to_android_sanitizer.rb' + # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/RedundantRegexpEscape: @@ -290,20 +283,13 @@ Style/StringConcatenation: - 'lib/ad_localize/serializers/strings_serializer.rb' - 'lib/ad_localize/serializers/templated_serializer.rb' -# Offense count: 85 +# Offense count: 142 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes Style/StringLiterals: Enabled: false -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -Style/SymbolLiteral: - Exclude: - - 'lib/ad_localize/mappers/options_to_export_request.rb' - - 'test/option_handler_test.rb' - # Offense count: 3 # This cop supports unsafe autocorrection (--autocorrect-all). Style/ZeroLengthPredicate: @@ -311,9 +297,9 @@ Style/ZeroLengthPredicate: - 'lib/ad_localize/mappers/locale_wording_to_hash.rb' - 'test/repositories/drive_repository_test.rb' -# Offense count: 10 +# Offense count: 15 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 153 diff --git a/CHANGELOG.md b/CHANGELOG.md index 177dfbc..9b3f341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - new option `--skip-value-stripping` that disable the leading and trailing whitespaces removal on wording values. The value stripping was introduced with version 6.0.0. +### Changed + +- Updated dependencies + ## 6.1.0 ### Added diff --git a/Gemfile b/Gemfile index 2c0c96c..b3f9e4a 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,11 @@ source "https://rubygems.org" # Specify your gem's dependencies in ad_localize.gemspec gemspec + +gem 'bundler', '>= 1.12.0', '< 3.0.0' +gem 'debug', ">= 1.0.0", '< 2.0' +gem 'diffy', '~> 3.3' +gem 'minitest', '~> 5.11' +gem 'minitest-reporters', '~> 1.3' +gem 'rake', '>= 12.3.0', '< 14.0.0' +gem 'rubocop', "~> 1.0" diff --git a/Gemfile.lock b/Gemfile.lock index 54724aa..3c1f592 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,35 +3,46 @@ PATH specs: ad_localize (6.1.0) activesupport (>= 6.1.3.2, < 8.0) - colorize (~> 0.8) + colorize (~> 1.0) google-apis-drive_v3 (~> 0.33.0) google-apis-sheets_v4 (~> 0.9) GEM remote: https://rubygems.org/ specs: - activesupport (7.0.4) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - addressable (2.8.1) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ansi (1.5.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.4) builder (3.2.4) - colorize (0.8.1) - concurrent-ruby (1.1.10) - debug (1.7.1) + colorize (1.1.0) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) + debug (1.8.0) irb (>= 1.5.0) reline (>= 0.3.1) declarative (0.0.20) diffy (3.4.2) - faraday (2.7.2) + drb (2.2.0) + ruby2_keywords + faraday (2.7.12) + base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) - google-apis-core (0.9.4) + google-apis-core (0.11.2) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -42,76 +53,85 @@ GEM webrick google-apis-drive_v3 (0.33.0) google-apis-core (>= 0.9.1, < 2.a) - google-apis-sheets_v4 (0.21.0) - google-apis-core (>= 0.9.1, < 2.a) - googleauth (1.3.0) + google-apis-sheets_v4 (0.26.0) + google-apis-core (>= 0.11.0, < 2.a) + googleauth (1.8.1) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) io-console (0.6.0) - irb (1.6.2) - reline (>= 0.3.0) - json (2.6.3) - jwt (2.6.0) - memoist (0.16.2) - mini_mime (1.1.2) - minitest (5.17.0) - minitest-reporters (1.5.0) + irb (1.10.1) + rdoc + reline (>= 0.3.8) + json (2.7.1) + jwt (2.7.1) + language_server-protocol (3.17.0.3) + mini_mime (1.1.5) + minitest (5.20.0) + minitest-reporters (1.6.1) ansi builder minitest (>= 5.0) ruby-progressbar multi_json (1.15.0) + mutex_m (0.2.0) os (1.1.4) - parallel (1.22.1) - parser (3.2.0.0) + parallel (1.23.0) + parser (3.2.2.4) ast (~> 2.4.1) - public_suffix (5.0.1) + racc + psych (5.1.1.1) + stringio + public_suffix (5.0.4) + racc (1.7.3) rainbow (3.1.1) - rake (13.0.6) - regexp_parser (2.6.1) - reline (0.3.2) + rake (13.1.0) + rdoc (6.6.1) + psych (>= 4.0.0) + regexp_parser (2.8.3) + reline (0.4.1) io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.5) - rubocop (1.43.0) + rexml (3.2.6) + rubocop (1.58.0) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.24.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.24.1) - parser (>= 3.1.1.0) - ruby-progressbar (1.11.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - signet (0.17.0) + signet (0.18.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) + stringio (3.1.0) trailblazer-option (0.1.2) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (2.4.2) - webrick (1.7.0) + unicode-display_width (2.5.0) + webrick (1.8.1) PLATFORMS - arm64-darwin-21 + ruby DEPENDENCIES ad_localize! diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3bc0211 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +build: + gem build ad_localize.gemspec + +install: clean build + gem install ad_localize-*.gem + +publish: clean build + gem push ad_localize-*.gem + +clean: + rm -f ad_localize-*.gem + +tests: + bundle exec rake test diff --git a/README.md b/README.md index b45816a..5d8656d 100644 --- a/README.md +++ b/README.md @@ -288,6 +288,15 @@ To see all available commands run `bundle exec rake -T` . Bug reports and pull requests are welcome on GitHub at https://github.com/applidium/ad_localize. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. +## How to release a new version + +1. After all your changes are reviewed and merged +2. Create a `release` branch +3. Update the version in field `s.version` from file `ad_localize.gemspec` +4. Execute `make publish` + +You may need to configure your account at step `4.` if you've never pushed any gem. You can find all the informations you need on [the official documentation](https://guides.rubygems.org/make-your-own-gem/#your-first-gem). + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/ad_localize.gemspec b/ad_localize.gemspec index 986d0d4..02abdf7 100644 --- a/ad_localize.gemspec +++ b/ad_localize.gemspec @@ -39,16 +39,8 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.add_development_dependency 'bundler', '>= 1.12.0', '< 3.0.0' - spec.add_development_dependency 'rake', '>= 12.3.0', '< 14.0.0' - spec.add_development_dependency 'minitest', '~> 5.11' - spec.add_development_dependency 'minitest-reporters', '~> 1.3' - spec.add_development_dependency 'diffy', '~> 3.3' - spec.add_development_dependency 'debug', ">= 1.0.0", '< 2.0' - spec.add_development_dependency 'rubocop', "~> 1.0" - spec.add_dependency 'activesupport', '>= 6.1.3.2', '< 8.0' - spec.add_dependency 'colorize', '~> 0.8' + spec.add_dependency 'colorize', '~> 1.0' spec.add_dependency 'google-apis-sheets_v4', '~> 0.9' spec.add_dependency 'google-apis-drive_v3', '~> 0.33.0' diff --git a/lib/ad_localize/mappers/locale_wording_to_hash.rb b/lib/ad_localize/mappers/locale_wording_to_hash.rb index e9fd44e..78c9255 100644 --- a/lib/ad_localize/mappers/locale_wording_to_hash.rb +++ b/lib/ad_localize/mappers/locale_wording_to_hash.rb @@ -23,7 +23,7 @@ def map_singulars(simple_wordings:) def map_plurals(coumpound_wordings:) result = {} - coumpound_wordings.each do |label, simple_wordings| + coumpound_wordings.each_value do |simple_wordings| variants_hash = map_translations(translations: simple_wordings.values) do |keys, translation| dotted_key_to_hash(keys, { translation.key.variant_name => translation.value }) end diff --git a/test/repositories/drive_repository_test.rb b/test/repositories/drive_repository_test.rb index 0e8586d..903567f 100644 --- a/test/repositories/drive_repository_test.rb +++ b/test/repositories/drive_repository_test.rb @@ -16,6 +16,7 @@ class DriveRepositoryTest < TestCase end test 'download private sheets' do + skip('This test needs CI update to work') spreadsheet_id = '149EE3axc9e0knaCZuf7nTjj0vR7EyRhGgGT3MqWKpwM' sheet_ids = %w[0 877315405] files = DriveRepository.new.download_sheets_by_id(spreadsheet_id: spreadsheet_id, sheet_ids: sheet_ids)