tailwind_dsl 0.0.19 → 0.0.21
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/CHANGELOG.md +14 -0
- data/lib/tailwind_dsl/etl/component_models/extractor.rb +32 -19
- data/lib/tailwind_dsl/etl/component_structures/generator.rb +2 -0
- data/lib/tailwind_dsl/etl/component_structures/raw_component_query.rb +4 -1
- data/lib/tailwind_dsl/etl/raw_components/{director.rb → load.rb} +3 -3
- data/lib/tailwind_dsl/version.rb +1 -1
- data/lib/tailwind_dsl.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cd0c0909e9a48950228de203ff226826d232fa82798e57ce11513d8fb333ffa
|
4
|
+
data.tar.gz: 38307842f83d9d0f9d55aab36baba41e3e62b4f6ebffeacf80a27850757ece74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 894085b30a5b7219cb9c02b31c6ea1ab187cf7a7a26b4c0c5e670b6ff079b56ac31cfd9f3bd707a0018dce2237d8d0f20733f013e830860dd70bfb6284d1634a
|
7
|
+
data.tar.gz: 155bbf81aa7e67918d4eb904f92a1f8f06fbd74537893e8cf3c7b4f3483428ff0a96797479b3e5473cc9c2dbfbd2ca8f83272757cba5254a3c32b5d0f071a391
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [0.0.20](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.19...v0.0.20) (2022-10-21)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* rename director to load ([db85a1b](https://github.com/klueless-io/tailwind_dsl/commit/db85a1b85804390865ec66dabe9d7561767c6578))
|
7
|
+
|
8
|
+
## [0.0.19](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.18...v0.0.19) (2022-10-21)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* update file locations ([db95e15](https://github.com/klueless-io/tailwind_dsl/commit/db95e15dd7d08f765113ca4f6c9a00eda3cfc661))
|
14
|
+
|
1
15
|
## [0.0.18](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.17...v0.0.18) (2022-10-20)
|
2
16
|
|
3
17
|
|
@@ -18,16 +18,23 @@ module TailwindDsl
|
|
18
18
|
attr_reader :components
|
19
19
|
attr_reader :target_root_path
|
20
20
|
attr_reader :batch_size
|
21
|
-
attr_reader :batch_left
|
22
21
|
attr_reader :use_prompt
|
23
22
|
attr_reader :filter_design_system
|
24
23
|
attr_reader :extract_handler
|
25
24
|
|
25
|
+
# Create comment for this initialize method
|
26
|
+
|
27
|
+
# @param [Array] components list of components that can be used to extract data
|
28
|
+
# @param [String] target_root_path root directory where the extracted data will be written to, this is the root path for all design systems and groups
|
29
|
+
# @param [Hash] args
|
30
|
+
# @option args [Integer] :batch_size number of components to process, default is 1
|
31
|
+
# @option args [Boolean] :use_prompt console based prompt so the user can guide the extractor, default is false
|
32
|
+
# @option args [String] :filter_design_system name of the design system to filter on, default is nil meaning all
|
33
|
+
# @option args [Class] :extract_handler class that implements the extract_data and extract_model methods, default is Gpt3Extractor
|
26
34
|
def initialize(components, target_root_path, **args)
|
27
35
|
@components = components
|
28
36
|
@target_root_path = target_root_path
|
29
37
|
@batch_size = args[:batch_size] || 1
|
30
|
-
@batch_left = batch_size
|
31
38
|
@use_prompt = args[:use_prompt] || false
|
32
39
|
@filter_design_system = args[:filter_design_system] || nil
|
33
40
|
@extract_handler = (args[:extract_handler] || Gpt3Extractor).new
|
@@ -45,16 +52,17 @@ module TailwindDsl
|
|
45
52
|
# if :use_prompt is true then display the input/output files and ask if you wish to process the component or skip.
|
46
53
|
# process the component by calling the GPT3 API and save the results to the target folder.
|
47
54
|
|
48
|
-
# rubocop:disable Metrics/AbcSize
|
49
55
|
def extract
|
50
56
|
guards
|
51
57
|
|
58
|
+
remaining = batch_size
|
59
|
+
|
52
60
|
filter_components.each do |component|
|
53
|
-
puts "Processing: #{component.design_system.name} -> #{component.group.key} -> #{component.name} -> remaining#: #{
|
61
|
+
# puts "Processing: #{component.design_system.name} -> #{component.group.key} -> #{component.name} -> remaining#: #{remaining}"
|
62
|
+
|
63
|
+
component_guards(component)
|
54
64
|
|
55
|
-
component
|
56
|
-
# component_model_path = File.join(target_root_path, component.design_system.name, component.group_hierarchy, "#{component.name}.model.rb")
|
57
|
-
# next if File.exist?(component_model_path)
|
65
|
+
next if data_file_exist?(component) && model_file_exist?(component)
|
58
66
|
|
59
67
|
# if use_prompt
|
60
68
|
# puts "Input: #{component.cleansed_html_path}"
|
@@ -63,21 +71,13 @@ module TailwindDsl
|
|
63
71
|
# next unless STDIN.gets.chomp == 'y'
|
64
72
|
# end
|
65
73
|
|
66
|
-
|
67
|
-
|
68
|
-
# next if extract_handler
|
69
|
-
|
70
|
-
# model = Gpt3::ComponentModel.new(component.cleansed_html_path)
|
71
|
-
# model.save(component_model_path)
|
72
|
-
|
73
|
-
extract_handler.extract_data(component)
|
74
|
-
extract_handler.extract_model(component)
|
74
|
+
extract_handler.extract_data(component) unless data_file_exist?(component)
|
75
|
+
extract_handler.extract_model(component) unless model_file_exist?(component)
|
75
76
|
|
76
|
-
|
77
|
-
break if
|
77
|
+
remaining -= 1
|
78
|
+
break if remaining.zero?
|
78
79
|
end
|
79
80
|
end
|
80
|
-
# rubocop:enable Metrics/AbcSize
|
81
81
|
|
82
82
|
private
|
83
83
|
|
@@ -88,11 +88,24 @@ module TailwindDsl
|
|
88
88
|
raise 'Extract handler must implement extract_model method' unless extract_handler.respond_to?(:extract_model)
|
89
89
|
end
|
90
90
|
|
91
|
+
def component_guards(component)
|
92
|
+
path = File.join(component.design_system.target_path, component.group.folder)
|
93
|
+
raise "Folder does not exist: '#{path}', make sure you run component structure generator first." unless File.exist?(path)
|
94
|
+
end
|
95
|
+
|
91
96
|
def filter_components
|
92
97
|
return components unless filter_design_system
|
93
98
|
|
94
99
|
components.select { |component| component.design_system.name == filter_design_system }
|
95
100
|
end
|
101
|
+
|
102
|
+
def data_file_exist?(component)
|
103
|
+
File.exist?(component.absolute.target_data_file)
|
104
|
+
end
|
105
|
+
|
106
|
+
def model_file_exist?(component)
|
107
|
+
File.exist?(component.absolute.target_model_file)
|
108
|
+
end
|
96
109
|
end
|
97
110
|
end
|
98
111
|
end
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# This is Reusable across concerns, it should be in it's own folder or in the ETL root
|
4
|
+
# Rename to component_list or component_query
|
5
|
+
|
3
6
|
module TailwindDsl
|
4
7
|
module Etl
|
5
8
|
module ComponentStructures
|
@@ -118,7 +121,7 @@ module TailwindDsl
|
|
118
121
|
end
|
119
122
|
|
120
123
|
def call
|
121
|
-
@components = build_components
|
124
|
+
@components = build_components.sort_by { |component| [component.design_system.name, component.group.key, component.name] }
|
122
125
|
|
123
126
|
self
|
124
127
|
end
|
@@ -3,15 +3,15 @@
|
|
3
3
|
module TailwindDsl
|
4
4
|
module Etl
|
5
5
|
module RawComponents
|
6
|
-
# NOTE:
|
6
|
+
# NOTE: Load is badly named.
|
7
7
|
|
8
|
-
# Use the
|
8
|
+
# Use the Load to build the UiKit which will store the JSON representations of each Design System plus components.
|
9
9
|
#
|
10
10
|
# This is a raw representation of the source.
|
11
11
|
#
|
12
12
|
# This data structure will be used by the component transformer to build
|
13
13
|
# auxiliary data structures for components such as clean HTML, Astro, data shapes.
|
14
|
-
class
|
14
|
+
class Load
|
15
15
|
attr_reader :uikit
|
16
16
|
|
17
17
|
def initialize
|
data/lib/tailwind_dsl/version.rb
CHANGED
data/lib/tailwind_dsl.rb
CHANGED
@@ -5,7 +5,7 @@ require 'cmdlet'
|
|
5
5
|
require_relative 'tailwind_dsl/version'
|
6
6
|
# require_relative '_'
|
7
7
|
|
8
|
-
require_relative 'tailwind_dsl/etl/raw_components/
|
8
|
+
require_relative 'tailwind_dsl/etl/raw_components/load'
|
9
9
|
require_relative 'tailwind_dsl/etl/raw_components/transformer'
|
10
10
|
|
11
11
|
require_relative 'tailwind_dsl/etl/element'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "tailwind_dsl",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.21",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "tailwind_dsl",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.21",
|
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: tailwind_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
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-10-
|
11
|
+
date: 2022-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdlet
|
@@ -2155,7 +2155,7 @@ files:
|
|
2155
2155
|
- lib/tailwind_dsl/etl/component_structures/generator.rb
|
2156
2156
|
- lib/tailwind_dsl/etl/component_structures/raw_component_query.rb
|
2157
2157
|
- lib/tailwind_dsl/etl/element.rb
|
2158
|
-
- lib/tailwind_dsl/etl/raw_components/
|
2158
|
+
- lib/tailwind_dsl/etl/raw_components/load.rb
|
2159
2159
|
- lib/tailwind_dsl/etl/raw_components/schema/design_system.rb
|
2160
2160
|
- lib/tailwind_dsl/etl/raw_components/schema/group.rb
|
2161
2161
|
- lib/tailwind_dsl/etl/raw_components/schema/source_file.rb
|