localio 0.2.2 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f31b993473369d48f4c412c59ac04e9614ff3d0d614b68e041fa5856c91657
4
- data.tar.gz: 502a7d85bb17426d0985328f89488de086fc08692be41c951dc22bc16a517bad
3
+ metadata.gz: c71c64191921014c578180266917742cc15ebe32ac5d66917a0e8e6970b1422d
4
+ data.tar.gz: 5436fd60cf0362b53106a4ce2044ce29b0d6dc76654df36664638ef2b787559a
5
5
  SHA512:
6
- metadata.gz: 10742946a6d8928b4f636bdec770d31364281a4b5070537342656f376500e4a17322c89d8dc755ec91c48d0d0e8e0fe74535a799ee6d990e099b9ec02f9fda3a
7
- data.tar.gz: c2135d3b03e5c82250715d03fc4c6354279bc08ec7394bf31ca4edc9b11535dc53efd1dcdafb5591a9be4c2900ce06da2d1325dd0aae8906c1d2263e618d59d7
6
+ metadata.gz: f0f3f71d57fdbfbc3915c59c584744337664f7f389973127a46b2be89cb0b43b972803f71ac104f9a3da46ae92bff3e2ccfba8ab6459909adb175331410362cb
7
+ data.tar.gz: 3f60cd0029c60c0a0d74dadd049dd4d63c7985960c74df1aaed4908aeac36b0f1b619c159d4504958dd910e7be7d1e6dfcb649984aa3962350c8e71fde02c309
@@ -24,5 +24,11 @@ jobs:
24
24
  ruby-version: ${{ matrix.ruby }}
25
25
  bundler-cache: true
26
26
 
27
+ - name: Audit dependencies
28
+ run: bundle exec bundle-audit check --update
29
+
27
30
  - name: Run tests
28
31
  run: bundle exec rspec
32
+
33
+ - name: Build gem
34
+ run: bundle exec rake build
@@ -20,6 +20,9 @@ jobs:
20
20
  ruby-version: "3.3"
21
21
  bundler-cache: true
22
22
 
23
+ - name: Audit dependencies
24
+ run: bundle exec bundle-audit check --update
25
+
23
26
  - name: Run tests
24
27
  run: bundle exec rspec
25
28
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.10
1
+ 3.2.9
data/CLAUDE.md CHANGED
@@ -1,6 +1,6 @@
1
- # CLAUDE.md
1
+ # AGENTS.md
2
2
 
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3
+ This file provides guidance to Claude Code (claude.ai/code) and other AI assistants working on this repository.
4
4
 
5
5
  ## Commands
6
6
 
@@ -64,13 +64,13 @@ Spreadsheets must follow a specific structure:
64
64
  2. Create corresponding ERB template(s) in `lib/localio/templates/`
65
65
  3. Add a case branch in `LocalizableWriter`
66
66
  4. Add a case branch in the `platform` DSL accessor in `Locfile`
67
- 5. Add specs in `spec/writers/`
67
+ 5. Add specs in `spec/localio/writers/`
68
68
 
69
69
  ### Adding a New Source Format
70
70
 
71
71
  1. Create `lib/localio/processors/<format>_processor.rb` with a `load_localizables(config)` class method returning `{language => [Segment]}`
72
72
  2. Add a case branch in `Processor`
73
- 3. Add specs in `spec/processors/`
73
+ 3. Add specs in `spec/localio/processors/`
74
74
 
75
75
  ## Notes
76
76
 
data/CONTRIBUTING.md CHANGED
@@ -5,4 +5,26 @@ Contributing
5
5
  2. Create your feature branch (`git checkout -b my-new-feature`)
6
6
  3. Commit your changes (`git commit -am 'Add some feature'`)
7
7
  4. Push to the branch (`git push origin my-new-feature`)
8
- 5. Create new Pull Request
8
+ 5. Create new Pull Request
9
+
10
+ ## Dependency security
11
+
12
+ Install the bundle, audit it against the current Ruby Advisory Database, and run the
13
+ checks before submitting dependency updates:
14
+
15
+ ```sh
16
+ bundle install
17
+ bundle exec bundle-audit check --update
18
+ bundle exec rspec
19
+ bundle exec rake build
20
+ ```
21
+
22
+ CI runs the audit, tests, and gem build on every supported Ruby version. The release
23
+ workflow also audits the bundle before publishing to RubyGems. Do not ignore or
24
+ dismiss advisories instead of updating the affected dependency.
25
+
26
+ Update `Gemfile.lock` for all tracked platforms. If a vulnerable version is still
27
+ allowed by a runtime dependency in `localio.gemspec`, raise its minimum version as
28
+ well. RubyGems consumers resolve dependencies from the gemspec, not this repository's
29
+ lockfile. Regression specs in `spec/localio/dependencies_spec.rb` protect these
30
+ minimum safe versions.
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in localio.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+ gem 'bundler-audit', '~> 0.9'
8
+ end
data/Gemfile.lock CHANGED
@@ -1,42 +1,50 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- localio (0.2.2)
4
+ localio (0.2.5)
5
+ addressable (~> 2.9, >= 2.9.1)
5
6
  csv (~> 3.2)
6
7
  google_drive (~> 3.0)
7
- nokogiri (~> 1.16)
8
+ nokogiri (~> 1.19, >= 1.19.5)
8
9
  simple_xlsx_reader (~> 2.0)
9
10
  spreadsheet (~> 1.3)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
14
- addressable (2.8.8)
15
+ addressable (2.10.0)
15
16
  public_suffix (>= 2.0.2, < 8.0)
16
17
  base64 (0.3.0)
17
18
  bigdecimal (4.0.1)
19
+ bundler-audit (0.9.3)
20
+ bundler (>= 1.2.0)
21
+ thor (~> 1.0)
18
22
  csv (3.3.5)
19
23
  declarative (0.0.20)
20
24
  diff-lcs (1.6.2)
21
- faraday (1.8.0)
25
+ faraday (1.10.6)
22
26
  faraday-em_http (~> 1.0)
23
27
  faraday-em_synchrony (~> 1.0)
24
28
  faraday-excon (~> 1.1)
25
- faraday-httpclient (~> 1.0.1)
29
+ faraday-httpclient (~> 1.0)
30
+ faraday-multipart (~> 1.0)
26
31
  faraday-net_http (~> 1.0)
27
- faraday-net_http_persistent (~> 1.1)
32
+ faraday-net_http_persistent (~> 1.0)
28
33
  faraday-patron (~> 1.0)
29
34
  faraday-rack (~> 1.0)
30
- multipart-post (>= 1.2, < 3)
35
+ faraday-retry (~> 1.0)
31
36
  ruby2_keywords (>= 0.0.4)
32
37
  faraday-em_http (1.0.0)
33
38
  faraday-em_synchrony (1.0.1)
34
39
  faraday-excon (1.1.0)
35
40
  faraday-httpclient (1.0.1)
41
+ faraday-multipart (1.2.0)
42
+ multipart-post (~> 2.0)
36
43
  faraday-net_http (1.0.2)
37
44
  faraday-net_http_persistent (1.2.0)
38
45
  faraday-patron (1.0.0)
39
46
  faraday-rack (1.0.0)
47
+ faraday-retry (1.0.4)
40
48
  google-apis-core (0.11.3)
41
49
  addressable (~> 2.5, >= 2.5.1)
42
50
  googleauth (>= 0.16.2, < 2.a)
@@ -63,7 +71,7 @@ GEM
63
71
  signet (~> 0.15)
64
72
  httpclient (2.9.0)
65
73
  mutex_m
66
- jwt (2.10.2)
74
+ jwt (2.10.3)
67
75
  base64
68
76
  logger (1.7.0)
