foobara-type-generator 0.0.1 → 0.0.2
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/CHANGELOG.md +4 -0
- data/src/type_config.rb +13 -1
- data/src/type_generator.rb +14 -4
- 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: 371ff772daf8be10634ada53169fb375c2de6af3a4eff19107fe98e85649caf1
         | 
| 4 | 
            +
              data.tar.gz: 10051cda28cf201af43a7b7a1764c950f4cb5d165c9def9949c6412934a54f2f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e94df421ed933c4890e1f22c54b2089a168c1ae0dfa7e03a12d6b8d04a11ac447476dee5aab388c201aed62fbe973b89642dc7e1d0077540df6039c1f24c055f
         | 
| 7 | 
            +
              data.tar.gz: 446904fbefa29fd63375476e0cbd6e052fe1cab0ee7d426e9a3876bc17cef3e5cd26791d1afbd1c099dc811c166cc85b79a0ac37763bcee33da323d25ef409ab
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/src/type_config.rb
    CHANGED
    
    | @@ -19,7 +19,19 @@ module Foobara | |
| 19 19 | 
             
                    end
         | 
| 20 20 |  | 
| 21 21 | 
             
                    def module_path
         | 
| 22 | 
            -
                      @module_path ||=  | 
| 22 | 
            +
                      @module_path ||= domain_path + post_domain_path
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    def domain_path
         | 
| 26 | 
            +
                      @domain_path ||= [*organization&.split("::"), *domain&.split("::")]
         | 
| 27 | 
            +
                    end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                    def post_domain_path
         | 
| 30 | 
            +
                      name.split("::")
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                    def has_domain?
         | 
| 34 | 
            +
                      !domain_path.empty?
         | 
| 23 35 | 
             
                    end
         | 
| 24 36 | 
             
                  end
         | 
| 25 37 | 
             
                end
         | 
    
        data/src/type_generator.rb
    CHANGED
    
    | @@ -23,15 +23,25 @@ module Foobara | |
| 23 23 | 
             
                      end
         | 
| 24 24 |  | 
| 25 25 | 
             
                      def target_path
         | 
| 26 | 
            -
                         | 
| 26 | 
            +
                        domain_path, post_domain_path = if has_domain?
         | 
| 27 | 
            +
                                                          [self.domain_path, self.post_domain_path]
         | 
| 28 | 
            +
                                                        else
         | 
| 29 | 
            +
                                                          *path, file = module_path.map { |part| Util.underscore(part) }
         | 
| 30 | 
            +
                                                          [path, [file]]
         | 
| 31 | 
            +
                                                        end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                        domain_path = domain_path.map { |part| Util.underscore(part) }
         | 
| 34 | 
            +
                        post_domain_path = post_domain_path.map { |part| Util.underscore(part) }
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                        *post_domain_path, file = post_domain_path
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                        path = ["src", *domain_path]
         | 
| 27 39 |  | 
| 28 40 | 
             
                        unless path.last == "types"
         | 
| 29 41 | 
             
                          path << "types"
         | 
| 30 42 | 
             
                        end
         | 
| 31 43 |  | 
| 32 | 
            -
                         | 
| 33 | 
            -
             | 
| 34 | 
            -
                        ["src", *path, file]
         | 
| 44 | 
            +
                        [*path, *post_domain_path, "#{file}.rb"]
         | 
| 35 45 | 
             
                      end
         | 
| 36 46 |  | 
| 37 47 | 
             
                      alias type_config relevant_manifest
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: foobara-type-generator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Miles Georgi
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-08-13 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: foobara
         |