awestruct 0.6.2 → 0.6.3
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/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: 87462b3b89d000f6d65eed4d9c92c31376177bb611ae7a206f33bbd23d6739a2
         | 
| 4 | 
            +
              data.tar.gz: 0d7820bf17266c7733102ad1d89407f71f580a74bbfedd8f39851a175bed98b9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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- | 
| 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 | 
| 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_file').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.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- | 
| 16 | 
            +
            date: 2023-01-24 00:00:00.000000000 Z
         | 
| 17 17 | 
             
            dependencies:
         | 
| 18 18 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 19 19 | 
             
              name: haml
         |