phraseapp_updater 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/phraseapp_updater +16 -1
- data/lib/phraseapp_updater/phraseapp_api.rb +8 -3
- data/lib/phraseapp_updater/version.rb +1 -1
- data/lib/phraseapp_updater.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32efb606f930f644881f15a2c3c1edf0bf72eddefd4de9de61524145e8b74c0
|
4
|
+
data.tar.gz: 3fd1b4164ee16b056b8ecc964863d66dac48a459aee374f1056268b524d2bbaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c03c6ffd3ef4c33825884d9e14552445d5a86d3e7248d3295e3998a66b482f496bf716961bb61df602f293681ad4a755082813ce997e41a3507414f7973f586e
|
7
|
+
data.tar.gz: 0b08b5b4ddec6a3fd38675acf3d00c79f9bf3bc51dba94290cfde4a2f5223414b87ce50d7d9e06834c9c64872b111469625f4419afee17012c4dcc1171e3e3ea
|
data/bin/phraseapp_updater
CHANGED
@@ -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
|
-
|
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
|
31
|
-
|
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
|
|
data/lib/phraseapp_updater.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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.
|