k_director 0.10.3 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb7ed7623517d20d588f3fd176ee05dd8d28161d5164b099eaef39152475735d
4
- data.tar.gz: 54b3ce3d61554f6d6f85b82167b9f1fcb82de4ccaacd7ec970ca68ae8cf07ccf
3
+ metadata.gz: '080320db2da48079ad1ed3423f6856187cb9bdc90bdd8932ca7956d037a893da'
4
+ data.tar.gz: c9ba83b95704695ac09568c866b061fb8745bf28acb7f07a77682dbfaef945ee
5
5
  SHA512:
6
- metadata.gz: d25fbb9ad8b1dcd71b6fb7a56a31d5a54022071f28559d0e31bb1d53b3274e6287342f87cca3ea2f0e7dd812f436db2eb4458454266e83ea5f9c4202d9d2ad34
7
- data.tar.gz: 486576cb37d37f4e973df1a4baf0a1430188d29a525fddc64b79528ed16f2bb830aa04de81fe65e94a3a258c5d8d75d1d901a7d1f272859f84430ad9cb48a1c8
6
+ metadata.gz: 34b5b5092ed72be396cff0e16de843c80f08cda90663a73e1941317bade6f1dd240050456e10d640aa031a1cd95881c80b15a0b5a589f78ad729e65275d8c9cc
7
+ data.tar.gz: '0088962799499fed1afdb02d925362b4bb7194c529fce42fcdb12a1742b68de9ae54a81053242e622539dd83eacd83cea2c6603cf2080d98c177f99954d22048'
data/docs/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [0.11.1](https://github.com/klueless-io/k_director/compare/v0.11.0...v0.11.1) (2022-02-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * move add, oadd, tadd, fadd from blueprint_director to base_director ([caab926](https://github.com/klueless-io/k_director/commit/caab92618406a072c3e326a3a640f7c6a4b71f03))
7
+
8
+ # [0.11.0](https://github.com/klueless-io/k_director/compare/v0.10.4...v0.11.0) (2022-02-07)
9
+
10
+
11
+ ### Features
12
+
13
+ * move github, blueprint and package_json fluent accessors onto BaseDirector ([88fa3fd](https://github.com/klueless-io/k_director/commit/88fa3fd0df530bef3731f0b4a62369d925df2fa5))
14
+
15
+ ## [0.10.4](https://github.com/klueless-io/k_director/compare/v0.10.3...v0.10.4) (2022-02-07)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add active option so that child directors can be suppressed or executed ([8a57617](https://github.com/klueless-io/k_director/commit/8a57617eea20dd9a020aec329bd994b3c444f087))
21
+
22
+ ## [0.10.3](https://github.com/klueless-io/k_director/compare/v0.10.2...v0.10.3) (2022-02-06)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * package_json and multi-settings #settings(**opts, group: nil) ([7f23a08](https://github.com/klueless-io/k_director/commit/7f23a08751c3bca7ea99685f33a95eeed8786e1a))
28
+
1
29
  ## [0.10.2](https://github.com/klueless-io/k_director/compare/v0.10.1...v0.10.2) (2022-02-06)
2
30
 
3
31
 
@@ -32,6 +32,7 @@ module KDirector
32
32
  @options.template_base_folder ||= default_template_base_folder
33
33
  @options.on_exist ||= :skip # %i[skip write compare]
34
34
  @options.on_action ||= :queue # %i[queue execute]
35
+ @options.active = true unless defined?(@options.active)
35
36
  end
36
37
 
37
38
  def data(name = nil, **opts)
@@ -50,12 +51,17 @@ module KDirector
50
51
  builder.dom
51
52
  end
52
53
 
54
+ def typed_dom
55
+ builder.build
56
+ end
57
+
53
58
  # Used by child directors to inherit options from parent
54
59
  def inherited_opts(**opts)
55
60
  {
56
61
  on_exist: @options.on_exist,
57
62
  on_action: @options.on_action,
58
- template_base_folder: @options.template_base_folder
63
+ template_base_folder: @options.template_base_folder,
64
+ active: @options.active
59
65
  }.merge(opts)
60
66
  end
61
67
 
@@ -63,6 +69,10 @@ module KDirector
63
69
  k_builder.configuration
64
70
  end
65
71
 
72
+ def active?
73
+ @options.active == true
74
+ end
75
+
66
76
  def director_name
67
77
  @options.director_name
68
78
  end
@@ -83,6 +93,37 @@ module KDirector
83
93
  @options.on_action
84
94
  end
85
95
 
96
+ # Add a single file into the code base
97
+ #
98
+ # This is a wrapper around add_file that will add the file to the codebase using template path rules
99
+ #
100
+ # @param [String] output_filename The output file name, this can be a relative path
101
+ # @param [Hash] **opts The options
102
+ # @option opts [String] :template_filename Template filename can be set or it will default to the same value as the output file name
103
+ # @option opts [String] :template_subfolder Template subfolder
104
+ def add(output_file, **opts)
105
+ template_file = opts[:template_file] || output_file
106
+ template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
107
+ template_path = File.join(*template_parts)
108
+
109
+ # maybe template_file should be renamed to template_path in k_builder
110
+ opts[:template_file] = template_path
111
+
112
+ add_file(output_file, **opts)
113
+ end
114
+
115
+ def oadd(name, **opts)
116
+ add(name, **{ open: true }.merge(opts))
117
+ end
118
+
119
+ def tadd(name, **opts)
120
+ add(name, **{ open_template: true }.merge(opts))
121
+ end
122
+
123
+ def fadd(name, **opts)
124
+ add(name, **{ on_exist: :write }.merge(opts))
125
+ end
126
+
86
127
  # Add a file to target folder
87
128
  def add_file(file, **opts)
88
129
  opts = {
@@ -127,6 +168,29 @@ module KDirector
127
168
  k_builder.play_actions(builder.actions)
128
169
  end
129
170
 
171
+ # Common child directors
172
+
173
+ def github(**opts, &block)
174
+ github = KDirector::Dsls::Children::Github.new(self, **opts)
175
+ github.instance_eval(&block) if github.active? && block_given?
176
+
177
+ self
178
+ end
179
+
180
+ def package_json(**opts, &block)
181
+ package_json = KDirector::Dsls::Children::PackageJson.new(self, **opts)
182
+ package_json.instance_eval(&block) if package_json.active? && block_given?
183
+
184
+ self
185
+ end
186
+
187
+ def blueprint(**opts, &block)
188
+ blueprint = KDirector::Dsls::Children::Blueprint.new(self, **opts)
189
+ blueprint.instance_eval(&block) if blueprint.active? && block_given?
190
+
191
+ self
192
+ end
193
+
130
194
  def debug
131
195
  debug_options
132
196
  debug_dom
@@ -7,35 +7,6 @@ module KDirector
7
7
  #
8
8
  # A blueprint is a recipe that you can follow to build out assets on the target application
9
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
10
  # def template_content(template_file, **opts)
40
11
  # template_parts = [template_base_folder, opts[:template_subfolder], template_file].reject(&:blank?)
41
12
  # template_file = File.join(*template_parts)
@@ -259,8 +259,8 @@ module KDirector
259
259
  # rubocop:enable Naming/AccessorMethodName
260
260
 
261
261
  # Setter for package file
262
- def package_file=(_value)
263
- @package_file = File.join(k_builder.target_folder, 'package.json')
262
+ def package_file=(value)
263
+ @package_file = File.join(k_builder.target_folder, value)
264
264
  end
265
265
 
266
266
  # Remove package-lock.json
@@ -36,12 +36,18 @@ module KDirector
36
36
  end
37
37
 
38
38
  # Setup the default package groups
39
+ # rubocop:disable Metrics/MethodLength
39
40
  def set_default_package_groups
40
41
  set_package_group('webpack' , 'Webpack V5' , %w[webpack webpack-cli webpack-dev-server])
41
42
  set_package_group('swc' , 'SWC Transpiler' , %w[@swc/cli @swc/core swc-loader])
42
43
  set_package_group('babel' , 'Babel Transpiler' , %w[@babel/core @babel/cli @babel/preset-env babel-loader])
43
44
  set_package_group('typescript' , 'Typescript' , %w[typescript ts-loader])
44
- set_package_group('semver-ruby' , 'Semantic Release for Ruby' , %w[semantic-release github:klueless-js/semantic-release-rubygem @semantic-release/changelog @semantic-release/git])
45
+ set_package_group('semver-ruby' , 'Semantic Release for Ruby' , %w[
46
+ semantic-release
47
+ @semantic-release/changelog
48
+ @semantic-release/git
49
+ @klueless-js/semantic-release-rubygem@github:klueless-js/semantic-release-rubygem
50
+ ])
45
51
 
46
52
  set_package_group('semver-nuxt' , 'Semantic Release for Nuxt' , %w[
47
53
  semantic-release
@@ -66,6 +72,7 @@ module KDirector
66
72
  # @storybook/addon-docs@6.4.18
67
73
  # @storybook/addon-essentials@6.4.18
68
74
  end
75
+ # rubocop:enable Metrics/MethodLength
69
76
 
70
77
  def debug
71
78
  log.structure(package_groups, convert_data_to: :open_struct)
@@ -8,27 +8,6 @@ module KDirector
8
8
  'nuxt3'
9
9
  end
10
10
 
11
- def github(**opts, &block)
12
- github = KDirector::Dsls::Children::Github.new(self, **opts)
13
- github.instance_eval(&block) if block_given?
14
-
15
- self
16
- end
17
-
18
- def package_json(**opts, &block)
19
- package_json = KDirector::Dsls::Children::PackageJson.new(self, **opts)
20
- package_json.instance_eval(&block) if block_given?
21
-
22
- self
23
- end
24
-
25
- def blueprint(**opts, &block)
26
- blueprint = KDirector::Dsls::Children::Blueprint.new(self, **opts)
27
- blueprint.instance_eval(&block) if block_given?
28
-
29
- self
30
- end
31
-
32
11
  # def app(**opts, &block)
33
12
  # app = Dsl::Nuxt3App.new(self, **opts)
34
13
  # app.instance_eval(&block)
@@ -8,26 +8,26 @@ module KDirector
8
8
  'ruby/gem'
9
9
  end
10
10
 
11
- def github(**opts, &block)
12
- github = KDirector::Dsls::Children::Github.new(self, **opts)
13
- github.instance_eval(&block) if block_given?
11
+ # def github(**opts, &block)
12
+ # github = KDirector::Dsls::Children::Github.new(self, **opts)
13
+ # github.instance_eval(&block) if github.active? && block_given?
14
14
 
15
- self
16
- end
15
+ # self
16
+ # end
17
17
 
18
- def package_json(**opts, &block)
19
- package_json = KDirector::Dsls::Children::PackageJson.new(self, **opts)
20
- package_json.instance_eval(&block) if block_given?
18
+ # def package_json(**opts, &block)
19
+ # package_json = KDirector::Dsls::Children::PackageJson.new(self, **opts)
20
+ # package_json.instance_eval(&block) if package_json.active? && block_given?
21
21
 
22
- self
23
- end
22
+ # self
23
+ # end
24
24
 
25
- def blueprint(**opts, &block)
26
- blueprint = KDirector::Dsls::Children::Blueprint.new(self, **opts)
27
- blueprint.instance_eval(&block) if block_given?
25
+ # def blueprint(**opts, &block)
26
+ # blueprint = KDirector::Dsls::Children::Blueprint.new(self, **opts)
27
+ # blueprint.instance_eval(&block) if blueprint.active? && block_given?
28
28
 
29
- self
30
- end
29
+ # self
30
+ # end
31
31
  end
32
32
  end
33
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KDirector
4
- VERSION = '0.10.3'
4
+ VERSION = '0.11.2'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "k_director",
3
- "version": "0.10.3",
3
+ "version": "0.11.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "k_director",
9
- "version": "0.10.3",
9
+ "version": "0.11.2",
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.10.3",
3
+ "version": "0.11.2",
4
4
  "description": "Command line and CI/CD tools for k_director",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.10.3
4
+ version: 0.11.2
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-02-06 00:00:00.000000000 Z
11
+ date: 2022-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_config