arkana 1.0.1 → 1.2.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: c806c3bea86dc03a9a4ab1180bb4904ab452db972683343bef5f049044feda45
4
- data.tar.gz: 28fb5b390cc3e231be4fea6c19f7eced9140ab0b9622e8f1e2efd506e8351b8c
3
+ metadata.gz: ea330bc2a7e6d65bb0e28e3053447c512d3145e5b7fe9d5661eede4493deba69
4
+ data.tar.gz: a3cf5a8223ebbfd219a95c97e65f8ed0a81a6628ebd7b61032ba67f41d0a2826
5
5
  SHA512:
6
- metadata.gz: b0cacc87a69e46464706d05b402a28d0a1fe6d7bcc2daa8e4c27fc6ef871cd18e0cbd062d8584eb84924a720d3a21db4b68a16a7c41307003cb8233954b37a10
7
- data.tar.gz: 914f4a31212fecede128a68f602b777e16128dcd4305de2319fd80a0b6c1c782b20902cbf7b43d534df47782a3a43a29ce4915c5e6961a4a45c0c510db0da3d1
6
+ metadata.gz: b63c03ce224ee7d0519447625406ccadd19e20f7fff8933ce51017a5f767459b131d5894dbcceba40d60b0c383ca5494be566a6114bdb7a3e1a059836daf0f64
7
+ data.tar.gz: 4117a49c4df94c33007045198e7b30209a89433e13efb730b21c674c5f722bebc55212bf5eea6f0442db7e19e8b079b1cac320666db58b34a6eb72b06db81ec3
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "arkana/helpers/string"
4
+ require "arkana/helpers/enumerable"
4
5
 
5
6
  # The encoder is responsible for finding the env vars for given keys, encoding them, and creating Secrets based on the generated data.
6
7
  module Encoder
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Enumerable extensions and utilities.
4
+ module Enumerable
5
+ # NOTE: This is a backport of Ruby 2.7 filter_map. This method can be deleted when the minimum target Ruby version is 2.7
6
+ # We're not gating against redefining the method (e.g. via `unless Enumerable.method_defined? :filter_map`) because this
7
+ # would reduce the code coverage when analysing code coverage on Ruby versions >= 2.7
8
+ def filter_map
9
+ return to_enum(:filter_map) unless block_given?
10
+
11
+ each_with_object([]) do |item, res|
12
+ processed = yield(item)
13
+ res << processed if processed
14
+ end
15
+ end
16
+ end
@@ -9,4 +9,12 @@ module SwiftTemplateHelper
9
9
  else raise "Unknown variable type '#{type}' received.'"
10
10
  end
11
11
  end
12
+
13
+ def self.protocol_getter(declaration_strategy)
14
+ case declaration_strategy
15
+ when "lazy var" then "mutating get"
16
+ when "var", "let" then "get"
17
+ else raise "Unknown declaration strategy '#{declaration_strategy}' received.'"
18
+ end
19
+ end
12
20
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This file was autogenerated by Arkana. Do not attempt to modify it.
3
+ # DO NOT MODIFY
4
+ # Automatically generated by Arkana (https://github.com/rogerluan/arkana)
4
5
 
5
6
  Pod::Spec.new do |spec|
6
7
  spec.name = '<%= @pod_name %>'
@@ -12,4 +13,6 @@ Pod::Spec.new do |spec|
12
13
  spec.source_files = 'Sources/**/*.swift'
13
14
  spec.ios.deployment_target = '11.0'
14
15
  spec.swift_version = '5.0'
16
+
17
+ spec.dependency '<%= @pod_name %>Interfaces', '~> 1.0.0'
15
18
  end
@@ -1,10 +1,14 @@
1
1
  <% require 'arkana/helpers/string' %>
2
2
  <% require 'arkana/helpers/swift_template_helper' %>
3
3
  <% # TODO: Sort these import statements alphabetically %>
4
+ // DO NOT MODIFY
5
+ // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
6
+
4
7
  import Foundation
5
8
  import <%= @import_name %>Interfaces
6
9
 
7
10
  public enum <%= @namespace %> {
11
+ @inline(__always)
8
12
  fileprivate static let salt: [UInt8] = [
9
13
  <%= @salt.formatted %>
10
14
 
@@ -18,10 +22,11 @@ public enum <%= @namespace %> {
18
22
  }
19
23
 
20
24
  public extension <%= @namespace %> {
21
- struct Global: <%= @import_name %>GlobalProtocol {
25
+ struct Global: <%= @namespace %>GlobalProtocol {
22
26
  public init() {}
23
27
  <% for secret in @global_secrets %>
24
28
 
29
+ @inline(__always)
25
30
  public <%= @swift_declaration_strategy %> <%= secret.key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> = {
26
31
  let encoded: [UInt8] = [
27
32
  <%= secret.encoded_value %>
@@ -35,10 +40,11 @@ public extension <%= @namespace %> {
35
40
 
36
41
  <% for environment in @environments %>
37
42
  public extension <%= @namespace %> {
38
- struct <%= environment %>: <%= @import_name %>EnvironmentProtocol {
43
+ struct <%= environment %>: <%= @namespace %>EnvironmentProtocol {
39
44
  public init() {}
40
45
  <% for secret in environment_protocol_secrets(environment) %>
41
46
 
47
+ @inline(__always)
42
48
  public <%= @swift_declaration_strategy %> <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> = {
43
49
  let encoded: [UInt8] = [
44
50
  <%= secret.encoded_value %>
@@ -1,15 +1,18 @@
1
1
  <% require 'arkana/helpers/string' %>
2
2
  <% require 'arkana/helpers/swift_template_helper' %>
3
+ // DO NOT MODIFY
4
+ // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
5
+
3
6
  import Foundation
4
7
 
5
8
  public protocol <%= @namespace %>GlobalProtocol {
6
9
  <% for secret in @global_secrets %>
7
- var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { get }
10
+ var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { <%= SwiftTemplateHelper.protocol_getter(@swift_declaration_strategy) %> }
8
11
  <% end %>
9
12
  }
10
13
 
11
14
  public protocol <%= @namespace %>EnvironmentProtocol {
12
15
  <% for secret in @environment_secrets.uniq(&:protocol_key) %>
13
- var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { get }
16
+ var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { <%= SwiftTemplateHelper.protocol_getter(@swift_declaration_strategy) %> }
14
17
  <% end %>
15
18
  }
@@ -1,3 +1,6 @@
1
+ // DO NOT MODIFY
2
+ // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
3
+
1
4
  import Foundation
2
5
  import XCTest
3
6
  @testable import <%= @import_name %>
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This file was autogenerated by Arkana. Do not attempt to modify it.
3
+ # DO NOT MODIFY
4
+ # Automatically generated by Arkana (https://github.com/rogerluan/arkana)
4
5
 
5
6
  Pod::Spec.new do |spec|
6
7
  spec.name = '<%= @pod_name %>Interfaces'
@@ -1,6 +1,7 @@
1
1
  // swift-tools-version: 5.6
2
2
 
3
- // This file was autogenerated by Arkana. Do not attempt to modify it.
3
+ // DO NOT MODIFY
4
+ // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
4
5
 
5
6
  import PackageDescription
6
7
 
@@ -1,6 +1,7 @@
1
1
  // swift-tools-version: 5.6
2
2
 
3
- // This file was autogenerated by Arkana. Do not attempt to modify it.
3
+ // DO NOT MODIFY
4
+ // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
4
5
 
5
6
  import PackageDescription
6
7
 
@@ -25,12 +26,12 @@ let package = Package(
25
26
  dependencies: ["<%= @import_name %>Interfaces"],
26
27
  path: "Sources"
27
28
  ),
28
- <% if @should_generate_unit_tests %>
29
+ <% if @should_generate_unit_tests %>
29
30
  .testTarget(
30
31
  name: "<%= @import_name %>Tests",
31
32
  dependencies: ["<%= @import_name %>"],
32
33
  path: "Tests"
33
34
  ),
34
- <% end %>
35
+ <% end %>
35
36
  ]
36
37
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arkana
4
- VERSION = "1.0.1"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Oba
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-03 00:00:00.000000000 Z
11
+ date: 2022-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.2'
55
- description:
55
+ description:
56
56
  email:
57
57
  - rogerluan.oba@gmail.com
58
58
  executables:
@@ -67,6 +67,7 @@ files:
67
67
  - lib/arkana/config_parser.rb
68
68
  - lib/arkana/encoder.rb
69
69
  - lib/arkana/helpers/dotenv_helper.rb
70
+ - lib/arkana/helpers/enumerable.rb
70
71
  - lib/arkana/helpers/string.rb
71
72
  - lib/arkana/helpers/swift_template_helper.rb
72
73
  - lib/arkana/helpers/ui.rb
@@ -96,7 +97,7 @@ metadata:
96
97
  source_code_uri: https://github.com/rogerluan/arkana
97
98
  changelog_uri: https://github.com/rogerluan/arkana/blob/main/CHANGELOG.md
98
99
  rubygems_mfa_required: 'true'
99
- post_install_message:
100
+ post_install_message:
100
101
  rdoc_options: []
101
102
  require_paths:
102
103
  - lib
@@ -104,15 +105,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
105
  requirements:
105
106
  - - ">="
106
107
  - !ruby/object:Gem::Version
107
- version: 2.7.0
108
+ version: 2.6.9
108
109
  required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  requirements:
110
111
  - - ">="
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0'
113
114
  requirements: []
114
- rubygems_version: 3.1.6
115
- signing_key:
115
+ rubygems_version: 3.3.7
116
+ signing_key:
116
117
  specification_version: 4
117
118
  summary: Store your keys and secrets away from your source code. Designed for Android
118
119
  and iOS projects.