phraseapp_updater 3.1.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f010eea4d5b1504c18facc0756b88021d87d207b7942ad66b30aee3800fbb82f
4
- data.tar.gz: c1e0d6146fbadda3d36bcc622e8889de17072be9c5172e71c3a9545854f956be
3
+ metadata.gz: a32efb606f930f644881f15a2c3c1edf0bf72eddefd4de9de61524145e8b74c0
4
+ data.tar.gz: 3fd1b4164ee16b056b8ecc964863d66dac48a459aee374f1056268b524d2bbaf
5
5
  SHA512:
6
- metadata.gz: aac0c0be65646c83f608fca0ab7f5b45cdc0d7c0f58cf11eab1efbe714b709557a76de7082062c213d415f7153482fbeca3311c3a6a3152e0e6c10d012781c3d
7
- data.tar.gz: 29fd576ce2a3fb249689a01f3d648b5e7f80992f7a55f702ed802054d5b8419ae4b8bb0ae4d1bd1d4782c7c031d9e72d5a2cdb70e17051b8dbc896c666ba95f3
6
+ metadata.gz: c03c6ffd3ef4c33825884d9e14552445d5a86d3e7248d3295e3998a66b482f496bf716961bb61df602f293681ad4a755082813ce997e41a3507414f7973f586e
7
+ data.tar.gz: 0b08b5b4ddec6a3fd38675acf3d00c79f9bf3bc51dba94290cfde4a2f5223414b87ce50d7d9e06834c9c64872b111469625f4419afee17012c4dcc1171e3e3ea
@@ -9,6 +9,14 @@ class PhraseAppUpdaterCLI < Thor
9
9
  class_option :file_format, type: :string, default: 'json', desc: 'Filetype of localization files.'
10
10
  class_option :verbose, type: :boolean, default: false, desc: 'Verbose output'
11
11
 
12
+ # Options that mirror the PhraseApp API (https://developers.phrase.com/api/#post-/projects)
13
+ PHRASEAPP_CREATE_PROJECT_OPTIONS = {
14
+ zero_plural_form_enabled: {
15
+ type: :boolean,
16
+ desc: 'Displays the input fields for the \'ZERO\' plural form for every key as well although only some languages require the \'ZERO\' explicitly.'
17
+ },
18
+ }
19
+
12
20
  desc 'setup <locale_path>',
13
21
  'Create a new PhraseApp project, initializing it with locale files at <locale_path>. the new project ID is printed to STDOUT'
14
22
  method_option :phraseapp_api_key, type: :string, required: true, desc: 'PhraseApp API key.'
@@ -16,16 +24,23 @@ class PhraseAppUpdaterCLI < Thor
16
24
  method_option :parent_commit, type: :string, required: true, desc: 'git commit hash of initial locales'
17
25
  method_option :remove_orphans, type: :boolean, default: true, desc: 'Remove keys not in the uploaded default locale'
18
26
 
27
+ PHRASEAPP_CREATE_PROJECT_OPTIONS.each do |name, params|
28
+ method_option(name, **params)
29
+ end
30
+
19
31
  def setup(locales_path)
20
32
  validate_readable_path!('locales', locales_path)
21
33
 
22
34
  handle_errors do
35
+ phraseapp_opts = options.slice(*PHRASEAPP_CREATE_PROJECT_OPTIONS.keys)
36
+
23
37
  updater, project_id = PhraseAppUpdater.for_new_project(
24
38
  options[:phraseapp_api_key],
25
39
  options[:phraseapp_project_name],
26
40
  options[:file_format],
27
41
  options[:parent_commit],
28
- verbose: options[:verbose])
42
+ verbose: options[:verbose],
43
+ **phraseapp_opts)
29
44
 
30
45
  updater.upload_directory(locales_path, remove_orphans: options[:remove_orphans])
31
46
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'multi_json'
4
3
  require 'oj'
5
4
 
6
5
  # We're working with pure JSON, not
@@ -25,10 +25,15 @@ class PhraseAppUpdater
25
25
  @locale_file_class = locale_file_class
26
26
  end
27
27
 
28
- def create_project(name, parent_commit)
28
+ # @param [Hash] opts Options to be passed to the {https://developers.phrase.com/api/#post-/projects PhraseApp API}
29
+ def create_project(name, parent_commit, **opts)
29
30
  params = Phrase::ProjectCreateParameters.new(
30
- name: name,
31
- main_format: @locale_file_class.phraseapp_type)
31
+ # Merges name and main_format into opts to prevent overriding these properties
32
+ opts.merge(
33
+ name: name,
34
+ main_format: @locale_file_class.phraseapp_type
35
+ )
36
+ )
32
37
 
33
38
  project = phraseapp_request(Phrase::ProjectsApi, :project_create, params)
34
39
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class PhraseAppUpdater
4
- VERSION = '3.1.0'
4
+ VERSION = '3.3.0'
5
5
  end
@@ -10,9 +10,9 @@ require 'phraseapp_updater/yml_config_loader'
10
10
  class PhraseAppUpdater
11
11
  using IndexBy
12
12
 
13
- def self.for_new_project(phraseapp_api_key, phraseapp_project_name, file_format, parent_commit, verbose: false)
13
+ def self.for_new_project(phraseapp_api_key, phraseapp_project_name, file_format, parent_commit, verbose: false, **phraseapp_opts)
14
14
  api = PhraseAppAPI.new(phraseapp_api_key, nil, LocaleFile.class_for_file_format(file_format))
15
- project_id = api.create_project(phraseapp_project_name, parent_commit)
15
+ project_id = api.create_project(phraseapp_project_name, parent_commit, **phraseapp_opts)
16
16
  return self.new(phraseapp_api_key, project_id, file_format, verbose: verbose), project_id
17
17
  end
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phraseapp_updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - iKnow Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-19 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.19'
19
+ version: 1.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.19'
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: phrase
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.8.3
33
+ version: 2.20.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.8.3
40
+ version: 2.20.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hashdiff
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,62 +52,48 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.1
55
- - !ruby/object:Gem::Dependency
56
- name: multi_json
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.12'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.12'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: oj
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '2.18'
61
+ version: '3.16'
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '2.18'
68
+ version: '3.16'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: deep_merge
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '1.1'
75
+ version: '1.2'
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '1.1'
82
+ version: '1.2'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: parallel
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '1.12'
89
+ version: '1.23'
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '1.12'
96
+ version: '1.23'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: bundler
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -128,42 +114,42 @@ dependencies:
128
114
  requirements:
129
115
  - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: '10.0'
117
+ version: '13.1'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
- version: '10.0'
124
+ version: '13.1'
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: rspec
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: '3.0'
131
+ version: '3.12'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: '3.0'
138
+ version: '3.12'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: pry
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - "~>"
158
144
  - !ruby/object:Gem::Version
159
- version: '0.10'
145
+ version: '0.14'
160
146
  type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
- version: '0.10'
152
+ version: '0.14'
167
153
  description: A tool for merging data on PhraseApp with local changes (usually two
168
154
  git revisions)
169
155
  email:
@@ -207,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
193
  - !ruby/object:Gem::Version
208
194
  version: '0'
209
195
  requirements: []
210
- rubygems_version: 3.1.6
196
+ rubygems_version: 3.3.27
211
197
  signing_key:
212
198
  specification_version: 4
213
199
  summary: A three-way differ for PhraseApp projects.