i18n-migrations 2.1 → 2.2

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: 3222379e3c0147177cc712856d96c687525cd522df164fdfa5b93209df84c2d0
4
- data.tar.gz: 3d26a19e166b5a1f8ec23e20940128cf52f6db8ba432a40acb0ddf79ddece887
3
+ metadata.gz: c794a07b5f171a0a62b142739b15d912f2adbb30abd08ea312664a5a8d8ea6b7
4
+ data.tar.gz: c6d8f2f7337e76ba91a5c6334e89e81c8060db755881f30ab0da138812c36d72
5
5
  SHA512:
6
- metadata.gz: 9efbb8b0e289431dce695f9eece3e9e3d33bc443c1887ed61d3f047e55fcedd74bfcb204b76670e2d7bb047ea0e0dc6d68b38adec34a2e2aab558e5230300b6c
7
- data.tar.gz: 56b70c0099c639e183ce49a94ccdde7352b6688c7525c9805565505d0edbd8b9e55a6acf5ba94362bcc390467ad0353f7194657f2863464ac349f8ce64ae819b
6
+ metadata.gz: 03b7052d802ba2581023d2942fe31a6f45ebfd0b45828998bce656540fb5f40b114991301a4c500a05eb137a830a626b9b1c7c928c7f73a17d8f0cf6da8d6a16
7
+ data.tar.gz: eb79a91390106288b7a2799db2e34f2da8413c2dbbd3f2b58accc396b178b28380f81189fb269d5fe2b6642ec6c2e9bff0d37c9b200e958247c29055bdc6e27b
data/.gitignore CHANGED
@@ -8,3 +8,6 @@
8
8
  /tmp/
9
9
  /.ruby-gemset
10
10
  /.idea
11
+ .env
12
+ .i18n-migrations.yml
13
+ /config/
@@ -21,7 +21,8 @@ main_locale: en
21
21
 
22
22
  # put all other locales you want to use here, if they don't already exist, add them with i18n-migrations new-locale es
23
23
  other_locales:
24
- - es
24
+ es:
25
+ name: Spanish
25
26
 
26
27
  # you need a service account key in order to access google spreadsheets. This is the path to it, relative to your config file
27
28
  google_service_account_key_path: i18n/google_drive_key.json
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.4.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- i18n-migrations (2.1)
4
+ i18n-migrations (2.2)
5
5
  activesupport
6
6
  colorize
7
7
  faraday
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.1.3.4)
13
+ activesupport (7.1.3.3)
14
14
  base64
15
15
  bigdecimal
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -20,173 +20,133 @@ GEM
20
20
  minitest (>= 5.1)
21
21
  mutex_m
22
22
  tzinfo (~> 2.0)
23
- addressable (2.8.7)
24
- public_suffix (>= 2.0.2, < 7.0)
25
- autoparse (0.3.3)
26
- addressable (>= 2.3.1)
27
- extlib (>= 0.9.15)
28
- multi_json (>= 1.0.0)
23
+ addressable (2.8.1)
24
+ public_suffix (>= 2.0.2, < 6.0)
29
25
  base64 (0.2.0)
30
26
  bigdecimal (3.1.8)
31
- childprocess (5.0.0)
32
- colorize (1.1.0)
33
- concurrent-ruby (1.3.3)
27
+ colorize (0.8.1)
28
+ concurrent-ruby (1.2.3)
34
29
  connection_pool (2.4.1)
35
- date (3.3.4)
36
- diff-lcs (1.5.1)
37
- domain_name (0.6.20240107)
30
+ declarative (0.0.20)
31
+ diff-lcs (1.5.0)
32
+ domain_name (0.5.20190701)
33
+ unf (>= 0.0.5, < 1.0.0)
38
34
  drb (2.2.1)
39
- extlib (0.9.16)
40
- faraday (2.10.0)
41
- faraday-net_http (>= 2.0, < 3.2)
42
- logger
43
- faraday-net_http (3.1.0)
44
- net-http
45
- google-api-client (0.7.1)
46
- addressable (>= 2.3.2)
47
- autoparse (>= 0.3.3)
48
- extlib (>= 0.9.15)
49
- faraday (>= 0.9.0)
50
- jwt (>= 0.1.5)
51
- launchy (>= 2.1.1)
52
- multi_json (>= 1.0.0)
53
- retriable (>= 1.4)
54
- signet (>= 0.5.0)
55
- uuidtools (>= 2.1.0)
56
- google_drive (1.0.6)
57
- google-api-client (>= 0.7.0, < 0.9)
58
- nokogiri (>= 1.4.4, != 1.5.2, != 1.5.1)
59
- oauth (>= 0.3.6)
60
- oauth2 (>= 0.5.0)
61
- hashie (5.0.0)
62
- http-cookie (1.0.6)
35
+ faraday (0.17.6)
36
+ multipart-post (>= 1.2, < 3)
37
+ google-apis-core (0.10.0)
38
+ addressable (~> 2.5, >= 2.5.1)
39
+ googleauth (>= 0.16.2, < 2.a)
40
+ httpclient (>= 2.8.1, < 3.a)
41
+ mini_mime (~> 1.0)
42
+ representable (~> 3.0)
43
+ retriable (>= 2.0, < 4.a)
44
+ rexml
45
+ webrick
46
+ google-apis-drive_v3 (0.33.0)
47
+ google-apis-core (>= 0.9.1, < 2.a)
48
+ google-apis-sheets_v4 (0.21.0)
49
+ google-apis-core (>= 0.9.1, < 2.a)
50
+ google_drive (3.0.7)
51
+ google-apis-drive_v3 (>= 0.5.0, < 1.0.0)
52
+ google-apis-sheets_v4 (>= 0.4.0, < 1.0.0)
53
+ googleauth (>= 0.5.0, < 1.0.0)
54
+ nokogiri (>= 1.5.3, < 2.0.0)
55
+ googleauth (0.17.1)
56
+ faraday (>= 0.17.3, < 2.0)
57
+ jwt (>= 1.4, < 3.0)
58
+ memoist (~> 0.16)
59
+ multi_json (~> 1.11)
60
+ os (>= 0.9, < 2.0)
61
+ signet (~> 0.15)
62
+ http-cookie (1.0.5)
63
63
  domain_name (~> 0.5)
64
+ httpclient (2.8.3)
64
65
  i18n (1.14.5)
65
66
  concurrent-ruby (~> 1.0)
66
- jwt (2.8.2)
67
- base64
68
- launchy (3.0.1)
69
- addressable (~> 2.8)
70
- childprocess (~> 5.0)
71
- logger (1.6.0)
72
- mail (2.8.1)
67
+ jwt (2.7.0)
68
+ mail (2.7.1)
73
69
  mini_mime (>= 0.1.1)
74
- net-imap
75
- net-pop
76
- net-smtp
77
- mechanize (2.10.1)
70
+ mechanize (2.8.5)
78
71
  addressable (~> 2.8)
79
- base64
80
72
  domain_name (~> 0.5, >= 0.5.20190701)
81
73
  http-cookie (~> 1.0, >= 1.0.3)
82
74
  mime-types (~> 3.0)
83
75
  net-http-digest_auth (~> 1.4, >= 1.4.1)
84
76
  net-http-persistent (>= 2.5.2, < 5.0.dev)
85
- nkf
86
77
  nokogiri (~> 1.11, >= 1.11.2)
87
78
  rubyntlm (~> 0.6, >= 0.6.3)
88
79
  webrick (~> 1.7)
89
80
  webrobots (~> 0.1.2)
81
+ memoist (0.16.2)
90
82
  mime (0.4.4)
91
- mime-types (3.5.2)
83
+ mime-types (3.4.1)
92
84
  mime-types-data (~> 3.2015)
93
- mime-types-data (3.2024.0702)
94
- mini_mime (1.1.5)
95
- minitest (5.24.1)
85
+ mime-types-data (3.2022.0105)
86
+ mini_mime (1.1.2)
87
+ mini_portile2 (2.8.6)
88
+ minitest (5.23.1)
96
89
  multi_json (1.15.0)
97
- multi_xml (0.7.1)
98
- bigdecimal (~> 3.1)
90
+ multipart-post (2.2.3)
99
91
  mutex_m (0.2.0)
100
- net-http (0.4.1)
101
- uri
102
92
  net-http-digest_auth (1.4.1)
103
- net-http-persistent (4.0.2)
93
+ net-http-persistent (4.0.1)
104
94
  connection_pool (~> 2.2)
105
- net-imap (0.4.14)
106
- date
107
- net-protocol
108
- net-pop (0.1.2)
109
- net-protocol
110
- net-protocol (0.2.2)
111
- timeout
112
- net-smtp (0.5.0)
113
- net-protocol
114
- nkf (0.2.0)
115
- nokogiri (1.16.6-aarch64-linux)
116
- racc (~> 1.4)
117
- nokogiri (1.16.6-arm-linux)
95
+ nokogiri (1.16.5)
96
+ mini_portile2 (~> 2.8.2)
118
97
  racc (~> 1.4)
119
- nokogiri (1.16.6-arm64-darwin)
98
+ nokogiri (1.16.5-x86_64-linux)
120
99
  racc (~> 1.4)
121
- nokogiri (1.16.6-x86-linux)
122
- racc (~> 1.4)
123
- nokogiri (1.16.6-x86_64-darwin)
124
- racc (~> 1.4)
125
- nokogiri (1.16.6-x86_64-linux)
126
- racc (~> 1.4)
127
- oauth (1.1.0)
128
- oauth-tty (~> 1.0, >= 1.0.1)
129
- snaky_hash (~> 2.0)
130
- version_gem (~> 1.1)
131
- oauth-tty (1.0.5)
132
- version_gem (~> 1.1, >= 1.1.1)
133
- oauth2 (2.0.9)
134
- faraday (>= 0.17.3, < 3.0)
135
- jwt (>= 1.0, < 3.0)
136
- multi_xml (~> 0.5)
137
- rack (>= 1.2, < 4)
138
- snaky_hash (~> 2.0)
139
- version_gem (~> 1.1)
140
- public_suffix (6.0.0)
100
+ os (1.1.4)
101
+ public_suffix (5.0.1)
141
102
  racc (1.8.0)
142
- rack (3.1.7)
143
- rake (13.2.1)
103
+ rake (13.0.6)
104
+ representable (3.2.0)
105
+ declarative (< 0.1.0)
106
+ trailblazer-option (>= 0.1.1, < 0.2.0)
107
+ uber (< 0.2.0)
144
108
  retriable (3.1.2)
145
- rspec (3.13.0)
146
- rspec-core (~> 3.13.0)
147
- rspec-expectations (~> 3.13.0)
148
- rspec-mocks (~> 3.13.0)
149
- rspec-core (3.13.0)
150
- rspec-support (~> 3.13.0)
151
- rspec-expectations (3.13.1)
109
+ rexml (3.3.6)
110
+ strscan
111
+ rspec (3.12.0)
112
+ rspec-core (~> 3.12.0)
113
+ rspec-expectations (~> 3.12.0)
114
+ rspec-mocks (~> 3.12.0)
115
+ rspec-core (3.12.2)
116
+ rspec-support (~> 3.12.0)
117
+ rspec-expectations (3.12.3)
152
118
  diff-lcs (>= 1.2.0, < 2.0)
153
- rspec-support (~> 3.13.0)
154
- rspec-mocks (3.13.1)
119
+ rspec-support (~> 3.12.0)
120
+ rspec-mocks (3.12.6)
155
121
  diff-lcs (>= 1.2.0, < 2.0)
156
- rspec-support (~> 3.13.0)
157
- rspec-support (3.13.1)
122
+ rspec-support (~> 3.12.0)
123
+ rspec-support (3.12.1)
158
124
  rspec_junit_formatter (0.6.0)
159
125
  rspec-core (>= 2, < 4, != 2.12.0)
160
126
  ruby-gmail (0.3.1)
161
127
  mail (>= 2.2.1)
162
128
  mime (>= 0.1)
163
129
  shared-mime-info
164
- rubyntlm (0.6.5)
165
- base64
130
+ rubyntlm (0.6.3)
166
131
  shared-mime-info (0.2.5)
167
- signet (0.19.0)
132
+ signet (0.17.0)
168
133
  addressable (~> 2.8)
169
134
  faraday (>= 0.17.5, < 3.a)
170
135
  jwt (>= 1.5, < 3.0)
171
136
  multi_json (~> 1.10)
172
- snaky_hash (2.0.1)
173
- hashie
174
- version_gem (~> 1.1, >= 1.1.1)
175
- timeout (0.4.1)
137
+ strscan (3.1.0)
138
+ trailblazer-option (0.1.2)
176
139
  tzinfo (2.0.6)
177
140
  concurrent-ruby (~> 1.0)
178
- uri (0.13.0)
179
- uuidtools (2.2.0)
180
- version_gem (1.1.4)
181
- webrick (1.8.1)
141
+ uber (0.1.0)
142
+ unf (0.1.4)
143
+ unf_ext
144
+ unf_ext (0.0.8.2)
145
+ webrick (1.8.2)
182
146
  webrobots (0.1.2)
183
147
 
184
148
  PLATFORMS
185
- aarch64-linux
186
- arm-linux
187
- arm64-darwin
188
- x86-linux
189
- x86_64-darwin
149
+ ruby
190
150
  x86_64-linux
191
151
 
192
152
  DEPENDENCIES
@@ -203,4 +163,4 @@ DEPENDENCIES
203
163
  ruby-gmail
204
164
 
205
165
  BUNDLED WITH
206
- 2.5.6
166
+ 2.3.26
data/README.md CHANGED
@@ -58,6 +58,29 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
58
58
 
59
59
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
60
 
61
+ ## Updating the gem version
62
+ 1. Create a commit with the new version number and push it up to Github
63
+ ```
64
+ git commit -m "vx.x.x"
65
+ git push
66
+ ```
67
+ 1. Create a tag in Github for the new release
68
+ ```
69
+ git tag -a vx.x.x -m "[INSERT CHANGE DESCRIPTION]"
70
+ git push origin v.x.x
71
+ ```
72
+ 1. Push up and merge the branch into the repo
73
+ 1. Build the new `.gem` file. This will create a new file labeled `i18n-migrations-x.x.gem`
74
+ ```
75
+ gem build i18n-migrations
76
+ ```
77
+ 1. Push the newly built gem to RubyGems
78
+ ```
79
+ gem push i18n-migrations-x.x.x.gem
80
+ ```
81
+ 1. Verify on the [i18n-migrations RubyGems directory page](https://rubygems.org/gems/i18n-migrations) that the new version has been published
82
+ 1. Delete the gem build file (`i18n-migrations-x.x.x.gem`)
83
+
61
84
  ## Contributing
62
85
 
63
86
  1. Fork it ( https://github.com/[my-github-username]/i18n-migrations/fork )
data/bin/i18n-migrate CHANGED
@@ -4,66 +4,72 @@ require_relative '../lib/i18n/migrations/migrator'
4
4
  require_relative '../lib/i18n/migrations/config'
5
5
  require_relative '../lib/i18n/migrations/version'
6
6
 
7
- migrator = I18n::Migrations::Migrator.new
7
+ def translating_migrator
8
+ @translating_migrator ||= I18n::Migrations::Migrator.new
9
+ end
10
+
11
+ def nontranslating_migrator
12
+ @nontranslating_migrator ||= I18n::Migrations::Migrator.new(allow_translations: false)
13
+ end
8
14
 
9
15
  def extract_option(name)
10
16
  !!ARGV.delete(name)
11
17
  end
12
18
 
13
- begin
14
- case ARGV.shift
15
- when 'setup'
16
- puts 'Where should we create a default config file? [.]'
17
- dir = gets.chomp
18
- dir = dir == '' ? '.' : dir
19
- file = I18n::Migrations::Config.copy_default_config_file(dir)
20
-
21
- puts 'You will need to configure this file before you can get going.'
22
- puts File.expand_path(file)
23
-
24
- when 'new'
25
- name = ARGV.shift
26
- if name
27
- migrator.new_migration name
28
- else
29
- STDERR.puts 'Usage: im new [name]'
30
- exit 1
31
- end
32
-
33
- when 'migrate'
34
- migrator.migrate(ARGV[0] || 'all')
35
-
36
- when 'rollback'
37
- migrator.rollback(ARGV[0] || 'all')
38
-
39
- when 'redo'
40
- migrator.rollback(ARGV[0] || 'all')
41
- migrator.migrate(ARGV[0] || 'all')
42
-
43
- when 'pull'
44
- migrator.pull(ARGV[0] || 'all')
45
-
46
- when 'push'
47
- force = extract_option('-f')
48
- migrator.push(ARGV[0] || 'all', force)
49
-
50
- when 'validate'
51
- migrator.validate(ARGV[0] || 'all')
52
-
53
- when 'new_locale'
54
- locale = ARGV.shift
55
- if locale
56
- migrator.new_locale(locale)
57
- else
58
- STDERR.puts 'Usage: im new_locale [name]'
59
- exit 1
60
- end
61
-
62
- when 'version'
63
- migrator.version
64
19
 
20
+ case ARGV.shift
21
+ when 'setup'
22
+ puts 'Where should we create a default config file? [.]'
23
+ dir = gets.chomp
24
+ dir = dir == '' ? '.' : dir
25
+ file = I18n::Migrations::Config.copy_default_config_file(dir)
26
+
27
+ puts 'You will need to configure this file before you can get going.'
28
+ puts File.expand_path(file)
29
+
30
+ when 'new'
31
+ name = ARGV.shift
32
+ if name
33
+ nontranslating_migrator.new_migration name
34
+ else
35
+ STDERR.puts 'Usage: im new [name]'
36
+ exit 1
37
+ end
38
+
39
+ when 'migrate'
40
+ translating_migrator.migrate(ARGV[0] || 'all')
41
+
42
+ when 'rollback'
43
+ translating_migrator.rollback(ARGV[0] || 'all')
44
+
45
+ when 'redo'
46
+ translating_migrator.rollback(ARGV[0] || 'all')
47
+ translating_migrator.migrate(ARGV[0] || 'all')
48
+
49
+ when 'pull'
50
+ nontranslating_migrator.pull(ARGV[0] || 'all')
51
+
52
+ when 'push'
53
+ force = extract_option('-f')
54
+ nontranslating_migrator.push(ARGV[0] || 'all', force)
55
+
56
+ when 'validate'
57
+ nontranslating_migrator.validate(ARGV[0] || 'all')
58
+
59
+ when 'new_locale'
60
+ locale = ARGV.shift
61
+ if locale
62
+ translating_migrator.new_locale(locale)
65
63
  else
66
- puts <<-USAGE
64
+ STDERR.puts 'Usage: im new_locale [name]'
65
+ exit 1
66
+ end
67
+
68
+ when 'version'
69
+ nontranslating_migrator.version
70
+
71
+ else
72
+ puts <<-USAGE
67
73
  Usage: i18n-migrate [command]
68
74
 
69
75
  Commands:
@@ -72,16 +78,12 @@ Commands:
72
78
  migrate - Migrate to current version.
73
79
  rollback - Rollback to previous version.
74
80
  redo - Rollback and then migrate again.
75
- pull - Pull latest translation spreadsheet.
81
+ pull - Pull latest translation spreadsheet.
76
82
  push - Push to translation spreadsheet. (-f to force, without doing a pull first)
77
83
  validate - check all translations according to our rules and fix what we can
78
84
  new_locale - Copy your current main locale file to a new language, translating all keys.
79
85
  version - Print version of locales.
80
86
 
81
87
  i18n-migrations version #{I18n::Migrations::VERSION}
82
- USAGE
83
- end
84
- rescue Exception
85
- puts "Error\n#{$!.message}".red
86
- exit 1
88
+ USAGE
87
89
  end
data/config/.gitkeep ADDED
File without changes
File without changes
@@ -6,18 +6,24 @@ require 'active_support/inflector'
6
6
  require 'active_support/core_ext/object'
7
7
  require 'colorize'
8
8
 
9
- require 'i18n/migrations/backends/crowd_translate_backend'
10
- require 'i18n/migrations/backends/google_spreadsheets_backend'
11
- require 'i18n/migrations/config'
12
- require 'i18n/migrations/google_translate_dictionary'
13
- require 'i18n/migrations/locale'
14
- require 'i18n/migrations/migration_factory'
9
+ require_relative 'backends/crowd_translate_backend'
10
+ require_relative 'backends/google_spreadsheets_backend'
11
+ require_relative 'config'
12
+ require_relative 'google_translate_dictionary'
13
+ require_relative 'locale'
14
+ require_relative 'migration_factory'
15
15
 
16
16
  # this class knows how to do all the things the cli needs done.
17
17
  # it mostly delegates to locale to do it, often asking multiple locales to do the same thing
18
18
  module I18n
19
19
  module Migrations
20
20
  class Migrator
21
+ attr_accessor :allow_translations
22
+
23
+ def initialize(allow_translations: true)
24
+ self.allow_translations = allow_translations
25
+ end
26
+
21
27
  def locale_for(name)
22
28
  Locale.new(name,
23
29
  locales_dir: config.locales_dir,
@@ -153,6 +159,8 @@ end
153
159
  end
154
160
 
155
161
  private def new_dictionary(locale)
162
+ return nil if !allow_translations
163
+
156
164
  GoogleTranslateDictionary.new(from_locale: config.main_locale,
157
165
  to_locale: locale,
158
166
  key: config.google_translate_api_key,
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Migrations
3
- VERSION = "2.1"
3
+ VERSION = "2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.1'
4
+ version: '2.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
10
+ date: 2025-03-06 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -131,6 +130,8 @@ files:
131
130
  - bin/console
132
131
  - bin/i18n-migrate
133
132
  - bin/setup
133
+ - config/.gitkeep
134
+ - config/locales/.gitkeep
134
135
  - example/.i18n-migrations.yml
135
136
  - example/config/es_notes.yml
136
137
  - example/config/locales/en.yml
@@ -154,7 +155,6 @@ homepage: https://github.com/transparentclassroom/i18n-migrations
154
155
  licenses:
155
156
  - MIT
156
157
  metadata: {}
157
- post_install_message:
158
158
  rdoc_options: []
159
159
  require_paths:
160
160
  - lib
@@ -169,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.5.3
173
- signing_key:
172
+ rubygems_version: 3.6.2
174
173
  specification_version: 4
175
174
  summary: Migrations for doing i18n.
176
175
  test_files: []