ruby_vault 0.1.0.pre.2 → 0.1.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ruby_vault/options/definitions.rb +7 -0
- data/lib/ruby_vault/options/factory.rb +27 -0
- data/lib/ruby_vault/options/name.rb +37 -0
- data/lib/ruby_vault/options.rb +10 -0
- data/lib/ruby_vault/version.rb +1 -1
- data/lib/ruby_vault.rb +37 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e8aadca9a6285c7decb702603d6a0ef61aa6b644a46c236ac96ce3ad9a6310
|
4
|
+
data.tar.gz: 8bff21c678170fb4187d171c859756cec283e3d546d0b1ae3a02248f76d6393a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81c23a4e58bb4954f769c3dda63196fa7af0b06736cbf79f566cd1b88555eb31a55f2635a3d8961067d265bc8245350bb8e4f513d5a3479d6d4c3aa8439fd74b
|
7
|
+
data.tar.gz: 209e56bdf568f52332287e19c9190694995482a35c1fa5c79186f81e3fe920edad50cbd2bbdf2bd4499f7c9c1417b9e805f1e99495e4307665daa35c8203be2e
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'name'
|
4
|
+
|
5
|
+
module RubyVault
|
6
|
+
module Options
|
7
|
+
class Factory
|
8
|
+
def initialize(definitions)
|
9
|
+
@definitions = definitions
|
10
|
+
end
|
11
|
+
|
12
|
+
def resolve(names, parameters)
|
13
|
+
names
|
14
|
+
.map { |name| Name.new(name) }
|
15
|
+
.inject([]) do |options, name|
|
16
|
+
options + resolve_name(name, parameters)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def resolve_name(name, parameters)
|
23
|
+
@definitions.find { |d| d.matches?(name) }.build(parameters)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'immutable-struct'
|
4
|
+
|
5
|
+
module RubyVault
|
6
|
+
module Options
|
7
|
+
class Name < ImmutableStruct.new(:name)
|
8
|
+
def initialize(name)
|
9
|
+
super(name: name.to_s)
|
10
|
+
end
|
11
|
+
|
12
|
+
def name
|
13
|
+
"-#{without_prefix}"
|
14
|
+
end
|
15
|
+
|
16
|
+
alias to_s name
|
17
|
+
|
18
|
+
def as_singular_key
|
19
|
+
snake_case.to_sym
|
20
|
+
end
|
21
|
+
|
22
|
+
def as_plural_key
|
23
|
+
"#{snake_case}s".to_sym
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def without_prefix
|
29
|
+
@name.sub(/^-+/, '')
|
30
|
+
end
|
31
|
+
|
32
|
+
def snake_case
|
33
|
+
without_prefix.gsub('-', '_')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/ruby_vault/version.rb
CHANGED
data/lib/ruby_vault.rb
CHANGED
@@ -1,3 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'ruby_vault/options'
|
3
4
|
require 'ruby_vault/version'
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
module RubyVault
|
8
|
+
class << self
|
9
|
+
def configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset!
|
14
|
+
@configuration = nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Configuration
|
19
|
+
attr_accessor :binary, :logger, :options, :stdin, :stdout, :stderr
|
20
|
+
|
21
|
+
def default_logger
|
22
|
+
logger = Logger.new($stdout)
|
23
|
+
logger.level = Logger::INFO
|
24
|
+
logger
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_options
|
28
|
+
Options::Factory.new(Options::DEFINITIONS)
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
@binary = 'terraform'
|
33
|
+
@logger = default_logger
|
34
|
+
@options = default_options
|
35
|
+
@stdin = ''
|
36
|
+
@stdout = $stdout
|
37
|
+
@stderr = $stderr
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_vault
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- InfraBlocks Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: immutable-struct
|
@@ -279,6 +279,10 @@ files:
|
|
279
279
|
- bin/console
|
280
280
|
- bin/setup
|
281
281
|
- lib/ruby_vault.rb
|
282
|
+
- lib/ruby_vault/options.rb
|
283
|
+
- lib/ruby_vault/options/definitions.rb
|
284
|
+
- lib/ruby_vault/options/factory.rb
|
285
|
+
- lib/ruby_vault/options/name.rb
|
282
286
|
- lib/ruby_vault/version.rb
|
283
287
|
- ruby_vault.gemspec
|
284
288
|
homepage: https://github.com/infrablocks/ruby_vault
|