arkana 2.0.0 → 2.1.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: 191140e1234c08e36b1d1bb3591bac7b77041edd8b7e00565f15480fd47bfe81
4
- data.tar.gz: 8dd30c6bd576db0cd779b3f645cb9ec15541f5189dd71bd461c2f8895334a6e3
3
+ metadata.gz: 0eebedf149a0b63a1a27a4e7c788918a8c213f65af6ea50a33caae5c01361fa7
4
+ data.tar.gz: 255c72585235c23af030656e44ef212dd6efccf7873fe69aa6af078369529a64
5
5
  SHA512:
6
- metadata.gz: a79924122cac3f3a32e471f49218ff85227fab2898821e56436a32d6c8e7e6d8cea1af20538e71eb010383ac47cef7266964ccc1a9251ee058538227ae5a9a2d
7
- data.tar.gz: dc8a20dfe2d1650cc14e1d3e8d24733229a795f8b6471272ff8d67cdaf72fd453925ea50d35d86386dfb1419c05fbf8910b8a7dbacbce4d80febed50883465cc
6
+ metadata.gz: df602733de90c8035aa1709b5271f7f6b12cbca6c1fd67a53f6dc1ddc17cdcc6d73f63ee5ed5d6a3040d8cc06c0c3842e724e40a8c50a4799c4d211a1af162ac
7
+ data.tar.gz: f088cc8cacfed6c9561c3db34fd3a9161624ca29f5c89db1dc50db125e38e22216f06581ad9034824f8611121d03051607ea02b0b99c7ec34645f81bf2820a25
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "yaml"
3
+ require "yaml" unless defined?(YAML)
4
4
  require_relative "models/config"
5
5
  require_relative "helpers/ui"
6
6
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "arkana/helpers/string"
3
+ require_relative "helpers/string"
4
4
 
5
5
  # The encoder is responsible for finding the env vars for given keys, encoding them, and creating Secrets based on the generated data.
6
6
  module Encoder
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "erb"
4
- require "fileutils"
3
+ require "erb" unless defined?(Erb)
4
+ require "fileutils" unless defined?(FileUtils)
5
5
  require_relative "helpers/string"
6
6
 
7
7
  # Responsible for generating Kotlin source and test files.
@@ -9,22 +9,27 @@ module KotlinCodeGenerator
9
9
  # Generates Kotlin code and test files for the given template arguments.
10
10
  def self.generate(template_arguments:, config:)
11
11
  kotlin_module_dir = config.result_path
12
- kotlin_sources_dir = File.join(kotlin_module_dir, "src", "main", config.kotlin_sources_path, config.kotlin_package_name.split("."))
13
- kotlin_tests_dir = File.join(kotlin_module_dir, "src", "test", config.kotlin_sources_path, config.kotlin_package_name.split("."))
12
+
13
+ source_set = config.is_kotlin_multiplatform_module ? "commonMain" : "main"
14
+ test_set = config.is_kotlin_multiplatform_module ? "commonTest" : "test"
15
+
16
+ kotlin_sources_dir = File.join(kotlin_module_dir, "src", source_set, config.kotlin_sources_path, config.kotlin_package_name.split("."))
17
+ kotlin_tests_dir = File.join(kotlin_module_dir, "src", test_set, config.kotlin_sources_path, config.kotlin_package_name.split("."))
14
18
 
15
19
  if config.should_generate_gradle_build_file
16
- set_up_kotlin_module(kotlin_module_dir, template_arguments)
20
+ set_up_kotlin_module(kotlin_module_dir, template_arguments, config)
17
21
  end
18
22
 
19
23
  set_up_kotlin_interfaces(kotlin_sources_dir, template_arguments, config)
20
24
  set_up_kotlin_classes(kotlin_sources_dir, kotlin_tests_dir, template_arguments, config)
21
25
  end
22
26
 
23
- def self.set_up_kotlin_module(path, template_arguments)
27
+ def self.set_up_kotlin_module(path, template_arguments, config)
24
28
  dirname = File.dirname(__FILE__)
25
29
  sources_dir = path
26
30
  readme_template = File.read("#{dirname}/templates/readme.erb")
27
- source_template = File.read("#{dirname}/templates/kotlin/build.gradle.kts.erb")
31
+ gradle_template_file = config.is_kotlin_multiplatform_module ? "build_kmp.gradle.kts.erb" : "build.gradle.kts.erb"
32
+ source_template = File.read("#{dirname}/templates/kotlin/#{gradle_template_file}")
28
33
  FileUtils.mkdir_p(path)
29
34
  render(readme_template, template_arguments, File.join(path, "README.md"))
30
35
  render(source_template, template_arguments, File.join(sources_dir, "build.gradle.kts"))
@@ -34,6 +34,8 @@ class Config
34
34
  attr_reader :should_generate_gradle_build_file
35
35
  # @returns [int]
36
36
  attr_reader :kotlin_jvm_toolchain_version
37
+ # @returns [boolean]
38
+ attr_reader :is_kotlin_multiplatform_module
37
39
 
38
40
  # @returns [string]
39
41
  attr_accessor :current_flavor
@@ -64,6 +66,8 @@ class Config
64
66
  @should_generate_gradle_build_file = yaml["should_generate_gradle_build_file"]
65
67
  @should_generate_gradle_build_file = true if @should_generate_gradle_build_file.nil?
66
68
  @kotlin_jvm_toolchain_version = yaml["kotlin_jvm_toolchain_version"] || 11
69
+ @is_kotlin_multiplatform_module = yaml["is_kotlin_multiplatform_module"]
70
+ @is_kotlin_multiplatform_module = false if @should_generate_gradle_build_file.nil?
67
71
  end
68
72
  # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
69
73
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "arkana/models/secret"
3
+ require_relative "secret"
4
4
 
5
5
  # A class that defines template arguments in a language-agnostic form.
6
6
  class TemplateArguments
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "securerandom"
3
+ require "securerandom" unless defined?(SecureRandom)
4
4
  require_relative "models/salt"
5
5
 
6
6
  # Responsible for generating the salt.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "erb"
4
- require "fileutils"
3
+ require "erb" unless defined?(Erb)
4
+ require "fileutils" unless defined?(FileUtils)
5
5
  require_relative "helpers/string"
6
6
 
7
7
  # Responsible for generating Swift source and test files.
@@ -1,5 +1,5 @@
1
- <% require "arkana/helpers/string" %>
2
- <% require "arkana/helpers/kotlin_template_helper" %>
1
+ <% require_relative "lib/arkana/helpers/string" %>
2
+ <% require_relative "lib/arkana/helpers/kotlin_template_helper" %>
3
3
  <% # TODO: Sort these import statements alphabetically %>
4
4
  // DO NOT MODIFY
5
5
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
@@ -13,7 +13,7 @@ object <%= @namespace %> {
13
13
  val decoded = encoded.mapIndexed { index, item ->
14
14
  (item xor cipher[(index % cipher.size)]).toByte()
15
15
  }.toByteArray()
16
- return decoded.toString(Charsets.UTF_8)
16
+ return decoded.decodeToString()
17
17
  }
18
18
 
19
19
  internal fun decodeInt(encoded: List<Int>, cipher: List<Int>): Int {
@@ -1,5 +1,5 @@
1
- <% require "arkana/helpers/string" %>
2
- <% require "arkana/helpers/kotlin_template_helper" %>
1
+ <% require_relative "lib/arkana/helpers/string" %>
2
+ <% require_relative "lib/arkana/helpers/kotlin_template_helper" %>
3
3
  // DO NOT MODIFY
4
4
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
5
5
  package <%= @kotlin_package_name %>
@@ -1,5 +1,5 @@
1
- <% require "arkana/helpers/string" %>
2
- <% require "arkana/helpers/kotlin_template_helper" %>
1
+ <% require_relative "lib/arkana/helpers/string" %>
2
+ <% require_relative "lib/arkana/helpers/kotlin_template_helper" %>
3
3
  // DO NOT MODIFY
4
4
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
5
5
  package <%= @kotlin_package_name %>
@@ -0,0 +1,28 @@
1
+ // DO NOT MODIFY
2
+ // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
3
+
4
+ plugins {
5
+ id("org.jetbrains.kotlin.multiplatform")
6
+ }
7
+
8
+ kotlin {
9
+ jvm()
10
+ iosX64()
11
+ iosArm64()
12
+ iosSimulatorArm64()
13
+ linuxX64()
14
+ js {
15
+ browser()
16
+ nodejs()
17
+ }
18
+
19
+ sourceSets {
20
+ val commonTest by getting {
21
+ dependencies {
22
+ implementation(kotlin("test"))
23
+ }
24
+ }
25
+ }
26
+
27
+ jvmToolchain(<%= @kotlin_jvm_toolchain_version %>)
28
+ }
@@ -1,5 +1,5 @@
1
- <% require "arkana/helpers/string" %>
2
- <% require "arkana/helpers/swift_template_helper" %>
1
+ <% require_relative "lib/arkana/helpers/string" %>
2
+ <% require_relative "lib/arkana/helpers/swift_template_helper" %>
3
3
  <% # TODO: Sort these import statements alphabetically %>
4
4
  // DO NOT MODIFY
5
5
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
@@ -1,5 +1,5 @@
1
- <% require "arkana/helpers/string" %>
2
- <% require "arkana/helpers/swift_template_helper" %>
1
+ <% require_relative "lib/arkana/helpers/string" %>
2
+ <% require_relative "lib/arkana/helpers/swift_template_helper" %>
3
3
  // DO NOT MODIFY
4
4
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
5
5
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arkana
4
- VERSION = "2.0.0"
4
+ VERSION = "2.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: 2.0.0
4
+ version: 2.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: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2024-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -84,6 +84,7 @@ files:
84
84
  - lib/arkana/templates/kotlin/arkana_protocol.kt.erb
85
85
  - lib/arkana/templates/kotlin/arkana_tests.kt.erb
86
86
  - lib/arkana/templates/kotlin/build.gradle.kts.erb
87
+ - lib/arkana/templates/kotlin/build_kmp.gradle.kts.erb
87
88
  - lib/arkana/templates/readme.erb
88
89
  - lib/arkana/templates/swift/arkana.podspec.erb
89
90
  - lib/arkana/templates/swift/arkana.swift.erb
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.4.10
121
+ rubygems_version: 3.5.3
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: Store your keys and secrets away from your source code. Designed for Android