69
77
  memoist (0.16.2)
@@ -72,15 +80,15 @@ GEM
72
80
  multi_json (1.19.1)
73
81
  multipart-post (2.4.1)
74
82
  mutex_m (0.3.0)
75
- nokogiri (1.19.1)
83
+ nokogiri (1.19.7)
76
84
  mini_portile2 (~> 2.8.2)
77
85
  racc (~> 1.4)
78
- nokogiri (1.19.1-arm64-darwin)
86
+ nokogiri (1.19.7-arm64-darwin)
79
87
  racc (~> 1.4)
80
- nokogiri (1.19.1-x86_64-linux-gnu)
88
+ nokogiri (1.19.7-x86_64-linux-gnu)
81
89
  racc (~> 1.4)
82
90
  os (1.1.4)
83
- public_suffix (7.0.2)
91
+ public_suffix (7.0.5)
84
92
  racc (1.8.1)
85
93
  rake (13.3.1)
86
94
  representable (3.2.0)
@@ -104,7 +112,7 @@ GEM
104
112
  rspec-support (3.13.7)
105
113
  ruby-ole (1.2.13.1)
106
114
  ruby2_keywords (0.0.5)
107
- rubyzip (3.2.2)
115
+ rubyzip (3.6.0)
108
116
  signet (0.21.0)
109
117
  addressable (~> 2.8)
110
118
  faraday (>= 0.17.5, < 3.a)
@@ -117,6 +125,7 @@ GEM
117
125
  bigdecimal
118
126
  logger
119
127
  ruby-ole
128
+ thor (1.5.0)
120
129
  trailblazer-option (0.1.2)
121
130
  uber (0.1.0)
122
131
 
@@ -126,6 +135,7 @@ PLATFORMS
126
135
  x86_64-linux
127
136
 
128
137
  DEPENDENCIES
138
+ bundler-audit (~> 0.9)
129
139
  localio!
130
140
  rake (~> 13.0)
131
141
  rspec (~> 3.0)
data/README.md CHANGED
@@ -271,6 +271,43 @@ For example, if we wanted to override the default (english) and use spanish inst
271
271
  platform :android, :override_default => 'es'
272
272
  ```
273
273
 
274
+ ## Fastlane Integration
275
+
276
+ Use the [fastlane-plugin-localio](https://github.com/mrmans0n/fastlane-plugin-localio) plugin to run localio as part of your Fastlane workflow.
277
+
278
+ ### Installation
279
+
280
+ ```bash
281
+ fastlane add_plugin localio
282
+ ```
283
+
284
+ ### Usage
285
+
286
+ You can use an existing Locfile:
287
+
288
+ ```ruby
289
+ lane :localize do
290
+ localio(locfile: "Locfile")
291
+ end
292
+ ```
293
+
294
+ Or configure everything inline:
295
+
296
+ ```ruby
297
+ lane :localize do
298
+ localio(
299
+ platform: "android",
300
+ source: "xlsx",
301
+ source_path: "translations.xlsx",
302
+ source_sheet: "Sheet1",
303
+ output_path: "app/src/main/res",
304
+ formatting: "smart"
305
+ )
306
+ end
307
+ ```
308
+
309
+ See the [plugin README](https://github.com/mrmans0n/fastlane-plugin-localio) for the full list of parameters and examples.
310
+
274
311
  ## Contributing
275
312
 
276
313
  Please read the [contributing guide](https://github.com/mrmans0n/localio/blob/master/CONTRIBUTING.md).
@@ -1,3 +1,3 @@
1
1
  module Localio
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.5"
3
3
  end
data/localio.gemspec CHANGED
@@ -21,9 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "rspec", "~> 3.0"
22
22
  spec.add_development_dependency "rake", "~> 13.0"
23
23
 
24
+ # Enforce patched transitive dependencies for consumers that do not use our lockfile.
25
+ spec.add_dependency "addressable", "~> 2.9", ">= 2.9.1"
24
26
  spec.add_dependency "google_drive", "~> 3.0"
25
27
  spec.add_dependency "spreadsheet", "~> 1.3"
26
28
  spec.add_dependency "simple_xlsx_reader", "~> 2.0"
27
- spec.add_dependency "nokogiri", "~> 1.16"
29
+ spec.add_dependency "nokogiri", "~> 1.19", ">= 1.19.5"
28
30
  spec.add_dependency "csv", "~> 3.2"
29
31
  end
@@ -0,0 +1,23 @@
1
+ RSpec.describe 'Localio runtime dependencies' do
2
+ let(:gemspec) { Gem::Specification.load(File.expand_path('../../localio.gemspec', __dir__)) }
3
+
4
+ it 'requires an Addressable release with the URI security fixes' do
5
+ dependency = gemspec.runtime_dependencies.find { |candidate| candidate.name == 'addressable' }
6
+
7
+ expect(dependency).not_to be_nil
8
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('2.9.0'))).to be(false)
9
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('2.9.1'))).to be(true)
10
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('2.10.0'))).to be(true)
11
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('3.0.0'))).to be(false)
12
+ end
13
+
14
+ it 'requires a Nokogiri release with the XML and HTML security fixes' do
15
+ dependency = gemspec.runtime_dependencies.find { |candidate| candidate.name == 'nokogiri' }
16
+
17
+ expect(dependency).not_to be_nil
18
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('1.19.4'))).to be(false)
19
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('1.19.5'))).to be(true)
20
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('1.19.7'))).to be(true)
21
+ expect(dependency.requirement.satisfied_by?(Gem::Version.new('2.0.0'))).to be(false)
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nacho Lopez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-24 00:00:00.000000000 Z
11
+ date: 2026-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -38,6 +38,26 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: addressable
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.9'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 2.9.1
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '2.9'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.9.1
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: google_drive
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +106,20 @@ dependencies:
86
106
  requirements:
87
107
  - - "~>"
88
108
  - !ruby/object:Gem::Version
89
- version: '1.16'
109
+ version: '1.19'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 1.19.5
90
113
  type: :runtime
91
114
  prerelease: false
92
115
  version_requirements: !ruby/object:Gem::Requirement
93
116
  requirements:
94
117
  - - "~>"
95
118
  - !ruby/object:Gem::Version
96
- version: '1.16'
119
+ version: '1.19'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 1.19.5
97
123
  - !ruby/object:Gem::Dependency
98
124
  name: csv
99
125
  requirement: !ruby/object:Gem::Requirement
@@ -130,10 +156,6 @@ files:
130
156
  - README.md
131
157
  - Rakefile
132
158
  - bin/localize
133
- - docs/plans/2026-02-23-modernization-design.md
134
- - docs/plans/2026-02-23-modernization.md
135
- - docs/plans/2026-02-23-twine-writer-design.md
136
- - docs/plans/2026-02-23-twine-writer.md
137
159
  - lib/localio.rb
138
160
  - lib/localio/config_store.rb
139
161
  - lib/localio/filter.rb
@@ -170,6 +192,7 @@ files:
170
192
  - lib/localio/writers/twine_writer.rb
171
193
  - localio.gemspec
172
194
  - spec/fixtures/sample.csv
195
+ - spec/localio/dependencies_spec.rb
173
196
  - spec/localio/filter_spec.rb
174
197
  - spec/localio/formatter_spec.rb
175
198
  - spec/localio/processors/csv_processor_spec.rb
@@ -1,91 +0,0 @@
1
- # Localio Modernization Design
2
-
3
- **Date:** 2026-02-23
4
- **Approach:** Option A — tests first, then dependency updates
5
-
6
- ## Overview
7
-
8
- Modernize the Localio gem in two phases:
9
-
10
- 1. Write a comprehensive RSpec test suite with fixtures and mocks
11
- 2. Update all dependencies to current versions and target Ruby 3.x, using the test suite as a safety net
12
-
13
- ## Phase 1: Test Suite
14
-
15
- ### Structure
16
-
17
- ```
18
- spec/
19
- spec_helper.rb
20
- fixtures/
21
- sample.csv # canonical test data: keys in 3 languages, special chars, comments, multi-level keys
22
- sample.xlsx # small binary fixture
23
- sample.xls # small binary fixture
24
- localio/
25
- term_spec.rb
26
- segment_spec.rb
27
- filter_spec.rb
28
- formatter_spec.rb
29
- template_handler_spec.rb
30
- processors/
31
- csv_processor_spec.rb
32
- xlsx_processor_spec.rb
33
- xls_processor_spec.rb
34
- google_drive_processor_spec.rb # mocked worksheet interface
35
- writers/
36
- android_writer_spec.rb
37
- ios_writer_spec.rb
38
- swift_writer_spec.rb
39
- json_writer_spec.rb
40
- rails_writer_spec.rb
41
- java_properties_writer_spec.rb
42
- resx_writer_spec.rb
43
- localio_spec.rb # end-to-end: CSV fixture → writer → verify output files
44
- ```
45
-
46
- ### Fixture Data
47
-
48
- A single canonical `sample.csv` covers all test scenarios:
49
- - Normal keys with translations in 3 languages
50
- - Special characters: ampersands, ellipsis, printf format strings
51
- - Comment rows
52
- - Multi-level/nested keys (dot-separated) for JSON nesting tests
53
-
54
- The same fixture data drives all processor and writer tests for consistency.
55
-
56
- ### Testing Strategy Per Layer
57
-
58
- **Models (Term, Segment):** Construction, attribute access, `is_comment?` detection.
59
-
60
- **Filter:** `only` and `except` with regex patterns against a fixed segment list.
61
-
62
- **Formatter:** All 4 modes (`:smart`, `:none`, `:camel_case`, `:snake_case`) against varied key strings.
63
-
64
- **Processors:**
65
- - CSV/XLSX/XLS: Parse real fixture files, assert correct Term extraction, language detection, comment handling
66
- - Google Drive: Mock the gem's worksheet interface, test the same parsing logic in isolation
67
-
68
- **TemplateHandler:** Render ERB templates, write to `Dir.mktmpdir`, assert output matches expected content.
69
-
70
- **Writers (all 7):** Feed a fixed Terms array → call writer → assert output files in a temp dir contain expected strings (spot-check key lines, not byte-perfect comparison).
71
-
72
- **Pipeline (`localio_spec.rb`):** CSV fixture → Android + JSON writers → verify files exist with correct content.
73
-
74
- ### Key Test Helpers
75
- - Shared `let(:terms)` factory via RSpec shared contexts
76
- - `Dir.mktmpdir` for output isolation in all writer and template tests
77
- - No network calls; Google Drive mocked at the worksheet interface level
78
-
79
- ## Phase 2: Dependency Updates
80
-
81
- | Gem | Current | Target | Notes |
82
- |-----|---------|--------|-------|
83
- | `google_drive` | `~> 1.0` | `~> 3.0` | API changed; processor needs update |
84
- | `spreadsheet` | `~> 1.0` | `~> 1.3` | Minor updates only |
85
- | `simple_xlsx_reader` | `~> 1.0` | `~> 2.0` | Breaking changes in v2 |
86
- | `nokogiri` | `~> 1.6` | `~> 1.16` | Mostly drop-in |
87
- | `micro-optparse` | `~> 1.2` | remove → stdlib `optparse` | Unmaintained |
88
- | `bundler` | `~> 1.3` | `~> 2.0` | Dev dep |
89
- | Ruby | `>= 1.9.2` | `>= 3.0` | Gemspec update |
90
-
91
- The green test suite from Phase 1 is the safety net — failures after dep updates pinpoint exactly what broke.