bookshop-array-structures 2.0.0.pre.alpha.2 → 2.0.0.pre.alpha.7
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/Gemfile.lock +3 -1
- data/bookshop-array-structures.gemspec +1 -0
- data/lib/bookshop-array-structures.rb +14 -4
- data/lib/bookshop-array-structures/version.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd2df4cf6c4e92bfd97e35c225f46e023741544e663ad394ec6a460d0960d43b
|
4
|
+
data.tar.gz: 150ce500ea36bfc8f901b8c07ae73e805cf02c0ee4e4a842924abdbf38609860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f830c97c0ba625a1cd7900a771bf0db02dff11a9e52bdd1b88bbcba9ac38e7c1e8a6e72fa166a26249c32f46bf1b3b1ddefa812e7024d189a2d4f89a2f178760
|
7
|
+
data.tar.gz: '08d21dd06e49f51718253ccbbd2484e67987e62297c7d2a08dcd901857ffde83484f8b59c2b20a39307fc191ad9deb322ccbe60e3818e77f078e8738808036ee'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bookshop-array-structures (
|
4
|
+
bookshop-array-structures (2.0.0.pre.alpha.3)
|
5
|
+
dry-inflector (>= 0.1, < 1.0)
|
5
6
|
jekyll (>= 3.7, < 5.0)
|
6
7
|
toml-rb (>= 2.0, < 3.0)
|
7
8
|
|
@@ -16,6 +17,7 @@ GEM
|
|
16
17
|
citrus (3.0.2)
|
17
18
|
colorator (1.1.0)
|
18
19
|
concurrent-ruby (1.1.8)
|
20
|
+
dry-inflector (0.2.0)
|
19
21
|
em-websocket (0.5.2)
|
20
22
|
eventmachine (>= 0.12.9)
|
21
23
|
http_parser.rb (~> 0.6.0)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "jekyll"
|
2
|
-
require
|
2
|
+
require "pathname"
|
3
3
|
require "toml-rb"
|
4
|
+
require "dry/inflector"
|
4
5
|
|
5
6
|
module Bookshop
|
6
7
|
class ArrayStructures
|
@@ -28,6 +29,7 @@ module Bookshop
|
|
28
29
|
structure["_comments"] ||= {}
|
29
30
|
structure["value"] ||= {}
|
30
31
|
value_context = structure["value"] if value_context.nil?
|
32
|
+
inflector = Dry::Inflector.new
|
31
33
|
value_obj.each_pair {|key, value|
|
32
34
|
if value_context.has_key?(key)
|
33
35
|
next
|
@@ -47,7 +49,8 @@ module Bookshop
|
|
47
49
|
end
|
48
50
|
if value["select"]
|
49
51
|
value_context[key] = nil
|
50
|
-
|
52
|
+
plural_key = inflector.pluralize(key)
|
53
|
+
structure["_select_data"][plural_key] = value["select"]
|
51
54
|
next
|
52
55
|
end
|
53
56
|
if value["preview"]
|
@@ -65,7 +68,14 @@ module Bookshop
|
|
65
68
|
structure["_comments"][key] = value[0]["--bookshop_comment"]
|
66
69
|
end
|
67
70
|
|
68
|
-
|
71
|
+
singular_title = inflector.classify(key).gsub(/(.)([A-Z])/, '\1 \2')
|
72
|
+
structure["_array_structures"][key] ||= {
|
73
|
+
"values" => [{
|
74
|
+
"label" => singular_title,
|
75
|
+
"icon" => "add_box",
|
76
|
+
"value" => {}
|
77
|
+
}]
|
78
|
+
}
|
69
79
|
handle_bookprops( value[0],
|
70
80
|
structure["_array_structures"][key]["values"][0],
|
71
81
|
structure["_array_structures"][key]["values"][0]["value"])
|
@@ -242,7 +252,7 @@ module Bookshop
|
|
242
252
|
|
243
253
|
def self.build_array_structures(site)
|
244
254
|
bookshop_locations = site.config['bookshop_locations']&.collect do |location|
|
245
|
-
Pathname.new(location
|
255
|
+
Pathname.new("#{site.source}/#{location}/components").cleanpath.to_s
|
246
256
|
end
|
247
257
|
bookshop_locations = bookshop_locations.select do |location|
|
248
258
|
Dir.exist?(location)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookshop-array-structures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.alpha.
|
4
|
+
version: 2.0.0.pre.alpha.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tate
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -50,6 +50,26 @@ dependencies:
|
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '3.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: dry-inflector
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.1'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.1'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.0'
|
53
73
|
description:
|
54
74
|
email:
|
55
75
|
- tate@cloudcannon.com
|