i18n-migrations 2.0.10 → 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: fe24e12d97be8602c77d0a6ae4825a01037aeffa85650d2ebd7ed482dabb9b36
4
- data.tar.gz: 7b59aadaef48811dfb86a6f6a29fd1bf95e5d02fe5a42bfd917f95de562b307e
3
+ metadata.gz: c794a07b5f171a0a62b142739b15d912f2adbb30abd08ea312664a5a8d8ea6b7
4
+ data.tar.gz: c6d8f2f7337e76ba91a5c6334e89e81c8060db755881f30ab0da138812c36d72
5
5
  SHA512:
6
- metadata.gz: 9baca9df28a1c4f21d02a7ea9d8ca4a5fea3a62934b300d25a06d45d6eeb32f1dc4d12265f9dbb3967a0d563c816a19dd2c0f688c37f7c58165d00c9850a3156
7
- data.tar.gz: cddf61c3b5bc831fcb8e274736a8e660beff3cf8ac4f89bb78e7daec8be73a41563cf25bf0af3db36a0484599748fe90fcfe82f3394f48d59a8233e2ba3ff8d5
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.0.10)
4
+ i18n-migrations (2.2)
5
5
  activesupport
6
6
  colorize
7
7
  faraday
@@ -10,20 +10,28 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.4.3)
13
+ activesupport (7.1.3.3)
14
+ base64
15
+ bigdecimal
14
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ connection_pool (>= 2.2.5)
18
+ drb
15
19
  i18n (>= 1.6, < 2)
16
20
  minitest (>= 5.1)
21
+ mutex_m
17
22
  tzinfo (~> 2.0)
18
23
  addressable (2.8.1)
19
24
  public_suffix (>= 2.0.2, < 6.0)
25
+ base64 (0.2.0)
26
+ bigdecimal (3.1.8)
20
27
  colorize (0.8.1)
21
- concurrent-ruby (1.2.2)
22
- connection_pool (2.3.0)
28
+ concurrent-ruby (1.2.3)
29
+ connection_pool (2.4.1)
23
30
  declarative (0.0.20)
24
31
  diff-lcs (1.5.0)
25
32
  domain_name (0.5.20190701)
26
33
  unf (>= 0.0.5, < 1.0.0)
34
+ drb (2.2.1)
27
35
  faraday (0.17.6)
28
36
  multipart-post (>= 1.2, < 3)
29
37
  google-apis-core (0.10.0)
@@ -54,7 +62,7 @@ GEM
54
62
  http-cookie (1.0.5)
55
63
  domain_name (~> 0.5)
56
64
  httpclient (2.8.3)
57
- i18n (1.12.0)
65
+ i18n (1.14.5)
58
66
  concurrent-ruby (~> 1.0)
59
67
  jwt (2.7.0)
60
68
  mail (2.7.1)
@@ -76,41 +84,43 @@ GEM
76
84
  mime-types-data (~> 3.2015)
77
85
  mime-types-data (3.2022.0105)
78
86
  mini_mime (1.1.2)
79
- mini_portile2 (2.8.2)
80
- minitest (5.18.0)
87
+ mini_portile2 (2.8.6)
88
+ minitest (5.23.1)
81
89
  multi_json (1.15.0)
82
90
  multipart-post (2.2.3)
91
+ mutex_m (0.2.0)
83
92
  net-http-digest_auth (1.4.1)
84
93
  net-http-persistent (4.0.1)
85
94
  connection_pool (~> 2.2)
86
- nokogiri (1.15.2)
95
+ nokogiri (1.16.5)
87
96
  mini_portile2 (~> 2.8.2)
88
97
  racc (~> 1.4)
89
- nokogiri (1.15.2-x86_64-linux)
98
+ nokogiri (1.16.5-x86_64-linux)
90
99
  racc (~> 1.4)
91
100
  os (1.1.4)
92
101
  public_suffix (5.0.1)
93
- racc (1.7.1)
102
+ racc (1.8.0)
94
103
  rake (13.0.6)
95
104
  representable (3.2.0)
96
105
  declarative (< 0.1.0)
97
106
  trailblazer-option (>= 0.1.1, < 0.2.0)
98
107
  uber (< 0.2.0)
99
108
  retriable (3.1.2)
100
- rexml (3.2.5)
101
- rspec (3.11.0)
102
- rspec-core (~> 3.11.0)
103
- rspec-expectations (~> 3.11.0)
104
- rspec-mocks (~> 3.11.0)
105
- rspec-core (3.11.0)
106
- rspec-support (~> 3.11.0)
107
- rspec-expectations (3.11.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)
108
118
  diff-lcs (>= 1.2.0, < 2.0)
109
- rspec-support (~> 3.11.0)
110
- rspec-mocks (3.11.1)
119
+ rspec-support (~> 3.12.0)
120
+ rspec-mocks (3.12.6)
111
121
  diff-lcs (>= 1.2.0, < 2.0)
112
- rspec-support (~> 3.11.0)
113
- rspec-support (3.11.1)
122
+ rspec-support (~> 3.12.0)
123
+ rspec-support (3.12.1)
114
124
  rspec_junit_formatter (0.6.0)
115
125
  rspec-core (>= 2, < 4, != 2.12.0)
116
126
  ruby-gmail (0.3.1)
@@ -124,6 +134,7 @@ GEM
124
134
  faraday (>= 0.17.5, < 3.a)
125
135
  jwt (>= 1.5, < 3.0)
126
136
  multi_json (~> 1.10)
137
+ strscan (3.1.0)
127
138
  trailblazer-option (0.1.2)
128
139
  tzinfo (2.0.6)
129
140
  concurrent-ruby (~> 1.0)
@@ -131,7 +142,7 @@ GEM
131
142
  unf (0.1.4)
132
143
  unf_ext
133
144
  unf_ext (0.0.8.2)
134
- webrick (1.8.1)
145
+ webrick (1.8.2)
135
146
  webrobots (0.1.2)
136
147
 
137
148
  PLATFORMS
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
@@ -1,21 +1,29 @@
1
1
  require 'fileutils'
2
2
  require 'yaml'
3
+ require 'active_support/deprecation'
4
+ require 'active_support/deprecator'
3
5
  require 'active_support/inflector'
4
6
  require 'active_support/core_ext/object'
5
7
  require 'colorize'
6
8
 
7
- require 'i18n/migrations/backends/crowd_translate_backend'
8
- require 'i18n/migrations/backends/google_spreadsheets_backend'
9
- require 'i18n/migrations/config'
10
- require 'i18n/migrations/google_translate_dictionary'
11
- require 'i18n/migrations/locale'
12
- 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'
13
15
 
14
16
  # this class knows how to do all the things the cli needs done.
15
17
  # it mostly delegates to locale to do it, often asking multiple locales to do the same thing
16
18
  module I18n
17
19
  module Migrations
18
20
  class Migrator
21
+ attr_accessor :allow_translations
22
+
23
+ def initialize(allow_translations: true)
24
+ self.allow_translations = allow_translations
25
+ end
26
+
19
27
  def locale_for(name)
20
28
  Locale.new(name,
21
29
  locales_dir: config.locales_dir,
@@ -151,6 +159,8 @@ end
151
159
  end
152
160
 
153
161
  private def new_dictionary(locale)
162
+ return nil if !allow_translations
163
+
154
164
  GoogleTranslateDictionary.new(from_locale: config.main_locale,
155
165
  to_locale: locale,
156
166
  key: config.google_translate_api_key,
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Migrations
3
- VERSION = "2.0.10"
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.0.10
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: 2023-11-09 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.4.10
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: []