tailwind_dsl 0.0.7 → 0.0.8

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: 12b4cb1ead96f5fff7c3314de7a9c1cbf0acc4543749a16bd11ad1044f54c3bb
4
- data.tar.gz: afc589fd9df719bf67b6ab61088dd65345d39b617af6a5924f0a07a027991661
3
+ metadata.gz: e5d699a31b5861f307ea6f9d8b32c08435e2f33708977962d41c202010f8d106
4
+ data.tar.gz: ee2aa1cc833cc840cb92d7f5e84d450d3709acb9507ca0b09b59fd54e898a4e5
5
5
  SHA512:
6
- metadata.gz: a88b93f3410119b8af4521b75fea20af52dfa84bae7b617ca163cfd3a600eeb36ff534ae470b2a99db4307313815657f05426618b3fbf32c08ba2b3d21658761
7
- data.tar.gz: b4bf2cc19b04b6ff284cfeba11c152921c869c989f53cb1efcca20aa2a3e71de84d08a544c7709512dd5bcd44a9d72c2e2470900d5e940c988dd58676654e403
6
+ metadata.gz: bd7a34b8b6bd408db9bbe4c456cf5434842369ca96da813cf9ab13b78991f070e244362d905b94ae8a5c6f002bee00a63d43ce06fb12f946f4b07b80e4a3b309
7
+ data.tar.gz: 9258ee349bd09aa3ecdc20be3300e2672e01a7024ae5cfe8bcc6bb15510a9301a8407f21272093ee8043657a475cec6d0a7ae836ee8b86caea5ed0fc7e176d3d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.0.7](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.6...v0.0.7) (2022-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add base element class with tests ([1845f67](https://github.com/klueless-io/tailwind_dsl/commit/1845f6769a3be7f81b2f8ed3c9e7e2e94d0b6861))
7
+ * json objects inherit element ([494908f](https://github.com/klueless-io/tailwind_dsl/commit/494908f840b562011038a387149cf3891ad3fe6c))
8
+
1
9
  ## [0.0.6](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.5...v0.0.6) (2022-10-12)
2
10
 
3
11
 
@@ -17,6 +17,16 @@ module TailwindDsl
17
17
 
18
18
  value || default
19
19
  end
20
+
21
+ def map_to(klass, data)
22
+ return nil if data.nil?
23
+
24
+ return data if data.is_a?(klass)
25
+ return klass.new(**data) if data.is_a?(Hash)
26
+
27
+ puts "Data of type: #{data.class} cannot be converted to #{klass}"
28
+ nil
29
+ end
20
30
  end
21
31
  end
22
32
  end
@@ -14,11 +14,11 @@ module TailwindDsl
14
14
  def initialize(**args)
15
15
  @name = grab_arg(args, :name, guard: 'Missing name')
16
16
  @stats = grab_arg(args, :stats, default: {})
17
- @groups = grab_arg(args, :groups, default: []).map { |group| convert_group(group) }.compact
17
+ @groups = grab_arg(args, :groups, default: []).map { |group| map_to(Group, group) }.compact
18
18
  end
19
19
 
20
20
  def add_group(group)
21
- add = convert_group(group)
21
+ add = map_to(Group, group)
22
22
 
23
23
  return nil if add.nil?
24
24
 
@@ -34,18 +34,6 @@ module TailwindDsl
34
34
  groups: groups.map(&:to_h)
35
35
  }
36
36
  end
37
-
38
- private
39
-
40
- def convert_group(group)
41
- return nil if group.nil?
42
-
43
- return group if group.is_a?(Group)
44
- return Group.new(**group) if group.is_a?(Hash)
45
-
46
- puts "Unknown group type: #{group.class}"
47
- nil
48
- end
49
37
  end
50
38
  end
51
39
  end
@@ -18,12 +18,11 @@ module TailwindDsl
18
18
  @type = grab_arg(args, :type, guard: 'Missing type')
19
19
  @folder = grab_arg(args, :folder, guard: 'Missing folder')
20
20
  @sub_keys = grab_arg(args, :sub_keys, guard: 'Missing sub_keys')
21
-
22
21
  @files = grab_arg(args, :files, default: []).map { |file| convert_file(file) }.compact
23
22
  end
24
23
 
25
24
  def add_file(file)
26
- add = convert_file(file)
25
+ add = map_to(SourceFile, file)
27
26
 
28
27
  return nil if add.nil?
29
28
 
@@ -18,7 +18,7 @@ module TailwindDsl
18
18
  @file_name = grab_arg(args, :file_name, guard: 'Missing file_name')
19
19
  @file_name_only = grab_arg(args, :file_name_only, guard: 'Missing file_name_only')
20
20
  @file = grab_arg(args, :file, guard: 'Missing file')
21
- @target = convert_target(grab_arg(args, :target))
21
+ @target = map_to(TargetFile, grab_arg(args, :target))
22
22
  end
23
23
 
24
24
  def to_h
@@ -31,21 +31,6 @@ module TailwindDsl
31
31
  result[:target] = target.to_h if target
32
32
  result
33
33
  end
34
-
35
- private
36
-
37
- def convert_target(target)
38
- return nil if target.nil?
39
-
40
- case target
41
- when TargetFile
42
- target
43
- when Hash
44
- TargetFile.new(**target)
45
- else
46
- raise "Unknown target type: #{target.class}"
47
- end
48
- end
49
34
  end
50
35
  end
51
36
  end
@@ -6,7 +6,7 @@ module TailwindDsl
6
6
  # UiKit
7
7
  #
8
8
  # UiKit is a container for storing different tailwind design systems
9
- class UiKit
9
+ class UiKit < TailwindDsl::Etl::Element
10
10
  attr_accessor :design_systems
11
11
 
12
12
  # Pass in a document with the keys symbolized
@@ -23,7 +23,7 @@ module TailwindDsl
23
23
  end
24
24
 
25
25
  def add_design_system(design_system)
26
- add = convert_design_system(design_system)
26
+ add = map_to(DesignSystem, design_system)
27
27
 
28
28
  return nil if add.nil?
29
29
 
@@ -47,18 +47,6 @@ module TailwindDsl
47
47
  design_systems: design_systems.map(&:to_h)
48
48
  }
49
49
  end
50
-
51
- private
52
-
53
- def convert_design_system(design_system)
54
- return nil if design_system.nil?
55
-
56
- return design_system if design_system.is_a?(DesignSystem)
57
- return DesignSystem.new(**design_system) if design_system.is_a?(Hash)
58
-
59
- puts "Unknown design_system type: #{design_system.class}"
60
- nil
61
- end
62
50
  end
63
51
  end
64
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindDsl
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tailwind_dsl",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tailwind_dsl",
9
- "version": "0.0.7",
9
+ "version": "0.0.8",
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": "tailwind_dsl",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Tailwind DSL will build tailwind websites useing Domain Specific Language conventions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailwind_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys