localio 0.1.7 → 0.2.1
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 +5 -5
- data/.github/workflows/ci.yml +28 -0
- data/.gitignore +4 -1
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +134 -0
- data/README.md +36 -34
- data/bin/localize +10 -7
- data/docs/plans/2026-02-23-modernization-design.md +91 -0
- data/docs/plans/2026-02-23-modernization.md +1699 -0
- data/docs/plans/2026-02-23-twine-writer-design.md +72 -0
- data/docs/plans/2026-02-23-twine-writer.md +267 -0
- data/lib/localio/localizable_writer.rb +4 -1
- data/lib/localio/processors/csv_processor.rb +1 -1
- data/lib/localio/processors/google_drive_processor.rb +19 -45
- data/lib/localio/processors/xlsx_processor.rb +1 -1
- data/lib/localio/template_handler.rb +3 -1
- data/lib/localio/templates/android_localizable.erb +14 -2
- data/lib/localio/templates/ios_constant_localizable.erb +16 -2
- data/lib/localio/templates/ios_localizable.erb +20 -5
- data/lib/localio/templates/java_properties_localizable.erb +16 -2
- data/lib/localio/templates/json_localizable.erb +6 -5
- data/lib/localio/templates/rails_localizable.erb +15 -3
- data/lib/localio/templates/resx_localizable.erb +14 -2
- data/lib/localio/templates/swift_constant_localizable.erb +15 -2
- data/lib/localio/version.rb +1 -1
- data/lib/localio/writers/ios_writer.rb +3 -3
- data/lib/localio/writers/swift_writer.rb +3 -3
- data/lib/localio/writers/twine_writer.rb +48 -0
- data/localio.gemspec +19 -25
- data/spec/fixtures/sample.csv +11 -0
- data/spec/localio/filter_spec.rb +40 -0
- data/spec/localio/formatter_spec.rb +32 -0
- data/spec/localio/processors/csv_processor_spec.rb +89 -0
- data/spec/localio/processors/google_drive_processor_spec.rb +107 -0
- data/spec/localio/processors/xls_processor_spec.rb +65 -0
- data/spec/localio/processors/xlsx_processor_spec.rb +59 -0
- data/spec/localio/segment_spec.rb +27 -0
- data/spec/localio/segments_list_holder_spec.rb +22 -0
- data/spec/localio/string_helper_spec.rb +49 -0
- data/spec/localio/template_handler_spec.rb +67 -0
- data/spec/localio/term_spec.rb +24 -0
- data/spec/localio/writers/android_writer_spec.rb +71 -0
- data/spec/localio/writers/ios_writer_spec.rb +63 -0
- data/spec/localio/writers/java_properties_writer_spec.rb +35 -0
- data/spec/localio/writers/json_writer_spec.rb +57 -0
- data/spec/localio/writers/rails_writer_spec.rb +47 -0
- data/spec/localio/writers/resx_writer_spec.rb +44 -0
- data/spec/localio/writers/swift_writer_spec.rb +42 -0
- data/spec/localio/writers/twine_writer_spec.rb +68 -0
- data/spec/localio_spec.rb +62 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/shared_terms.rb +35 -0
- metadata +61 -46
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e811c8aa9cf8dabaff74b28dca5476b389c46e27a2dbb5addd87177f28abf566
|
|
4
|
+
data.tar.gz: 6536d23be9e050ec9d579e6fd0bd35af573eba46536f2d711acaf5d8ee086dc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2217300fc3ff1610320e23053d97969c93983caf57ecbbc064c5e4018ba4d599b90c71a70ee27bfa5e38ffc3f52bf8c539110c9c55eefdcec4fe8c0960a4d5bd
|
|
7
|
+
data.tar.gz: 40b1707ad311b028a76a4a0b5f26485153642fc48a89b2e488b7c7b3c13e146f82b55f72bf6a18481082a76b486719c33f1936c83a706d94b14afd7a28b3e230
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Ruby ${{ matrix.ruby }}
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
ruby: ["3.2", "3.3"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- uses: ruby/setup-ruby@v1
|
|
23
|
+
with:
|
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
|
25
|
+
bundler-cache: true
|
|
26
|
+
|
|
27
|
+
- name: Run tests
|
|
28
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.3.10
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
localio (0.2.0)
|
|
5
|
+
csv (~> 3.2)
|
|
6
|
+
google_drive (~> 3.0)
|
|
7
|
+
nokogiri (~> 1.16)
|
|
8
|
+
simple_xlsx_reader (~> 2.0)
|
|
9
|
+
spreadsheet (~> 1.3)
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
addressable (2.8.8)
|
|
15
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
16
|
+
base64 (0.3.0)
|
|
17
|
+
bigdecimal (4.0.1)
|
|
18
|
+
csv (3.3.5)
|
|
19
|
+
declarative (0.0.20)
|
|
20
|
+
diff-lcs (1.6.2)
|
|
21
|
+
faraday (1.8.0)
|
|
22
|
+
faraday-em_http (~> 1.0)
|
|
23
|
+
faraday-em_synchrony (~> 1.0)
|
|
24
|
+
faraday-excon (~> 1.1)
|
|
25
|
+
faraday-httpclient (~> 1.0.1)
|
|
26
|
+
faraday-net_http (~> 1.0)
|
|
27
|
+
faraday-net_http_persistent (~> 1.1)
|
|
28
|
+
faraday-patron (~> 1.0)
|
|
29
|
+
faraday-rack (~> 1.0)
|
|
30
|
+
multipart-post (>= 1.2, < 3)
|
|
31
|
+
ruby2_keywords (>= 0.0.4)
|
|
32
|
+
faraday-em_http (1.0.0)
|
|
33
|
+
faraday-em_synchrony (1.0.1)
|
|
34
|
+
faraday-excon (1.1.0)
|
|
35
|
+
faraday-httpclient (1.0.1)
|
|
36
|
+
faraday-net_http (1.0.2)
|
|
37
|
+
faraday-net_http_persistent (1.2.0)
|
|
38
|
+
faraday-patron (1.0.0)
|
|
39
|
+
faraday-rack (1.0.0)
|
|
40
|
+
google-apis-core (0.11.3)
|
|
41
|
+
addressable (~> 2.5, >= 2.5.1)
|
|
42
|
+
googleauth (>= 0.16.2, < 2.a)
|
|
43
|
+
httpclient (>= 2.8.1, < 3.a)
|
|
44
|
+
mini_mime (~> 1.0)
|
|
45
|
+
representable (~> 3.0)
|
|
46
|
+
retriable (>= 2.0, < 4.a)
|
|
47
|
+
rexml
|
|
48
|
+
google-apis-drive_v3 (0.46.0)
|
|
49
|
+
google-apis-core (>= 0.11.0, < 2.a)
|
|
50
|
+
google-apis-sheets_v4 (0.26.0)
|
|
51
|
+
google-apis-core (>= 0.11.0, < 2.a)
|
|
52
|
+
google_drive (3.0.7)
|
|
53
|
+
google-apis-drive_v3 (>= 0.5.0, < 1.0.0)
|
|
54
|
+
google-apis-sheets_v4 (>= 0.4.0, < 1.0.0)
|
|
55
|
+
googleauth (>= 0.5.0, < 1.0.0)
|
|
56
|
+
nokogiri (>= 1.5.3, < 2.0.0)
|
|
57
|
+
googleauth (0.17.1)
|
|
58
|
+
faraday (>= 0.17.3, < 2.0)
|
|
59
|
+
jwt (>= 1.4, < 3.0)
|
|
60
|
+
memoist (~> 0.16)
|
|
61
|
+
multi_json (~> 1.11)
|
|
62
|
+
os (>= 0.9, < 2.0)
|
|
63
|
+
signet (~> 0.15)
|
|
64
|
+
httpclient (2.9.0)
|
|
65
|
+
mutex_m
|
|
66
|
+
jwt (2.10.2)
|
|
67
|
+
base64
|
|
68
|
+
logger (1.7.0)
|
|
69
|
+
memoist (0.16.2)
|
|
70
|
+
mini_mime (1.1.5)
|
|
71
|
+
mini_portile2 (2.8.9)
|
|
72
|
+
multi_json (1.19.1)
|
|
73
|
+
multipart-post (2.4.1)
|
|
74
|
+
mutex_m (0.3.0)
|
|
75
|
+
nokogiri (1.19.1)
|
|
76
|
+
mini_portile2 (~> 2.8.2)
|
|
77
|
+
racc (~> 1.4)
|
|
78
|
+
nokogiri (1.19.1-arm64-darwin)
|
|
79
|
+
racc (~> 1.4)
|
|
80
|
+
nokogiri (1.19.1-x86_64-linux-gnu)
|
|
81
|
+
racc (~> 1.4)
|
|
82
|
+
os (1.1.4)
|
|
83
|
+
public_suffix (7.0.2)
|
|
84
|
+
racc (1.8.1)
|
|
85
|
+
rake (13.3.1)
|
|
86
|
+
representable (3.2.0)
|
|
87
|
+
declarative (< 0.1.0)
|
|
88
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
|
89
|
+
uber (< 0.2.0)
|
|
90
|
+
retriable (3.2.1)
|
|
91
|
+
rexml (3.4.4)
|
|
92
|
+
rspec (3.13.2)
|
|
93
|
+
rspec-core (~> 3.13.0)
|
|
94
|
+
rspec-expectations (~> 3.13.0)
|
|
95
|
+
rspec-mocks (~> 3.13.0)
|
|
96
|
+
rspec-core (3.13.6)
|
|
97
|
+
rspec-support (~> 3.13.0)
|
|
98
|
+
rspec-expectations (3.13.5)
|
|
99
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
100
|
+
rspec-support (~> 3.13.0)
|
|
101
|
+
rspec-mocks (3.13.7)
|
|
102
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
103
|
+
rspec-support (~> 3.13.0)
|
|
104
|
+
rspec-support (3.13.7)
|
|
105
|
+
ruby-ole (1.2.13.1)
|
|
106
|
+
ruby2_keywords (0.0.5)
|
|
107
|
+
rubyzip (3.2.2)
|
|
108
|
+
signet (0.21.0)
|
|
109
|
+
addressable (~> 2.8)
|
|
110
|
+
faraday (>= 0.17.5, < 3.a)
|
|
111
|
+
jwt (>= 1.5, < 4.0)
|
|
112
|
+
multi_json (~> 1.10)
|
|
113
|
+
simple_xlsx_reader (2.0.1)
|
|
114
|
+
nokogiri
|
|
115
|
+
rubyzip
|
|
116
|
+
spreadsheet (1.3.4)
|
|
117
|
+
bigdecimal
|
|
118
|
+
logger
|
|
119
|
+
ruby-ole
|
|
120
|
+
trailblazer-option (0.1.2)
|
|
121
|
+
uber (0.1.0)
|
|
122
|
+
|
|
123
|
+
PLATFORMS
|
|
124
|
+
arm64-darwin
|
|
125
|
+
ruby
|
|
126
|
+
x86_64-linux
|
|
127
|
+
|
|
128
|
+
DEPENDENCIES
|
|
129
|
+
localio!
|
|
130
|
+
rake (~> 13.0)
|
|
131
|
+
rspec (~> 3.0)
|
|
132
|
+
|
|
133
|
+
BUNDLED WITH
|
|
134
|
+
2.5.22
|
data/README.md
CHANGED
|
@@ -51,7 +51,7 @@ source :xlsx,
|
|
|
51
51
|
:path => 'my_translations.xlsx'
|
|
52
52
|
````
|
|
53
53
|
|
|
54
|
-
This would
|
|
54
|
+
This would read from `my_translations.xlsx` and write iOS localizable files to `my_output_path/`.
|
|
55
55
|
|
|
56
56
|
The list of possible commands is this.
|
|
57
57
|
|
|
@@ -73,6 +73,7 @@ Option | Description
|
|
|
73
73
|
* `:json` for an easy JSON format for localizables. The `output_path` is yours to decide :)
|
|
74
74
|
* `:java_properties` for .properties files used mainly in Java. Files named language_(lang).properties will be generated in `output_path`'s root directory.
|
|
75
75
|
* `:resx` for .resx files used by .NET projects, e.g. Windows Forms, Windows Phone or Xamarin.
|
|
76
|
+
* `:twine` for [Twine](https://github.com/scelis/twine)-compatible `strings.txt` files containing all languages in a single file. The `output_path` is the directory where the file will be written.
|
|
76
77
|
|
|
77
78
|
#### Extra platform parameters
|
|
78
79
|
|
|
@@ -103,64 +104,65 @@ platform :resx, :resource_file => "WebResources"
|
|
|
103
104
|
# ... rest of your Locfile ...
|
|
104
105
|
````
|
|
105
106
|
|
|
107
|
+
##### Twine - :twine
|
|
108
|
+
|
|
109
|
+
By default the output file is named `strings.txt`. Use `:output_file` to override:
|
|
110
|
+
|
|
111
|
+
````ruby
|
|
112
|
+
platform :twine, :output_file => 'MyApp.strings'
|
|
113
|
+
````
|
|
114
|
+
|
|
106
115
|
#### Supported sources
|
|
107
116
|
|
|
108
117
|
##### Google Drive
|
|
109
118
|
|
|
110
119
|
`source :google_drive` will get the translation strings from Google Drive.
|
|
111
120
|
|
|
112
|
-
|
|
121
|
+
Two authentication methods are supported: **OAuth2** (for personal accounts) and **service accounts** (for automated/CI use).
|
|
113
122
|
|
|
114
123
|
Option | Description
|
|
115
124
|
----------------------------|-------------------------------------------------------------------------
|
|
116
125
|
`:spreadsheet` | (Req.) Title of the spreadsheet you want to use. Can be a partial match.
|
|
117
126
|
`:sheet` | (Req.) Index number (starting with 0) or name of the sheet w/ the data
|
|
118
|
-
`:
|
|
119
|
-
`:
|
|
120
|
-
`:
|
|
121
|
-
`:client_secret` | (Req.) Your Google CLIENT SECRET.
|
|
127
|
+
`:client_id` | Your Google OAuth2 Client ID. Required unless using `:client_token`.
|
|
128
|
+
`:client_secret` | Your Google OAuth2 Client Secret. Required unless using `:client_token`.
|
|
129
|
+
`:client_token` | Path to a service account JSON key file. Alternative to OAuth2.
|
|
122
130
|
|
|
123
|
-
|
|
131
|
+
###### Option A: OAuth2 (personal account)
|
|
124
132
|
|
|
125
|
-
|
|
133
|
+
1. Go to the [Google Cloud Console](https://console.cloud.google.com/), create a project and enable the **Google Drive API**.
|
|
134
|
+
2. Under **APIs & Services → Credentials**, create an **OAuth client ID**. Choose **Desktop app** as the application type.
|
|
135
|
+
3. Download or copy your **Client ID** and **Client Secret**.
|
|
126
136
|
|
|
127
|
-
|
|
128
|
-
2. After it is created you will be redirected to the credentials section (if not, just select under APIs and authentication in the sidebar the Credentials section), where you will click in the button labeled **Create new client ID**.
|
|
129
|
-
3. Select the third option, the one that says something like **Installed Application**.
|
|
130
|
-
4. Fill the form with whatever you want. For example, you could put Localio as the product name (the only thing required there).
|
|
131
|
-
5. Select again the third option, **Installed Application**, and in the platform selector select the last one, **Others**.
|
|
132
|
-
6. You will have all the necessary information in the next screen: Client ID and Client Secret.
|
|
133
|
-
|
|
134
|
-
After doing all this, you are ready to add `:client_id` and `:client_secret` fields to your Locfile `source`. It will look somewhat like this at this stage:
|
|
137
|
+
Add them to your Locfile:
|
|
135
138
|
|
|
136
139
|
```ruby
|
|
137
140
|
source :google_drive,
|
|
138
141
|
:spreadsheet => '[Localizables] My Project',
|
|
139
|
-
:client_id => '
|
|
140
|
-
:client_secret => '
|
|
142
|
+
:client_id => ENV['GOOGLE_CLIENT_ID'],
|
|
143
|
+
:client_secret => ENV['GOOGLE_CLIENT_SECRET']
|
|
141
144
|
```
|
|
142
145
|
|
|
143
|
-
|
|
146
|
+
The first time you run `localize`, you will be prompted to open a URL in your browser, grant access to your Drive, and paste the authorization code back into the terminal. After that, the refresh token is saved to `~/.localio_gdrive_config.json` and subsequent runs authenticate automatically.
|
|
144
147
|
|
|
145
|
-
**NOTE**
|
|
148
|
+
**NOTE** As it is a very bad practice to put your sensitive information in a plain file, it is **strongly recommended** to use environment variables. Export them from your shell profile (`.zshrc`, `.bashrc`, etc.):
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
```bash
|
|
151
|
+
export GOOGLE_CLIENT_ID="your_client_id"
|
|
152
|
+
export GOOGLE_CLIENT_SECRET="your_client_secret"
|
|
153
|
+
```
|
|
148
154
|
|
|
149
|
-
|
|
155
|
+
###### Option B: Service account (automated/CI use)
|
|
150
156
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
:client_id => ENV['CLIENT_ID'],
|
|
155
|
-
:client_secret => ENV['CLIENT_SECRET']
|
|
156
|
-
````
|
|
157
|
-
|
|
158
|
-
And in your .bashrc (or .bash_profile, .zshrc or whatever), you could export those environment variables like this:
|
|
157
|
+
1. In the [Google Cloud Console](https://console.cloud.google.com/), create a **Service Account** under **APIs & Services → Credentials**.
|
|
158
|
+
2. Download the JSON key file.
|
|
159
|
+
3. Share the target spreadsheet with the service account's email address (found in the JSON file under `client_email`).
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
```ruby
|
|
162
|
+
source :google_drive,
|
|
163
|
+
:spreadsheet => '[Localizables] My Project',
|
|
164
|
+
:client_token => 'path/to/service_account_key.json'
|
|
165
|
+
```
|
|
164
166
|
|
|
165
167
|
##### XLS
|
|
166
168
|
|
data/bin/localize
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
require 'optparse'
|
|
4
3
|
require 'localio'
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
OptionParser.new do |opts|
|
|
6
|
+
opts.banner = 'Usage: localize [Locfile]'
|
|
7
|
+
opts.on('-v', '--version', 'Show version') do
|
|
8
|
+
require 'localio/version'
|
|
9
|
+
puts Localio::VERSION
|
|
10
|
+
exit
|
|
11
|
+
end
|
|
12
|
+
end.parse!
|
|
11
13
|
|
|
14
|
+
Localio.from_cmdline(ARGV)
|
|
@@ -0,0 +1,91 @@
|
|
|
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.
|