phraseapp_updater 0.1.6 → 0.1.7

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
  SHA1:
3
- metadata.gz: d67eacb35853fba62acb15d0d75cde0ce6f9e404
4
- data.tar.gz: a5b4673fe4b9bd243abcc40a75fed90879fcf9a3
3
+ metadata.gz: b0d34620e813a3d8381bb9e69718c4eddf00861c
4
+ data.tar.gz: 83376f665f0c2a2db922f5297f2a29890700be54
5
5
  SHA512:
6
- metadata.gz: 5212349be6b3b61355fafcccb042f733a43c1a790830970b0f80a3c5bc3d3235f628ca0557ff0dce8c3ce67778233da2c758ab65ff6eb584f513c452c7a79058
7
- data.tar.gz: 3bf0fd14f412b895bfc59f6665c5d378a1921242ff8a09e03cc94730a2d05ccf00fbd9337f2518c400a703f5775da363097a0c334f6e91a5bfa5d42b6f72c430
6
+ metadata.gz: e17e637e811441675d66c88a948913ba8526a014934405889b31422200991e66cc68d8cc9e0a733d99cd98f87e7b0f6f051fa0b358d5d15f3af8f47ad6eb28c3
7
+ data.tar.gz: 4b3e48725db68140f04d6c12f836ce82e6514151b652525331925ea3a8b690209fdf2d67ff5c6594c2f0b75c7629ffd3e1254ca1a191ff43228edc4e224f101a
data/README.markdown CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/iknow/phraseapp_updater.svg?branch=master)](https://travis-ci.org/iknow/phraseapp_updater)
4
4
 
5
- **Version** 0.1.6
5
+ **Version** 0.1.7
6
6
 
7
7
  This is a tool for merging PhraseApp locale data with locale data
8
8
  committed in your project.
@@ -89,7 +89,7 @@ committed to your application's respository. These will be used in the
89
89
  merge with the files on PhraseApp.
90
90
 
91
91
  ```
92
- phraseapp_updater push --new_locales_path="/data/previous", --previous_locales_path="/data/new" --phraseapp_api_key="yourkey" --phraseapp_project_id="projectid --file_format=json"
92
+ phraseapp_updater push --new_locales_path="/data/new", --previous_locales_path="/data/previous" --phraseapp_api_key="yourkey" --phraseapp_project_id="projectid --file_format=json"
93
93
  ```
94
94
 
95
95
  The arguments provided to the command can also be specified as shell
@@ -160,7 +160,6 @@ If you'd like to contribute, these would be very helpful!
160
160
  * Separating downloading and resolving data from PhraseApp from pushing
161
161
  back up to it, to enable different kinds of workflows.
162
162
  * Expose the changed files on the command line.
163
- * Implement other `LocaleFile`s with `parse` for non-JSON types.
164
163
  * Checking if PhraseApp files changed during execution before upload, to reduce the race condition window.
165
164
  * More specs for the API and shell.
166
165
 
@@ -57,6 +57,7 @@ class PhraseAppUpdaterCLI < Thor
57
57
  option :phraseapp_api_key, type: :string, desc: "PhraseApp API key. Shell variable: PA_API_KEY"
58
58
  option :phraseapp_project_id, type: :string, desc: "PhraseApp project ID. Shell variable: PA_PROJECT_ID"
59
59
  option :config_file_path, type: :string, desc: "Path to .phraseapp.yml config file to read API key and project ID."
60
+ option :file_format, type: :string, desc: "Filetype of localization files."
60
61
 
61
62
  def pull
62
63
  phraseapp_api_key, phraseapp_project_id, file_format = load_phraseapp_configuration(options)
@@ -8,7 +8,9 @@ Oj.default_options = {mode: :strict}
8
8
  class PhraseAppUpdater
9
9
  class LocaleFile
10
10
  class JSONFile < LocaleFile
11
- EXTENSION = "json"
11
+ EXTENSION = "json"
12
+ PHRASEAPP_TYPE = "nested_json"
13
+
12
14
  def self.from_hash(name, hash)
13
15
  new(name, MultiJson.dump(hash))
14
16
  end
@@ -2,7 +2,9 @@ require 'psych'
2
2
  class PhraseAppUpdater
3
3
  class LocaleFile
4
4
  class YAMLFile < LocaleFile
5
- EXTENSION = "yml"
5
+ EXTENSION = "yml"
6
+ PHRASEAPP_TYPE = "yml"
7
+
6
8
  def self.from_hash(name, hash)
7
9
  new(name, Psych.dump(hash))
8
10
  end
@@ -46,7 +46,7 @@ class PhraseAppUpdater
46
46
  def download_file(locale, skip_unverified)
47
47
  download_params = PhraseApp::RequestParams::LocaleDownloadParams.new
48
48
 
49
- download_params.file_format = "nested_json"
49
+ download_params.file_format = @locale_file_class.const_get(:PHRASEAPP_TYPE)
50
50
  download_params.skip_unverified_translations = skip_unverified
51
51
 
52
52
  phraseapp_request { @client.locale_download(@project_id, locale.id, download_params) }
@@ -142,7 +142,7 @@ class PhraseAppUpdater
142
142
  def create_upload_params(locale_name)
143
143
  upload_params = PhraseApp::RequestParams::UploadParams.new
144
144
  upload_params.file_encoding = "UTF-8"
145
- upload_params.file_format = "nested_json"
145
+ upload_params.file_format = @locale_file_class.const_get(:PHRASEAPP_TYPE)
146
146
  upload_params.locale_id = locale_name
147
147
  upload_params.skip_unverification = false
148
148
  upload_params.update_translations = true
@@ -1,3 +1,3 @@
1
1
  class PhraseAppUpdater
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -32,6 +32,10 @@ class PhraseAppUpdater
32
32
 
33
33
  private
34
34
 
35
+ # TODO As this information is now duplicated in the file type
36
+ # classes, it would be better to pass this around and use it to determine
37
+ # which class to instantiate. Maybe? Should probably go along with a change
38
+ # to the command line which forces the use of PhraseApp types.
35
39
  def convert(phraseapp_file_format)
36
40
  case phraseapp_file_format
37
41
  when "nested_json"
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: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Griffin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-31 00:00:00.000000000 Z
11
+ date: 2017-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor