awestruct 0.6.2 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/awestruct.gemspec +1 -1
- data/lib/awestruct/extensions/data_dir.rb +16 -10
- data/lib/awestruct/util/yaml_load.rb +6 -0
- data/lib/awestruct/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9ed4c5741b5bac0a846e405a6a66ae1ec44f2c4218c0fcc893a32cfff96d89
|
4
|
+
data.tar.gz: b24ddb3bfdb28018415263f098c5f4351f3005f5720db6a4990939a6ab980573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d02941fd58c618e4c4924fc1dd4cc86f7be9eaf73e010af6217f35b770d821817e351555c8295cc4589da0644329f38f8cfb77a8a61e048235501963df546f
|
7
|
+
data.tar.gz: 7f318704c90d81440d7748d3210e3e62fe8651761ac25fceac50433acac2dcc987d1be5d303525430d48e18da2052c987e5fd01e0949ee3689e103a40098edf2
|
data/awestruct.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'awestruct/version'
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.name = 'awestruct'
|
6
6
|
s.version = Awestruct::VERSION
|
7
|
-
s.date = '2023-01-
|
7
|
+
s.date = '2023-01-25'
|
8
8
|
|
9
9
|
s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
|
10
10
|
s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'awestruct/util/yaml_load'
|
2
|
+
|
1
3
|
module Awestruct
|
2
4
|
module Extensions
|
3
5
|
class DataDir
|
@@ -11,18 +13,22 @@ module Awestruct
|
|
11
13
|
end
|
12
14
|
|
13
15
|
def execute(site)
|
14
|
-
Dir
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
Dir.glob(File.join(site.dir, @data_dir, '*')).each do |entry|
|
17
|
+
next unless File.directory? entry
|
18
|
+
data_key = File.basename(entry)
|
19
|
+
data_map = {}
|
20
|
+
Dir.glob(File.join(entry, '*')).each do |chunk|
|
21
|
+
File.basename(chunk) =~ /^([^\.]+)/
|
22
|
+
key = $1.to_sym
|
23
|
+
chunk_page = nil
|
24
|
+
if chunk.end_with?('.yml')
|
25
|
+
chunk_page = Awestruct.yaml_load_file(chunk)
|
26
|
+
else
|
27
|
+
chunk_page = site.engine.load_page(chunk)
|
23
28
|
end
|
24
|
-
|
29
|
+
data_map[key] = chunk_page
|
25
30
|
end
|
31
|
+
site.send("#{data_key}=", data_map)
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
@@ -5,4 +5,10 @@ module Awestruct
|
|
5
5
|
return YAML.load(str) unless YAML.method('load').parameters.any? {|k,v| v == :permitted_classes}
|
6
6
|
YAML.load(str, permitted_classes: [Date, Symbol])
|
7
7
|
end
|
8
|
+
|
9
|
+
def self.yaml_load_file(str)
|
10
|
+
return YAML.load_file(str) unless YAML.method('load').parameters.any? {|k,v| v == :permitted_classes}
|
11
|
+
YAML.load_file(str, permitted_classes: [Date, Symbol])
|
12
|
+
end
|
13
|
+
|
8
14
|
end
|
data/lib/awestruct/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awestruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob McWhirter
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2023-01-
|
16
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: haml
|