polyglot_cli 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +11 -0
- data/.ruby-version +1 -1
- data/README.md +34 -5
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/exe/polyglot +6 -5
- data/lib/polyglot_cli.rb +1 -1
- data/lib/polyglot_cli/commands/login.rb +9 -6
- data/lib/polyglot_cli/commands/pull.rb +12 -10
- data/lib/polyglot_cli/commands/push.rb +20 -17
- data/lib/polyglot_cli/commands/setup.rb +66 -6
- data/lib/polyglot_cli/helpers/general.rb +28 -5
- data/lib/polyglot_cli/helpers/terminal.rb +1 -1
- data/lib/polyglot_cli/io/locale.rb +1 -1
- data/lib/polyglot_cli/resources/base.rb +11 -3
- data/lib/polyglot_cli/version.rb +1 -1
- data/polyglot_cli.gemspec +11 -13
- metadata +74 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ff5f065d97ab493e63b3bf053b1cd00ef76c7ce61b18d89b7635e86e219f08b2
|
4
|
+
data.tar.gz: 9d7e56011431cef1308a4a280fb1f100690a0b972e3b78c4c27def0332e38d25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d950cd0f92427923d409d71feecb1698cb79c46e7b7db56dffc6fc0a84a64d31a49f9e97a0b39e836cdecb4b97ffc40a8e85af2ccecc53ec90292fbe47a42b4c
|
7
|
+
data.tar.gz: 3e396a1f14590dd52aaa61736201bf3e69470a17d2844d2847cb55bdeff74a93a53484433eb2ea043becac2fd2696ffa1d57bcef597d347603848d5b1117588d
|
data/.codeclimate.yml
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# PolyglotCli
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/polyglot_cli.svg)](https://badge.fury.io/rb/polyglot_cli) [![Code Climate](https://codeclimate.com/repos/5875055a2c6a0b7145003aec/badges/37ca549d69fb7b786979/gpa.svg)](https://codeclimate.com/repos/5875055a2c6a0b7145003aec/feed) [![Test Coverage](https://codeclimate.com/repos/5875055a2c6a0b7145003aec/badges/37ca549d69fb7b786979/coverage.svg)](https://codeclimate.com/repos/5875055a2c6a0b7145003aec/coverage) [![Issue Count](https://codeclimate.com/repos/5875055a2c6a0b7145003aec/badges/37ca549d69fb7b786979/issue_count.svg)](https://codeclimate.com/repos/5875055a2c6a0b7145003aec/feed) [![Build Status](https://semaphoreci.com/api/v1/projects/13ad022a-36ce-4b0d-9d3d-48634e2c2591/1126271/shields_badge.svg)](https://semaphoreci.com/infinum/rails-polyglot-cli)
|
4
4
|
|
5
|
-
|
5
|
+
|
6
|
+
Pulls and pushes translations to and from locale files.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -20,9 +21,38 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
$ gem install polyglot_cli
|
22
23
|
|
24
|
+
## Setup
|
25
|
+
All commands have --help with detailed descriptions of options.
|
26
|
+
|
27
|
+
First we need to login to Polyglot:
|
28
|
+
|
29
|
+
polyglot login
|
30
|
+
|
31
|
+
This will prompt you for your email and password. If the the login attempt is successful. The API token will be written to a file in your home directory: `~/.polyglot.auth`
|
32
|
+
|
33
|
+
Next you have to initialize the project and go through a quick setup:
|
34
|
+
|
35
|
+
polyglot init [--query]
|
36
|
+
|
37
|
+
This will prompt you to choose from a list of projects, and you can use the `--query` option to filter the list of projects. Also it will ask you to set your locale directory. The default locale directory is `config/locales` for rails apps. Finally, it will ask you whether you would like to use full locales or short locales. If you choose to include full locales, your files will be stored like this for example: `en_US` and `en_GB`. If you choose to exclude full locales, your files will then look like `en` for example, but you will be prompted to choose between `en_US` and `en_GB`, if a language has more than one locale.
|
38
|
+
|
23
39
|
## Usage
|
40
|
+
Once you have setup the project you can use any of the following commands:
|
41
|
+
|
42
|
+
### polyglot pull
|
43
|
+
This command will query the Polyglot API and retrieve all translations. If you use the `--locale` option it will only retrieve that locale. If you use `--path` option you will override the default locale path. Both options are optional. Please be careful when pulling, it will overwrite any changes that are not stored on the server.
|
44
|
+
|
45
|
+
polyglot pull [--locale --path]
|
46
|
+
|
47
|
+
### polyglot push
|
48
|
+
This command will read the locale files and push them to the server. It will update and create both translations and translation keys. If your locales aren't up to date with the server, the command will fail. If you use the `--locale` option it will only retrieve that locale. If you use `--path` option you will override the default locale path. Both options are optional.
|
24
49
|
|
25
|
-
|
50
|
+
polyglot push [--locale --path]
|
51
|
+
|
52
|
+
### polyglot status
|
53
|
+
This command simply checks if your version of the locales are up to date with the sever.
|
54
|
+
|
55
|
+
polyglot status
|
26
56
|
|
27
57
|
## Development
|
28
58
|
|
@@ -32,10 +62,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
62
|
|
33
63
|
## Contributing
|
34
64
|
|
35
|
-
Bug reports and pull requests are welcome on
|
65
|
+
Bug reports and pull requests are welcome on Bitbucket at https://bitbucket.org/infinum_hr/rails-polyglot-cli/.
|
36
66
|
|
37
67
|
|
38
68
|
## License
|
39
69
|
|
40
70
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
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
@@ -19,11 +19,12 @@ command :login do |c|
|
|
19
19
|
end
|
20
20
|
|
21
21
|
command :init do |c|
|
22
|
-
c.syntax = 'polyglot init'
|
22
|
+
c.syntax = 'polyglot init [options]'
|
23
23
|
c.description = 'Sets up a Polyglot project you need for your current project.'
|
24
|
-
c.
|
24
|
+
c.option '--query STRING', String, 'Only shows projects that matches string'
|
25
|
+
c.action do |_args, options|
|
25
26
|
PolyglotCli::ErrorHandler.rescuable do
|
26
|
-
PolyglotCli::Command::Setup.init
|
27
|
+
PolyglotCli::Command::Setup.init(options)
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
@@ -33,7 +34,7 @@ command :pull do |c|
|
|
33
34
|
c.description = 'Pulls all translations from Polyglot and stores them in ./config/locales'
|
34
35
|
c.option '--locale STRING', String, 'Only pulls the specified locale'
|
35
36
|
c.option '--path STRING', String, 'Writes the translations to the specified location'
|
36
|
-
c.action do |
|
37
|
+
c.action do |_args, options|
|
37
38
|
PolyglotCli::ErrorHandler.rescuable do
|
38
39
|
PolyglotCli::Command::Pull.init(options)
|
39
40
|
end
|
@@ -45,7 +46,7 @@ command :push do |c|
|
|
45
46
|
c.description = 'Writes all translations to Polyglot API'
|
46
47
|
c.option '--locale STRING', String, 'Only pushes the specified locale'
|
47
48
|
c.option '--path STRING', String, 'Reads the translations from the specified location'
|
48
|
-
c.action do |
|
49
|
+
c.action do |_args, options|
|
49
50
|
PolyglotCli::ErrorHandler.rescuable do
|
50
51
|
PolyglotCli::Command::Push.init(options)
|
51
52
|
end
|
data/lib/polyglot_cli.rb
CHANGED
@@ -7,11 +7,6 @@ module PolyglotCli
|
|
7
7
|
new.call
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize
|
11
|
-
@email = prompt.ask('Email:') { |q| q.validate :email }
|
12
|
-
@password = prompt.mask('Password:')
|
13
|
-
end
|
14
|
-
|
15
10
|
def call
|
16
11
|
PolyglotCli::IO::Token.write(token)
|
17
12
|
success
|
@@ -21,7 +16,15 @@ module PolyglotCli
|
|
21
16
|
|
22
17
|
def token
|
23
18
|
prompt.say('Logging into API...')
|
24
|
-
PolyglotCli::Resource::Session.create(email:
|
19
|
+
PolyglotCli::Resource::Session.create(email: email, password: password).token
|
20
|
+
end
|
21
|
+
|
22
|
+
def email
|
23
|
+
prompt.ask('Email:') { |q| q.validate :email }
|
24
|
+
end
|
25
|
+
|
26
|
+
def password
|
27
|
+
prompt.mask('Password:')
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
@@ -10,12 +10,11 @@ module PolyglotCli
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(options)
|
13
|
-
@
|
14
|
-
@path = options.path
|
13
|
+
@options = options
|
15
14
|
end
|
16
15
|
|
17
16
|
def call
|
18
|
-
languages(
|
17
|
+
languages(option_locale).each do |language|
|
19
18
|
PolyglotCli::IO::Locale.write(locale_path, translation_hash(language))
|
20
19
|
end
|
21
20
|
update_config
|
@@ -25,23 +24,26 @@ module PolyglotCli
|
|
25
24
|
private
|
26
25
|
|
27
26
|
def locale_path
|
28
|
-
|
27
|
+
option_path || config[:locale_path]
|
28
|
+
end
|
29
|
+
|
30
|
+
def option_locale
|
31
|
+
@options.locale
|
32
|
+
end
|
33
|
+
|
34
|
+
def option_path
|
35
|
+
@options.path
|
29
36
|
end
|
30
37
|
|
31
38
|
def translation_hash(language)
|
32
39
|
hash = { language.locale => {} }
|
33
40
|
|
34
|
-
|
41
|
+
remote_translations(language).each do |t|
|
35
42
|
hash[language.locale].deep_merge!(nest(t.translation_key.name, t.value))
|
36
43
|
end
|
37
44
|
|
38
45
|
hash
|
39
46
|
end
|
40
|
-
|
41
|
-
def translations(language)
|
42
|
-
prompt.say("Getting #{language.name} translations...")
|
43
|
-
PolyglotCli::Resource::Translation.token(token).depaginate(project_id: project_id, language_id: language.id)
|
44
|
-
end
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
@@ -10,15 +10,14 @@ module PolyglotCli
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(options)
|
13
|
-
@
|
14
|
-
@path = options.path
|
13
|
+
@options = options
|
15
14
|
end
|
16
15
|
|
17
16
|
def call
|
18
17
|
if server_changed?
|
19
18
|
prompt.error('Changes have been made on the server. Please pull before pushing.')
|
20
19
|
else
|
21
|
-
languages(
|
20
|
+
languages(option_locale).each do |language|
|
22
21
|
prompt.say("Processing push for #{language.name}...")
|
23
22
|
process(language)
|
24
23
|
end
|
@@ -46,20 +45,20 @@ module PolyglotCli
|
|
46
45
|
key_id = translation_keys[key]
|
47
46
|
|
48
47
|
if key_id.nil?
|
49
|
-
prompt.ok("Creating translation key
|
50
|
-
key_id =
|
48
|
+
prompt.ok("Creating translation key: #{key}...")
|
49
|
+
key_id = create_translation_key(key)
|
51
50
|
end
|
52
51
|
|
53
|
-
create_translation(value, key_id, language_id)
|
52
|
+
create_translation(value, key, key_id, language_id)
|
54
53
|
end
|
55
54
|
|
56
55
|
def create_translation_key(name)
|
57
|
-
PolyglotCli::Resource::TranslationKey.token(token).create(name: name, project_id: project_id).id
|
56
|
+
PolyglotCli::Resource::TranslationKey.with_subdomain(subdomain).token(token).create(name: name, project_id: project_id).id
|
58
57
|
end
|
59
58
|
|
60
|
-
def create_translation(value, key_id, language_id)
|
61
|
-
prompt.ok("Creating translation for key
|
62
|
-
PolyglotCli::Resource::Translation.token(token).create(
|
59
|
+
def create_translation(value, key_name, key_id, language_id)
|
60
|
+
prompt.ok("Creating translation for key: #{key_name}...")
|
61
|
+
PolyglotCli::Resource::Translation.with_subdomain(subdomain).token(token).create(
|
63
62
|
value: value,
|
64
63
|
translation_key_id: key_id,
|
65
64
|
language_id: language_id
|
@@ -70,7 +69,7 @@ module PolyglotCli
|
|
70
69
|
new_value = local.delete(translation.translation_key.name)
|
71
70
|
return if new_value == translation.value
|
72
71
|
|
73
|
-
prompt.ok("Updating translation #{translation.
|
72
|
+
prompt.ok("Updating translation for key: #{translation.translation_key.name}...")
|
74
73
|
translation.update(value: new_value)
|
75
74
|
end
|
76
75
|
|
@@ -79,6 +78,7 @@ module PolyglotCli
|
|
79
78
|
prompt.say('Getting translation keys...')
|
80
79
|
@translation_keys =
|
81
80
|
PolyglotCli::Resource::TranslationKey
|
81
|
+
.with_subdomain(subdomain)
|
82
82
|
.token(token)
|
83
83
|
.depaginate(project_id: project_id)
|
84
84
|
.each_with_object({}) do |translation_key, hash|
|
@@ -86,17 +86,20 @@ module PolyglotCli
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
def remote_translations(language)
|
90
|
-
prompt.say("Getting #{language.name} translations...")
|
91
|
-
PolyglotCli::Resource::Translation.token(token).depaginate(project_id: project_id, language_id: language.id)
|
92
|
-
end
|
93
|
-
|
94
89
|
def local_translations(locale)
|
95
90
|
denest(PolyglotCli::IO::Locale.read(locale_path, locale)[locale])
|
96
91
|
end
|
97
92
|
|
93
|
+
def option_locale
|
94
|
+
@options.locale
|
95
|
+
end
|
96
|
+
|
97
|
+
def option_path
|
98
|
+
@options.path
|
99
|
+
end
|
100
|
+
|
98
101
|
def locale_path
|
99
|
-
|
102
|
+
option_path || config[:locale_path]
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
@@ -1,25 +1,77 @@
|
|
1
|
+
require 'commander/blank'
|
2
|
+
require 'commander/command'
|
3
|
+
|
1
4
|
module PolyglotCli
|
2
5
|
module Command
|
3
6
|
class Setup
|
4
7
|
include Helper::Terminal
|
5
8
|
include Helper::General
|
6
9
|
|
7
|
-
def self.init
|
8
|
-
new.call
|
10
|
+
def self.init(options)
|
11
|
+
new(options).call
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(options = Commander::Command::Options.new)
|
15
|
+
@options = options
|
9
16
|
end
|
10
17
|
|
11
18
|
def call
|
12
|
-
|
19
|
+
@config = {
|
20
|
+
subdomain: subdomain_prompt,
|
13
21
|
project_id: project_id_prompt,
|
14
22
|
locale_path: locale_path_prompt
|
15
|
-
|
23
|
+
}
|
24
|
+
PolyglotCli::IO::Config.write(@config.merge(locale_mapping: locale_mapping))
|
16
25
|
success
|
26
|
+
rescue TTY::Prompt::ConfigurationError
|
27
|
+
prompt.error('Could not find any projects. Please try a new search.')
|
17
28
|
end
|
18
29
|
|
30
|
+
# override subdomain for the setup,
|
31
|
+
# use the cached value (from prompt)
|
32
|
+
# instead of reading it from the config file
|
33
|
+
# (which does not exist yet during the setup)
|
34
|
+
attr_reader :subdomain
|
35
|
+
|
19
36
|
private
|
20
37
|
|
38
|
+
def locale_mapping
|
39
|
+
return if mapping_prompt
|
40
|
+
|
41
|
+
locale_map.each_with_object({}) do |map, hash|
|
42
|
+
key = if map[1].size > 1
|
43
|
+
locale_prompt(map[0], map[1])
|
44
|
+
else
|
45
|
+
map[1].first
|
46
|
+
end
|
47
|
+
hash[key] = map[0]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def locale_map
|
52
|
+
languages.each_with_object(Hash.new([])) do |l, hash|
|
53
|
+
hash[l.locale[0..1]] += [l.locale]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def mapping_prompt
|
58
|
+
prompt.yes?('Would you like to include locales?')
|
59
|
+
end
|
60
|
+
|
61
|
+
def locale_prompt(language, locales)
|
62
|
+
prompt.select("Choose a locale for #{language}: ", locales)
|
63
|
+
end
|
64
|
+
|
65
|
+
def subdomain_prompt
|
66
|
+
@subdomain = prompt.ask('Enter your subdomain: ', default: 'infinum')
|
67
|
+
end
|
68
|
+
|
21
69
|
def project_id_prompt
|
22
|
-
|
70
|
+
if filtered_projects.any?
|
71
|
+
prompt.select('Choose a project: ', filtered_projects)
|
72
|
+
else
|
73
|
+
raise StandardError, "No projects for the subdomain #{subdomain}!"
|
74
|
+
end
|
23
75
|
end
|
24
76
|
|
25
77
|
def locale_path_prompt
|
@@ -28,10 +80,18 @@ module PolyglotCli
|
|
28
80
|
|
29
81
|
def projects
|
30
82
|
prompt.say('Getting projects...')
|
31
|
-
PolyglotCli::Resource::Project.token(token).depaginate.each_with_object({}) do |r, hash|
|
83
|
+
PolyglotCli::Resource::Project.with_subdomain(subdomain).token(token).depaginate.each_with_object({}) do |r, hash|
|
32
84
|
hash[r.name] = r.id
|
33
85
|
end
|
34
86
|
end
|
87
|
+
|
88
|
+
def filtered_projects
|
89
|
+
@filtered_projects ||= projects.select { |key, _id| key[/^(.*?(#{option_query})[^$]*)$/i] }.sort_by { |p| p[0].downcase }.to_h
|
90
|
+
end
|
91
|
+
|
92
|
+
def option_query
|
93
|
+
@option_query ||= @options.__hash__.fetch(:query, '')
|
94
|
+
end
|
35
95
|
end
|
36
96
|
end
|
37
97
|
end
|
@@ -5,6 +5,10 @@ module PolyglotCli
|
|
5
5
|
@token ||= PolyglotCli::IO::Token.read
|
6
6
|
end
|
7
7
|
|
8
|
+
def subdomain
|
9
|
+
config[:subdomain]
|
10
|
+
end
|
11
|
+
|
8
12
|
def config
|
9
13
|
@config ||= PolyglotCli::IO::Config.read
|
10
14
|
end
|
@@ -15,18 +19,32 @@ module PolyglotCli
|
|
15
19
|
|
16
20
|
def project
|
17
21
|
prompt.say('Getting project...')
|
18
|
-
PolyglotCli::Resource::Project.token(token).find(project_id).first
|
22
|
+
PolyglotCli::Resource::Project.with_subdomain(subdomain).token(token).find(project_id).first
|
19
23
|
end
|
20
24
|
|
21
25
|
def server_changed?
|
22
26
|
return true if config[:project_updated_at].nil?
|
23
|
-
Time.parse(project.updated_at) > Time.parse(config[:project_updated_at])
|
27
|
+
Time.parse(project.updated_at).utc > Time.parse(config[:project_updated_at]).utc
|
24
28
|
end
|
25
29
|
|
26
|
-
def languages(locale)
|
30
|
+
def languages(locale = nil)
|
27
31
|
prompt.say('Getting languages...')
|
28
|
-
|
29
|
-
|
32
|
+
select_languages(
|
33
|
+
locale,
|
34
|
+
PolyglotCli::Resource::Language.with_subdomain(subdomain).token(token).depaginate(project_id: project_id)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def select_languages(locale, results)
|
39
|
+
results.select! { |l| l.locale == locale } if locale.present?
|
40
|
+
|
41
|
+
if config[:locale_mapping].present?
|
42
|
+
results.select! do |l|
|
43
|
+
l.locale = config[:locale_mapping][l.locale]
|
44
|
+
l.locale.present?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
30
48
|
results
|
31
49
|
end
|
32
50
|
|
@@ -34,6 +52,11 @@ module PolyglotCli
|
|
34
52
|
config[:project_updated_at] = project.updated_at
|
35
53
|
PolyglotCli::IO::Config.write(config)
|
36
54
|
end
|
55
|
+
|
56
|
+
def remote_translations(language)
|
57
|
+
prompt.say("Getting #{language.name} translations...")
|
58
|
+
PolyglotCli::Resource::Translation.with_subdomain(subdomain).token(token).depaginate(project_id: project_id, language_id: language.id)
|
59
|
+
end
|
37
60
|
end
|
38
61
|
end
|
39
62
|
end
|
@@ -6,7 +6,7 @@ module PolyglotCli
|
|
6
6
|
class << self
|
7
7
|
def write(locale_path, data)
|
8
8
|
prompt.say("Writing translations to #{path(locale_path, data.keys[0])}")
|
9
|
-
File.open(path(locale_path, data.keys[0]), 'w') { |f|
|
9
|
+
File.open(path(locale_path, data.keys[0]), 'w') { |f| f.write(data.to_yaml(line_width: -1)) }
|
10
10
|
end
|
11
11
|
|
12
12
|
def read(locale_path, locale)
|
@@ -3,12 +3,20 @@ module PolyglotCli
|
|
3
3
|
class Base < JsonApiClient::Resource
|
4
4
|
extend PolyglotCli::Helper::Depaginate
|
5
5
|
|
6
|
-
self.site =
|
7
|
-
|
6
|
+
self.site = case ENV['POLYGLOT_CLI_ENV']
|
7
|
+
when 'development', 'test'
|
8
|
+
'http://polyglothq.test/api/v2/'
|
9
|
+
when 'staging'
|
10
|
+
'https://staging-polyglothq.com/api/v2/'
|
8
11
|
else
|
9
|
-
'https://
|
12
|
+
'https://polyglothq.com/api/v2/'
|
10
13
|
end
|
11
14
|
|
15
|
+
def self.with_subdomain(subdomain)
|
16
|
+
self.site = site.sub(/http(s)?\:\/\//, "http\\1://#{subdomain}.")
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
12
20
|
def self.token(token)
|
13
21
|
self.connection_options = { headers: { 'X-Auth-Token' => token } }
|
14
22
|
self
|
data/lib/polyglot_cli/version.rb
CHANGED
data/polyglot_cli.gemspec
CHANGED
@@ -10,17 +10,11 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['ivan.grgurevic@infinum.hr']
|
11
11
|
|
12
12
|
spec.summary = 'A ruby cli for pulling and pushing polyglot translations'
|
13
|
-
|
14
|
-
|
13
|
+
spec.description = 'A ruby cli that takes translations from Polyglot and writes them to yml locale files. Also allows pushing of new translations to Polyglot.'
|
14
|
+
spec.homepage = 'https://bitbucket.org/infinum_hr/rails-polyglot-cli/'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
-
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
|
-
else
|
22
|
-
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
23
|
-
end
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
24
18
|
|
25
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
20
|
f.match(%r{^(test|spec|features)/})
|
@@ -29,11 +23,15 @@ Gem::Specification.new do |spec|
|
|
29
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
24
|
spec.require_paths = ['lib']
|
31
25
|
|
32
|
-
spec.add_development_dependency 'bundler'
|
33
|
-
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'bundler'
|
27
|
+
spec.add_development_dependency 'rake'
|
34
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
|
-
spec.add_development_dependency 'pry-byebug'
|
36
|
-
spec.
|
29
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.4'
|
30
|
+
spec.add_development_dependency 'vcr', '~> 3.0'
|
31
|
+
spec.add_development_dependency 'simplecov'
|
32
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
|
33
|
+
spec.add_development_dependency 'webmock', '~> 2.3.2'
|
34
|
+
spec.add_dependency 'json_api_client', '~> 1.4.0' # newer versions have some breaking changes with the pagination; issue: https://github.com/JsonApiClient/json_api_client/issues/365
|
37
35
|
spec.add_dependency 'commander'
|
38
36
|
spec.add_dependency 'tty-prompt'
|
39
37
|
end
|
metadata
CHANGED
@@ -1,45 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyglot_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Grgurevic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
16
44
|
requirements:
|
17
45
|
- - "~>"
|
18
46
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
47
|
+
version: '3.0'
|
20
48
|
type: :development
|
21
49
|
prerelease: false
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
23
51
|
requirements:
|
24
52
|
- - "~>"
|
25
53
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
54
|
+
version: '3.0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
56
|
+
name: pry-byebug
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
59
|
- - "~>"
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
61
|
+
version: '3.4'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
66
|
- - "~>"
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
68
|
+
version: '3.4'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
70
|
+
name: vcr
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
@@ -53,7 +81,7 @@ dependencies:
|
|
53
81
|
- !ruby/object:Gem::Version
|
54
82
|
version: '3.0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: simplecov
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - ">="
|
@@ -66,20 +94,48 @@ dependencies:
|
|
66
94
|
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: codeclimate-test-reporter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.3.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.3.2
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: json_api_client
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
72
128
|
requirements:
|
73
|
-
- - "
|
129
|
+
- - "~>"
|
74
130
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
131
|
+
version: 1.4.0
|
76
132
|
type: :runtime
|
77
133
|
prerelease: false
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
79
135
|
requirements:
|
80
|
-
- - "
|
136
|
+
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
138
|
+
version: 1.4.0
|
83
139
|
- !ruby/object:Gem::Dependency
|
84
140
|
name: commander
|
85
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +164,8 @@ dependencies:
|
|
108
164
|
- - ">="
|
109
165
|
- !ruby/object:Gem::Version
|
110
166
|
version: '0'
|
111
|
-
description:
|
167
|
+
description: A ruby cli that takes translations from Polyglot and writes them to yml
|
168
|
+
locale files. Also allows pushing of new translations to Polyglot.
|
112
169
|
email:
|
113
170
|
- ivan.grgurevic@infinum.hr
|
114
171
|
executables:
|
@@ -116,6 +173,7 @@ executables:
|
|
116
173
|
extensions: []
|
117
174
|
extra_rdoc_files: []
|
118
175
|
files:
|
176
|
+
- ".codeclimate.yml"
|
119
177
|
- ".gitignore"
|
120
178
|
- ".rspec"
|
121
179
|
- ".rubocop.yml"
|
@@ -150,7 +208,7 @@ files:
|
|
150
208
|
- lib/polyglot_cli/resources/translation_key.rb
|
151
209
|
- lib/polyglot_cli/version.rb
|
152
210
|
- polyglot_cli.gemspec
|
153
|
-
homepage:
|
211
|
+
homepage: https://bitbucket.org/infinum_hr/rails-polyglot-cli/
|
154
212
|
licenses:
|
155
213
|
- MIT
|
156
214
|
metadata:
|
@@ -170,8 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
228
|
- !ruby/object:Gem::Version
|
171
229
|
version: '0'
|
172
230
|
requirements: []
|
173
|
-
|
174
|
-
rubygems_version: 2.6.7
|
231
|
+
rubygems_version: 3.1.2
|
175
232
|
signing_key:
|
176
233
|
specification_version: 4
|
177
234
|
summary: A ruby cli for pulling and pushing polyglot translations
|