arkana 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c806c3bea86dc03a9a4ab1180bb4904ab452db972683343bef5f049044feda45
4
- data.tar.gz: 28fb5b390cc3e231be4fea6c19f7eced9140ab0b9622e8f1e2efd506e8351b8c
3
+ metadata.gz: 5f21dca107c8705dd68f62e1ebc9f726b2cff328915fc70f6d9f8eb0a488ea42
4
+ data.tar.gz: 62bdbaeed35fbc9b1e696916627aaf5d7a4b28ad74e547fe62837f1bcd895d07
5
5
  SHA512:
6
- metadata.gz: b0cacc87a69e46464706d05b402a28d0a1fe6d7bcc2daa8e4c27fc6ef871cd18e0cbd062d8584eb84924a720d3a21db4b68a16a7c41307003cb8233954b37a10
7
- data.tar.gz: 914f4a31212fecede128a68f602b777e16128dcd4305de2319fd80a0b6c1c782b20902cbf7b43d534df47782a3a43a29ce4915c5e6961a4a45c0c510db0da3d1
6
+ metadata.gz: fcb406e5b832dadbfbf465f493225b784304a2d7e10d56f9a8802414f953a6af00a44509d029f21809d9308382979560557f703c23d803c1bb9f1b06ae726f6f
7
+ data.tar.gz: 2eb298ec9f709f7b2928b297834a474a63a29d1fa65ec4fbd422c71d4881e9c06fc2777cb4c66fe00b44811b17908e5f12fabb47b111d917210b2e8007a2ffb5
@@ -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
@@ -5,6 +5,7 @@ import Foundation
5
5
  import <%= @import_name %>Interfaces
6
6
 
7
7
  public enum <%= @namespace %> {
8
+ @inline(__always)
8
9
  fileprivate static let salt: [UInt8] = [
9
10
  <%= @salt.formatted %>
10
11
 
@@ -18,10 +19,11 @@ public enum <%= @namespace %> {
18
19
  }
19
20
 
20
21
  public extension <%= @namespace %> {
21
- struct Global: <%= @import_name %>GlobalProtocol {
22
+ struct Global: <%= @namespace %>GlobalProtocol {
22
23
  public init() {}
23
24
  <% for secret in @global_secrets %>
24
25
 
26
+ @inline(__always)
25
27
  public <%= @swift_declaration_strategy %> <%= secret.key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> = {
26
28
  let encoded: [UInt8] = [
27
29
  <%= secret.encoded_value %>
@@ -35,10 +37,11 @@ public extension <%= @namespace %> {
35
37
 
36
38
  <% for environment in @environments %>
37
39
  public extension <%= @namespace %> {
38
- struct <%= environment %>: <%= @import_name %>EnvironmentProtocol {
40
+ struct <%= environment %>: <%= @namespace %>EnvironmentProtocol {
39
41
  public init() {}
40
42
  <% for secret in environment_protocol_secrets(environment) %>
41
43
 
44
+ @inline(__always)
42
45
  public <%= @swift_declaration_strategy %> <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> = {
43
46
  let encoded: [UInt8] = [
44
47
  <%= secret.encoded_value %>
@@ -4,12 +4,12 @@ import Foundation
4
4
 
5
5
  public protocol <%= @namespace %>GlobalProtocol {
6
6
  <% for secret in @global_secrets %>
7
- var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { get }
7
+ var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { <%= SwiftTemplateHelper.protocol_getter(@swift_declaration_strategy) %> }
8
8
  <% end %>
9
9
  }
10
10
 
11
11
  public protocol <%= @namespace %>EnvironmentProtocol {
12
12
  <% for secret in @environment_secrets.uniq(&:protocol_key) %>
13
- var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { get }
13
+ var <%= secret.protocol_key.camel_case %>: <%= SwiftTemplateHelper.swift_type(secret.type) %> { <%= SwiftTemplateHelper.protocol_getter(@swift_declaration_strategy) %> }
14
14
  <% end %>
15
15
  }
@@ -25,12 +25,12 @@ let package = Package(
25
25
  dependencies: ["<%= @import_name %>Interfaces"],
26
26
  path: "Sources"
27
27
  ),
28
- <% if @should_generate_unit_tests %>
28
+ <% if @should_generate_unit_tests %>
29
29
  .testTarget(
30
30
  name: "<%= @import_name %>Tests",
31
31
  dependencies: ["<%= @import_name %>"],
32
32
  path: "Tests"
33
33
  ),
34
- <% end %>
34
+ <% end %>
35
35
  ]
36
36
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arkana
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.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.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Oba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-03 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize