ios_polyglot_cli 2.5.1 → 2.6.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: 3a28da6027422897aaf071d3f6d1a4f5dc569f3669c8f5e3ccdf6188260c02eb
4
- data.tar.gz: 1f1746b9383063d36a932f7e509cb417a4b6ac608dcde8278c2913ab7c4f25a4
3
+ metadata.gz: 64f6cf0ba34d7cb3a80d4b025b20117ae9c84e8c8c4c24c0bc16fdc378330df4
4
+ data.tar.gz: 316eff6f025db95ff716800a305f624ce2e199b210dfe4275f87a46f3d2c9bec
5
5
  SHA512:
6
- metadata.gz: 7d9b465ed705ad0c0d6eba37d4aa2179353fd327eee8babc7ebadb033b5cb4754de573bf0de2dd33b690984861adbe4464b1a50183ff329ed9ada961fc7bcd68
7
- data.tar.gz: 181d35960b6bf13327689d57e0074440a2b1a4b1a7874756a2dd089d15c6d008a190feb7beff98a7ccdab1d168379ef58ef7e260026a0bca7e8ce46be3503e89
6
+ metadata.gz: cd2106d3dfacd97b4ac947376f96e91c4cdc64082cc8d3f17ae54fb0b2ae9e521189360dd0f0689976cdb76d8a2f9982fb9b90806624a5771a525e29679d5bd5
7
+ data.tar.gz: c6bfcd2189e1258e4821f73b35680b458658f2752563980ba27cb956de3991386671ca723f918d186ba1f052273dd66c4f51ae1508a145ee75f4de47372eb705
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ios_polyglot_cli (2.5.1)
4
+ ios_polyglot_cli (2.6.0)
5
5
  activesupport
6
6
  commander
7
7
  json_api_client
data/README.md CHANGED
@@ -24,17 +24,11 @@ You should see the output with all commands and their description.
24
24
 
25
25
  ## Usage
26
26
 
27
- ### Login - soon to be deprecated!
27
+ ### Login
28
28
 
29
- > Login command will be deprecated in the near future!
30
- > To obtain a new token then, please visit https://infinum.polyglothq.com, generate a new token under Settings and store
31
- > it in your environment variables under POLYGLOT_TOKEN environment variable (or whatever variable your project is using).
29
+ > Login command is removed!
32
30
 
33
- You will have to log in with your Infinum ID if you want to use polyglot:
34
-
35
- polyglot login
36
-
37
- 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.
31
+ To generate an Auth Token please visit https://infinum.polyglothq.com, generate a new token under Settings -> Security and store it in your environment variables under POLYGLOT_TOKEN environment variable (or whatever variable your project is using).
38
32
 
39
33
  ### Setup
40
34
 
data/exe/polyglot CHANGED
@@ -10,9 +10,8 @@ program :version, PolyglotIos::VERSION
10
10
  program :description, 'An iOS client for managing polyglot\'s translations.'
11
11
 
12
12
  command :login do |c|
13
- c.syntax = 'polyglot login [options]'
14
- c.description = 'Login to Polyglot and fetches the token using the email and password you provide.'
15
- c.option '--url STRING', String, "URL of the Polyglot API. If not provided, #{PolyglotIos::DEFAULT_API_URL} will be used."
13
+ c.syntax = 'polyglot login'
14
+ c.description = 'Removed!!! Please generate an Auth Token from the Polyglot web and store it to env variable'
16
15
  c.action do |_args, options|
17
16
  PolyglotIos::ErrorHandler.rescuable do
18
17
  PolyglotIos::Command::Login.init(options)
@@ -22,7 +21,7 @@ end
22
21
 
23
22
  command :init do |c|
24
23
  c.syntax = 'polyglot init [options]'
25
- c.description = 'Sets up a polyglot.yml config for selected project.'
24
+ c.description = 'Sets up a polyglot.yml config for selected project'
26
25
  c.option '--query STRING', String, 'Only show projects which name matches query string.'
27
26
  c.option '--url STRING', String, "URL of the Polyglot API. If not provided, #{PolyglotIos::DEFAULT_API_URL} will be used."
28
27
  c.option '--token STRING', String, "Auth token. If not provided, #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE} environment variable value will be used."
@@ -35,7 +34,7 @@ end
35
34
 
36
35
  command :projects do |c|
37
36
  c.syntax = 'polyglot projects [options]'
38
- c.description = 'Lists all available polyglot projects with their IDs.'
37
+ c.description = 'Lists all available polyglot projects with their IDs'
39
38
  c.option '--query STRING', String, 'Only show projects which name matches query string.'
40
39
  c.option '--url STRING', String, "URL of the Polyglot API. If not provided, #{PolyglotIos::DEFAULT_API_URL} will be used."
41
40
  c.option '--token STRING', String, "Auth token. If not provided, #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE} environment variable value will be used."
@@ -4,7 +4,7 @@ module PolyglotIos
4
4
 
5
5
  def clean_translation(language)
6
6
  translation_value = name
7
- translation = translations.find { |key| key.language.id == language.id }
7
+ translation = (translations || []).find { |key| key.language.id == language.id }
8
8
  if translation && translation.value
9
9
  translation_value = translation.value
10
10
  end
@@ -19,7 +19,6 @@ module PolyglotIos
19
19
  .gsub("%s", "%@")
20
20
  .gsub(/(%\d+)(\$)(s)/, '\1\2@') # Positional parameter support, converts %1$s to %1$@ for example
21
21
  end
22
-
23
22
  end
24
23
  end
25
24
  end
@@ -12,41 +12,9 @@ module PolyglotIos
12
12
  end
13
13
 
14
14
  def call
15
- PolyglotIos::IO::Token.write(token)
15
+ prompt.error("Login command removed!\n")
16
+ prompt.warn(generate_token_message())
16
17
  end
17
-
18
- private
19
-
20
- def token
21
- prompt.warn(<<~WARN
22
- Login command will be deprecated soon!
23
- To obtain a token, please visit https://infinum.polyglothq.com, generate a new token under Settings and store
24
- it in your environment variables under #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE} variable.
25
- zsh:
26
- echo '\\nexport #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE}=<YOUR_AUTH_TOKEN>' >> ~/.zshrc
27
- source ~/.zshrc
28
- bash:
29
- echo '\\nexport #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE}=<YOUR_AUTH_TOKEN>' >> ~/.bashrc
30
- source ~/.bashrc
31
- WARN
32
- )
33
- prompt.say('Logging into API...')
34
- @data = PolyglotIos::Resource::Session.api_url(option_site_url).create(email: email, password: password)
35
- @data.token
36
- end
37
-
38
- def email
39
- prompt.ask('Email:') { |value| value.validate :email }
40
- end
41
-
42
- def password
43
- prompt.mask('Password:')
44
- end
45
-
46
- def option_site_url
47
- @option_site_url = @options.__hash__.fetch(:url, PolyglotIos::DEFAULT_API_URL)
48
- end
49
-
50
18
  end
51
19
  end
52
20
  end
@@ -2,29 +2,26 @@ module PolyglotIos
2
2
  module Helper
3
3
  module General
4
4
  include Terminal
5
- ESCAPE_KEYWORDS = ["associatedtype", "class", "deinit", "enum", "extension", "fileprivate", "func",
6
- "import", "init", "inout", "internal", "let", "operator", "private", "protocol",
7
- "public", "static", "struct", "subscript", "typealias", "var", "break", "case",
8
- "continue", "default", "defer", "do", "else", "fallthrough", "for", "guard", "if",
9
- "in", "repeat", "return", "switch", "where", "while", "as", "Any", "catch", "false",
5
+ ESCAPE_KEYWORDS = ["associatedtype", "class", "deinit", "enum", "extension", "fileprivate", "func",
6
+ "import", "init", "inout", "internal", "let", "operator", "private", "protocol",
7
+ "public", "static", "struct", "subscript", "typealias", "var", "break", "case",
8
+ "continue", "default", "defer", "do", "else", "fallthrough", "for", "guard", "if",
9
+ "in", "repeat", "return", "switch", "where", "while", "as", "Any", "catch", "false",
10
10
  "is", "nil", "rethrows", "super", "self", "Self", "throw", "throws", "true", "try", "_"]
11
11
  def token
12
12
  @token ||= PolyglotIos::IO::Token.read(token_env_variable)
13
13
  if @token.to_s.empty?
14
- prompt.error(<<~MESSAGE
15
- No Auth Token found under #{token_env_variable} environment variable.
16
- Please add your token to the environemnt variables under #{token_env_variable} or pass it as an argument --token <YOUR_AUTH_TOKENb>
17
- MESSAGE
18
- )
14
+ prompt.error("No Auth Token provided!\n")
15
+ prompt.warn(generate_token_message(token_env_variable))
19
16
  exit
20
17
  end
21
18
  @token
22
19
  end
23
-
20
+
24
21
  def config
25
22
  @config ||= PolyglotIos::IO::Config.read.with_indifferent_access
26
23
  end
27
-
24
+
28
25
  def project_configs
29
26
  @project_configs ||= config[:projects]
30
27
  end
@@ -84,7 +81,7 @@ module PolyglotIos
84
81
  escaped_underscore = escape_with_underscore_if_needed(clean_name)
85
82
  escape_keyword_if_needed(escaped_underscore)
86
83
  end
87
-
84
+
88
85
  def escape_with_underscore_if_needed(name)
89
86
  return name if name.match(/^[A-Za-z_]/)
90
87
  "_" + name
@@ -97,4 +94,4 @@ module PolyglotIos
97
94
 
98
95
  end
99
96
  end
100
- end
97
+ end
@@ -12,6 +12,20 @@ module PolyglotIos
12
12
  @prompt ||= TTY::Prompt.new(interrupt: :exit)
13
13
  end
14
14
 
15
+ def generate_token_message(token_env_variable = nil)
16
+ token_env_variable ||= PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE
17
+ return <<~MESSAGE
18
+ To generate an Auth Token, please visit Polyglot website ( for Infinum https://infinum.polyglothq.com ), generate a new token under Settings -> Security and store it in your environment variables under #{token_env_variable} variable.
19
+
20
+ zsh:
21
+ echo '\\nexport #{token_env_variable}=<YOUR_AUTH_TOKEN>' >> ~/.zshrc
22
+ source ~/.zshrc
23
+ bash:
24
+ echo '\\nexport #{token_env_variable}=<YOUR_AUTH_TOKEN>' >> ~/.bashrc
25
+ source ~/.bashrc
26
+ MESSAGE
27
+ end
28
+
15
29
  end
16
30
  end
17
31
  end
@@ -13,8 +13,7 @@ module PolyglotIos
13
13
  YAML.load_file(CONFIG_FILE_PATH)
14
14
  end
15
15
  end
16
-
16
+
17
17
  end
18
18
  end
19
19
  end
20
-
@@ -3,33 +3,14 @@ module PolyglotIos
3
3
  class Token
4
4
 
5
5
  @@in_memory_token = nil
6
-
7
- class << self
8
-
9
- def write(token)
10
- if @@in_memory_token.nil?
11
- out = <<~HELLO
12
6
 
13
- #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE}=#{token}
7
+ class << self
14
8
 
15
- To stay logged in, add the Polyglot auth token to your local environment (.zshrc, .bashrc...).
16
- zsh:
17
- echo '\\nexport #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE}=#{token}' >> ~/.zshrc
18
- source ~/.zshrc
19
- bash:
20
- echo '\\nexport #{PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE}=#{token}' >> ~/.bashrc
21
- source ~/.bashrc
22
- HELLO
23
- puts out
24
- end
25
- @@in_memory_token = token
26
- end
27
-
28
9
  def read(token_env_variable)
29
10
  @@in_memory_token ||= ENV[token_env_variable]
30
11
  end
12
+
31
13
  end
32
14
  end
33
15
  end
34
16
  end
35
-
@@ -1,3 +1,3 @@
1
1
  module PolyglotIos
2
- VERSION = '2.5.1'
2
+ VERSION = '2.6.0'
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.5.1
4
+ version: 2.6.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: 2024-03-15 00:00:00.000000000 Z
11
+ date: 2024-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler