trailblazer-developer 0.0.2 → 0.0.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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a335d20215b1a63a952f0e94df992dd342cbf24dc20b91f7b70d41c120cb8dd3
         | 
| 4 | 
            +
              data.tar.gz: 79f2dc801129d1f23b08ff48ec0f57c2384c07a60d91d938c0e2295f83e0a542
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9ae845e9b99bc30d96da9bba11e8b46e439bc1f103b5823402b363ac57fa517baf7a0cf3c189b827ab58cfff1176938215f4af5350a1232a5100577b9ded9f0c
         | 
| 7 | 
            +
              data.tar.gz: 2fc6c5fb824f423489ae41031aa4544172bbe56163681cc4944ee6cb0fd88d24ba173badf6516901fcc359ea4ce208d123f65fe4d6196362d169001a556b92d1
         | 
| @@ -0,0 +1,71 @@ | |
| 1 | 
            +
            module Trailblazer
         | 
| 2 | 
            +
              # Operation-specific circuit rendering. This is optimized for a linear railway circuit.
         | 
| 3 | 
            +
              #
         | 
| 4 | 
            +
              # @private
         | 
| 5 | 
            +
              #
         | 
| 6 | 
            +
              # NOTE: this is absolutely to be considered as prototyping and acts more like a test helper ATM as
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              module Developer
         | 
| 9 | 
            +
                def self.railway(*args)
         | 
| 10 | 
            +
                  Render::Linear.(*args)
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                module Render
         | 
| 14 | 
            +
                  module Linear
         | 
| 15 | 
            +
                    module_function
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    def call(operation, options = {style: :line})
         | 
| 18 | 
            +
                      graph = Activity::Introspect::Graph(operation)
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                      rows = graph.collect do |node, i|
         | 
| 21 | 
            +
                        next if node[:data][:stop_event] # DISCUSS: show this?
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                        created_by = node[:data][:dsl_track] || :pass
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                        [i, [created_by, node.id]]
         | 
| 26 | 
            +
                      end.compact
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                      rows = rows[1..-1] # remove start
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                      return inspect_line(rows) if options[:style] == :line
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                      return inspect_rows(rows)
         | 
| 33 | 
            +
                    end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    def inspect_func(step)
         | 
| 36 | 
            +
                      @inspect[step]
         | 
| 37 | 
            +
                    end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                    Operator = {fail: "<<", pass: ">>", step: ">"}
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                    def inspect_line(names)
         | 
| 42 | 
            +
                      string = names.collect { |i, (end_of_edge, name)| "#{Operator[end_of_edge]}#{name}" }.join(",")
         | 
| 43 | 
            +
                      "[#{string}]"
         | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    def inspect_rows(names)
         | 
| 47 | 
            +
                      string = names.collect do |i, (end_of_edge, name)|
         | 
| 48 | 
            +
                        operator = Operator[end_of_edge]
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                        op = "#{operator}#{name}"
         | 
| 51 | 
            +
                        padding = 38
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                        proc = if operator == "<<"
         | 
| 54 | 
            +
                                 sprintf("%- #{padding}s", op)
         | 
| 55 | 
            +
                               elsif [">", ">>", "&"].include?(operator.to_s)
         | 
| 56 | 
            +
                                 sprintf("% #{padding}s", op)
         | 
| 57 | 
            +
                               else
         | 
| 58 | 
            +
                                 pad = " " * ((padding - op.length) / 2)
         | 
| 59 | 
            +
                                 "#{pad}#{op}#{pad}"
         | 
| 60 | 
            +
                               end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                        proc = proc.gsub(" ", "=")
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                        sprintf("%2d %s", i, proc)
         | 
| 65 | 
            +
                      end.join("\n")
         | 
| 66 | 
            +
                      "\n#{string}"
         | 
| 67 | 
            +
                    end
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
              end
         | 
| 71 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: trailblazer-developer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Nick Sutterer
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019-06- | 
| 11 | 
            +
            date: 2019-06-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -130,6 +130,7 @@ files: | |
| 130 130 | 
             
            - lib/trailblazer/developer/client.rb
         | 
| 131 131 | 
             
            - lib/trailblazer/developer/generate.rb
         | 
| 132 132 | 
             
            - lib/trailblazer/developer/render/circuit.rb
         | 
| 133 | 
            +
            - lib/trailblazer/developer/render/linear.rb
         | 
| 133 134 | 
             
            - lib/trailblazer/developer/version.rb
         | 
| 134 135 | 
             
            - lib/trailblazer/developer/wtf.rb
         | 
| 135 136 | 
             
            - lib/trailblazer/diagram/bpmn.rb
         |