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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbfde0af291abd73352c5250d0d43fb1ba1a0e90ddd97bd697ed5ed24072b435
4
- data.tar.gz: b4f5566a1d739e41614ebe9f13836deb69d384f921f9c644f080865fcf472f78
3
+ metadata.gz: 6d9ed4c5741b5bac0a846e405a6a66ae1ec44f2c4218c0fcc893a32cfff96d89
4
+ data.tar.gz: b24ddb3bfdb28018415263f098c5f4351f3005f5720db6a4990939a6ab980573
5
5
  SHA512:
6
- metadata.gz: db3fa768353f108cf524fe7db7527ff997e5ce545228cd2c12ec859f07be1a98f5c8c5e8d6f675b530b3c24a358b214e9e924e00a6a14fc1fdf3155228f210a1
7
- data.tar.gz: c06a668a66477b7826546cf61a8963bc8ddb65ec1601555e38c12c61247eea53f7fd1fd65806e4b36f8412640037b8030223a005d5fe676ce20ec781110586b3
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-21'
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[ "#{site.dir}/#{@data_dir}/*" ].each do |entry|
15
- if ( File.directory?( entry ) )
16
- data_key = File.basename( entry )
17
- data_map = {}
18
- Dir[ "#{entry}/*" ].each do |chunk|
19
- File.basename( chunk ) =~ /^([^\.]+)/
20
- key = $1.to_sym
21
- chunk_page = site.engine.load_page( chunk )
22
- data_map[ key ] = chunk_page
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
- site.send( "#{data_key}=", data_map )
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
@@ -1,3 +1,3 @@
1
1
  module Awestruct
2
- VERSION = '0.6.2'
2
+ VERSION = '0.6.4'
3
3
  end
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.2
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-21 00:00:00.000000000 Z
16
+ date: 2023-01-25 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: haml