dogviz 0.0.17 → 0.0.18
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/lib/dogviz/colorizer.rb +25 -0
 - data/lib/dogviz/common.rb +89 -0
 - data/lib/dogviz/container.rb +88 -0
 - data/lib/dogviz/duplicate_lookup_error.rb +7 -0
 - data/lib/dogviz/flow.rb +67 -0
 - data/lib/dogviz/flowable.rb +9 -0
 - data/lib/dogviz/graphviz_renderer.rb +60 -0
 - data/lib/dogviz/logical_container.rb +8 -0
 - data/lib/dogviz/lookup_error.rb +7 -0
 - data/lib/dogviz/missing_match_block_error.rb +7 -0
 - data/lib/dogviz/nominator.rb +18 -0
 - data/lib/dogviz/parent.rb +38 -0
 - data/lib/dogviz/process.rb +18 -0
 - data/lib/dogviz/registry.rb +39 -0
 - data/lib/dogviz/rendered_sequence.rb +13 -0
 - data/lib/dogviz/sequence_renderer.rb +47 -0
 - data/lib/dogviz/sigma_graph_hash.rb +25 -0
 - data/lib/dogviz/sigma_renderer.rb +32 -0
 - data/lib/dogviz/system.rb +95 -0
 - data/lib/dogviz/thing.rb +135 -0
 - data/lib/dogviz/version.rb +1 -1
 - data/lib/dogviz.rb +7 -687
 - data/tests/test_dogviz_sigma_rendering.rb +68 -0
 - data/todo.txt +7 -0
 - metadata +24 -2
 
| 
         @@ -0,0 +1,68 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'setup_tests'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TestDogvizSigmaRendering < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              include Dogviz
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              attr_reader :sys
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 9 
     | 
    
         
            +
                @sys = Dogviz::System.new 'test'
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def test_renders_empty_graph__as_sigma_js_graph_definition
         
     | 
| 
      
 13 
     | 
    
         
            +
                graph = sys.render(:sigma)
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                assert_equal({ nodes: [], edges: [] }, graph)
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def test_renders_single_node__as_sigma_js_graph_definition
         
     | 
| 
      
 19 
     | 
    
         
            +
                sys.thing('a')
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                graph = sys.render(:sigma)
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                assert_equal({nodes: [ { id: 'a', label: 'a' }], edges: []}, graph)
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def test_renders_two_linked_nodes
         
     | 
| 
      
 27 
     | 
    
         
            +
                sys.thing('a').points_to sys.thing('b')
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                graph = sys.render(:sigma)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                assert_equal({nodes: [
         
     | 
| 
      
 32 
     | 
    
         
            +
                    { id: 'a', label: 'a' },
         
     | 
| 
      
 33 
     | 
    
         
            +
                    { id: 'b', label: 'b' }
         
     | 
| 
      
 34 
     | 
    
         
            +
                ], edges: [
         
     | 
| 
      
 35 
     | 
    
         
            +
                    {
         
     | 
| 
      
 36 
     | 
    
         
            +
                        id: 'a->b',
         
     | 
| 
      
 37 
     | 
    
         
            +
                        label: 'a->b',
         
     | 
| 
      
 38 
     | 
    
         
            +
                        source: 'a',
         
     | 
| 
      
 39 
     | 
    
         
            +
                        target: 'b'
         
     | 
| 
      
 40 
     | 
    
         
            +
                    }
         
     | 
| 
      
 41 
     | 
    
         
            +
                ]}, graph)
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                graph.output json: '/tmp/simpls.json'
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              def test_outputs_to_json
         
     | 
| 
      
 47 
     | 
    
         
            +
                outfile = '/tmp/sigma_test.json'
         
     | 
| 
      
 48 
     | 
    
         
            +
                FileUtils.rm_f outfile
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                empty_graph = sys.render(:sigma)
         
     | 
| 
      
 51 
     | 
    
         
            +
                empty_graph.output json: outfile
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                assert_equal('{"nodes":[],"edges":[]}', File.read(outfile))
         
     | 
| 
      
 54 
     | 
    
         
            +
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              def test_output_requires_type
         
     | 
| 
      
 57 
     | 
    
         
            +
                assert_raise_with_message(StandardError, /provide hash/) {
         
     | 
| 
      
 58 
     | 
    
         
            +
                  sys.render(:sigma).output 'file'
         
     | 
| 
      
 59 
     | 
    
         
            +
                }
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              def test_json_only_output
         
     | 
| 
      
 63 
     | 
    
         
            +
                assert_raise_with_message(StandardError, /json.*only/) {
         
     | 
| 
      
 64 
     | 
    
         
            +
                  sys.render(:sigma).output xml: 'xmlfile'
         
     | 
| 
      
 65 
     | 
    
         
            +
                }
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            end
         
     | 
    
        data/todo.txt
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            * render generic output (sigma.js json) for ingestion -> unity
         
     | 
| 
      
 2 
     | 
    
         
            +
            * move from inheritance -> better encaps
         
     | 
| 
      
 3 
     | 
    
         
            +
            * sort out fore vs back color
         
     | 
| 
      
 4 
     | 
    
         
            +
            * move out any graphviz specifics from main models, e.g. colorize
         
     | 
| 
      
 5 
     | 
    
         
            +
            * clean up init options + render attributes - not v clear / overlapping
         
     | 
| 
      
 6 
     | 
    
         
            +
            * separate style from domain-specific elements (can use same view-manipulation selection mechanisms)
         
     | 
| 
      
 7 
     | 
    
         
            +
            * make style attributes well defined -> less leaky + explicit graphviz passthroughs
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: dogviz
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.18
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - damned
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-11-19 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -115,6 +115,26 @@ files: 
     | 
|
| 
       115 
115 
     | 
    
         
             
            - examples/website.rb
         
     | 
| 
       116 
116 
     | 
    
         
             
            - examples/website_domain.rb
         
     | 
| 
       117 
117 
     | 
    
         
             
            - lib/dogviz.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib/dogviz/colorizer.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - lib/dogviz/common.rb
         
     | 
| 
      
 120 
     | 
    
         
            +
            - lib/dogviz/container.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - lib/dogviz/duplicate_lookup_error.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - lib/dogviz/flow.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - lib/dogviz/flowable.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - lib/dogviz/graphviz_renderer.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - lib/dogviz/logical_container.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib/dogviz/lookup_error.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - lib/dogviz/missing_match_block_error.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - lib/dogviz/nominator.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            - lib/dogviz/parent.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/dogviz/process.rb
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/dogviz/registry.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/dogviz/rendered_sequence.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - lib/dogviz/sequence_renderer.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib/dogviz/sigma_graph_hash.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/dogviz/sigma_renderer.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            - lib/dogviz/system.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            - lib/dogviz/thing.rb
         
     | 
| 
       118 
138 
     | 
    
         
             
            - lib/dogviz/version.rb
         
     | 
| 
       119 
139 
     | 
    
         
             
            - tests/graph_checking.rb
         
     | 
| 
       120 
140 
     | 
    
         
             
            - tests/setup_tests.rb
         
     | 
| 
         @@ -124,7 +144,9 @@ files: 
     | 
|
| 
       124 
144 
     | 
    
         
             
            - tests/test_dogviz_functionally.rb
         
     | 
| 
       125 
145 
     | 
    
         
             
            - tests/test_dogviz_graph.rb
         
     | 
| 
       126 
146 
     | 
    
         
             
            - tests/test_dogviz_graphviz_rendering.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - tests/test_dogviz_sigma_rendering.rb
         
     | 
| 
       127 
148 
     | 
    
         
             
            - tests/test_thing.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - todo.txt
         
     | 
| 
       128 
150 
     | 
    
         
             
            homepage: https://github.com/damned/dogviz
         
     | 
| 
       129 
151 
     | 
    
         
             
            licenses:
         
     | 
| 
       130 
152 
     | 
    
         
             
            - MIT
         
     |