k_director 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +7 -0
- data/lib/k_director/builders/actions_builder.rb +16 -1
- data/lib/k_director/directors/base_director.rb +0 -3
- data/lib/k_director/directors/data.rb +58 -0
- data/lib/k_director/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0208f9ecd1fa6a0a1a649266a9a6a823e7db688c632e9f79681c9386d6a4a3fb'
|
4
|
+
data.tar.gz: '08140ee775462704f34ade6c236000ed615e877007b9fc1d48dc748de222c72b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49321aaf3a58a70ea34e0668cfe89e91ff069bffa2301cd90b51ab64a446b41d69dc2501f2d3cea469d47f8af31f57965840b664f55bad79e14321bbcefd436e
|
7
|
+
data.tar.gz: 04d83e5f3b8d1f8d89ea07eba68b393836a13d8e0876069d38017d1001fe5bd02f1e68803e208f3e020d783eabd5a3280fa673e5784f5ca7f5816f4eb795369e
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.4.1](https://github.com/klueless-io/k_director/compare/v0.4.0...v0.4.1) (2022-01-30)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* refactor dom builder with set/add supporting key hierarchies ([8fee48d](https://github.com/klueless-io/k_director/commit/8fee48d12dfb37210ed87d0fb22222bd2db3da28))
|
7
|
+
|
1
8
|
# [0.4.0](https://github.com/klueless-io/k_director/compare/v0.3.0...v0.4.0) (2022-01-29)
|
2
9
|
|
3
10
|
|
@@ -23,6 +23,16 @@ module KDirector
|
|
23
23
|
@last_action = action
|
24
24
|
end
|
25
25
|
|
26
|
+
# Set many key/value pairs gainst a group
|
27
|
+
#
|
28
|
+
# example:
|
29
|
+
# set_many(:github, { repo_name: 'repo-name', organization: 'org-name' })
|
30
|
+
def group_set(group, **opts)
|
31
|
+
opts.each do |key, value|
|
32
|
+
set(group, key, value)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
26
36
|
# set key_set/value pair, can be used for
|
27
37
|
#
|
28
38
|
# - simple key/value pairs
|
@@ -47,6 +57,10 @@ module KDirector
|
|
47
57
|
end
|
48
58
|
|
49
59
|
# add value to array
|
60
|
+
# set(:a, [])
|
61
|
+
# add(:a, 1])
|
62
|
+
# add(:a, 2])
|
63
|
+
# add(:a, 3])
|
50
64
|
def add(*keyset_value, default_value: nil)
|
51
65
|
size = keyset_value.size
|
52
66
|
|
@@ -58,7 +72,8 @@ module KDirector
|
|
58
72
|
end
|
59
73
|
|
60
74
|
def debug
|
61
|
-
puts JSON.pretty_generate(
|
75
|
+
puts JSON.pretty_generate(actions)
|
76
|
+
# puts JSON.pretty_generate(dom)
|
62
77
|
# log.structure(dom)
|
63
78
|
|
64
79
|
self
|
@@ -24,7 +24,6 @@ module KDirector
|
|
24
24
|
attr_reader :options
|
25
25
|
|
26
26
|
def initialize(k_builder, builder, **opts)
|
27
|
-
@index = 1
|
28
27
|
@k_builder = k_builder
|
29
28
|
@builder = builder
|
30
29
|
@options = OpenStruct.new(**opts)
|
@@ -36,8 +35,6 @@ module KDirector
|
|
36
35
|
end
|
37
36
|
|
38
37
|
def dom
|
39
|
-
@index += 1
|
40
|
-
puts "dom#{@index}"
|
41
38
|
builder.dom
|
42
39
|
end
|
43
40
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KDirector
|
4
|
+
module Dsls
|
5
|
+
module Children
|
6
|
+
# Blueprint DSL is used to add files to the target folder.
|
7
|
+
#
|
8
|
+
# A blueprint is a recipe that you can follow to build out assets on the target application
|
9
|
+
class Blueprint < KDirector::Directors::ChildDirector
|
10
|
+
# Add a single file into the code base
|
11
|
+
#
|
12
|
+
# @param [String] output_filename The output file name, this can be a relative path
|
13
|
+
# @param [Hash] **opts The options
|
14
|
+
# @option opts [String] :template_filename Template filename can be set or it will default to the same value as the output file name
|
15
|
+
# @option opts [String] :template_subfolder Template subfolder
|
16
|
+
def add(output_file, **opts)
|
17
|
+
template_file = opts[:template_file] || output_file
|
18
|
+
template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
|
19
|
+
template_path = File.join(*template_parts)
|
20
|
+
|
21
|
+
# maybe template_file should be renamed to template_path in k_builder
|
22
|
+
opts[:template_file] = template_path
|
23
|
+
|
24
|
+
add_file(output_file, **opts)
|
25
|
+
end
|
26
|
+
|
27
|
+
def oadd(name, **opts)
|
28
|
+
add(name, **{ open: true }.merge(opts))
|
29
|
+
end
|
30
|
+
|
31
|
+
def tadd(name, **opts)
|
32
|
+
add(name, **{ open_template: true }.merge(opts))
|
33
|
+
end
|
34
|
+
|
35
|
+
def fadd(name, **opts)
|
36
|
+
add(name, **{ on_exist: :write }.merge(opts))
|
37
|
+
end
|
38
|
+
|
39
|
+
# def template_content(template_file, **opts)
|
40
|
+
# template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
|
41
|
+
# template_file = File.join(*template_parts)
|
42
|
+
|
43
|
+
# file = k_builder.find_template_file(template_file)
|
44
|
+
# File.read(file)
|
45
|
+
# end
|
46
|
+
|
47
|
+
def run_template_script(template_file, **opts)
|
48
|
+
template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
|
49
|
+
template_path = File.join(*template_parts)
|
50
|
+
|
51
|
+
script = k_builder.process_any_content(template_file: template_path, **opts)
|
52
|
+
|
53
|
+
run_script(script)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/k_director/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "k_director",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "k_director",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.5.0",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_director
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: k_log
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/k_director/builders/actions_builder.rb
|
89
89
|
- lib/k_director/directors/base_director.rb
|
90
90
|
- lib/k_director/directors/child_director.rb
|
91
|
+
- lib/k_director/directors/data.rb
|
91
92
|
- lib/k_director/dsls/children/blueprint.rb
|
92
93
|
- lib/k_director/dsls/children/github.rb
|
93
94
|
- lib/k_director/version.rb
|