giblish 2.2.2 → 3.0.1
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/.gitignore +20 -53
 - data/.solargraph.yml +15 -0
 - data/Changelog.adoc +16 -0
 - data/README.adoc +1 -1
 - data/diagram-classes.png +0 -0
 - data/giblish.gemspec +10 -22
 - data/lib/giblish/application.rb +11 -57
 - data/lib/giblish/config_builders/docid_config_builder.rb +84 -0
 - data/lib/giblish/config_builders/git_index_config_builder.rb +37 -0
 - data/lib/giblish/config_builders/index_config_builder.rb +53 -0
 - data/lib/giblish/config_utils.rb +0 -42
 - data/lib/giblish/configurator.rb +81 -163
 - data/lib/giblish/docid/docid.rb +3 -3
 - data/lib/giblish/gitrepos/checkoutmanager.rb +3 -2
 - data/lib/giblish/gitrepos/history_pb.rb +10 -5
 - data/lib/giblish/indexbuilders/depgraphbuilder.rb +1 -1
 - data/lib/giblish/indexbuilders/subtree_indices.rb +5 -11
 - data/lib/giblish/indexbuilders/verbatimtree.rb +1 -1
 - data/lib/giblish/layout_config/html_layout_config.rb +77 -0
 - data/lib/giblish/layout_config/layout_config_result.rb +35 -0
 - data/lib/giblish/layout_config/pdf_layout_config.rb +89 -0
 - data/lib/giblish/node_data_provider.rb +137 -0
 - data/lib/giblish/resourcepaths.rb +3 -2
 - data/lib/giblish/search/searchquery.rb +3 -3
 - data/lib/giblish/search/textsearcher.rb +3 -3
 - data/lib/giblish/subtreeinfobuilder.rb +2 -2
 - data/lib/giblish/treeconverter.rb +13 -8
 - data/lib/giblish/version.rb +1 -1
 - data/scripts/release.rb +365 -0
 - metadata +37 -178
 - data/.github/workflows/unit_tests.yml +0 -30
 - data/.ruby-version +0 -1
 - data/lib/giblish/pathtree.rb +0 -518
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fc2d44b3987ea014fad53e2accf48aa3734e1ba68c20328506179bf19e41621e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 65b013e0e91895ed2b9d882ff0249111856bbee31db29d72b08242d2cef9b3e6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e3cbae7cfd88de2a747dfe27e82bedf52fcb270963c8388a2f1b3e41c4401bd412a536e5d87097ce715c9c5aaf380385d85ee78b0d190669e6be1ffea24f8733
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ca512fe02b3b3a172637bfaa955682fedbde866ba943276cc81b8389ff3b40b59e0714702d56752d11d0cf4a0b8413bbf06d371f3550a04b153c286378b0cd00
         
     | 
    
        data/.gitignore
    CHANGED
    
    | 
         @@ -1,56 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # IDE and editor files
         
     | 
| 
      
 2 
     | 
    
         
            +
            .vscode/
         
     | 
| 
      
 3 
     | 
    
         
            +
            *.swp
         
     | 
| 
      
 4 
     | 
    
         
            +
            *.swo
         
     | 
| 
      
 5 
     | 
    
         
            +
            *~
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # Asciidoctor cache and generated files
         
     | 
| 
      
 8 
     | 
    
         
            +
            .asciidoctor/
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            # Test artifacts
         
     | 
| 
      
 11 
     | 
    
         
            +
            test/tmp/
         
     | 
| 
      
 12 
     | 
    
         
            +
            test/output/
         
     | 
| 
      
 13 
     | 
    
         
            +
            coverage/
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            # Build and packaging
         
     | 
| 
      
 16 
     | 
    
         
            +
            pkg/
         
     | 
| 
       1 
17 
     | 
    
         
             
            *.gem
         
     | 
| 
       2 
     | 
    
         
            -
            *.rbc
         
     | 
| 
       3 
     | 
    
         
            -
            /.config
         
     | 
| 
       4 
     | 
    
         
            -
            /coverage/
         
     | 
| 
       5 
     | 
    
         
            -
            /InstalledFiles
         
     | 
| 
       6 
     | 
    
         
            -
            /pkg/
         
     | 
| 
       7 
     | 
    
         
            -
            /spec/reports/
         
     | 
| 
       8 
     | 
    
         
            -
            /spec/examples.txt
         
     | 
| 
       9 
     | 
    
         
            -
            /test/tmp/
         
     | 
| 
       10 
     | 
    
         
            -
            /test/version_tmp/
         
     | 
| 
       11 
     | 
    
         
            -
            /tmp/
         
     | 
| 
       12 
18 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            #  
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
            # Logs
         
     | 
| 
      
 20 
     | 
    
         
            +
            *.log
         
     | 
| 
       15 
21 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            .repl_history
         
     | 
| 
       19 
     | 
    
         
            -
            build/
         
     | 
| 
       20 
     | 
    
         
            -
            *.bridgesupport
         
     | 
| 
       21 
     | 
    
         
            -
            build-iPhoneOS/
         
     | 
| 
       22 
     | 
    
         
            -
            build-iPhoneSimulator/
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            ## Specific to RubyMotion (use of CocoaPods):
         
     | 
| 
       25 
     | 
    
         
            -
            #
         
     | 
| 
       26 
     | 
    
         
            -
            # We recommend against adding the Pods directory to your .gitignore. However
         
     | 
| 
       27 
     | 
    
         
            -
            # you should judge for yourself, the pros and cons are mentioned at:
         
     | 
| 
       28 
     | 
    
         
            -
            # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
         
     | 
| 
       29 
     | 
    
         
            -
            #
         
     | 
| 
       30 
     | 
    
         
            -
            # vendor/Pods/
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            ## Documentation cache and generated files:
         
     | 
| 
       33 
     | 
    
         
            -
            /.yardoc/
         
     | 
| 
       34 
     | 
    
         
            -
            /_yardoc/
         
     | 
| 
       35 
     | 
    
         
            -
            /doc/
         
     | 
| 
       36 
     | 
    
         
            -
            /rdoc/
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            ## Environment normalization:
         
     | 
| 
       39 
     | 
    
         
            -
            /.bundle/
         
     | 
| 
       40 
     | 
    
         
            -
            /vendor/bundle
         
     | 
| 
       41 
     | 
    
         
            -
            /lib/bundler/man/
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
            # for a library or gem, you might want to ignore these files since the code is
         
     | 
| 
       44 
     | 
    
         
            -
            # intended to run in multiple environments; otherwise, check them in:
         
     | 
| 
       45 
     | 
    
         
            -
            Gemfile.lock
         
     | 
| 
       46 
     | 
    
         
            -
            .ruby-version
         
     | 
| 
       47 
     | 
    
         
            -
            .ruby-gemset
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
            # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
         
     | 
| 
       50 
     | 
    
         
            -
            .rvmrc
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
            # RubyMine idea files
         
     | 
| 
       53 
     | 
    
         
            -
            /.idea/
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            # Local playground
         
     | 
| 
       56 
     | 
    
         
            -
            sandbox.rb
         
     | 
| 
      
 22 
     | 
    
         
            +
            # Temporary files
         
     | 
| 
      
 23 
     | 
    
         
            +
            tmp/
         
     | 
    
        data/.solargraph.yml
    ADDED
    
    
    
        data/Changelog.adoc
    CHANGED
    
    | 
         @@ -7,6 +7,22 @@ 
     | 
|
| 
       7 
7 
     | 
    
         
             
             ** write instructions for github webhook triggered generation
         
     | 
| 
       8 
8 
     | 
    
         
             
             * Update the default css for giblish html generation.
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
      
 10 
     | 
    
         
            +
            == v3.0.1
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
             * add release scripts
         
     | 
| 
      
 13 
     | 
    
         
            +
             * fix some linting issues
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            == v3.0.0
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
             * break out the pathtree operations into a separate gem (gran)
         
     | 
| 
      
 18 
     | 
    
         
            +
             * bump ruby version to >= 3.3
         
     | 
| 
      
 19 
     | 
    
         
            +
             * bump all asciidoctor dependencies to the latest available
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            == v2.2.2
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
             * [BUGFIX] - fix a possible null ref when generating pdfs
         
     | 
| 
      
 24 
     | 
    
         
            +
             * set the 'sourcemap' attribute to true by default
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       10 
26 
     | 
    
         
             
            == v2.2.1
         
     | 
| 
       11 
27 
     | 
    
         | 
| 
       12 
28 
     | 
    
         
             
             * bump dependencies to latest versions of the asciidoctor ecosystem
         
     | 
    
        data/README.adoc
    CHANGED
    
    | 
         @@ -206,7 +206,7 @@ Pull requests must meet the following to be considered for merging: 
     | 
|
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
            To develop on giblish, you:
         
     | 
| 
       208 
208 
     | 
    
         | 
| 
       209 
     | 
    
         
            -
             . Install ruby on your local machine (rbenv  
     | 
| 
      
 209 
     | 
    
         
            +
             . Install ruby on your local machine (rbenv could be a good choice for handling ruby installations)
         
     | 
| 
       210 
210 
     | 
    
         
             
             . Install necessary dependencies to install the ruby 'mathematica' gem, see eg https://github.com/gjtorikian/mathematical/blob/47041d5492cc7c5f04105031430fb44119406f49/script/install_linux_deps
         
     | 
| 
       211 
211 
     | 
    
         
             
             . Install graphviz
         
     | 
| 
       212 
212 
     | 
    
         
             
             . Clone or fork the repository
         
     | 
    
        data/diagram-classes.png
    ADDED
    
    | 
         Binary file 
     | 
    
        data/giblish.gemspec
    CHANGED
    
    | 
         @@ -6,6 +6,7 @@ end 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.name = "giblish"
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.required_ruby_version = ">= 3.3"
         
     | 
| 
       9 
10 
     | 
    
         
             
              spec.version = Giblish::VERSION
         
     | 
| 
       10 
11 
     | 
    
         
             
              spec.summary = "A tool for publishing asciidoc docs stored in git repos"
         
     | 
| 
       11 
12 
     | 
    
         
             
              spec.description = <<~EOF
         
     | 
| 
         @@ -44,30 +45,17 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       44 
45 
     | 
    
         
             
              spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       45 
46 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       46 
47 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
              # Development deps
         
     | 
| 
       48 
     | 
    
         
            -
              spec.add_development_dependency "ruby-lsp", "~> 0.11"
         
     | 
| 
       49 
     | 
    
         
            -
              spec.add_development_dependency "minitest", "~> 5.16"
         
     | 
| 
       50 
     | 
    
         
            -
              spec.add_development_dependency "standard", "~> 1.24.3"
         
     | 
| 
       51 
     | 
    
         
            -
              spec.add_development_dependency "rake", "~> 13.0"
         
     | 
| 
       52 
     | 
    
         
            -
              spec.add_development_dependency "oga", "~> 3.3"
         
     | 
| 
       53 
     | 
    
         
            -
              spec.add_development_dependency "thor", "~> 1.2"
         
     | 
| 
       54 
     | 
    
         
            -
              spec.add_development_dependency "asciidoctor-mathematical", "~> 0.3.5"
         
     | 
| 
       55 
     | 
    
         
            -
              # needed for the sinatra-based apps
         
     | 
| 
       56 
     | 
    
         
            -
              spec.add_development_dependency "sinatra", "~>2.1"
         
     | 
| 
       57 
     | 
    
         
            -
              spec.add_development_dependency "thin", "~>1.8"
         
     | 
| 
       58 
     | 
    
         
            -
              spec.add_development_dependency "rack", "2.2.3"
         
     | 
| 
       59 
     | 
    
         
            -
              spec.add_development_dependency "rack-test", "1.1"
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
48 
     | 
    
         
             
              # Run-time deps
         
     | 
| 
       62 
49 
     | 
    
         
             
              # 'matrix' needed because of incompatibilities between prawn v2.4
         
     | 
| 
       63 
50 
     | 
    
         
             
              # and ruby 3.1
         
     | 
| 
       64 
51 
     | 
    
         
             
              # sorbet-runtime
         
     | 
| 
       65 
     | 
    
         
            -
              spec.add_runtime_dependency " 
     | 
| 
       66 
     | 
    
         
            -
              spec.add_runtime_dependency " 
     | 
| 
       67 
     | 
    
         
            -
              spec.add_runtime_dependency " 
     | 
| 
       68 
     | 
    
         
            -
              spec.add_runtime_dependency "asciidoctor 
     | 
| 
       69 
     | 
    
         
            -
              spec.add_runtime_dependency "asciidoctor- 
     | 
| 
       70 
     | 
    
         
            -
              spec.add_runtime_dependency " 
     | 
| 
       71 
     | 
    
         
            -
              spec.add_runtime_dependency " 
     | 
| 
       72 
     | 
    
         
            -
              spec.add_runtime_dependency " 
     | 
| 
      
 52 
     | 
    
         
            +
              spec.add_runtime_dependency "gran", "~> 0.1", ">= 0.1.1"
         
     | 
| 
      
 53 
     | 
    
         
            +
              #  spec.add_runtime_dependency "matrix", "~>0.4"
         
     | 
| 
      
 54 
     | 
    
         
            +
              spec.add_runtime_dependency "warning", "~>1.0"
         
     | 
| 
      
 55 
     | 
    
         
            +
              spec.add_runtime_dependency "asciidoctor", "~>2.0", ">= 2.0.25"
         
     | 
| 
      
 56 
     | 
    
         
            +
              spec.add_runtime_dependency "asciidoctor-diagram", ["~> 3.0"]
         
     | 
| 
      
 57 
     | 
    
         
            +
              spec.add_runtime_dependency "asciidoctor-pdf", "~> 2.3"
         
     | 
| 
      
 58 
     | 
    
         
            +
              spec.add_runtime_dependency "git", "~> 4.0"
         
     | 
| 
      
 59 
     | 
    
         
            +
              spec.add_runtime_dependency "rouge", "~> 4.6"
         
     | 
| 
      
 60 
     | 
    
         
            +
              spec.add_runtime_dependency "prawn-svg", "~> 0.34"
         
     | 
| 
       73 
61 
     | 
    
         
             
            end
         
     | 
    
        data/lib/giblish/application.rb
    CHANGED
    
    | 
         @@ -1,59 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "gran"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative "adocsrc_providers"
         
     | 
| 
       1 
3 
     | 
    
         
             
            require_relative "cmdline"
         
     | 
| 
       2 
4 
     | 
    
         
             
            require_relative "configurator"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative "node_data_provider"
         
     | 
| 
       3 
6 
     | 
    
         
             
            require_relative "treeconverter"
         
     | 
| 
       4 
7 
     | 
    
         
             
            require_relative "gitrepos/checkoutmanager"
         
     | 
| 
       5 
8 
     | 
    
         | 
| 
       6 
9 
     | 
    
         
             
            module Giblish
         
     | 
| 
       7 
     | 
    
         
            -
              # The app class for the giblish application
         
     | 
| 
       8 
     | 
    
         
            -
              # class Application
         
     | 
| 
       9 
     | 
    
         
            -
              #   # returns on success, raises otherwise
         
     | 
| 
       10 
     | 
    
         
            -
              #   def run(args)
         
     | 
| 
       11 
     | 
    
         
            -
              #     # force immediate output
         
     | 
| 
       12 
     | 
    
         
            -
              #     $stdout.sync = true
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              #     # setup logging
         
     | 
| 
       15 
     | 
    
         
            -
              #     Giblog.setup
         
     | 
| 
       16 
     | 
    
         
            -
              #     Giblog.logger.level = Logger::INFO
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
              #     # Parse cmd line
         
     | 
| 
       19 
     | 
    
         
            -
              #     cmdline = CmdLine.new.parse(args)
         
     | 
| 
       20 
     | 
    
         
            -
              #     Giblog.logger.level = cmdline.log_level
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              #     Giblog.logger.debug { "cmd line args: #{cmdline.inspect}" }
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              #     # build a tree of files matching user's regexp selection
         
     | 
| 
       25 
     | 
    
         
            -
              #     src_tree = PathTree.build_from_fs(cmdline.srcdir) do |p|
         
     | 
| 
       26 
     | 
    
         
            -
              #       if cmdline.exclude_regex&.match(p.to_s)
         
     | 
| 
       27 
     | 
    
         
            -
              #         false
         
     | 
| 
       28 
     | 
    
         
            -
              #       else
         
     | 
| 
       29 
     | 
    
         
            -
              #         (cmdline.include_regex =~ p.to_s)
         
     | 
| 
       30 
     | 
    
         
            -
              #       end
         
     | 
| 
       31 
     | 
    
         
            -
              #     end
         
     | 
| 
       32 
     | 
    
         
            -
              #     if src_tree.nil?
         
     | 
| 
       33 
     | 
    
         
            -
              #       Giblog.logger.warn { "Did not find any files to convert" }
         
     | 
| 
       34 
     | 
    
         
            -
              #       return
         
     | 
| 
       35 
     | 
    
         
            -
              #     end
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
              #     app = Configurator.new(cmdline, src_tree)
         
     | 
| 
       38 
     | 
    
         
            -
              #     app.tree_converter.run
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
              #     Giblog.logger.info { "Giblish is done!" }
         
     | 
| 
       41 
     | 
    
         
            -
              #   end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
              #   # does not return, exits with status code
         
     | 
| 
       44 
     | 
    
         
            -
              #   def run_from_cmd_line
         
     | 
| 
       45 
     | 
    
         
            -
              #     begin
         
     | 
| 
       46 
     | 
    
         
            -
              #       run(ARGV)
         
     | 
| 
       47 
     | 
    
         
            -
              #       exit_code = 0
         
     | 
| 
       48 
     | 
    
         
            -
              #     rescue => exc
         
     | 
| 
       49 
     | 
    
         
            -
              #       Giblog.logger.error { exc.message }
         
     | 
| 
       50 
     | 
    
         
            -
              #       Giblog.logger.error { exc.backtrace }
         
     | 
| 
       51 
     | 
    
         
            -
              #       exit_code = 1
         
     | 
| 
       52 
     | 
    
         
            -
              #     end
         
     | 
| 
       53 
     | 
    
         
            -
              #     exit(exit_code)
         
     | 
| 
       54 
     | 
    
         
            -
              #   end
         
     | 
| 
       55 
     | 
    
         
            -
              # end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
10 
     | 
    
         
             
              class DirTreeConvert
         
     | 
| 
       58 
11 
     | 
    
         
             
                # This class provides a file as the source for the asciidoc info and
         
     | 
| 
       59 
12 
     | 
    
         
             
                # sets the document attributes required by Asciidoctor to resolve
         
     | 
| 
         @@ -96,7 +49,7 @@ module Giblish 
     | 
|
| 
       96 
49 
     | 
    
         | 
| 
       97 
50 
     | 
    
         
             
                # build a tree of files matching user's regexp selection
         
     | 
| 
       98 
51 
     | 
    
         
             
                def build_src_tree(srcdir, include_regex, exclude_regex)
         
     | 
| 
       99 
     | 
    
         
            -
                  pt = PathTree.build_from_fs(srcdir) do |p|
         
     | 
| 
      
 52 
     | 
    
         
            +
                  pt = Gran::PathTree.build_from_fs(srcdir) do |p|
         
     | 
| 
       100 
53 
     | 
    
         
             
                    if exclude_regex&.match(p.to_s)
         
     | 
| 
       101 
54 
     | 
    
         
             
                      false
         
     | 
| 
       102 
55 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -113,8 +66,8 @@ module Giblish 
     | 
|
| 
       113 
66 
     | 
    
         
             
                def setup_converter(src_tree, adoc_src_provider, configurator)
         
     | 
| 
       114 
67 
     | 
    
         
             
                  # compose the doc attribute provider.
         
     | 
| 
       115 
68 
     | 
    
         
             
                  configurator.doc_attr.add_doc_attr_providers(adoc_src_provider)
         
     | 
| 
       116 
     | 
    
         
            -
                  #  
     | 
| 
       117 
     | 
    
         
            -
                  data_provider =  
     | 
| 
      
 69 
     | 
    
         
            +
                  # compose the data provider for the source nodes
         
     | 
| 
      
 70 
     | 
    
         
            +
                  data_provider = NodeDataProvider.new(configurator.doc_attr, adoc_src_provider)
         
     | 
| 
       118 
71 
     | 
    
         | 
| 
       119 
72 
     | 
    
         
             
                  # associate the data providers with each source node in the tree
         
     | 
| 
       120 
73 
     | 
    
         
             
                  src_tree.traverse_preorder do |level, node|
         
     | 
| 
         @@ -178,15 +131,16 @@ module Giblish 
     | 
|
| 
       178 
131 
     | 
    
         
             
                  conf = Configurator.new(@user_opts)
         
     | 
| 
       179 
132 
     | 
    
         
             
                  s = @gm.summary_provider
         
     | 
| 
       180 
133 
     | 
    
         
             
                  s.index_basename = conf.config_opts.index_basename
         
     | 
| 
       181 
     | 
    
         
            -
                  data_provider =  
     | 
| 
       182 
     | 
    
         
            -
                     
     | 
| 
       183 
     | 
    
         
            -
                     
     | 
| 
      
 134 
     | 
    
         
            +
                  data_provider = NodeDataProvider.new(
         
     | 
| 
      
 135 
     | 
    
         
            +
                    conf.doc_attr,
         
     | 
| 
      
 136 
     | 
    
         
            +
                    SrcFromString.new(s.source)
         
     | 
| 
       184 
137 
     | 
    
         
             
                  )
         
     | 
| 
       185 
     | 
    
         
            -
                  srctree = PathTree.new("/" + conf.config_opts.index_basename + ".adoc", data_provider)
         
     | 
| 
      
 138 
     | 
    
         
            +
                  srctree = Gran::PathTree.new("/" + conf.config_opts.index_basename + ".adoc", data_provider)
         
     | 
| 
       186 
139 
     | 
    
         
             
                  TreeConverter.new(srctree, @dst_topdir, conf.build_options).run
         
     | 
| 
       187 
140 
     | 
    
         
             
                end
         
     | 
| 
       188 
141 
     | 
    
         
             
              end
         
     | 
| 
       189 
142 
     | 
    
         | 
| 
      
 143 
     | 
    
         
            +
              # The main entry point to the giblish application
         
     | 
| 
       190 
144 
     | 
    
         
             
              class EntryPoint
         
     | 
| 
       191 
145 
     | 
    
         
             
                def initialize(args, logger = nil)
         
     | 
| 
       192 
146 
     | 
    
         
             
                  # force immediate output
         
     | 
| 
         @@ -0,0 +1,84 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "../docid/docid"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative "../indexbuilders/depgraphbuilder"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Giblish
         
     | 
| 
      
 5 
     | 
    
         
            +
              # AIDEV-NOTE: Immutable value object for DocId configuration
         
     | 
| 
      
 6 
     | 
    
         
            +
              class DocIdConfig
         
     | 
| 
      
 7 
     | 
    
         
            +
                # @return [Array<DocIdExtension::DocidPreBuilder>] Pre-build processors
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :pre_builders
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                # @return [Array<DocIdExtension::DocidProcessor>] Asciidoctor preprocessors
         
     | 
| 
      
 11 
     | 
    
         
            +
                attr_reader :preprocessors
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                # @return [Array<DependencyGraphPostBuilder>] Post-build processors
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_reader :post_builders
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                # Creates immutable DocId configuration.
         
     | 
| 
      
 17 
     | 
    
         
            +
                #
         
     | 
| 
      
 18 
     | 
    
         
            +
                # @param pre_builders [Array<DocIdExtension::DocidPreBuilder>]
         
     | 
| 
      
 19 
     | 
    
         
            +
                # @param preprocessors [Array<DocIdExtension::DocidProcessor>]
         
     | 
| 
      
 20 
     | 
    
         
            +
                # @param post_builders [Array<DependencyGraphPostBuilder>]
         
     | 
| 
      
 21 
     | 
    
         
            +
                def initialize(pre_builders:, preprocessors:, post_builders:)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @pre_builders = pre_builders.freeze
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @preprocessors = preprocessors.freeze
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @post_builders = post_builders.freeze
         
     | 
| 
      
 25 
     | 
    
         
            +
                  freeze
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              # AIDEV-NOTE: Builder for DocId configuration following established provider pattern
         
     | 
| 
      
 30 
     | 
    
         
            +
              class DocIdConfigBuilder
         
     | 
| 
      
 31 
     | 
    
         
            +
                # Builds complete DocId configuration based on user options.
         
     | 
| 
      
 32 
     | 
    
         
            +
                # Returns a null configuration if DocId resolution is disabled.
         
     | 
| 
      
 33 
     | 
    
         
            +
                #
         
     | 
| 
      
 34 
     | 
    
         
            +
                # @param config_opts [CmdLine::Options] User configuration with resolve_docid flag
         
     | 
| 
      
 35 
     | 
    
         
            +
                # @return [DocIdConfig] Configuration with pre-builders, preprocessors, and post-builders
         
     | 
| 
      
 36 
     | 
    
         
            +
                def self.build(config_opts)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  return null_config unless config_opts.resolve_docid
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  docid_prebuilder = DocIdExtension::DocidPreBuilder.new
         
     | 
| 
      
 40 
     | 
    
         
            +
                  docid_processor = DocIdExtension::DocidProcessor.new({id_2_node: docid_prebuilder.id_2_node})
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  post_builders = build_post_builders(config_opts, docid_processor)
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  DocIdConfig.new(
         
     | 
| 
      
 45 
     | 
    
         
            +
                    pre_builders: [docid_prebuilder],
         
     | 
| 
      
 46 
     | 
    
         
            +
                    preprocessors: [docid_processor],
         
     | 
| 
      
 47 
     | 
    
         
            +
                    post_builders: post_builders
         
     | 
| 
      
 48 
     | 
    
         
            +
                  )
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                # @param config_opts [CmdLine::Options]
         
     | 
| 
      
 52 
     | 
    
         
            +
                # @param docid_processor [DocIdExtension::DocidProcessor]
         
     | 
| 
      
 53 
     | 
    
         
            +
                # @return [Array<DependencyGraphPostBuilder>]
         
     | 
| 
      
 54 
     | 
    
         
            +
                def self.build_post_builders(config_opts, docid_processor)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  builders = []
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  # Add dependency graph if not disabled and graphviz is available
         
     | 
| 
      
 58 
     | 
    
         
            +
                  unless config_opts.no_index
         
     | 
| 
      
 59 
     | 
    
         
            +
                    if DependencyGraphPostBuilder.dot_supported
         
     | 
| 
      
 60 
     | 
    
         
            +
                      builders << DependencyGraphPostBuilder.new(
         
     | 
| 
      
 61 
     | 
    
         
            +
                        docid_processor.node_2_ids,
         
     | 
| 
      
 62 
     | 
    
         
            +
                        nil,
         
     | 
| 
      
 63 
     | 
    
         
            +
                        nil,
         
     | 
| 
      
 64 
     | 
    
         
            +
                        nil,
         
     | 
| 
      
 65 
     | 
    
         
            +
                        config_opts.graph_basename
         
     | 
| 
      
 66 
     | 
    
         
            +
                      )
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                  builders
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                # @return [DocIdConfig]
         
     | 
| 
      
 74 
     | 
    
         
            +
                def self.null_config
         
     | 
| 
      
 75 
     | 
    
         
            +
                  DocIdConfig.new(
         
     | 
| 
      
 76 
     | 
    
         
            +
                    pre_builders: [],
         
     | 
| 
      
 77 
     | 
    
         
            +
                    preprocessors: [],
         
     | 
| 
      
 78 
     | 
    
         
            +
                    post_builders: []
         
     | 
| 
      
 79 
     | 
    
         
            +
                  )
         
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                private_class_method :build_post_builders, :null_config
         
     | 
| 
      
 83 
     | 
    
         
            +
              end
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "index_config_builder"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative "../gitrepos/history_pb"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative "../indexbuilders/subtree_indices"
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Giblish
         
     | 
| 
      
 6 
     | 
    
         
            +
              # AIDEV-NOTE: Builder for git-specific Index configuration with history support
         
     | 
| 
      
 7 
     | 
    
         
            +
              class GitIndexConfigBuilder
         
     | 
| 
      
 8 
     | 
    
         
            +
                # Builds complete Index configuration with git history support.
         
     | 
| 
      
 9 
     | 
    
         
            +
                # Returns a null configuration if index generation is disabled.
         
     | 
| 
      
 10 
     | 
    
         
            +
                #
         
     | 
| 
      
 11 
     | 
    
         
            +
                # @param config_opts [CmdLine::Options] User configuration with no_index flag
         
     | 
| 
      
 12 
     | 
    
         
            +
                # @param resource_paths [ResourcePaths] Resolved paths for templates
         
     | 
| 
      
 13 
     | 
    
         
            +
                # @param doc_attr [DocAttrBuilder] Document attribute builder
         
     | 
| 
      
 14 
     | 
    
         
            +
                # @param git_repo_dir [Pathname] Path to git repository root
         
     | 
| 
      
 15 
     | 
    
         
            +
                # @return [IndexConfig] Configuration with index generation and git history support
         
     | 
| 
      
 16 
     | 
    
         
            +
                def self.build(config_opts, resource_paths, doc_attr, git_repo_dir)
         
     | 
| 
      
 17 
     | 
    
         
            +
                  return IndexConfigBuilder.null_config if config_opts.no_index
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  post_builders = []
         
     | 
| 
      
 20 
     | 
    
         
            +
                  post_builders << AddHistoryPostBuilder.new(git_repo_dir)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  adoc_src_provider = SubtreeIndexGit.new(
         
     | 
| 
      
 23 
     | 
    
         
            +
                    {erb_template_path: resource_paths.idx_erb_template_abs}
         
     | 
| 
      
 24 
     | 
    
         
            +
                  )
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  idx = SubtreeInfoBuilder.new(
         
     | 
| 
      
 27 
     | 
    
         
            +
                    doc_attr,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    nil,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    adoc_src_provider,
         
     | 
| 
      
 30 
     | 
    
         
            +
                    config_opts.index_basename
         
     | 
| 
      
 31 
     | 
    
         
            +
                  )
         
     | 
| 
      
 32 
     | 
    
         
            +
                  post_builders << idx
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  IndexConfig.new(post_builders: post_builders)
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,53 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative "../subtreeinfobuilder"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative "../indexbuilders/subtree_indices"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Giblish
         
     | 
| 
      
 5 
     | 
    
         
            +
              # AIDEV-NOTE: Immutable value object for Index configuration
         
     | 
| 
      
 6 
     | 
    
         
            +
              class IndexConfig
         
     | 
| 
      
 7 
     | 
    
         
            +
                # @return [Array<SubtreeInfoBuilder>] Post-build processors for index generation
         
     | 
| 
      
 8 
     | 
    
         
            +
                attr_reader :post_builders
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                # Creates immutable Index configuration.
         
     | 
| 
      
 11 
     | 
    
         
            +
                #
         
     | 
| 
      
 12 
     | 
    
         
            +
                # @param post_builders [Array<SubtreeInfoBuilder>]
         
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(post_builders:)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @post_builders = post_builders.freeze
         
     | 
| 
      
 15 
     | 
    
         
            +
                  freeze
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              # AIDEV-NOTE: Builder for Index configuration following established provider pattern
         
     | 
| 
      
 20 
     | 
    
         
            +
              class IndexConfigBuilder
         
     | 
| 
      
 21 
     | 
    
         
            +
                # Builds complete Index configuration with index generation support.
         
     | 
| 
      
 22 
     | 
    
         
            +
                # Returns a null configuration if index generation is disabled.
         
     | 
| 
      
 23 
     | 
    
         
            +
                #
         
     | 
| 
      
 24 
     | 
    
         
            +
                # @param config_opts [CmdLine::Options] User configuration with no_index flag
         
     | 
| 
      
 25 
     | 
    
         
            +
                # @param resource_paths [ResourcePaths] Resolved paths for templates
         
     | 
| 
      
 26 
     | 
    
         
            +
                # @param doc_attr [DocAttrBuilder] Document attribute builder
         
     | 
| 
      
 27 
     | 
    
         
            +
                # @param adoc_src_provider_class [Class] Class for generating index source (defaults to SubtreeIndexBase)
         
     | 
| 
      
 28 
     | 
    
         
            +
                # @return [IndexConfig] Configuration with index generation post-builders
         
     | 
| 
      
 29 
     | 
    
         
            +
                def self.build(config_opts, resource_paths, doc_attr, adoc_src_provider_class = SubtreeIndexBase)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  return null_config if config_opts.no_index
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  adoc_src_provider = adoc_src_provider_class.new(
         
     | 
| 
      
 33 
     | 
    
         
            +
                    {erb_template_path: resource_paths.idx_erb_template_abs}
         
     | 
| 
      
 34 
     | 
    
         
            +
                  )
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  idx = SubtreeInfoBuilder.new(
         
     | 
| 
      
 37 
     | 
    
         
            +
                    doc_attr,
         
     | 
| 
      
 38 
     | 
    
         
            +
                    nil,
         
     | 
| 
      
 39 
     | 
    
         
            +
                    adoc_src_provider,
         
     | 
| 
      
 40 
     | 
    
         
            +
                    config_opts.index_basename
         
     | 
| 
      
 41 
     | 
    
         
            +
                  )
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  IndexConfig.new(post_builders: [idx])
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                # @return [IndexConfig]
         
     | 
| 
      
 47 
     | 
    
         
            +
                def self.null_config
         
     | 
| 
      
 48 
     | 
    
         
            +
                  IndexConfig.new(post_builders: [])
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                private_class_method :null_config
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/giblish/config_utils.rb
    CHANGED
    
    | 
         @@ -1,44 +1,2 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Giblish
         
     | 
| 
       2 
     | 
    
         
            -
              # delegates all method calls to the first supplied delegate that
         
     | 
| 
       3 
     | 
    
         
            -
              # implements it.
         
     | 
| 
       4 
     | 
    
         
            -
              class DataDelegator
         
     | 
| 
       5 
     | 
    
         
            -
                attr_reader :delegates
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                def initialize(*delegate_arr)
         
     | 
| 
       8 
     | 
    
         
            -
                  @delegates = Array(delegate_arr)
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                def add(delegate)
         
     | 
| 
       12 
     | 
    
         
            -
                  @delegates << delegate
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                # define this to short-cut circular references
         
     | 
| 
       16 
     | 
    
         
            -
                #
         
     | 
| 
       17 
     | 
    
         
            -
                # TODO: This should probably be avoided by refactoring the SuccessfulConversion
         
     | 
| 
       18 
     | 
    
         
            -
                # class which, as of this writing, is part of a circular ref to a PathTree which
         
     | 
| 
       19 
     | 
    
         
            -
                # throws 'inspect' calls into an eternal loop instead of implementing a custom 'inspect'
         
     | 
| 
       20 
     | 
    
         
            -
                # method.
         
     | 
| 
       21 
     | 
    
         
            -
                def inspect
         
     | 
| 
       22 
     | 
    
         
            -
                  @delegates.map do |d|
         
     | 
| 
       23 
     | 
    
         
            -
                    "<#{d.class}:#{d.object_id}>"
         
     | 
| 
       24 
     | 
    
         
            -
                  end.join(",")
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                def method_missing(m, *args, &block)
         
     | 
| 
       28 
     | 
    
         
            -
                  del = @delegates&.find { |d| d.respond_to?(m) }
         
     | 
| 
       29 
     | 
    
         
            -
                  if del.nil?
         
     | 
| 
       30 
     | 
    
         
            -
                    Giblog.logger.warn { "Did not find method '#{m}' in any delegate (#{@delegates}"}
         
     | 
| 
       31 
     | 
    
         
            -
                  end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                  del.nil? ? super : del.send(m, *args, &block)
         
     | 
| 
       34 
     | 
    
         
            -
                end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                def respond_to_missing?(method_name, include_private = false)
         
     | 
| 
       37 
     | 
    
         
            -
                  ok = @delegates.find { |d|
         
     | 
| 
       38 
     | 
    
         
            -
                    d.respond_to?(method_name)
         
     | 
| 
       39 
     | 
    
         
            -
                  }
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                  ok || super(method_name, include_private)
         
     | 
| 
       42 
     | 
    
         
            -
                end
         
     | 
| 
       43 
     | 
    
         
            -
              end
         
     | 
| 
       44 
2 
     | 
    
         
             
            end
         
     |