vispan 0.6.0 → 0.7.0

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
  SHA1:
3
- metadata.gz: 16ae8378441dec19d14ad6dbc0a35d8225c1767d
4
- data.tar.gz: a3fbf472097f38bfe35bbe0222760cc8c26617c9
3
+ metadata.gz: 0223f7cfd208708a1fab670b3ec424f1520bf969
4
+ data.tar.gz: c298807c684cea9249d3341adcf5ad57cdca3155
5
5
  SHA512:
6
- metadata.gz: c046015855ed153d23bc879c9c4a775750a67416a91c7f15b9f5a7a49a30ca19d63539559624fdb82ea60885ecfe1b83388f0b67076e65613ce1634f76f609c1
7
- data.tar.gz: 1e7440ae83f4d5a54a93932bce9bdd42a73b332f4c19777edc89f5b2881f98b03874800d6bfc3a95abe7b2c9cf5c3407a0254f9cb6bb9bfa04f5e9833b746804
6
+ metadata.gz: c39a467ef8ec4130b12d7cce31cafd95576227f4a4ca7f5ca90aba3c676bb92fa206d9e38a705c1832273f9540b7733929d21cae187a09895618fd6ec465ac0f
7
+ data.tar.gz: a301dd388f4cddca1bbc8023ad168a645f2a8c0cc746918a862f1716b6ee1074fec50f1af381d535ec5dc22e1f15fb76bad12829be35b7d76cc76df475f32463
@@ -5,7 +5,7 @@ require "./lib/vispan.rb"
5
5
  if ARGV.length == 2
6
6
  input_file = ARGV[0]
7
7
  output_file = ARGV[1]
8
- process = Vispan.new(input_file)
8
+ process = Vispan::WebPreview.new(input_file)
9
9
  process.display_text
10
10
  process.visualize(output_file)
11
11
  else
@@ -1,5 +1,3 @@
1
- # require "process_visualisation/version.rb"
2
- require 'rack'
3
1
  require "vispan/szenario.rb"
4
2
  require "vispan/relation.rb"
5
3
  require "vispan/node.rb"
@@ -9,13 +7,10 @@ require "vispan/output_graphic.rb"
9
7
  module Vispan
10
8
  attr_reader :processed_string, :nodes, :text, :szenarios
11
9
 
12
- class WebPreview < Rack::Static
10
+ class WebPreview
13
11
  def call(env)
14
- # initialize()
15
- self.visualize(Rails.root.join('app/assets/images/process.png'))
16
- #generate process.png
17
- # [200, {"Content-Type" => "text/plain"}, env]
18
- [200, {"Content-Type" => "image/png"}, [IO.read(Rails.root.join('app/assets/images/process.png'))]]
12
+ self.visualize('process.png')
13
+ [200, {"Content-Type" => "image/png"}, [IO.read('process.png')]]
19
14
  end
20
15
 
21
16
  def initialize(input_file)
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,9 @@
1
+ require 'tempfile'
2
+
1
3
  class OutputGraphic
2
4
 
3
5
  def initialize(szenarios, output_file)
6
+ @file = Tempfile.new(['processed', '.dot'])
4
7
  @szenarios = szenarios
5
8
  @processed_string = ""
6
9
  @output_file = output_file
@@ -18,16 +21,15 @@ class OutputGraphic
18
21
  end
19
22
 
20
23
  def generate_processed_file(processed_string)
21
- ready = File.open("lib/process_visualisation/input_processed.dot", "w") {
22
- |file| file.write(processed_string)
23
- }
24
+ @file << processed_string
25
+ @file.close
24
26
  end
25
27
 
26
28
  def generate_graph(output_file)
27
-
28
29
  file_ending = check_output(output_file)
29
- cmd = "dot -T#{file_ending} lib/process_visualisation/input_processed.dot -o #{output_file}"
30
+ cmd = "dot -T#{file_ending} #{@file.path} -o #{output_file}"
30
31
  system(cmd)
32
+ @file.unlink
31
33
  end
32
34
 
33
35
  def check_output(output_file)
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vispan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Witek
@@ -113,3 +113,4 @@ signing_key:
113
113
  specification_version: 4
114
114
  summary: Visualize processes with simple syntax and multiple output formats
115
115
  test_files: []
116
+ has_rdoc: