ios_polyglot_cli 2.0.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c70a269cb650575390a356bd3e4868c03cedf3a0f9bb4f6a3742f9d205c25d9a
4
- data.tar.gz: 9da347e54fbe271f21821718ad21e8a7f7e7dfdefb6aacc9bf74d1b60213c1e8
3
+ metadata.gz: 4d8abb15627edff0438ba802429131b45309681a9e6081cb0a35359feff688e3
4
+ data.tar.gz: '090c37e7b8caa611d646766cd277bd3bdd0210626efaf73dd675656f240dffe0'
5
5
  SHA512:
6
- metadata.gz: 657216588118ea21a532ddddcfb1b7e1f39499c5e58e1e94bfb02c49d127ee950533f94011f587b9dfec9d68bd1636e28848ea39b513313727e216e0a556ac97
7
- data.tar.gz: 0410ba10fab8373e94b3328fdbc4a0125f4e536c2563bdb11455669cd1ba8add6a2b384f2c7cac99faf47907c9cab58a7f5d9d68fcaacc6ea894a1ade83b9be0
6
+ metadata.gz: 904d6aec162fc7ab30fe22e80d48be84aad5abc04e0fd3ff1b261a403b7313b815db23fe01863aa019f5af4df0996a4d63c4ff96a7ff842b2ae65488a51d7190
7
+ data.tar.gz: a88ea229f41afc5411efef664defb7dd1bc9f8ca83e97993739a5cfafed97f61c80502035ced68d0d86412b9bb879a0b7549e5772a07e2d01eeddc64261b9e44
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ios_polyglot_cli (2.0.1)
4
+ ios_polyglot_cli (2.2.1)
5
5
  activesupport
6
6
  commander
7
7
  json_api_client
@@ -11,72 +11,73 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- RubyInline (3.12.4)
14
+ RubyInline (3.12.5)
15
15
  ZenTest (~> 4.3)
16
- ZenTest (4.11.2)
17
- activemodel (5.2.3)
18
- activesupport (= 5.2.3)
19
- activesupport (5.2.3)
16
+ ZenTest (4.12.0)
17
+ activemodel (6.0.0)
18
+ activesupport (= 6.0.0)
19
+ activesupport (6.0.0)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 0.7, < 2)
22
22
  minitest (~> 5.1)
23
23
  tzinfo (~> 1.1)
24
- addressable (2.6.0)
25
- public_suffix (>= 2.0.2, < 4.0)
24
+ zeitwerk (~> 2.1, >= 2.1.8)
25
+ addressable (2.7.0)
26
+ public_suffix (>= 2.0.2, < 5.0)
26
27
  byebug (11.0.1)
27
28
  coderay (1.1.2)
28
29
  commander (4.4.7)
29
30
  highline (~> 2.0.0)
30
- concurrent-ruby (1.1.5)
31
- equatable (0.5.0)
32
- faraday (0.15.4)
31
+ concurrent-ruby (1.1.6)
32
+ equatable (0.6.1)
33
+ faraday (0.17.0)
33
34
  multipart-post (>= 1.2, < 3)
34
35
  faraday_middleware (0.13.1)
35
36
  faraday (>= 0.7.4, < 1.0)
36
- highline (2.0.2)
37
- i18n (1.6.0)
37
+ highline (2.0.3)
38
+ i18n (1.7.0)
38
39
  concurrent-ruby (~> 1.0)
39
- json_api_client (1.9.0)
40
+ json_api_client (1.16.1)
40
41
  activemodel (>= 3.2.0)
41
42
  activesupport (>= 3.2.0)
42
43
  addressable (~> 2.2)
43
44
  faraday (~> 0.15, >= 0.15.2)
44
45
  faraday_middleware (~> 0.9)
46
+ rack (>= 0.2)
45
47
  method_source (0.9.2)
46
- minitest (5.11.3)
47
- multipart-post (2.0.0)
48
- necromancer (0.4.0)
48
+ minitest (5.14.1)
49
+ multipart-post (2.1.1)
50
+ necromancer (0.5.0)
49
51
  osx_keychain (1.0.2)
50
52
  RubyInline (~> 3)
51
- pastel (0.7.2)
52
- equatable (~> 0.5.0)
53
- tty-color (~> 0.4.0)
53
+ pastel (0.7.3)
54
+ equatable (~> 0.6)
55
+ tty-color (~> 0.5)
54
56
  pry (0.12.2)
55
57
  coderay (~> 1.1.0)
56
58
  method_source (~> 0.9.0)
57
59
  pry-byebug (3.7.0)
58
60
  byebug (~> 11.0)
59
61
  pry (~> 0.10)
60
- public_suffix (3.0.3)
62
+ public_suffix (4.0.1)
63
+ rack (2.0.7)
61
64
  rake (10.5.0)
62
65
  thread_safe (0.3.6)
63
- timers (4.3.0)
64
- tty-color (0.4.3)
65
- tty-cursor (0.6.1)
66
- tty-prompt (0.18.1)
67
- necromancer (~> 0.4.0)
66
+ tty-color (0.5.0)
67
+ tty-cursor (0.7.0)
68
+ tty-prompt (0.19.0)
69
+ necromancer (~> 0.5.0)
68
70
  pastel (~> 0.7.0)
69
- timers (~> 4.0)
70
- tty-cursor (~> 0.6.0)
71
- tty-reader (~> 0.5.0)
72
- tty-reader (0.5.0)
73
- tty-cursor (~> 0.6.0)
74
- tty-screen (~> 0.6.4)
71
+ tty-reader (~> 0.6.0)
72
+ tty-reader (0.6.0)
73
+ tty-cursor (~> 0.7)
74
+ tty-screen (~> 0.7)
75
75
  wisper (~> 2.0.0)
76
- tty-screen (0.6.5)
77
- tzinfo (1.2.5)
76
+ tty-screen (0.7.0)
77
+ tzinfo (1.2.7)
78
78
  thread_safe (~> 0.1)
79
- wisper (2.0.0)
79
+ wisper (2.0.1)
80
+ zeitwerk (2.3.1)
80
81
 
81
82
  PLATFORMS
82
83
  ruby
data/README.md CHANGED
@@ -7,12 +7,20 @@ Polyglot client for iOS development
7
7
 
8
8
  If you use old polyglot-cli or native polyglot please uninstall them first:
9
9
 
10
- $ sudo gem uninstall polyglot-cli
11
- $ brew uninstall --force infinum/formulae/polyglot
10
+ sudo gem uninstall polyglot-cli
11
+ brew uninstall --force infinum/formulae/polyglot
12
12
 
13
13
  Then to install polyglot simply run:
14
14
 
15
- $ gem install ios_polyglot_cli
15
+ gem install ios_polyglot_cli
16
+
17
+ If you have any issues with above command, please consult this [thread](https://stackoverflow.com/questions/2119064/sudo-gem-install-or-gem-install-and-gem-locations).
18
+
19
+ You can check if everything is OK running:
20
+
21
+ polyglot --help
22
+
23
+ You should see output with all commands and their description.
16
24
 
17
25
  ## Usage
18
26
 
@@ -20,7 +28,7 @@ Then to install polyglot simply run:
20
28
 
21
29
  You will have to login with your Infinum ID if you want to use polyglot:
22
30
 
23
- $ polyglot login
31
+ polyglot login
24
32
 
25
33
  If your login action is successful, polyglot will ask you to access Keychain. There it will save your access token, so you don’t have to enter your credentials every time when you use `polyglot` command.
26
34
 
@@ -28,12 +36,20 @@ If your login action is successful, polyglot will ask you to access Keychain. Th
28
36
 
29
37
  To setup polyglot in your Xcode project use:
30
38
 
31
- $ polyglot init
39
+ polyglot init
32
40
 
33
41
  It will prompt you with project list to select one you are setting up. You can provide source language (Swift/ObjC), translations path and resources path. It will create `polyglot.yml` file which you can edit later and add additional Polyglot projects.
34
42
 
35
43
  Also, you can pass optional parameter `--query` or `-q`. It will prompt you with a list of all projects that match specified query.
36
44
 
45
+ ### Projects
46
+
47
+ If you want to see all polyglot projects and their `IDs` enter:
48
+
49
+ polyglot projects
50
+
51
+ Also, you can pass optional parameter `--query` or `-q`. It will prompt you with a list of all projects that match specified query.
52
+
37
53
  ### Legacy projects
38
54
 
39
55
  New style translations will create files names `en_US.strings` for example, and some old projects still use old naming in the style of `en.strings`. To get around this issue, you either need to migrate your project to use the new naming (be mindful of existing app's settings), or add this line under your path value:
@@ -56,7 +72,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
56
72
 
57
73
  ## Contributing
58
74
 
59
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ios_polyglot_cli.
75
+ Bug reports and pull requests are welcome on GitHub at https://github.com/infinum/ios_polyglot_cli.
60
76
 
61
77
  ## License
62
78
 
data/exe/polyglot CHANGED
@@ -22,7 +22,7 @@ end
22
22
  command :init do |c|
23
23
  c.syntax = 'polyglot init [options]'
24
24
  c.description = 'Sets up a polyglot.yml config for selected project.'
25
- c.option '--query STRING', String, 'Only shows projects that matches string'
25
+ c.option '--query STRING', String, 'Only show projects which name matches query string.'
26
26
  c.action do |_args, options|
27
27
  PolyglotIos::ErrorHandler.rescuable do
28
28
  PolyglotIos::Command::Setup.init(options)
@@ -30,6 +30,17 @@ command :init do |c|
30
30
  end
31
31
  end
32
32
 
33
+ command :projects do |c|
34
+ c.syntax = 'polyglot projects [options]'
35
+ c.description = 'Lists all available polyglot projects with their IDs.'
36
+ c.option '--query STRING', String, 'Only show projects which name matches query string.'
37
+ c.action do |_args, options|
38
+ PolyglotIos::ErrorHandler.rescuable do
39
+ PolyglotIos::Command::Projects.init(options)
40
+ end
41
+ end
42
+ end
43
+
33
44
  command :pull do |c|
34
45
  c.syntax = 'polyglot pull'
35
46
  c.description = 'Pulls all translations from Polyglot and generates necessary files'
@@ -30,6 +30,7 @@ require 'ios_polyglot_cli/serializers/sources/sources_serializer_swift'
30
30
 
31
31
  # Commands
32
32
  require 'ios_polyglot_cli/commands/login'
33
+ require 'ios_polyglot_cli/commands/projects'
33
34
  require 'ios_polyglot_cli/commands/setup'
34
35
  require 'ios_polyglot_cli/commands/pull'
35
36
 
@@ -3,7 +3,7 @@ module PolyglotIos
3
3
  class Base < JsonApiClient::Resource
4
4
  extend PolyglotIos::Helper::Depaginate
5
5
 
6
- self.site = 'https://polyglot.infinum.co/api/v2/'
6
+ self.site = 'https://infinum.polyglothq.com/api/v2/'
7
7
 
8
8
  def self.token(token)
9
9
  self.connection_options = { headers: { 'X-Auth-Token' => token } }
@@ -0,0 +1,60 @@
1
+ require 'commander/blank'
2
+ require 'commander/command'
3
+
4
+ module PolyglotIos
5
+ module Command
6
+ class Projects
7
+ include Helper::Terminal
8
+ include Helper::General
9
+
10
+ attr_accessor :options
11
+
12
+ def self.init(options = Commander::Command::Options.new)
13
+ new(options).call
14
+ end
15
+
16
+ def initialize(options = Commander::Command::Options.new)
17
+ @options = options
18
+ end
19
+
20
+ def call
21
+ list_projects
22
+ end
23
+
24
+ def filtered_projects
25
+ projects
26
+ .select { |key, _id| key[/^(.*?(#{option_query})[^$]*)$/i] }
27
+ .sort_by { |p| p[0].downcase }
28
+ .to_h
29
+ end
30
+
31
+ def projects
32
+ prompt.say('Getting projects...')
33
+ PolyglotIos::Resource::Project.token(token).depaginate.each_with_object({}) do |r, hash|
34
+ hash[r.name] = r.id
35
+ end
36
+ end
37
+
38
+ def option_query
39
+ @option_query ||= @options.__hash__.fetch(:query, '')
40
+ end
41
+
42
+ private
43
+
44
+ def list_projects
45
+ projects = filtered_projects
46
+ selection = projects
47
+ .each_with_object({}) do |project, hash|
48
+ project_name = project[0]
49
+ project_id = project[1]
50
+ display_name = "#{project_name} => #{project_id}"
51
+ hash[display_name] = project_id
52
+ end
53
+ prompt.say(" Name - ID: \n ----------")
54
+ selected_id = prompt
55
+ .select("", selection)
56
+ end
57
+
58
+ end
59
+ end
60
+ end
@@ -22,7 +22,7 @@ module PolyglotIos
22
22
  languages = pull_languages(project_id)
23
23
  translation_keys = pull_translation_keys(project_id)
24
24
 
25
- write_translations(translation_keys, languages, project[:path], use_old_naming)
25
+ write_translations(translation_keys, languages, project[:path], project[:useOldNaming])
26
26
  write_languages(languages, project[:sourceFilesPath], programming_language)
27
27
  write_translation_sources(translation_keys, project[:sourceFilesPath], programming_language)
28
28
  end
@@ -3,7 +3,7 @@ require 'commander/command'
3
3
 
4
4
  module PolyglotIos
5
5
  module Command
6
- class Setup
6
+ class Setup < Projects
7
7
  include Helper::Terminal
8
8
  include Helper::General
9
9
 
@@ -40,22 +40,7 @@ module PolyglotIos
40
40
  def project_id_prompt
41
41
  prompt.select('Choose a project: ', filtered_projects)
42
42
  end
43
-
44
- def projects
45
- prompt.say('Getting projects...')
46
- PolyglotIos::Resource::Project.token(token).depaginate.each_with_object({}) do |r, hash|
47
- hash[r.name] = r.id
48
- end
49
- end
50
-
51
- def filtered_projects
52
- projects.select { |key, _id| key[/^(.*?(#{option_query})[^$]*)$/i] }.sort_by { |p| p[0].downcase }.to_h
53
- end
54
-
55
- def option_query
56
- @option_query ||= @options.__hash__.fetch(:query, '')
57
- end
58
-
43
+
59
44
  # Language
60
45
 
61
46
  def language_prompt
@@ -20,6 +20,7 @@ module PolyglotIos
20
20
  <<-TEMPLATE
21
21
  import Foundation
22
22
 
23
+ // swiftlint:disable file_length type_body_length line_length superfluous_disable_command
23
24
  <%= @root_enum.serialized() %>
24
25
  public protocol StringsProtocol: RawRepresentable {
25
26
  var localized: String { get }
@@ -1,3 +1,3 @@
1
1
  module PolyglotIos
2
- VERSION = '2.0.1'.freeze
2
+ VERSION = '2.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_polyglot_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filip Gulan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-17 00:00:00.000000000 Z
11
+ date: 2021-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - filip.gulan@infinum.hr
128
128
  executables:
@@ -149,6 +149,7 @@ files:
149
149
  - lib/ios_polyglot_cli/api/translation.rb
150
150
  - lib/ios_polyglot_cli/api/translation_key.rb
151
151
  - lib/ios_polyglot_cli/commands/login.rb
152
+ - lib/ios_polyglot_cli/commands/projects.rb
152
153
  - lib/ios_polyglot_cli/commands/pull.rb
153
154
  - lib/ios_polyglot_cli/commands/setup.rb
154
155
  - lib/ios_polyglot_cli/error_handler.rb
@@ -170,7 +171,7 @@ licenses:
170
171
  - MIT
171
172
  metadata:
172
173
  allowed_push_host: https://rubygems.org
173
- post_install_message:
174
+ post_install_message:
174
175
  rdoc_options: []
175
176
  require_paths:
176
177
  - lib
@@ -185,8 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  - !ruby/object:Gem::Version
186
187
  version: '0'
187
188
  requirements: []
188
- rubygems_version: 3.0.3
189
- signing_key:
189
+ rubygems_version: 3.0.9
190
+ signing_key:
190
191
  specification_version: 4
191
192
  summary: A CLI for pulling polyglot translations and generating iOS Source Files
192
193
  test_files: []