polyglot_cli 0.1.1 → 0.1.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 +4 -4
- data/.codeclimate.yml +11 -0
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/exe/polyglot +2 -2
- data/lib/polyglot_cli/commands/pull.rb +1 -6
- data/lib/polyglot_cli/commands/push.rb +1 -6
- data/lib/polyglot_cli/helpers/general.rb +6 -1
- data/lib/polyglot_cli/resources/base.rb +1 -1
- data/lib/polyglot_cli/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1471f76c19416f17a16dcd6a5d04fe2ce4c2047d
|
4
|
+
data.tar.gz: 5281b395f0dca136b8de0351448127c5fcb633ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f571558a0d97f003db71b9d08708fdcf73b48bf0911352b5e4bf86554a14cd5a9f99b5fefe6635fd1cfd73700b8cdc05ec6bb023ebd5dbd379636bf8686849cd
|
7
|
+
data.tar.gz: 6025b508ec34d427554505b43e39c74974ed5375da2ec4287744b04002f7909e73ee628d07be50ca9f9220f076345413995bd52c462e880ed80a8177727d80ea
|
data/.codeclimate.yml
ADDED
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'polyglot_cli'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "polyglot_cli"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/exe/polyglot
CHANGED
@@ -33,7 +33,7 @@ command :pull do |c|
|
|
33
33
|
c.description = 'Pulls all translations from Polyglot and stores them in ./config/locales'
|
34
34
|
c.option '--locale STRING', String, 'Only pulls the specified locale'
|
35
35
|
c.option '--path STRING', String, 'Writes the translations to the specified location'
|
36
|
-
c.action do |
|
36
|
+
c.action do |_args, options|
|
37
37
|
PolyglotCli::ErrorHandler.rescuable do
|
38
38
|
PolyglotCli::Command::Pull.init(options)
|
39
39
|
end
|
@@ -45,7 +45,7 @@ command :push do |c|
|
|
45
45
|
c.description = 'Writes all translations to Polyglot API'
|
46
46
|
c.option '--locale STRING', String, 'Only pushes the specified locale'
|
47
47
|
c.option '--path STRING', String, 'Reads the translations from the specified location'
|
48
|
-
c.action do |
|
48
|
+
c.action do |_args, options|
|
49
49
|
PolyglotCli::ErrorHandler.rescuable do
|
50
50
|
PolyglotCli::Command::Push.init(options)
|
51
51
|
end
|
@@ -38,17 +38,12 @@ module PolyglotCli
|
|
38
38
|
def translation_hash(language)
|
39
39
|
hash = { language.locale => {} }
|
40
40
|
|
41
|
-
|
41
|
+
remote_translations(language).each do |t|
|
42
42
|
hash[language.locale].deep_merge!(nest(t.translation_key.name, t.value))
|
43
43
|
end
|
44
44
|
|
45
45
|
hash
|
46
46
|
end
|
47
|
-
|
48
|
-
def translations(language)
|
49
|
-
prompt.say("Getting #{language.name} translations...")
|
50
|
-
PolyglotCli::Resource::Translation.token(token).depaginate(project_id: project_id, language_id: language.id)
|
51
|
-
end
|
52
47
|
end
|
53
48
|
end
|
54
49
|
end
|
@@ -46,7 +46,7 @@ module PolyglotCli
|
|
46
46
|
|
47
47
|
if key_id.nil?
|
48
48
|
prompt.ok("Creating translation key \"#{key}\"...")
|
49
|
-
key_id =
|
49
|
+
key_id = create_translation_key(key)
|
50
50
|
end
|
51
51
|
|
52
52
|
create_translation(value, key_id, language_id)
|
@@ -85,11 +85,6 @@ module PolyglotCli
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def remote_translations(language)
|
89
|
-
prompt.say("Getting #{language.name} translations...")
|
90
|
-
PolyglotCli::Resource::Translation.token(token).depaginate(project_id: project_id, language_id: language.id)
|
91
|
-
end
|
92
|
-
|
93
88
|
def local_translations(locale)
|
94
89
|
denest(PolyglotCli::IO::Locale.read(locale_path, locale)[locale])
|
95
90
|
end
|
@@ -20,7 +20,7 @@ module PolyglotCli
|
|
20
20
|
|
21
21
|
def server_changed?
|
22
22
|
return true if config[:project_updated_at].nil?
|
23
|
-
Time.parse(project.updated_at) > Time.parse(config[:project_updated_at])
|
23
|
+
Time.parse(project.updated_at).utc > Time.parse(config[:project_updated_at]).utc
|
24
24
|
end
|
25
25
|
|
26
26
|
def languages(locale)
|
@@ -34,6 +34,11 @@ module PolyglotCli
|
|
34
34
|
config[:project_updated_at] = project.updated_at
|
35
35
|
PolyglotCli::IO::Config.write(config)
|
36
36
|
end
|
37
|
+
|
38
|
+
def remote_translations(language)
|
39
|
+
prompt.say("Getting #{language.name} translations...")
|
40
|
+
PolyglotCli::Resource::Translation.token(token).depaginate(project_id: project_id, language_id: language.id)
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
@@ -3,7 +3,7 @@ module PolyglotCli
|
|
3
3
|
class Base < JsonApiClient::Resource
|
4
4
|
extend PolyglotCli::Helper::Depaginate
|
5
5
|
|
6
|
-
self.site = if
|
6
|
+
self.site = if ['development', 'test'].include? ENV['POLYGLOT_CLI_ENV']
|
7
7
|
'http://polyglot.infinum.co.dev/api/v2/'
|
8
8
|
else
|
9
9
|
'https://polyglot.infinum.co/api/v2/'
|
data/lib/polyglot_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyglot_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Grgurevic
|
@@ -173,6 +173,7 @@ executables:
|
|
173
173
|
extensions: []
|
174
174
|
extra_rdoc_files: []
|
175
175
|
files:
|
176
|
+
- ".codeclimate.yml"
|
176
177
|
- ".gitignore"
|
177
178
|
- ".rspec"
|
178
179
|
- ".rubocop.yml"
|