k_director 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +8 -1
- data/lib/k_director/dsls/children/blueprint.rb +58 -0
- data/lib/k_director/version.rb +1 -1
- data/lib/k_director.rb +1 -0
- 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: 98141965627ac652ecf0fea204874feaf97f6300d041257d85b3fab4e3e840d4
|
4
|
+
data.tar.gz: cdacf1b080b8d05759aed30e7ec752d8216aafd8ae2acf7c960cb1eea514dc6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d68c2ad216eb2b02aa7009d102a5e279ae8a18462c25c116b0736e2efe7c05991b9ff69216fec5a20b3073a2fb6703cef6a9bea3f4db05c6fc2dc47b4282dafe
|
7
|
+
data.tar.gz: d772867a03777163df1a034c55238a263974d9786b4849995c86945e41c8b136d77ffa296605b6c394b80d7c47c0e0528380f47d8576a65052353a7d23a6a005
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.2.0](https://github.com/klueless-io/k_director/compare/v0.1.2...v0.2.0) (2022-01-27)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add BaseDirector and ChildDirector ([d32265a](https://github.com/klueless-io/k_director/commit/d32265a1e46811bde6bdfbef4b8c9dc8602a8f88))
|
7
|
+
|
1
8
|
## [0.1.2](https://github.com/klueless-io/k_director/compare/v0.1.1...v0.1.2) (2022-01-26)
|
2
9
|
|
3
10
|
|
@@ -10,4 +17,4 @@
|
|
10
17
|
|
11
18
|
### Feature
|
12
19
|
|
13
|
-
* add dom and action builder ([a61e841](https://github.com/klueless-io/k_director/commit/a61e841a40f544f4751e4aaa012d60a447d2dfab))
|
20
|
+
* add dom and action builder ([a61e841](https://github.com/klueless-io/k_director/commit/a61e841a40f544f4751e4aaa012d60a447d2dfab))
|
@@ -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/lib/k_director.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative 'k_director/builders/dom_builder'
|
|
9
9
|
require_relative 'k_director/builders/actions_builder'
|
10
10
|
require_relative 'k_director/directors/base_director'
|
11
11
|
require_relative 'k_director/directors/child_director'
|
12
|
+
require_relative 'k_director/dsls/children/blueprint'
|
12
13
|
|
13
14
|
module KDirector
|
14
15
|
# raise KDirector::Error, 'Sample message'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "k_director",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.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.3.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.3.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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: k_log
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/k_director/builders/dom_builder.rb
|
94
94
|
- lib/k_director/directors/base_director.rb
|
95
95
|
- lib/k_director/directors/child_director.rb
|
96
|
+
- lib/k_director/dsls/children/blueprint.rb
|
96
97
|
- lib/k_director/version.rb
|
97
98
|
- package-lock.json
|
98
99
|
- package.json
|