arkana 1.0.0 → 1.1.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: 17be699093098399339947f5a8d0df3d5ff20fdb8186cfc9bd92fa1c3aa330d2
4
- data.tar.gz: e7b919f59bf5a491bfa9d4f166753f374a94a33a5023275e5d6d35549a0d1e58
3
+ metadata.gz: 2ccb918551d78aa659307141713f11842178960d452cf2891726412b19e3bdfe
4
+ data.tar.gz: 8b93394d683c3b0edcd2930f271159e6522d1e1bc1c898aa4d89eff018ba7f77
5
5
  SHA512:
6
- metadata.gz: fde3754bfdb500ef9607827f14927ab0e0d678f70ee30398b238d56ba07729d27c967ab890c0b933432898cf8577e6ed3e642ed1ec442a85020c11d54f6d0b0f
7
- data.tar.gz: 83880b13c6eeea494d7b85d5a73fe01cba9834156eb5d5d3a51d5cc9f7030a069e312eb98d3ab017861c67b818fcc9d1abe83de3bfb0850e3ddb520df4e80e07
6
+ metadata.gz: 741f9751ec27c89203d2a922f8502a204a90f5998796dbb3da15d2abdff3de0db45d052c4a716d05dbe3038a88f3a2c64c4a193cff53032276c42f49668f9e73
7
+ data.tar.gz: 8e2df0bfa7662bc6321df6516eee936bc647e447394d945dfd648a3a77c6c722022aedd9bfeb5328d68be042054973b31e4844768f432d53a0faf2e816e0ee8e
@@ -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
3
  require "erb"
4
+ require "fileutils"
4
5
  require_relative "helpers/string"
5
6
 
6
7
  # Responsible for generating Swift source and test files.
@@ -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,27 +1,32 @@
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
 
11
15
  ]
12
16
 
13
17
  static func decode(encoded: [UInt8], cipher: [UInt8]) -> String {
14
- return String(decoding: encoded.enumerated().map { (offset, element) in
18
+ return String(decoding: encoded.enumerated().map { offset, element in
15
19
  element ^ cipher[offset % cipher.count]
16
20
  }, as: UTF8.self)
17
21
  }
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.0"
4
+ VERSION = "1.1.1"
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.0
4
+ version: 1.1.1
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-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize