ios_polyglot_cli 2.2.2 → 2.4.0

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: f732e12b6a0d53d57530b7b1449daa454a14509968009eb96c7ce4e94e8eba74
4
- data.tar.gz: ed86e8a6336bfd8d5dc32e50bd9ee49182f82dbe43b8a989d5a5bb6738c154b1
3
+ metadata.gz: 8a4772a7586a26e165ab7b05bb5adc917e597f80d0aadd1681c447eb18294e80
4
+ data.tar.gz: 8a441b6e7f109e310aa33caf67ec22751a39da6eb46766f83a002e9f801d9802
5
5
  SHA512:
6
- metadata.gz: 0d2eef0ab5b63fb5c077f3a67d01f6594b97305f7ed35917ab8ef73ddd9f0f7522f8fcb0ff3404059a862b976132137aba091c2e9e5e6ed9d6fc39e566c9d2db
7
- data.tar.gz: 65afae6af5f0b4c486d884f4bed31f8c0f635fff1a4ee60ce0c43dc4bbb4717379ed41bf930540563a188a8207c1b517a79150a0947c9f59029942869ddfb4b2
6
+ metadata.gz: 9b776a929067b05d066076163a060bab2ff210db020d9a75c3d2357e217b817247a4b5fc1a44ae9abd78fbb746879659b7d47f3126c557d9b86f1e77821a5c5a
7
+ data.tar.gz: 0173e073f01dbfcf7a9318ecf9a9cbebabcfea04be5433c19a2c398d0d092f0fdbfc268d6efa5e910d5f5b4f680059bd8505e077558a6f9fab6c2e1d4002e3a3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 3.1.0
data/Gemfile.lock CHANGED
@@ -1,92 +1,101 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ios_polyglot_cli (2.2.2)
4
+ ios_polyglot_cli (2.4.0)
5
5
  activesupport
6
6
  commander
7
7
  json_api_client
8
- osx_keychain
9
8
  tty-prompt
10
9
 
11
10
  GEM
12
11
  remote: https://rubygems.org/
13
12
  specs:
14
- RubyInline (3.12.5)
15
- ZenTest (~> 4.3)
16
- ZenTest (4.12.0)
17
- activemodel (6.0.0)
18
- activesupport (= 6.0.0)
19
- activesupport (6.0.0)
13
+ activemodel (7.0.4)
14
+ activesupport (= 7.0.4)
15
+ activesupport (7.0.4)
20
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
- i18n (>= 0.7, < 2)
22
- minitest (~> 5.1)
23
- tzinfo (~> 1.1)
24
- zeitwerk (~> 2.1, >= 2.1.8)
25
- addressable (2.7.0)
26
- public_suffix (>= 2.0.2, < 5.0)
27
- byebug (11.0.1)
28
- coderay (1.1.2)
29
- commander (4.4.7)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ addressable (2.8.1)
21
+ public_suffix (>= 2.0.2, < 6.0)
22
+ byebug (11.1.3)
23
+ coderay (1.1.3)
24
+ commander (4.6.0)
30
25
  highline (~> 2.0.0)
31
- concurrent-ruby (1.1.6)
32
- equatable (0.6.1)
33
- faraday (0.17.0)
34
- multipart-post (>= 1.2, < 3)
35
- faraday_middleware (0.13.1)
36
- faraday (>= 0.7.4, < 1.0)
26
+ concurrent-ruby (1.2.2)
27
+ faraday (1.10.2)
28
+ faraday-em_http (~> 1.0)
29
+ faraday-em_synchrony (~> 1.0)
30
+ faraday-excon (~> 1.1)
31
+ faraday-httpclient (~> 1.0)
32
+ faraday-multipart (~> 1.0)
33
+ faraday-net_http (~> 1.0)
34
+ faraday-net_http_persistent (~> 1.0)
35
+ faraday-patron (~> 1.0)
36
+ faraday-rack (~> 1.0)
37
+ faraday-retry (~> 1.0)
38
+ ruby2_keywords (>= 0.0.4)
39
+ faraday-em_http (1.0.0)
40
+ faraday-em_synchrony (1.0.0)
41
+ faraday-excon (1.1.0)
42
+ faraday-httpclient (1.0.1)
43
+ faraday-multipart (1.0.4)
44
+ multipart-post (~> 2)
45
+ faraday-net_http (1.0.1)
46
+ faraday-net_http_persistent (1.2.0)
47
+ faraday-patron (1.0.0)
48
+ faraday-rack (1.0.0)
49
+ faraday-retry (1.0.3)
50
+ faraday_middleware (1.2.0)
51
+ faraday (~> 1.0)
37
52
  highline (2.0.3)
38
- i18n (1.7.0)
53
+ i18n (1.12.0)
39
54
  concurrent-ruby (~> 1.0)
40
- json_api_client (1.16.1)
55
+ json_api_client (1.21.0)
41
56
  activemodel (>= 3.2.0)
42
57
  activesupport (>= 3.2.0)
43
58
  addressable (~> 2.2)
44
- faraday (~> 0.15, >= 0.15.2)
45
- faraday_middleware (~> 0.9)
59
+ faraday (>= 0.15.2, < 2.0)
60
+ faraday_middleware (>= 0.9.0, < 2.0)
46
61
  rack (>= 0.2)
47
- method_source (0.9.2)
48
- minitest (5.14.1)
49
- multipart-post (2.1.1)
50
- necromancer (0.5.0)
51
- osx_keychain (1.0.2)
52
- RubyInline (~> 3)
53
- pastel (0.7.3)
54
- equatable (~> 0.6)
62
+ method_source (1.0.0)
63
+ minitest (5.16.3)
64
+ multipart-post (2.2.3)
65
+ pastel (0.8.0)
55
66
  tty-color (~> 0.5)
56
- pry (0.12.2)
57
- coderay (~> 1.1.0)
58
- method_source (~> 0.9.0)
59
- pry-byebug (3.7.0)
67
+ pry (0.14.1)
68
+ coderay (~> 1.1)
69
+ method_source (~> 1.0)
70
+ pry-byebug (3.10.1)
60
71
  byebug (~> 11.0)
61
- pry (~> 0.10)
62
- public_suffix (4.0.1)
63
- rack (2.0.7)
72
+ pry (>= 0.13, < 0.15)
73
+ public_suffix (5.0.0)
74
+ rack (3.0.1)
64
75
  rake (10.5.0)
65
- thread_safe (0.3.6)
66
- tty-color (0.5.0)
67
- tty-cursor (0.7.0)
68
- tty-prompt (0.19.0)
69
- necromancer (~> 0.5.0)
70
- pastel (~> 0.7.0)
71
- tty-reader (~> 0.6.0)
72
- tty-reader (0.6.0)
76
+ ruby2_keywords (0.0.5)
77
+ tty-color (0.6.0)
78
+ tty-cursor (0.7.1)
79
+ tty-prompt (0.23.1)
80
+ pastel (~> 0.8)
81
+ tty-reader (~> 0.8)
82
+ tty-reader (0.9.0)
73
83
  tty-cursor (~> 0.7)
74
- tty-screen (~> 0.7)
75
- wisper (~> 2.0.0)
76
- tty-screen (0.7.0)
77
- tzinfo (1.2.7)
78
- thread_safe (~> 0.1)
84
+ tty-screen (~> 0.8)
85
+ wisper (~> 2.0)
86
+ tty-screen (0.8.1)
87
+ tzinfo (2.0.5)
88
+ concurrent-ruby (~> 1.0)
79
89
  wisper (2.0.1)
80
- zeitwerk (2.3.1)
81
90
 
82
91
  PLATFORMS
83
- ruby
92
+ arm64-darwin-21
84
93
 
85
94
  DEPENDENCIES
86
- bundler (~> 1.16)
95
+ bundler (~> 2.3)
87
96
  ios_polyglot_cli!
88
97
  pry-byebug
89
98
  rake (~> 10.0)
90
99
 
91
100
  BUNDLED WITH
92
- 1.17.3
101
+ 2.3.26
data/README.md CHANGED
@@ -30,7 +30,7 @@ You will have to login with your Infinum ID if you want to use polyglot:
30
30
 
31
31
  polyglot login
32
32
 
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.
33
+ If your login action is successful, polyglot will ask you to store your Polyglot token to local environment variables, so you don’t have to enter your credentials every time when you use `polyglot` command.
34
34
 
35
35
  ### Setup
36
36
 
@@ -70,6 +70,8 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
70
70
 
71
71
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
72
72
 
73
+ In order to release a new version to rubygems, you will need to be added as an owner of polyglot project on rubygems. Owners that can add other users are listed on [project's rubygems page.](https://rubygems.org/gems/ios_polyglot_cli)
74
+
73
75
  ## Contributing
74
76
 
75
77
  Bug reports and pull requests are welcome on GitHub at https://github.com/infinum/ios_polyglot_cli.
data/exe/polyglot CHANGED
@@ -11,7 +11,7 @@ program :description, 'An iOS client for managing polyglot\'s translations.'
11
11
 
12
12
  command :login do |c|
13
13
  c.syntax = 'polyglot login'
14
- c.description = 'Fetches and writes your token to the keychain using the email and password you provide.'
14
+ c.description = 'Login to Polyglot and fetches the token using the email and password you provide.'
15
15
  c.action do
16
16
  PolyglotIos::ErrorHandler.rescuable do
17
17
  PolyglotIos::Command::Login.init
@@ -23,13 +23,12 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 1.16'
26
+ spec.add_development_dependency 'bundler', '~> 2.3'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_development_dependency 'pry-byebug'
29
29
 
30
30
  spec.add_dependency 'json_api_client'
31
31
  spec.add_dependency 'tty-prompt'
32
32
  spec.add_dependency 'commander'
33
- spec.add_dependency 'osx_keychain'
34
33
  spec.add_dependency 'activesupport'
35
34
  end
@@ -10,20 +10,22 @@ module PolyglotIos
10
10
 
11
11
  def call
12
12
  prompt.say("Fetching translations...")
13
- generate_translations(project_configs, programming_language)
13
+ generate_translations(project_configs, programming_language, skip_writing_language_struct)
14
14
  success("Translations successfully generated!")
15
15
  end
16
16
 
17
17
  private
18
18
 
19
- def generate_translations(projects, programming_language)
19
+ def generate_translations(projects, programming_language, skip_writing_language_struct)
20
20
  projects.each do |project|
21
21
  project_id = project[:id]
22
22
  languages = pull_languages(project_id)
23
23
  translation_keys = pull_translation_keys(project_id)
24
24
 
25
25
  write_translations(translation_keys, languages, project[:path], project[:useOldNaming])
26
- write_languages(languages, project[:sourceFilesPath], programming_language)
26
+ if !skip_writing_language_struct
27
+ write_languages(languages, project[:sourceFilesPath], programming_language)
28
+ end
27
29
  write_translation_sources(translation_keys, project[:sourceFilesPath], programming_language)
28
30
  end
29
31
  end
@@ -28,6 +28,10 @@ module PolyglotIos
28
28
  @programming_language ||= config[:language]
29
29
  end
30
30
 
31
+ def skip_writing_language_struct
32
+ @skip_writing_language_struct ||= config[:skip_writing_language_struct]
33
+ end
34
+
31
35
  def use_old_naming
32
36
  @useOldNaming ||= config[:useOldNaming]
33
37
  end
@@ -2,22 +2,38 @@ module PolyglotIos
2
2
  module IO
3
3
  class Token
4
4
 
5
- KEYCHAIN_SERVICE = 'polyglot'.freeze
6
- KEYCHAIN_TOKEN_KEY = 'polyglot_token'.freeze
5
+ @@in_memory_token = nil
6
+
7
+ POLYGLOT_TOKEN_KEY = "POLYGLOT_TOKEN".freeze
7
8
 
8
9
  class << self
10
+
9
11
  def write(token)
10
- keychain[KEYCHAIN_SERVICE, KEYCHAIN_TOKEN_KEY] = token
12
+ if @@in_memory_token.nil?
13
+ out = <<-HELLO
14
+
15
+ #{POLYGLOT_TOKEN_KEY}=#{token}
16
+
17
+ To stay logged in, add the Polyglot token to your local environment (.zshrc, .bashrc...).
18
+ zsh:
19
+ echo '\\nexport #{POLYGLOT_TOKEN_KEY}=#{token}' >> ~/.zshrc
20
+ source ~/.zshrc
21
+ bash:
22
+ echo '\\nexport #{POLYGLOT_TOKEN_KEY}=#{token}' >> ~/.bashrc
23
+ source ~/.bashrc
24
+ HELLO
25
+ puts out
26
+ end
27
+ @@in_memory_token = token
11
28
  end
12
29
 
13
30
  def read
14
- keychain[KEYCHAIN_SERVICE, KEYCHAIN_TOKEN_KEY]
31
+ if !@@in_memory_token.nil?
32
+ return @@in_memory_token
33
+ else
34
+ return ENV[POLYGLOT_TOKEN_KEY]
35
+ end
15
36
  end
16
-
17
- def keychain
18
- @keychain ||= OSXKeychain.new
19
- end
20
-
21
37
  end
22
38
  end
23
39
  end
@@ -10,7 +10,7 @@ module PolyglotIos
10
10
  end
11
11
 
12
12
  def render()
13
- ERB.new(template, nil, '-').result(binding)
13
+ ERB.new(template, trim_mode: '-').result(binding)
14
14
  end
15
15
 
16
16
  def template()
@@ -6,8 +6,8 @@ module PolyglotIos
6
6
  class ObjC < Base
7
7
 
8
8
  def render()
9
- h_file = ERB.new(h_template, nil, '-').result(binding)
10
- m_file = ERB.new(m_template, nil, '-').result(binding)
9
+ h_file = ERB.new(h_template, trim_mode: '-').result(binding)
10
+ m_file = ERB.new(m_template, trim_mode: '-').result(binding)
11
11
  return h_file, m_file
12
12
  end
13
13
 
@@ -13,7 +13,7 @@ module PolyglotIos
13
13
 
14
14
  def render()
15
15
  @root_enum = build_translations()
16
- ERB.new(template, nil, '-').result(binding)
16
+ ERB.new(template, trim_mode: '-').result(binding)
17
17
  end
18
18
 
19
19
  def template()
@@ -1,3 +1,3 @@
1
1
  module PolyglotIos
2
- VERSION = '2.2.2'
2
+ VERSION = '2.4.0'
3
3
  end
@@ -1,6 +1,5 @@
1
1
  # Parsing
2
2
  require 'yaml'
3
- require 'osx_keychain'
4
3
  require 'erb'
5
4
  require 'active_support/core_ext/hash/indifferent_access'
6
5
 
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.2.2
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filip Gulan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: osx_keychain
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: activesupport
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -186,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
172
  - !ruby/object:Gem::Version
187
173
  version: '0'
188
174
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.7.6
175
+ rubygems_version: 3.3.3
191
176
  signing_key:
192
177
  specification_version: 4
193
178
  summary: A CLI for pulling polyglot translations and generating iOS Source Files