that_language 0.1.2 → 0.2.0

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
- SHA1:
3
- metadata.gz: 98adc3d50c5db166ed67999b80c33c57b591f62a
4
- data.tar.gz: eee7118251bc0fd2ff3ff406c49d62290bf164c4
2
+ SHA256:
3
+ metadata.gz: 9c4fc1a440b036417a160b93532390568c864d0b70ca27af004f37f357bfbc8e
4
+ data.tar.gz: ac3a11365f954602347233b1d3243582aed9691786485fa2bdf55f55473618c0
5
5
  SHA512:
6
- metadata.gz: 57460596ffd60c2c2bd69c17c1088e39db6de20e820ef7e20b8a3ae3021c5ee420009882e463da1f13d07fca095a05c615873c61230a52432cd4defdabdb6578
7
- data.tar.gz: 792b5f984d2d14c234a2d7fcdbd0e397ab7405532949032b7e38b81a0a72506ff37b8fd99ef0f756d00950ea90a429bc839eef768d468a7e68fbb01134effeb0
6
+ metadata.gz: a52cfbb09b9b6a827676902bada6ffa2dcacdbeda3fe11dc58f4c471849a70cbf428fd66d8ad24e263281012fe12808250cc83eaddf2cd115ec04347516689cb
7
+ data.tar.gz: edf7c8fffba6566f326aa11d13c880338836e8f647917f6b94fbb6cb89f7d98bd42e7bf81caa8ca31997fccf4405e9d5839a35e36b8bf3d836d45d2702e13ca2
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ rspec:
12
+ name: rspec (ruby ${{ matrix.ruby }})
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby: ["3.1", "3.2", "3.3", "3.4", "4.0"]
18
+ steps:
19
+ - uses: actions/checkout@v7
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ bundler-cache: true
24
+ - run: bundle exec rspec
25
+
26
+ rubocop:
27
+ name: rubocop
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v7
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: "4.0"
34
+ bundler-cache: true
35
+ - run: bundle exec rubocop
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ # TargetRubyVersion is deliberately not set here. RuboCop derives it from
5
+ # required_ruby_version in the gemspec (currently ">= 3.1"), which takes
6
+ # precedence over .ruby-version, so the oldest supported Ruby is stated in
7
+ # exactly one place. It is the *minimum* supported version, not the version
8
+ # used for development -- raising it means dropping support for users.
9
+ NewCops: enable
10
+ SuggestExtensions: false
11
+ Exclude:
12
+ - "wordlists/**/*"
13
+ - "bin/**/*"
14
+ - "vendor/**/*"
15
+ - "tmp/**/*"
16
+
17
+ # The 72 per-language spec files are generated from a shared helper and are
18
+ # intentionally repetitive; block length is not a useful signal there.
19
+ Metrics/BlockLength:
20
+ Exclude:
21
+ - "spec/**/*"
22
+
23
+ # Specs read better without a documentation comment on every describe block.
24
+ Style/Documentation:
25
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,277 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-07-20 00:23:23 UTC using RuboCop version 1.88.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 5
10
+ # Configuration parameters: EnforcedStyle, AllowedGems.
11
+ # SupportedStyles: Gemfile, gems.rb, gemspec
12
+ Gemspec/DevelopmentDependencies:
13
+ Exclude:
14
+ - 'that_language.gemspec'
15
+
16
+ # Offense count: 4
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
19
+ # SupportedStyles: outdent, indent
20
+ Layout/AccessModifierIndentation:
21
+ Exclude:
22
+ - 'lib/that_language.rb'
23
+ - 'lib/that_language/detect.rb'
24
+ - 'lib/that_language/lookup_context.rb'
25
+ - 'lib/that_language/result_set.rb'
26
+
27
+ # Offense count: 1
28
+ # This cop supports safe autocorrection (--autocorrect).
29
+ Layout/EmptyLineAfterMagicComment:
30
+ Exclude:
31
+ - 'that_language.gemspec'
32
+
33
+ # Offense count: 3
34
+ # This cop supports safe autocorrection (--autocorrect).
35
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
36
+ # SupportedHashRocketStyles: key, separator, table
37
+ # SupportedColonStyles: key, separator, table
38
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
39
+ Layout/HashAlignment:
40
+ Exclude:
41
+ - 'that_language.gemspec'
42
+
43
+ # Offense count: 1
44
+ # This cop supports safe autocorrection (--autocorrect).
45
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
46
+ # SupportedStylesForExponentOperator: space, no_space
47
+ # SupportedStylesForRationalLiterals: space, no_space
48
+ Layout/SpaceAroundOperators:
49
+ Exclude:
50
+ - 'spec/that_language/result_spec.rb'
51
+
52
+ # Offense count: 2
53
+ # This cop supports safe autocorrection (--autocorrect).
54
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
55
+ # SupportedStyles: space, no_space
56
+ # SupportedStylesForEmptyBraces: space, no_space
57
+ Layout/SpaceBeforeBlockBraces:
58
+ Exclude:
59
+ - 'spec/that_language/detect_spec.rb'
60
+
61
+ # Offense count: 16
62
+ # This cop supports safe autocorrection (--autocorrect).
63
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
64
+ # SupportedStyles: space, no_space, compact
65
+ # SupportedStylesForEmptyBraces: space, no_space
66
+ Layout/SpaceInsideHashLiteralBraces:
67
+ Exclude:
68
+ - 'spec/that_language/lookup_context_spec.rb'
69
+
70
+ # Offense count: 385
71
+ # This cop supports safe autocorrection (--autocorrect).
72
+ # Configuration parameters: EnforcedStyle.
73
+ # SupportedStyles: strict, consistent
74
+ Lint/SymbolConversion:
75
+ Enabled: false
76
+
77
+ # Offense count: 2
78
+ # This cop supports safe autocorrection (--autocorrect).
79
+ Lint/ToJSON:
80
+ Exclude:
81
+ - 'lib/that_language/result.rb'
82
+ - 'lib/that_language/result_set.rb'
83
+
84
+ # Offense count: 1
85
+ # This cop supports safe autocorrection (--autocorrect).
86
+ # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
87
+ Lint/UselessAccessModifier:
88
+ Exclude:
89
+ - 'lib/that_language/iso_639.rb'
90
+
91
+ # Offense count: 1
92
+ Lint/UselessConstantScoping:
93
+ Exclude:
94
+ - 'lib/that_language/iso_639.rb'
95
+
96
+ # Offense count: 1
97
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
98
+ Metrics/AbcSize:
99
+ Max: 20
100
+
101
+ # Offense count: 1
102
+ # Configuration parameters: CountComments, CountAsOne.
103
+ Metrics/ModuleLength:
104
+ Max: 191
105
+
106
+ # Offense count: 4
107
+ # This cop supports safe autocorrection (--autocorrect).
108
+ # Configuration parameters: EnforcedStyle, BlockForwardingName.
109
+ # SupportedStyles: anonymous, explicit
110
+ Naming/BlockForwarding:
111
+ Exclude:
112
+ - 'lib/that_language/result_set.rb'
113
+ - 'lib/that_language/store.rb'
114
+
115
+ # Offense count: 1
116
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
117
+ # SupportedStyles: snake_case, normalcase, non_integer
118
+ # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
119
+ Naming/VariableNumber:
120
+ Exclude:
121
+ - 'spec/that_language/iso_639.rb'
122
+
123
+ # Offense count: 1
124
+ # This cop supports safe autocorrection (--autocorrect).
125
+ # Configuration parameters: EnforcedStyle.
126
+ # SupportedStyles: prefer_alias, prefer_alias_method
127
+ Style/Alias:
128
+ Exclude:
129
+ - 'lib/that_language.rb'
130
+
131
+ # Offense count: 4
132
+ # This cop supports safe autocorrection (--autocorrect).
133
+ # Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
134
+ # RedundantRestArgumentNames: args, arguments
135
+ # RedundantKeywordRestArgumentNames: kwargs, options, opts
136
+ # RedundantBlockArgumentNames: blk, block, proc
137
+ Style/ArgumentsForwarding:
138
+ Exclude:
139
+ - 'lib/that_language/result_set.rb'
140
+ - 'lib/that_language/store.rb'
141
+
142
+ # Offense count: 1
143
+ # This cop supports safe autocorrection (--autocorrect).
144
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
145
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
146
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
147
+ # FunctionalMethods: let, let!, subject, watch
148
+ # AllowedMethods: lambda, proc, it
149
+ Style/BlockDelimiters:
150
+ Exclude:
151
+ - 'spec/that_language/store_spec.rb'
152
+
153
+ # Offense count: 5
154
+ # This cop supports safe autocorrection (--autocorrect).
155
+ Style/EmptyLiteral:
156
+ Exclude:
157
+ - 'lib/that_language.rb'
158
+ - 'lib/that_language/store.rb'
159
+ - 'spec/that_language/detect_spec.rb'
160
+ - 'spec/that_language/lookup_context_spec.rb'
161
+
162
+ # Offense count: 1
163
+ # This cop supports safe autocorrection (--autocorrect).
164
+ Style/Encoding:
165
+ Exclude:
166
+ - 'that_language.gemspec'
167
+
168
+ # Offense count: 2
169
+ # This cop supports safe autocorrection (--autocorrect).
170
+ Style/ExpandPathArguments:
171
+ Exclude:
172
+ - 'spec/spec_helper.rb'
173
+ - 'that_language.gemspec'
174
+
175
+ # Offense count: 94
176
+ # This cop supports unsafe autocorrection (--autocorrect-all).
177
+ # Configuration parameters: EnforcedStyle.
178
+ # SupportedStyles: always, always_true, never
179
+ Style/FrozenStringLiteralComment:
180
+ Enabled: false
181
+
182
+ # Offense count: 1
183
+ # This cop supports safe autocorrection (--autocorrect).
184
+ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
185
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
186
+ # SupportedShorthandSyntax: always, never, either, consistent, either_consistent
187
+ Style/HashSyntax:
188
+ Exclude:
189
+ - 'Rakefile'
190
+
191
+ # Offense count: 2
192
+ # This cop supports safe autocorrection (--autocorrect).
193
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
194
+ Style/MethodCallWithoutArgsParentheses:
195
+ Exclude:
196
+ - 'spec/that_language/detect_spec.rb'
197
+ - 'spec/that_language/lookup_context_spec.rb'
198
+
199
+ # Offense count: 2
200
+ # This cop supports unsafe autocorrection (--autocorrect-all).
201
+ # Configuration parameters: EnforcedStyle, Recursive.
202
+ # SupportedStyles: literals, strict
203
+ Style/MutableConstant:
204
+ Exclude:
205
+ - 'lib/that_language/iso_639.rb'
206
+ - 'lib/that_language/version.rb'
207
+
208
+ # Offense count: 4
209
+ # This cop supports unsafe autocorrection (--autocorrect-all).
210
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
211
+ # SupportedStyles: predicate, comparison
212
+ Style/NumericPredicate:
213
+ Exclude:
214
+ - 'spec/**/*'
215
+ - 'lib/that_language/detect.rb'
216
+ - 'lib/that_language/result.rb'
217
+
218
+ # Offense count: 9
219
+ # This cop supports safe autocorrection (--autocorrect).
220
+ # Configuration parameters: PreferredDelimiters.
221
+ Style/PercentLiteralDelimiters:
222
+ Exclude:
223
+ - 'spec/that_language/detect_spec.rb'
224
+ - 'spec/that_language/lookup_context_spec.rb'
225
+ - 'that_language.gemspec'
226
+
227
+ # Offense count: 445
228
+ # This cop supports safe autocorrection (--autocorrect).
229
+ # Configuration parameters: .
230
+ # SupportedStyles: same_as_string_literals, single_quotes, double_quotes
231
+ Style/QuotedSymbols:
232
+ EnforcedStyle: double_quotes
233
+
234
+ # Offense count: 2
235
+ # This cop supports safe autocorrection (--autocorrect).
236
+ Style/RedundantPercentQ:
237
+ Exclude:
238
+ - 'that_language.gemspec'
239
+
240
+ # Offense count: 1
241
+ # This cop supports safe autocorrection (--autocorrect).
242
+ Style/RedundantSelf:
243
+ Exclude:
244
+ - 'lib/that_language.rb'
245
+
246
+ # Offense count: 1
247
+ # This cop supports unsafe autocorrection (--autocorrect-all).
248
+ Style/SelectByRegexp:
249
+ Exclude:
250
+ - 'lib/that_language/detect.rb'
251
+
252
+ # Offense count: 375
253
+ # This cop supports safe autocorrection (--autocorrect).
254
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
255
+ # SupportedStyles: single_quotes, double_quotes
256
+ Style/StringLiterals:
257
+ Enabled: false
258
+
259
+ # Offense count: 377
260
+ # This cop supports safe autocorrection (--autocorrect).
261
+ Style/SymbolLiteral:
262
+ Enabled: false
263
+
264
+ # Offense count: 1
265
+ # This cop supports safe autocorrection (--autocorrect).
266
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods.
267
+ # AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
268
+ Style/TrivialAccessors:
269
+ Exclude:
270
+ - 'lib/that_language/configuration.rb'
271
+
272
+ # Offense count: 1
273
+ # This cop supports safe autocorrection (--autocorrect).
274
+ # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
275
+ # URISchemes: http, https
276
+ Layout/LineLength:
277
+ Max: 166
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 4.0.6
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 4.0.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ ## 0.2.0 [☰](https://github.com/Deradon/that_language/compare/v0.1.2...v0.2.0) (2026-07-20)
2
+
3
+ Revival release. 0.1.2 dates from 2015 and does not run on Ruby 3 or later.
4
+
5
+ ### Breaking changes
6
+
7
+ * `required_ruby_version` is now `>= 3.1`. The gem no longer installs on Ruby
8
+ 2.x — hence the minor bump rather than a patch. Bundler continues to resolve
9
+ 0.1.2 for projects still on 2.x.
10
+
11
+ ### Bug fixes
12
+
13
+ * `File.exists?` → `File.exist?`. The alias was removed in Ruby 3, and this was
14
+ the single runtime blocker: the first wordlist load raised `NoMethodError`.
15
+ * `Store#within_pstore` now opens a **read-only** transaction
16
+ (`pstore.transaction(true)`). PStore's default is read-write and commits on
17
+ block exit, so every wordlist load rewrote the `.pstore` file it read.
18
+
19
+ ### Enhancements
20
+
21
+ * `pstore` is declared as a runtime dependency. It stopped being a default gem
22
+ in Ruby 4.0, where its absence is a bare `LoadError` at require time.
23
+ * Gemspec: dropped the `bundler ~> 1.10` development dependency that made
24
+ `bundle install` unsolvable, bumped rake, and added a description and
25
+ metadata.
26
+ * RuboCop 1.88 with a generated `.rubocop_todo.yml`, so the revival is not
27
+ buried in a mass reformatting.
28
+ * CI moved from Travis to GitHub Actions, covering Ruby 3.1 through 4.0.
29
+
30
+ The 2015 PStore wordlists are unchanged and load correctly on 3.2, 3.3 and 4.0.
31
+
32
+ ## 0.1.2 [☰](https://github.com/Deradon/that_language/compare/v0.1.1...v0.1.2) (2015-12-07)
33
+
34
+ ## 0.1.1 [☰](https://github.com/Deradon/that_language/compare/v0.1.0...v0.1.1) (2015-12-07)
35
+
36
+ ## 0.1.0 (2015-12-07)
37
+
38
+ * Initial release
data/CLAUDE.md ADDED
@@ -0,0 +1,73 @@
1
+ # CLAUDE.md — that_language
2
+
3
+ The core detection library. Scores text against per-language word-frequency
4
+ lists stored as PStore files. Developed on Ruby 4.0.6 (`.tool-versions`);
5
+ supports 3.1 and up.
6
+
7
+ `pstore` stopped being a default gem in Ruby 4.0 and is declared as a runtime
8
+ dependency in the gemspec. Do not remove it — without it the library fails to
9
+ load on 4.x with a bare `LoadError`.
10
+
11
+ ## Commands
12
+
13
+ ```sh
14
+ bundle install
15
+ bundle exec rspec # 413 examples, 0 failures, 5 pending
16
+ bundle exec rubocop
17
+ bundle exec rake spec # same as rspec
18
+ ```
19
+
20
+ The 5 pendings are pre-existing and marked "not yet implemented": Chinese and
21
+ Japanese detection (both are written without spaces, so the `/(\p{Word}+)/` word
22
+ splitter cannot segment them) plus three unwritten unit specs. A green run has
23
+ 5 pending — that is expected, not a regression.
24
+
25
+ ## Hard constraints
26
+
27
+ **Never modify, regenerate, move or re-encode a `.pstore` file** in `wordlists/`.
28
+ The generator that produced them is lost; they are irreplaceable source data.
29
+
30
+ **Wordlists must be opened in a read-only transaction:**
31
+
32
+ ```ruby
33
+ pstore.transaction(true) { ... } # correct
34
+ pstore.transaction { ... } # rewrites the file on block exit
35
+ ```
36
+
37
+ This is load-bearing, not stylistic. Until 2026-07-20 `Store#within_pstore` used
38
+ the default, so a single `ThatLanguage.language(...)` call left 29 wordlist files
39
+ modified in the working tree. If `git status` shows dirty `.pstore` files after
40
+ running code, something reintroduced this.
41
+
42
+ **The public API is a three-repository contract.** `that_language-client` mirrors
43
+ `ThatLanguage`'s methods over HTTP and `that_language-service` exposes the same
44
+ surface as eight endpoints. Nothing tests the parity. Renaming a public method is
45
+ a change in three repos.
46
+
47
+ ## Conventions
48
+
49
+ - Two-space indent, double-quoted strings in `require`s. Some classes put
50
+ `private`/`protected` at column 0 — that is intentional, leave it.
51
+ - **Do not mass-autocorrect RuboCop.** `.rubocop_todo.yml` grandfathers ~1750
52
+ pre-existing offences by design. If a cop fires on new code, fix that code;
53
+ if the todo needs regenerating, use `rubocop --auto-gen-config`.
54
+ - The 72 per-language specs in `spec/that_language/available_languages/` follow
55
+ one shape driven by `spec/support/available_languages_helper.rb`. Keep the
56
+ structure — one file per language.
57
+
58
+ ## Gotchas
59
+
60
+ - `Store#to_h` reads a root key named `:locales` for what are now called language
61
+ codes. There is a `FIXME`. Renaming it means rewriting every `.pstore`, which
62
+ is forbidden above.
63
+ - `LookupContext.from_directory` loads **every** file in the wordlist directory
64
+ with no extension filter, so any stray file becomes a phantom language. The
65
+ shipped 72-file set is clean; the wider archive is not.
66
+ - Wordlists load lazily and memoise at module level (~0.9 s cold). Deployments
67
+ should warm the cache at boot rather than making the first request pay.
68
+ - Default `wordlist_path` resolves from `__FILE__`, so the gem works unconfigured
69
+ and is insensitive to the working directory.
70
+
71
+ ## Context
72
+
73
+ This is a public GitHub repository — do not push without asking.
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![CI](https://github.com/Deradon/that_language/actions/workflows/ci.yml/badge.svg)](https://github.com/Deradon/that_language/actions/workflows/ci.yml)
2
+
1
3
  # ThatLanguage
2
4
 
3
5
  ## Installation
@@ -195,7 +197,7 @@ end
195
197
  ## Development
196
198
 
197
199
  After checking out the repo, run `bin/setup` to install dependencies.
198
- Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
200
+ Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
199
201
 
200
202
  To install this gem onto your local machine, run `bundle exec rake install`.
201
203
  To release a new version, update the version number in `version.rb`,
@@ -21,7 +21,7 @@ module ThatLanguage
21
21
  end
22
22
 
23
23
  def exists?
24
- File.exists?(path)
24
+ File.exist?(path)
25
25
  end
26
26
 
27
27
  private
@@ -30,8 +30,11 @@ module ThatLanguage
30
30
  @pstore ||= PStore.new(path) if exists?
31
31
  end
32
32
 
33
+ # NOTE: Read-only transaction. Without the `true`, PStore commits on block
34
+ # exit and rewrites the wordlist on disk -- merely loading a wordlist
35
+ # would leave every .pstore file modified in the working tree.
33
36
  def within_pstore(&block)
34
- pstore.transaction(&block)
37
+ pstore.transaction(true, &block)
35
38
  end
36
39
  end
37
40
  end
@@ -1,3 +1,3 @@
1
1
  module ThatLanguage
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -10,26 +10,31 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["me@patrick-helm.de"]
11
11
 
12
12
  spec.summary = %q{Detect language of given text}
13
- # spec.description = %q{Detect language of given text}
13
+ spec.description = %q{Detects the language of a given text by scoring its words against per-language word-frequency lists. Ships with wordlists for 72 languages.}
14
14
  spec.homepage = "https://github.com/Deradon/that_language"
15
15
  spec.license = "MIT"
16
16
 
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
- # if spec.respond_to?(:metadata)
20
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- # else
22
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- # end
17
+ spec.required_ruby_version = ">= 3.1"
18
+
19
+ spec.metadata = {
20
+ "homepage_uri" => spec.homepage,
21
+ "source_code_uri" => spec.homepage,
22
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
23
+ "rubygems_mfa_required" => "true"
24
+ }
24
25
 
25
26
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
27
  spec.bindir = "exe"
27
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
29
  spec.require_paths = ["lib"]
29
30
 
30
- spec.add_development_dependency "bundler", "~> 1.10"
31
+ # pstore stopped being a default gem in Ruby 4.0, so it must be declared
32
+ # explicitly. The wordlists are PStore files; this is a runtime dependency.
33
+ spec.add_dependency "pstore", "~> 0.2"
34
+
31
35
  spec.add_development_dependency "pry"
32
- spec.add_development_dependency "rake", "~> 10.0"
33
- spec.add_development_dependency "rspec"
34
- spec.add_development_dependency "rspec-its"
36
+ spec.add_development_dependency "rake", "~> 13.0"
37
+ spec.add_development_dependency "rspec", "~> 3.13"
38
+ spec.add_development_dependency "rspec-its", "~> 2.0"
39
+ spec.add_development_dependency "rubocop", "~> 1.88"
35
40
  end
metadata CHANGED
@@ -1,29 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: that_language
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Helm
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: bundler
13
+ name: pstore
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1.10'
20
- type: :development
18
+ version: '0.2'
19
+ type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '1.10'
25
+ version: '0.2'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: pry
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -44,52 +43,73 @@ dependencies:
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '10.0'
46
+ version: '13.0'
48
47
  type: :development
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '10.0'
53
+ version: '13.0'
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: rspec
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - ">="
58
+ - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '0'
60
+ version: '3.13'
62
61
  type: :development
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
- - - ">="
65
+ - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: '0'
67
+ version: '3.13'
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: rspec-its
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - ">="
72
+ - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: '0'
74
+ version: '2.0'
76
75
  type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
- - - ">="
79
+ - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: '0'
83
- description:
81
+ version: '2.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: rubocop
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.88'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.88'
96
+ description: Detects the language of a given text by scoring its words against per-language
97
+ word-frequency lists. Ships with wordlists for 72 languages.
84
98
  email:
85
99
  - me@patrick-helm.de
86
100
  executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
104
+ - ".github/workflows/ci.yml"
90
105
  - ".gitignore"
91
106
  - ".rspec"
92
- - ".travis.yml"
107
+ - ".rubocop.yml"
108
+ - ".rubocop_todo.yml"
109
+ - ".ruby-version"
110
+ - ".tool-versions"
111
+ - CHANGELOG.md
112
+ - CLAUDE.md
93
113
  - CODE_OF_CONDUCT.md
94
114
  - Gemfile
95
115
  - LICENSE.txt
@@ -183,8 +203,11 @@ files:
183
203
  homepage: https://github.com/Deradon/that_language
184
204
  licenses:
185
205
  - MIT
186
- metadata: {}
187
- post_install_message:
206
+ metadata:
207
+ homepage_uri: https://github.com/Deradon/that_language
208
+ source_code_uri: https://github.com/Deradon/that_language
209
+ bug_tracker_uri: https://github.com/Deradon/that_language/issues
210
+ rubygems_mfa_required: 'true'
188
211
  rdoc_options: []
189
212
  require_paths:
190
213
  - lib
@@ -192,16 +215,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
215
  requirements:
193
216
  - - ">="
194
217
  - !ruby/object:Gem::Version
195
- version: '0'
218
+ version: '3.1'
196
219
  required_rubygems_version: !ruby/object:Gem::Requirement
197
220
  requirements:
198
221
  - - ">="
199
222
  - !ruby/object:Gem::Version
200
223
  version: '0'
201
224
  requirements: []
202
- rubyforge_project:
203
- rubygems_version: 2.4.6
204
- signing_key:
225
+ rubygems_version: 4.0.16
205
226
  specification_version: 4
206
227
  summary: Detect language of given text
207
228
  test_files: []
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.2
4
- before_install: gem install bundler -v 1.10.3