k_director 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0208f9ecd1fa6a0a1a649266a9a6a823e7db688c632e9f79681c9386d6a4a3fb'
4
- data.tar.gz: '08140ee775462704f34ade6c236000ed615e877007b9fc1d48dc748de222c72b'
3
+ metadata.gz: f18b4641c3f5638987c5e9d8922b51fd9ec509df88012d2408393ddcdf1353b6
4
+ data.tar.gz: 7d38f50be00a404f176c3817228208eb980ebb158ea87f9966374e703c23d627
5
5
  SHA512:
6
- metadata.gz: 49321aaf3a58a70ea34e0668cfe89e91ff069bffa2301cd90b51ab64a446b41d69dc2501f2d3cea469d47f8af31f57965840b664f55bad79e14321bbcefd436e
7
- data.tar.gz: 04d83e5f3b8d1f8d89ea07eba68b393836a13d8e0876069d38017d1001fe5bd02f1e68803e208f3e020d783eabd5a3280fa673e5784f5ca7f5816f4eb795369e
6
+ metadata.gz: c9c4659dddb2c5b32a1e665ac633eb975711aee4e5f924d7ae26b97c63f4b0bcd6f406f4248a93dbf5c22c60cd3a03a099446aaa577168e053ba2bf1b61c71cd
7
+ data.tar.gz: 6ba9e757263833a14582d315d5dab1bb7b828b8f674486db65f566005386d2eeaa1f5d81d69540a75ba5ab14c7e6b69e67582f0ea7b61dcaa6efcd9788d09851
data/docs/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [0.5.0](https://github.com/klueless-io/k_director/compare/v0.4.1...v0.5.0) (2022-01-31)
2
+
3
+
4
+ ### Features
5
+
6
+ * add group_set to action_builder ([62d87ed](https://github.com/klueless-io/k_director/commit/62d87ed27cb1479cf5ba3a2fa8cac70fa71f63fd))
7
+
1
8
  ## [0.4.1](https://github.com/klueless-io/k_director/compare/v0.4.0...v0.4.1) (2022-01-30)
2
9
 
3
10
 
@@ -26,10 +26,19 @@ module KDirector
26
26
  # Set many key/value pairs gainst a group
27
27
  #
28
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)
29
+ # set_many(:github, repo_name: 'repo-name', organization: 'org-name')
30
+ def group_set(group = nil, **opts)
31
+ return if group.nil? && opts.empty?
32
+
33
+ if group.nil?
34
+ opts.each do |key, value|
35
+ set(key, value)
36
+ end
37
+ else
38
+ dom[group] = {} if opts.empty? # initialize the group name if no options are provided
39
+ opts.each do |key, value|
40
+ set(group, key, value)
41
+ end
33
42
  end
34
43
  end
35
44
 
@@ -34,6 +34,12 @@ module KDirector
34
34
  @options.on_action ||= :queue # %i[queue execute]
35
35
  end
36
36
 
37
+ def data(**opts)
38
+ KDirector::Dsls::Children::Data.new(self, **opts)
39
+
40
+ self
41
+ end
42
+
37
43
  def dom
38
44
  builder.dom
39
45
  end
@@ -1,57 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
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)
4
+ module Directors
5
+ # Data can update the underlying ActionBuilder DOM.
6
+ class Data
7
+ attr_reader :parent
8
+ attr_reader :name
20
9
 
21
- # maybe template_file should be renamed to template_path in k_builder
22
- opts[:template_file] = template_path
10
+ def initialize(parent, name, **opts)
11
+ @parent = parent
12
+ @name = name
23
13
 
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
14
+ parent.builder.group_set(name, **opts)
55
15
  end
56
16
  end
57
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KDirector
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
data/lib/k_director.rb CHANGED
@@ -8,6 +8,7 @@ require_relative 'k_director/version'
8
8
  require_relative 'k_director/builders/actions_builder'
9
9
  require_relative 'k_director/directors/base_director'
10
10
  require_relative 'k_director/directors/child_director'
11
+ require_relative 'k_director/directors/data'
11
12
  require_relative 'k_director/dsls/children/blueprint'
12
13
  require_relative 'k_director/dsls/children/github'
13
14
 
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "k_director",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "k_director",
9
- "version": "0.5.0",
9
+ "version": "0.6.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k_director",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Command line and CI/CD tools for k_director",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k_director
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys