dotcrypt 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.jsonnet +11 -0
- data/Gemfile.lock +5 -19
- data/Rakefile +1 -17
- data/lib/dotcrypt/CLI/commands/exec.rb +2 -2
- data/lib/dotcrypt/CLI/commands/globals.rb +2 -2
- data/lib/dotcrypt/CLI/commands/show.rb +2 -2
- data/lib/dotcrypt/jsonnet.rb +9 -0
- data/lib/dotcrypt/version.rb +1 -1
- data/lib/dotcrypt.rb +26 -4
- metadata +5 -6
- data/.env.dhall +0 -11
- data/lib/dotcrypt/dhall/as_hash.rb +0 -39
- data/lib/dotcrypt/dhall.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b24c31b9acd45de3b473e8479ee752e0392fe34f2e66ee3f6b39759b15bf487
|
4
|
+
data.tar.gz: c54a1ebbee56f32e27f7f0dfb9aad26d8158648abcf6e95e7029035d58798c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43aab882593c8c4820407ec4162156da5ea497c392f7b4d58e3b5d4b60dd623024bc105a61f3070c17de4c431577632b9e80d2c3ed678932050c5aeac399674a
|
7
|
+
data.tar.gz: a119ce9f2d3e7eea65c0d25efb36dab5945b3a6cd3d57a55d3fe99de1f56467634c363f88131b7ef0459acb56527c5dde0d5440f5222a0dd33a571518a251b02
|
data/.env.jsonnet
ADDED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dotcrypt (0.
|
4
|
+
dotcrypt (0.2.0)
|
5
5
|
bootsnap (~> 1.15.0)
|
6
|
-
|
6
|
+
jsonnet (~> 0.5.0)
|
7
7
|
thor (~> 1.2.0)
|
8
8
|
zeitwerk (~> 2.6.0)
|
9
9
|
|
@@ -12,35 +12,23 @@ GEM
|
|
12
12
|
specs:
|
13
13
|
ast (2.4.2)
|
14
14
|
backport (1.2.0)
|
15
|
-
base32 (0.3.4)
|
16
15
|
benchmark (0.2.0)
|
17
16
|
bootsnap (1.15.0)
|
18
17
|
msgpack (~> 1.2)
|
19
|
-
cbor (0.5.9.6)
|
20
18
|
childprocess (4.1.0)
|
21
|
-
citrus (3.0.2)
|
22
|
-
dhall (0.5.5)
|
23
|
-
base32 (~> 0.3.2)
|
24
|
-
cbor (~> 0.5.9.3)
|
25
|
-
citrus (~> 3.0)
|
26
|
-
lazy_object (>= 0.0.1, < 0.2.0)
|
27
|
-
multihashes (~> 0.2.0)
|
28
|
-
promise.rb (~> 0.7.4)
|
29
|
-
value_semantics (~> 3.0)
|
30
19
|
diff-lcs (1.5.0)
|
31
20
|
e2mmap (0.1.0)
|
32
21
|
iniparse (1.5.0)
|
33
22
|
jaro_winkler (1.5.4)
|
34
23
|
json (2.6.2)
|
24
|
+
jsonnet (0.5.2)
|
25
|
+
mini_portile2 (>= 2.2.0)
|
35
26
|
kramdown (2.4.0)
|
36
27
|
rexml
|
37
28
|
kramdown-parser-gfm (1.1.0)
|
38
29
|
kramdown (~> 2.0)
|
39
|
-
|
30
|
+
mini_portile2 (2.8.1)
|
40
31
|
msgpack (1.6.0)
|
41
|
-
multicodecs (0.2.1)
|
42
|
-
multihashes (0.2.0)
|
43
|
-
multicodecs (>= 0.2.0, < 1)
|
44
32
|
nokogiri (1.13.10-x86_64-linux)
|
45
33
|
racc (~> 1.4)
|
46
34
|
overcommit (0.59.1)
|
@@ -50,7 +38,6 @@ GEM
|
|
50
38
|
parallel (1.22.1)
|
51
39
|
parser (3.1.3.0)
|
52
40
|
ast (~> 2.4.1)
|
53
|
-
promise.rb (0.7.4)
|
54
41
|
racc (1.6.2)
|
55
42
|
rainbow (3.1.1)
|
56
43
|
rake (13.0.6)
|
@@ -107,7 +94,6 @@ GEM
|
|
107
94
|
thor (1.2.1)
|
108
95
|
tilt (2.0.11)
|
109
96
|
unicode-display_width (2.3.0)
|
110
|
-
value_semantics (3.6.1)
|
111
97
|
webrick (1.7.0)
|
112
98
|
yard (0.9.28)
|
113
99
|
webrick (~> 1.7.0)
|
data/Rakefile
CHANGED
@@ -9,20 +9,4 @@ require "rubocop/rake_task"
|
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
12
|
-
|
13
|
-
dhall_files = Dir["./**/.*.dhall"] + Dir["./**/*.dhall"]
|
14
|
-
|
15
|
-
def dhall(*args)
|
16
|
-
system("dhall", *args, exception: true)
|
17
|
-
end
|
18
|
-
|
19
|
-
task :check_fmt do
|
20
|
-
dhall("format", "--check", *dhall_files)
|
21
|
-
end
|
22
|
-
|
23
|
-
task :fmt do
|
24
|
-
dhall("format", *dhall_files)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
task default: ["dhall:fmt", :spec, :rubocop]
|
12
|
+
task default: [:spec, :rubocop]
|
@@ -5,7 +5,7 @@ module Dotcrypt::Cli::Commands::Exec
|
|
5
5
|
thor.class_eval do
|
6
6
|
include Dotcrypt::Cli::Commands::Globals
|
7
7
|
|
8
|
-
desc "exec COMMAND", "exec command a command with
|
8
|
+
desc "exec COMMAND", "exec command a command with env"
|
9
9
|
|
10
10
|
def exec(*command) = Handler.new(command, **options).call
|
11
11
|
end
|
@@ -24,7 +24,7 @@ module Dotcrypt::Cli::Commands::Exec
|
|
24
24
|
private
|
25
25
|
|
26
26
|
def env
|
27
|
-
@env ||= Dotcrypt::
|
27
|
+
@env ||= Dotcrypt::Jsonnet.load_from(@options[:file]).then do |c|
|
28
28
|
# TODO: validate variable names
|
29
29
|
Dotcrypt::Flattener.call(c, separator: @options[:separator])
|
30
30
|
end
|
@@ -5,7 +5,7 @@ module Dotcrypt::Cli::Commands::Show
|
|
5
5
|
thor.class_eval do
|
6
6
|
include Dotcrypt::Cli::Commands::Globals
|
7
7
|
|
8
|
-
desc "show", "converts a
|
8
|
+
desc "show", "converts a jsonnet file into various formats"
|
9
9
|
|
10
10
|
option :output, aliases: :o,
|
11
11
|
type: :string,
|
@@ -32,7 +32,7 @@ module Dotcrypt::Cli::Commands::Show
|
|
32
32
|
private
|
33
33
|
|
34
34
|
def config
|
35
|
-
@config ||= Dotcrypt::
|
35
|
+
@config ||= Dotcrypt::Jsonnet.load_from(@options[:file]).then do |c|
|
36
36
|
next Dotcrypt::Flattener.call(c, separator: @options[:separator]) if @options[:flatten]
|
37
37
|
|
38
38
|
c
|
data/lib/dotcrypt/version.rb
CHANGED
data/lib/dotcrypt.rb
CHANGED
@@ -4,7 +4,7 @@ require "json"
|
|
4
4
|
require "yaml"
|
5
5
|
|
6
6
|
require "zeitwerk"
|
7
|
-
require "
|
7
|
+
require "jsonnet"
|
8
8
|
require "thor"
|
9
9
|
|
10
10
|
loader = Zeitwerk::Loader.for_gem
|
@@ -18,8 +18,30 @@ loader.inflector.inflect(
|
|
18
18
|
loader.setup
|
19
19
|
|
20
20
|
module Dotcrypt
|
21
|
-
|
21
|
+
DEFAULT_NAME = ".env.jsonnet"
|
22
|
+
|
23
|
+
class Error < StandardError
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.setup(path: find_dotcrypt)
|
27
|
+
Dotcrypt::Jsonnet.load_from(path).then do |c|
|
28
|
+
Dotcrypt::Flattener.call(c).then do |f|
|
29
|
+
ENV.merge!(f)
|
30
|
+
return f
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.find_dotcrypt
|
36
|
+
dir = Dir.getwd
|
37
|
+
loop do
|
38
|
+
raise ".env.jsonnet is noot found" if dir == "/"
|
39
|
+
|
40
|
+
path = File.join(dir, DEFAULT_NAME)
|
41
|
+
|
42
|
+
return path if File.exist?(path)
|
22
43
|
|
23
|
-
|
24
|
-
|
44
|
+
dir = File.expand_path("..", dir)
|
45
|
+
end
|
46
|
+
end
|
25
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotcrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: jsonnet
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
@@ -74,7 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".env.
|
77
|
+
- ".env.jsonnet"
|
78
78
|
- ".overcommit.yml"
|
79
79
|
- ".rspec"
|
80
80
|
- ".rubocop.yml"
|
@@ -92,9 +92,8 @@ files:
|
|
92
92
|
- lib/dotcrypt/CLI/commands/globals.rb
|
93
93
|
- lib/dotcrypt/CLI/commands/show.rb
|
94
94
|
- lib/dotcrypt/core_ext/hash.rb
|
95
|
-
- lib/dotcrypt/dhall.rb
|
96
|
-
- lib/dotcrypt/dhall/as_hash.rb
|
97
95
|
- lib/dotcrypt/flattener.rb
|
96
|
+
- lib/dotcrypt/jsonnet.rb
|
98
97
|
- lib/dotcrypt/serializers.rb
|
99
98
|
- lib/dotcrypt/serializers/env.rb
|
100
99
|
- lib/dotcrypt/serializers/json.rb
|
data/.env.dhall
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dotcrypt::Dhall::AsHash
|
4
|
-
refine ::Dhall::Record do
|
5
|
-
def as_hash(*)
|
6
|
-
to_h.transform_values(&:as_hash)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
refine ::Dhall::List do
|
11
|
-
def as_hash(*)
|
12
|
-
to_a.map(&:as_hash)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
refine ::Dhall::Text do
|
17
|
-
def as_hash(*)
|
18
|
-
to_s
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
refine ::Dhall::Natural do
|
23
|
-
def as_hash(*)
|
24
|
-
to_i
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
refine ::Dhall::Double do
|
29
|
-
def as_hash(*)
|
30
|
-
to_f
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
refine ::Dhall::Builtins::None do
|
35
|
-
def as_hash(*)
|
36
|
-
nil
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/dotcrypt/dhall.rb
DELETED