awestruct 0.6.2 → 0.6.3

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: 87462b3b89d000f6d65eed4d9c92c31376177bb611ae7a206f33bbd23d6739a2
4
+ data.tar.gz: 0d7820bf17266c7733102ad1d89407f71f580a74bbfedd8f39851a175bed98b9
5
5
  SHA512:
6
- metadata.gz: db3fa768353f108cf524fe7db7527ff997e5ce545228cd2c12ec859f07be1a98f5c8c5e8d6f675b530b3c24a358b214e9e924e00a6a14fc1fdf3155228f210a1
7
- data.tar.gz: c06a668a66477b7826546cf61a8963bc8ddb65ec1601555e38c12c61247eea53f7fd1fd65806e4b36f8412640037b8030223a005d5fe676ce20ec781110586b3
6
+ metadata.gz: f45baef6a198a33465c0359e01338af16bfa854f39a2e10227aa6db740fff14e67f6b40c93de9685dc33eea4d546f0847bbafafdb562a7f2bcc10b81a5f42014
7
+ data.tar.gz: 8ab966c3a10df83a9844454adc0428f22050fa331676c94081be64b2a119927d324775d89a506d638b62091ae56d09238333466089dfbfe25e37e5bdacac97c7
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-24'
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_file').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.3'
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.3
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-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: haml