phraseapp_updater 3.2.0 → 3.3.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
2
  SHA256:
3
- metadata.gz: 5e8639a81e55d83a36d03854f2c970737ee9754266e629ef2bad1d9e65c53826
4
- data.tar.gz: '078928d80c10deb59f9a293fbd7135a2d9b4b52479809985b5c4cf9835332131'
3
+ metadata.gz: a32efb606f930f644881f15a2c3c1edf0bf72eddefd4de9de61524145e8b74c0
4
+ data.tar.gz: 3fd1b4164ee16b056b8ecc964863d66dac48a459aee374f1056268b524d2bbaf
5
5
  SHA512:
6
- metadata.gz: 1e2927b0dc2e87ba9ec5c64c8d0393a58624ce7e754183d556e1e165bb51fed61e0cac138a8e9bb9b46e2f97b74628ff75e2d24190fad30a68a1124d1425dee9
7
- data.tar.gz: 23f2339b569cbe5f6237d1f23c89259153ac80c79830a02861ec740c5c077384a8794aadad4d462fca4d95e46c04e4b145aff09f1bf5d1bc89c1b8f44e38f805
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
 
@@ -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.2.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.2.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-12-04 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
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.3.26
196
+ rubygems_version: 3.3.27
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: A three-way differ for PhraseApp projects.