gv_fsm 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gv_fsm +26 -4
  3. data/lib/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37d68711f43acf07c3071b793721cf34301e3b16dd01dbaeeae5083346337e98
4
- data.tar.gz: d47b62e5dcc5f7feafecc2e27744e94e2a96c8ed81ffe6f9425545558e8802d6
3
+ metadata.gz: 74b717895ae52d4a28c56c12944e18db81886463858bd42d9507a6cbb3c1309e
4
+ data.tar.gz: f929706aace8b53639fdd8e67aa3096be88994c551266d4c7805196144595e26
5
5
  SHA512:
6
- metadata.gz: 06b70b565f5e2aacea2840528cbc7da9150f7bba5d680502d1e8103986f8b9f9162bde162ee217fa9f0a6c8d8ee635a1c41db068f5b5df198200e414af01b0cb
7
- data.tar.gz: fc11849dda745e5e0fc3d3ade2356c1ec6d201e50c9093db98f2d01878e2c7b3e0f1871762811d590ad62b34d5307527f983e896d3aa10de4e36ee43796b0fb0
6
+ metadata.gz: a807c54fa79bda61a07df1fee06b8dac62d193d92eb7e056a44c56b144fd008f63e983b0ea28e18d1a7008637a5cf5c64dd21a430f5133cb03f8ca62a75af021
7
+ data.tar.gz: 6c471ada43c67ef29bdf12d7797b8f4d4bd23aa4e37bcc78ff7e56f0c91657c01066bec2ee5ee5d64a8c5ce0ac50845c4a156e7cf5ebc5d2af28413d25be3a40
data/bin/gv_fsm CHANGED
@@ -5,8 +5,15 @@ require 'optparse'
5
5
 
6
6
  sm = GV_FSM::FSM.new
7
7
 
8
- options = {}
8
+ options = {header: true, source: true}
9
9
  OptionParser.new do |parser|
10
+ parser.banner =<<~EOB
11
+ Graphviz to Finite State Machine generator
12
+ Version: #{GV_FSM::VERSION}
13
+ See also https://github.com/pbosetti/gv_fsm
14
+ Usage: gv_fsm [options] scheme.dot
15
+ EOB
16
+
10
17
  parser.on("-p", "--project PROJECT_NAME",
11
18
  "Set the project name to PROJECT_NAME") do |pn|
12
19
  sm.project_name = pn
@@ -19,12 +26,27 @@ OptionParser.new do |parser|
19
26
  parser.on("-o", "--output_file NAME", "Use NAME for generated .c and .h files") do |f|
20
27
  sm.cname = f
21
28
  end
29
+
30
+ parser.on("-h", "--header-only", "Only generate header file") do
31
+ options[:source] = false
32
+ end
33
+
34
+ parser.on("-s", "--source-only", "Only generate source file") do
35
+ options[:header] = false
36
+ end
37
+
22
38
  end.parse!
23
39
 
24
40
  raise ArgumentError, "I need the path to a Graphviz file!" unless ARGV[0]
25
41
  raise ArgumentError, "#{ARGV[0]} does not look like a Graphviz file!" unless File.extname(ARGV[0]) == ".dot"
26
42
 
27
43
  sm.parse(ARGV[0])
28
- sm.generate_h
29
- sm.generate_c
30
-
44
+ puts "Parsed #{sm.dotfile}.\nGenerating C stub for states: #{sm.states_list.join(", ")}."
45
+ if options[:header] then
46
+ sm.generate_h
47
+ puts "Generated header #{sm.cname}.h"
48
+ end
49
+ if options[:source] then
50
+ sm.generate_c
51
+ puts "Generated source #{sm.cname}.c"
52
+ end
@@ -1,3 +1,3 @@
1
1
  module GV_FSM
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gv_fsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Bosetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-28 00:00:00.000000000 Z
11
+ date: 2020-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-graphviz