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 +4 -4
- data/lib/arkana/config_parser.rb +1 -1
- data/lib/arkana/encoder.rb +1 -1
- data/lib/arkana/kotlin_code_generator.rb +12 -7
- data/lib/arkana/models/config.rb +4 -0
- data/lib/arkana/models/template_arguments.rb +1 -1
- data/lib/arkana/salt_generator.rb +1 -1
- data/lib/arkana/swift_code_generator.rb +2 -2
- data/lib/arkana/templates/kotlin/arkana.kt.erb +3 -3
- data/lib/arkana/templates/kotlin/arkana_protocol.kt.erb +2 -2
- data/lib/arkana/templates/kotlin/arkana_tests.kt.erb +2 -2
- data/lib/arkana/templates/kotlin/build_kmp.gradle.kts.erb +28 -0
- data/lib/arkana/templates/swift/arkana.swift.erb +2 -2
- data/lib/arkana/templates/swift/arkana_protocol.swift.erb +2 -2
- data/lib/arkana/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eebedf149a0b63a1a27a4e7c788918a8c213f65af6ea50a33caae5c01361fa7
|
4
|
+
data.tar.gz: 255c72585235c23af030656e44ef212dd6efccf7873fe69aa6af078369529a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df602733de90c8035aa1709b5271f7f6b12cbca6c1fd67a53f6dc1ddc17cdcc6d73f63ee5ed5d6a3040d8cc06c0c3842e724e40a8c50a4799c4d211a1af162ac
|
7
|
+
data.tar.gz: f088cc8cacfed6c9561c3db34fd3a9161624ca29f5c89db1dc50db125e38e22216f06581ad9034824f8611121d03051607ea02b0b99c7ec34645f81bf2820a25
|
data/lib/arkana/config_parser.rb
CHANGED
data/lib/arkana/encoder.rb
CHANGED
@@ -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
|
-
|
13
|
-
|
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
|
-
|
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"))
|
data/lib/arkana/models/config.rb
CHANGED
@@ -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,5 +1,5 @@
|
|
1
|
-
<%
|
2
|
-
<%
|
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.
|
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
|
-
<%
|
2
|
-
<%
|
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
|
-
<%
|
2
|
-
<%
|
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
|
-
<%
|
2
|
-
<%
|
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
|
-
<%
|
2
|
-
<%
|
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
|
|
data/lib/arkana/version.rb
CHANGED
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.
|
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:
|
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.
|
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
|