requidef 0.1.4 → 0.2.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.
- data/ChangeLog.md +8 -7
- data/README.md +5 -5
- data/bin/Makefile +2 -2
- data/bin/requidef +42 -17
- data/bin/requidef.rb +42 -17
- data/bin/sample.html +32 -0
- data/bin/sample.mm +9 -0
- data/lib/html2rd.rb +4 -4
- data/lib/mm2rdtree.rb +7 -8
- data/lib/rd2rdnodes.rb +9 -7
- data/lib/rd2rdtree.rb +2 -2
- data/lib/rdnodes2rdtree.rb +4 -0
- data/lib/rdtree.rb +1 -1
- data/lib/rdtree2rd.rb +5 -1
- data/lib/requidef.rb +21 -7
- metadata +14 -10
data/ChangeLog.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# version 0.1.0
|
2
|
-
The consequence of 10H rapid developement.
|
3
|
-
It had many bugs so we could not use the command after 'gem install'ing.
|
2
|
+
The consequence of 10H rapid developement.
|
3
|
+
It had many bugs so we could not use the command after 'gem install'ing.
|
4
4
|
|
5
5
|
# version 0.2.0
|
6
|
-
(Below describes the future which is not happened still.)
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
(Below describes the future which is not happened still.)
|
7
|
+
|
8
|
+
We found that the .rd file is not as easy to edit as we had expected.
|
9
|
+
So we decided to edit file in XMind, a free MindMap tool, export it to HTML to translate to .rd file.
|
10
|
+
Other features,
|
10
11
|
* The commandline I/F is changed.
|
11
|
-
* Fixed the
|
12
|
+
* Fixed the flashed bugs in 0.1.0.
|
12
13
|
* Provides some converter functionality.
|
13
14
|
* It is now ready to get started by just gem installing.
|
data/README.md
CHANGED
@@ -3,11 +3,11 @@ Requiem for the boring Requirement Definitions.
|
|
3
3
|
Save time and get back to coding.
|
4
4
|
|
5
5
|
## Motivation
|
6
|
-
Do you know the most and the last thing that hinder our technology grow rapidly in this century?
|
7
|
-
The most harmful software, you know that is the MS Office.
|
8
|
-
We, workers, are forced to write ten of thousand of lenghty documents with MS Word, MS Excel ... you know what.
|
9
|
-
I disrespect every single of the softwares MS provides.
|
10
|
-
Today, we declared to be free from these greedy evils.
|
6
|
+
Do you know the most and the last thing that hinder our technology grow rapidly in this century?
|
7
|
+
The most harmful software, you know that is the MS Office.
|
8
|
+
We, workers, are forced to write ten of thousand of lenghty documents with MS Word, MS Excel ... you know what.
|
9
|
+
I disrespect every single of the softwares MS provides.
|
10
|
+
Today, we declared to be free from these greedy evils.
|
11
11
|
|
12
12
|
This software, requidef [r`ekwidef], will guide you to the haven where any documentation works are happy.
|
13
13
|
|
data/bin/Makefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
sample : dot_sample csv_sample
|
2
2
|
|
3
3
|
dot_sample :
|
4
|
-
requidef --
|
4
|
+
cat sample.mm | requidef --from=mm --to=rd | requidef --from=rd --to=dot > sample.dot
|
5
5
|
dot -Tjpg sample.dot -o sample.jpg
|
6
6
|
|
7
7
|
csv_sample :
|
8
|
-
requidef
|
8
|
+
cat sample.html | requidef --from=html --to=rd | requidef --from=rd --to=csv > sample.csv
|
9
9
|
|
10
10
|
clean_sample :
|
11
11
|
rm sample.dot sample.csv sample.jpg
|
data/bin/requidef
CHANGED
@@ -3,33 +3,58 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
3
3
|
require "requidef"
|
4
4
|
require "optparse"
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
# Main
|
7
|
+
opt = OptionParser.new
|
8
|
+
|
9
|
+
usage = nil
|
10
|
+
opt.on("--usage") do |v|
|
11
|
+
usage = v
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
to = nil
|
15
|
+
opt.on("--to=ToType") do |v|
|
16
|
+
to = v
|
12
17
|
end
|
13
18
|
|
14
|
-
|
15
|
-
opt
|
19
|
+
from = nil
|
20
|
+
opt.on("--from=FromType") do |v|
|
21
|
+
from = v
|
22
|
+
end
|
16
23
|
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
opt.parse!(ARGV)
|
25
|
+
|
26
|
+
def usage_msg
|
27
|
+
"""
|
28
|
+
Usage:
|
29
|
+
requidef supports translations from one file format to another one.
|
30
|
+
You usually first create standard input and pipe it to requidef command and continue piping.
|
31
|
+
|
32
|
+
Clear Example,
|
33
|
+
cat input.mm | requidef --from=mm --to=rd | requidef --from=rd --to=dot > output.dot
|
34
|
+
"""
|
20
35
|
end
|
21
36
|
|
22
|
-
|
23
|
-
|
24
|
-
|
37
|
+
if usage
|
38
|
+
print usage_msg
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
inp = STDIN.read
|
43
|
+
|
44
|
+
def check_nil(x)
|
45
|
+
if x == nil
|
46
|
+
raise "input #{x} is nil"
|
47
|
+
end
|
48
|
+
x
|
25
49
|
end
|
26
|
-
opt.parse!(ARGV)
|
27
50
|
|
28
|
-
case
|
51
|
+
case to
|
29
52
|
when "dot"
|
30
|
-
|
53
|
+
print to_dot(inp)
|
31
54
|
when "csv"
|
32
|
-
|
55
|
+
print to_csv(inp)
|
56
|
+
when "rd"
|
57
|
+
print to_rd(inp, check_nil(from))
|
33
58
|
else
|
34
|
-
raise "no match on type"
|
59
|
+
raise "no match on output type"
|
35
60
|
end
|
data/bin/requidef.rb
CHANGED
@@ -3,33 +3,58 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
3
3
|
require "requidef"
|
4
4
|
require "optparse"
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
# Main
|
7
|
+
opt = OptionParser.new
|
8
|
+
|
9
|
+
usage = nil
|
10
|
+
opt.on("--usage") do |v|
|
11
|
+
usage = v
|
8
12
|
end
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
to = nil
|
15
|
+
opt.on("--to=ToType") do |v|
|
16
|
+
to = v
|
12
17
|
end
|
13
18
|
|
14
|
-
|
15
|
-
opt
|
19
|
+
from = nil
|
20
|
+
opt.on("--from=FromType") do |v|
|
21
|
+
from = v
|
22
|
+
end
|
16
23
|
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
opt.parse!(ARGV)
|
25
|
+
|
26
|
+
def usage_msg
|
27
|
+
"""
|
28
|
+
Usage:
|
29
|
+
requidef supports translations from one file format to another one.
|
30
|
+
You usually first create standard input and pipe it to requidef command and continue piping.
|
31
|
+
|
32
|
+
Clear Example,
|
33
|
+
cat input.mm | requidef --from=mm --to=rd | requidef --from=rd --to=dot > output.dot
|
34
|
+
"""
|
20
35
|
end
|
21
36
|
|
22
|
-
|
23
|
-
|
24
|
-
|
37
|
+
if usage
|
38
|
+
print usage_msg
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
inp = STDIN.read
|
43
|
+
|
44
|
+
def check_nil(x)
|
45
|
+
if x == nil
|
46
|
+
raise "input #{x} is nil"
|
47
|
+
end
|
48
|
+
x
|
25
49
|
end
|
26
|
-
opt.parse!(ARGV)
|
27
50
|
|
28
|
-
case
|
51
|
+
case to
|
29
52
|
when "dot"
|
30
|
-
|
53
|
+
print to_dot(inp)
|
31
54
|
when "csv"
|
32
|
-
|
55
|
+
print to_csv(inp)
|
56
|
+
when "rd"
|
57
|
+
print to_rd(inp, check_nil(from))
|
33
58
|
else
|
34
|
-
raise "no match on type"
|
59
|
+
raise "no match on output type"
|
35
60
|
end
|
data/bin/sample.html
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
4
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
5
|
+
<meta content="text/css" http-equiv="Content-Style-Type">
|
6
|
+
<title>My Topic</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1 align="center" class="root">
|
10
|
+
<a name="21uvm94sj9outhm1magv3p9v9g">My Topic</a>
|
11
|
+
</h1>
|
12
|
+
<h2 class="topic">
|
13
|
+
<a name="0rviipcu433ss8bf8p8t923995">A</a>
|
14
|
+
</h2>
|
15
|
+
<h3 class="topic">
|
16
|
+
<a name="4979s7rvktpr6obojjre7bilsi">B</a>
|
17
|
+
</h3>
|
18
|
+
<h3 class="topic">
|
19
|
+
<a name="4cvebhlh8g6og1quvcc1ak6pao">C</a>
|
20
|
+
</h3>
|
21
|
+
<h2 class="topic">
|
22
|
+
<a name="0bthuesn7hpimsvun34ssbc26b">D</a>
|
23
|
+
</h2>
|
24
|
+
<h3 class="topic">
|
25
|
+
<a name="4t16foto09kqkejjoqa1kof7sq">E</a>
|
26
|
+
</h3>
|
27
|
+
<h3 class="topic">
|
28
|
+
<a name="2e2ls9uqeer5tee7a57d4tsdf3">F</a>
|
29
|
+
</h3>
|
30
|
+
</body>
|
31
|
+
</html>
|
32
|
+
|
data/bin/sample.mm
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<map version="0.8.1">
|
3
|
+
<node CREATED="1313987433061" ID="21uvm94sj9outhm1magv3p9v9g" MODIFIED="1313987433061" TEXT="My Topic">
|
4
|
+
<node CREATED="1313987433061" ID="0rviipcu433ss8bf8p8t923995" MODIFIED="1313987433061" POSITION="right" TEXT="A">
|
5
|
+
<node CREATED="1313987433061" ID="4979s7rvktpr6obojjre7bilsi" MODIFIED="1313987433061" TEXT="B"/>
|
6
|
+
<node CREATED="1313987433061" ID="4cvebhlh8g6og1quvcc1ak6pao" MODIFIED="1313987433061" TEXT="C"/>
|
7
|
+
</node>
|
8
|
+
</node>
|
9
|
+
</map>
|
data/lib/html2rd.rb
CHANGED
@@ -28,7 +28,7 @@ def repeat(n, s)
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def read_body(html)
|
31
|
-
doc = Hpricot(
|
31
|
+
doc = Hpricot( html )
|
32
32
|
x = ""
|
33
33
|
(doc/"body").each do |e|
|
34
34
|
x += e.to_html
|
@@ -37,7 +37,7 @@ def read_body(html)
|
|
37
37
|
end
|
38
38
|
|
39
39
|
if __FILE__ == $0
|
40
|
-
p html2rd("sample.html")
|
41
|
-
|
42
|
-
|
40
|
+
p html2rd( File.read("sample.html") )
|
41
|
+
p read_body( File.read("sample.html") )
|
42
|
+
p read_anchor("<a name=\"hoge\">text</a>")
|
43
43
|
end
|
data/lib/mm2rdtree.rb
CHANGED
@@ -2,10 +2,14 @@ require "rexml/document"
|
|
2
2
|
require_relative "generic/tree"
|
3
3
|
require_relative "rdnode"
|
4
4
|
|
5
|
-
def
|
5
|
+
def mm2rdtree(mm)
|
6
6
|
build_tree(mm)
|
7
7
|
end
|
8
8
|
|
9
|
+
def mm2tree(mm)
|
10
|
+
mm2rdtree(mm)
|
11
|
+
end
|
12
|
+
|
9
13
|
# Doc -> Tree (of Text node class)
|
10
14
|
def build_tree(mm)
|
11
15
|
t = Tree.new
|
@@ -37,18 +41,13 @@ def to_node(doc, depth)
|
|
37
41
|
end
|
38
42
|
|
39
43
|
def root_node_of(mm)
|
40
|
-
|
41
|
-
|
42
|
-
txt = f.read
|
43
|
-
doc = REXML::Document.new( txt )
|
44
|
-
|
45
|
-
f.close
|
44
|
+
doc = REXML::Document.new( mm )
|
46
45
|
doc.root.elements[1]
|
47
46
|
end
|
48
47
|
|
49
48
|
if __FILE__ == $0
|
50
49
|
# p root_node_of("sample.mm")
|
51
|
-
p mm2tree("sample.mm")
|
50
|
+
p mm2tree( File.read("sample.mm") )
|
52
51
|
|
53
52
|
puts "# Test ------------------------"
|
54
53
|
include REXML
|
data/lib/rd2rdnodes.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require_relative "rdnode"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
f = File.open(file, "r")
|
6
|
-
lines = f.read.split("\n")
|
3
|
+
def rd2rdnodes( rd)
|
4
|
+
lines = rd.split("\n")
|
7
5
|
nodes = lines2nodes(lines)
|
8
|
-
|
9
|
-
|
6
|
+
nodes
|
7
|
+
end
|
8
|
+
|
9
|
+
# rd -> [node]
|
10
|
+
def rd2nodes(rd)
|
11
|
+
rd2rdnodes(rd)
|
10
12
|
end
|
11
13
|
|
12
14
|
def lines2nodes(lines)
|
@@ -57,6 +59,6 @@ end
|
|
57
59
|
|
58
60
|
if __FILE__ == $0
|
59
61
|
puts "nodes from .rd"
|
60
|
-
nodes = rd2nodes("sample.rd")
|
62
|
+
nodes = rd2nodes( File.read("sample.rd") )
|
61
63
|
puts nodes
|
62
64
|
end
|
data/lib/rd2rdtree.rb
CHANGED
data/lib/rdnodes2rdtree.rb
CHANGED
data/lib/rdtree.rb
CHANGED
data/lib/rdtree2rd.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require_relative "generic/tree"
|
2
2
|
|
3
|
+
def rdtree2rd(tree)
|
4
|
+
tree.to_rd
|
5
|
+
end
|
6
|
+
|
3
7
|
class Tree
|
4
8
|
def to_rd
|
5
9
|
nodes = list_depth_traverse(root_id)
|
@@ -13,6 +17,6 @@ end
|
|
13
17
|
|
14
18
|
require_relative "rd2rdtree"
|
15
19
|
if __FILE__ == $0
|
16
|
-
t = rd2rdtree( "sample.rd"
|
20
|
+
t = rd2rdtree( File.read("sample.rd"))
|
17
21
|
print t.to_rd
|
18
22
|
end
|
data/lib/requidef.rb
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
require_relative "rdtree"
|
2
2
|
require_relative "rd2rdnodes"
|
3
3
|
require_relative "rdnodes2rdtree"
|
4
|
+
require_relative "html2rd"
|
5
|
+
require_relative "mm2rdtree"
|
6
|
+
require_relative "rdtree2rd"
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
# File -> String
|
9
|
+
def to_dot(txt)
|
10
|
+
rd2rdtree( txt ).to_dot
|
7
11
|
end
|
8
12
|
|
9
13
|
# File -> String
|
10
|
-
def
|
11
|
-
|
14
|
+
def to_csv(txt)
|
15
|
+
rd2rdtree( txt ).to_csv
|
12
16
|
end
|
13
17
|
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
def to_rd(txt, ext)
|
19
|
+
case ext
|
20
|
+
when "mm"
|
21
|
+
return mm2rd(txt)
|
22
|
+
when "html"
|
23
|
+
return html2rd(txt)
|
24
|
+
else
|
25
|
+
raise "the input stream assumed type can not translate into rd."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def mm2rd(txt)
|
30
|
+
rdtree2rd( mm2rdtree(txt))
|
17
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: requidef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-22 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &28580760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.3.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *28580760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &28580280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *28580280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &28579800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *28579800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &28579300 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *28579300
|
58
58
|
description: Which do you use for your requirement definition job? MS Excel? MS Word?
|
59
59
|
Uninstall them. Because you will get a better solution.
|
60
60
|
email: ruby.wktk@gmail.com
|
@@ -62,6 +62,8 @@ executables:
|
|
62
62
|
- Makefile
|
63
63
|
- requidef
|
64
64
|
- requidef.rb
|
65
|
+
- sample.html
|
66
|
+
- sample.mm
|
65
67
|
- sample.rd
|
66
68
|
extensions: []
|
67
69
|
extra_rdoc_files:
|
@@ -90,6 +92,8 @@ files:
|
|
90
92
|
- bin/Makefile
|
91
93
|
- bin/requidef
|
92
94
|
- bin/requidef.rb
|
95
|
+
- bin/sample.html
|
96
|
+
- bin/sample.mm
|
93
97
|
- bin/sample.rd
|
94
98
|
homepage: http://github.com/akiradeveloper/requidef
|
95
99
|
licenses:
|
@@ -106,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
110
|
version: '0'
|
107
111
|
segments:
|
108
112
|
- 0
|
109
|
-
hash: -
|
113
|
+
hash: -2863670838995052431
|
110
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
115
|
none: false
|
112
116
|
requirements:
|