featuremap 0.1.0 → 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.
- checksums.yaml +5 -5
- data/bin/featuremap +6 -1
- data/features/{show features and subdirs/show-subdirs.feature → basic features/build-mindmap-on-subdirs.feature } +9 -8
- data/features/{give_feedback.feature → basic features/give-feedback.feature } +1 -1
- data/features/{show features and subdirs → basic features}/show-features.feature +2 -1
- data/features/{show features and subdirs → basic features}/show-scenarios.feature +2 -1
- data/features/step_definitions/{show_subdirs_steps.rb → build-mindmap-on-subdirs_steps.rb} +1 -1
- data/features/step_definitions/build-mindmap-on-tags_steps.rb +73 -0
- data/features/step_definitions/common_steps.rb +12 -0
- data/features/step_definitions/{give_feedback_steps.rb → give-feedback_steps.rb} +0 -0
- data/features/step_definitions/{show_features_steps.rb → show-features_steps.rb} +0 -0
- data/features/step_definitions/{show_scenarios_steps.rb → show-scenarios_steps.rb} +0 -0
- data/features/support/testdata_gen.rb +5 -2
- data/features/use tags/build-mindmap-on-tags.feature +65 -0
- data/lib/featuremap.rb +73 -7
- data/lib/mindmap.rb +13 -6
- data/lib/version.rb +1 -1
- metadata +23 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf0b7bb71043225918796a1932f9e08e096f8705
|
4
|
+
data.tar.gz: 85fd2cd4c5207e0531ed22de001ca107b683d4b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcafef73fe4983bf0c05cb8dbe74543f857495621792e29ab390f0d6c47f8eadbf0472fbdde81cae7f8a865b390404b1a82bdf9229d58bb3dcd558d20e818f6f
|
7
|
+
data.tar.gz: 065f77528492fbab827eb66e04dccff1c603e321db1812667927a89f06d87a7412528b31fb3f9a8fbe348fa7dae222419259b634d11354fd1ed7a63477ac3c4f
|
data/bin/featuremap
CHANGED
@@ -14,8 +14,13 @@ option_parser = OptionParser.new do |opts|
|
|
14
14
|
options[:verbose] = true
|
15
15
|
end
|
16
16
|
|
17
|
+
opts.on("-t","--use_tags") do
|
18
|
+
options[:use_tags] = true
|
19
|
+
end
|
20
|
+
|
17
21
|
end
|
18
22
|
|
23
|
+
|
19
24
|
option_parser.parse!
|
20
25
|
if ARGV.empty?
|
21
26
|
puts "you must supply the location of the feature files\n\n"
|
@@ -28,7 +33,7 @@ else
|
|
28
33
|
else
|
29
34
|
output_file = "STDOUT"
|
30
35
|
end
|
31
|
-
featuremap = Featuremap::Featuremap.new(feature_dir, output_file, options[:verbose])
|
36
|
+
featuremap = Featuremap::Featuremap.new(feature_dir, output_file, {"verbose" => options[:verbose], "use_tags" => options[:use_tags]})
|
32
37
|
if featuremap.exit_status == 0
|
33
38
|
featuremap.create_featuremap()
|
34
39
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
|
-
Ability:
|
3
|
-
Calling
|
4
|
-
show every subdir from the feature dir as a separate node and attach
|
5
|
-
features from the subdir as children nodes.
|
1
|
+
@default
|
2
|
+
Ability: build mindmap on subdirs
|
3
|
+
Calling featuremap will result in a new freemind mindmap. The mindmap will
|
4
|
+
show every subdir from the feature dir as a separate node by default and attach
|
5
|
+
all features from the subdir as children nodes.
|
6
|
+
See the "use tags/build mindmap on tags" ability if tags should be used instead of subdirs.
|
6
7
|
|
7
8
|
# rule: turn subdirs into mindmap nodes
|
8
9
|
# - show subdirs as mindmap nodes
|
@@ -16,7 +17,7 @@ Ability: show subdirs
|
|
16
17
|
Then a mindmap file without any validation error is created
|
17
18
|
And the mindmap contains a node with the feature name
|
18
19
|
|
19
|
-
|
20
|
+
|
20
21
|
Scenario: feature dir with one level of subdirs
|
21
22
|
Given a feature dir "subdirs_one_level"
|
22
23
|
And it contains at least one subdir
|
@@ -54,5 +55,5 @@ Ability: show subdirs
|
|
54
55
|
|support |0 |
|
55
56
|
When the mapper is called
|
56
57
|
Then a mindmap file without any validation error is created
|
57
|
-
And the
|
58
|
-
And the
|
58
|
+
And the mindmap does not contain a folder node "step_definitions"
|
59
|
+
And the mindmap does not contain a folder node "support"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@default
|
1
2
|
Ability: show features
|
2
3
|
Calling the mapper will result in a new freemind mindmap. The mindmap will
|
3
4
|
show all feature files as separate nodes.
|
@@ -20,7 +21,7 @@ Ability: show features
|
|
20
21
|
|
21
22
|
|
22
23
|
# rule: other files than .feature files are ignored
|
23
|
-
|
24
|
+
|
24
25
|
Scenario: ignore other file types
|
25
26
|
Given a feature dir "mixed_files"
|
26
27
|
And it contains <nr_of_files> files of <file_type>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@default
|
1
2
|
Ability: show scenarios
|
2
3
|
Calling the mapper will result in a new freemind mindmap. The mindmap will
|
3
4
|
show all feature files as separate nodes. Every feature node will contain
|
@@ -20,7 +21,7 @@ Ability: show scenarios
|
|
20
21
|
|
21
22
|
|
22
23
|
# rule: outline scenarios are marked by an list icon
|
23
|
-
|
24
|
+
|
24
25
|
Scenario: show outline scenario
|
25
26
|
Given a feature dir with a feature containing an outline scenario
|
26
27
|
When the mapper is called
|
@@ -56,6 +56,6 @@ Then("the node of every subdir contains the corresponding number of feature node
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
Then("the
|
59
|
+
Then("the mindmap does not contain a folder node {string}") do |node_name|
|
60
60
|
expect(@mindmap.xpath("//node[starts-with(@ID, 'subdir_') and @TEXT = '#{node_name}']").count).to eq(0)
|
61
61
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
Given("the name opf the mindmap file is set to {string}") do |featuremap_file|
|
2
|
+
create_path(@path_to_results)
|
3
|
+
@featuremap_file = "#{@path_to_results}/#{featuremap_file}"
|
4
|
+
end
|
5
|
+
|
6
|
+
Given("it contains a feature without tags") do
|
7
|
+
create_feature("#{@path_to_testdata}/#{@feature_dir}", "dummy.feature", [], {"tags" => ""})
|
8
|
+
end
|
9
|
+
|
10
|
+
Given("it contains a feature {string} with the tag {string}") do |feature, tag|
|
11
|
+
create_feature("#{@path_to_testdata}/#{@feature_dir}", "#{feature}.feature", [], {"feature" => feature, "tags" => "#{tag}"})
|
12
|
+
end
|
13
|
+
|
14
|
+
Given("the feature dir contains features with mutliple tags") do |table|
|
15
|
+
# table is a Cucumber::MultilineArgument::DataTable
|
16
|
+
features_path = "#{@path_to_testdata}/#{@feature_dir}"
|
17
|
+
table.hashes.each do |table_row|
|
18
|
+
create_feature(features_path, "#{table_row["feature"]}.feature", [], {"feature" => table_row["feature"], "tags" => table_row["tags"].gsub(/,/," ")})
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Given("it contains a subdir {string}") do |subdir|
|
23
|
+
@subdir_path = "#{@path_to_testdata}/#{@feature_dir}/#{subdir}"
|
24
|
+
create_path(@subdir_path)
|
25
|
+
end
|
26
|
+
|
27
|
+
Given("the subdir contains a feature {string} with the tag {string}") do |feature, tag|
|
28
|
+
create_feature(@subdir_path, "#{feature}.feature", [], {"feature" => feature, "tags" => tag})
|
29
|
+
end
|
30
|
+
|
31
|
+
Then("the feature nodes is attached to the root node") do
|
32
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'feature_')]").count).to eq(1)
|
33
|
+
end
|
34
|
+
|
35
|
+
Then("the root node has a tag child node {string}") do |tag|
|
36
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_') and @TEXT = '#{tag}']").count).to eq(1)
|
37
|
+
end
|
38
|
+
|
39
|
+
Then("the tag child node is marked by an paper clip icon") do
|
40
|
+
expect(@mindmap.xpath("//node[starts-with(@ID,'tag_')]/icon[@BUILTIN = 'attach']").count).to eq(1)
|
41
|
+
end
|
42
|
+
|
43
|
+
Then("the tag child contains a feature node named {string}") do |feature|
|
44
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_')]/node[starts-with(@ID,'feature_') and @TEXT = '#{feature}']").count).to eq(1)
|
45
|
+
end
|
46
|
+
|
47
|
+
Then("the mindmap shows tag nodes with feature nodes") do |table|
|
48
|
+
table.hashes.each do |table_row|
|
49
|
+
tag = table_row["tag_node"]
|
50
|
+
features = table_row["features"].split(",")
|
51
|
+
features.each do |feature|
|
52
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_') and @TEXT = '#{tag}']").count).to eq(1)
|
53
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_') and @TEXT = '#{tag}']/node[starts-with(@ID,'feature_') and @TEXT = '#{feature}']").count).to eq(1)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Then("the tag child contains the feature nodes {string} and {string}") do |feature1, feature2|
|
59
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_')]/node[starts-with(@ID,'feature_') and @TEXT = '#{feature1}']").count).to eq(1)
|
60
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_')]/node[starts-with(@ID,'feature_') and @TEXT = '#{feature2}']").count).to eq(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
Then("the mindmap contains a tag node {string}") do |tag|
|
64
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_') and @TEXT = '#{tag}']").count).to eq(1)
|
65
|
+
end
|
66
|
+
|
67
|
+
Then("the font of the {string} tag node uses grey color") do |tag|
|
68
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_') and @TEXT = '#{tag}' and @COLOR = '#999999']").count).to eq(1)
|
69
|
+
end
|
70
|
+
|
71
|
+
Then("the feature node is attached to the tag node") do
|
72
|
+
expect(@mindmap.xpath("/map/node[starts-with(@ID,'root_')]/node[starts-with(@ID,'tag_')]/node[starts-with(@ID,'feature_')]").count).to eq(1)
|
73
|
+
end
|
@@ -36,6 +36,18 @@ When("the user runs featuremap") do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
When("the user runs featuremap with the {string} option") do |option|
|
40
|
+
@log.debug "run script: bin/featuremap --#{option} #{@path_to_testdata}/#{@feature_dir} #{@featuremap_file}"
|
41
|
+
if @featuremap_file
|
42
|
+
@stdout, @stderr, @exit_status = Open3.capture3("bin/featuremap", "#{option}", "#{@path_to_testdata}/#{@feature_dir}", @featuremap_file)
|
43
|
+
else
|
44
|
+
@stdout, @stderr, @exit_status = Open3.capture3("bin/featuremap", "#{option}", "#{@path_to_testdata}/#{@feature_dir}")
|
45
|
+
end
|
46
|
+
@log.debug "stderr:\n#{@stderr}"
|
47
|
+
@log.debug "stdout:\n#{@stdout}"
|
48
|
+
@log.debug "script finished with exit code #{@exit_status.exitstatus}"
|
49
|
+
end
|
50
|
+
|
39
51
|
Then("a mindmap file without any validation error is created") do
|
40
52
|
#validate generated mm file with freemind.xsd
|
41
53
|
#validate_mm returns array containing validation errors
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,10 +1,13 @@
|
|
1
1
|
# generate feature files as test data
|
2
2
|
# path: location of tthe feature file
|
3
3
|
# name: name of the feature
|
4
|
-
def create_feature(path, name, scenarios = [])
|
4
|
+
def create_feature(path, name, scenarios = [], options = {})
|
5
|
+
|
6
|
+
options = {"feature" => "dummy feature for testing", "tags" => ""}.merge(options)
|
5
7
|
|
6
8
|
feature = <<DUMMY_FEATURE
|
7
|
-
|
9
|
+
#{options["tags"]}
|
10
|
+
Feature: #{options["feature"]}
|
8
11
|
This is a dummy just for testing purposes
|
9
12
|
DUMMY_FEATURE
|
10
13
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
@optional
|
2
|
+
Ability: build mindmap on tags
|
3
|
+
Calling featuremap will result in a new freemind mindmap. If specified by the
|
4
|
+
--use-tags option, the mindmap will show every tag aligned to features as
|
5
|
+
a separate node and attach all features marked by the tag as children nodes.
|
6
|
+
See the "build mindmap on subdirs" ability if subdirs should be used instead of tags.
|
7
|
+
|
8
|
+
Background:
|
9
|
+
Given the name opf the mindmap file is set to "featuremap.mm"
|
10
|
+
|
11
|
+
# rule: turn tags into mindmap nodes
|
12
|
+
# - show tags aligned to features as mindmap nodes
|
13
|
+
# - add a paperclip icon to mark them as tags
|
14
|
+
|
15
|
+
Scenario: feature with tag
|
16
|
+
Given a feature dir "one_tag"
|
17
|
+
And it contains a feature "dummy just for test" with the tag "@example"
|
18
|
+
When the user runs featuremap with the "--use_tags" option
|
19
|
+
Then a mindmap file without any validation error is created
|
20
|
+
And the root node has a tag child node "@example"
|
21
|
+
And the tag child node is marked by an paper clip icon
|
22
|
+
And the tag child contains a feature node named "dummy just for test"
|
23
|
+
|
24
|
+
|
25
|
+
# rule: if features have no tag, create a "no tags node" for those features
|
26
|
+
@debug
|
27
|
+
Scenario: feature without tags
|
28
|
+
Given a feature dir "tags_none"
|
29
|
+
And it contains a feature without tags
|
30
|
+
When the user runs featuremap with the "--use_tags" option
|
31
|
+
Then a mindmap file without any validation error is created
|
32
|
+
And the mindmap contains a tag node "no tags"
|
33
|
+
And the font of the "no tags" tag node uses grey color
|
34
|
+
And the feature node is attached to the tag node
|
35
|
+
|
36
|
+
|
37
|
+
# rule: if a feature has more than one tag, it appears under each tag
|
38
|
+
|
39
|
+
Scenario: feature with multiple tags
|
40
|
+
Given a feature dir "multiple tags"
|
41
|
+
And the feature dir contains features with mutliple tags
|
42
|
+
|feature |tags |
|
43
|
+
|dummy_1 |@tag_1,@tag_3 |
|
44
|
+
|dummy_2 |@tag_2 |
|
45
|
+
|dummy_3 |@tag_3 |
|
46
|
+
When the user runs featuremap with the "--use_tags" option
|
47
|
+
Then a mindmap file without any validation error is created
|
48
|
+
And the mindmap shows tag nodes with feature nodes
|
49
|
+
|tag_node |features |
|
50
|
+
|@tag_1 |dummy_1 |
|
51
|
+
|@tag_2 |dummy_2 |
|
52
|
+
|@tag_3 |dummy_1,dummy_3 |
|
53
|
+
|
54
|
+
|
55
|
+
# rule: subdirs are ignored - feature from subdirs appear on the same level in the mindmap
|
56
|
+
|
57
|
+
Scenario: features with tags and subdirs
|
58
|
+
Given a feature dir "tags_in_subdirs"
|
59
|
+
And it contains a feature "dummy_1" with the tag "@example"
|
60
|
+
And it contains a subdir "subdir"
|
61
|
+
And the subdir contains a feature "dummy_2" with the tag "@example"
|
62
|
+
When the user runs featuremap with the "--use_tags" option
|
63
|
+
Then a mindmap file without any validation error is created
|
64
|
+
And the root node has a tag child node "@example"
|
65
|
+
And the tag child contains the feature nodes "dummy_1" and "dummy_2"
|
data/lib/featuremap.rb
CHANGED
@@ -8,9 +8,12 @@ module Featuremap
|
|
8
8
|
|
9
9
|
class Featuremap
|
10
10
|
|
11
|
-
attr_reader :nodes, :exit_status, :mindmap_path, :features_path
|
11
|
+
attr_reader :nodes, :exit_status, :mindmap_path, :features_path, :options
|
12
12
|
|
13
|
-
|
13
|
+
NO_TAGS_NAME = "no tags"
|
14
|
+
|
15
|
+
def initialize(p_features_path, p_mindmap_path, p_options = {})
|
16
|
+
@options = {"verbose" => false, "use_tags" => false}.merge(p_options)
|
14
17
|
if p_mindmap_path == "STDOUT"
|
15
18
|
@log = Logger.new(STDERR)
|
16
19
|
else
|
@@ -31,7 +34,7 @@ module Featuremap
|
|
31
34
|
# default log level
|
32
35
|
@log.level = Logger::ERROR
|
33
36
|
end
|
34
|
-
if
|
37
|
+
if @options["verbose"] && @log.level != Logger::DEBUG && p_mindmap_path != "STDOUT"
|
35
38
|
@log.level = Logger::INFO
|
36
39
|
@log.info "set log level to verbose"
|
37
40
|
end
|
@@ -75,7 +78,11 @@ module Featuremap
|
|
75
78
|
begin
|
76
79
|
directory_model = CukeModeler::Directory.new(@features_path)
|
77
80
|
@log.info "start reading features from dir #{@features_path}"
|
78
|
-
|
81
|
+
if @options["use_tags"]
|
82
|
+
read_features_and_tags(directory_model)
|
83
|
+
else
|
84
|
+
read_features_and_subdirs(directory_model)
|
85
|
+
end
|
79
86
|
rescue Exception => e
|
80
87
|
@log.error("can't access >>#{features_path}<< as feature dir")
|
81
88
|
@log.debug(e.message)
|
@@ -93,8 +100,8 @@ module Featuremap
|
|
93
100
|
end
|
94
101
|
end
|
95
102
|
|
96
|
-
#
|
97
|
-
def
|
103
|
+
# build the mindmap by attaching feature nodes to subdir nodes
|
104
|
+
def read_features_and_subdirs(p_cm_directory, p_parent_node = nil)
|
98
105
|
feature_node = nil
|
99
106
|
p_cm_directory.feature_files.each do |feature_file|
|
100
107
|
feature_node = @mindmap.add_node(feature_file.feature.name, "feature", p_parent_node)
|
@@ -110,9 +117,68 @@ module Featuremap
|
|
110
117
|
if sub_dir.name != "step_definitions" and sub_dir.name != "support"
|
111
118
|
subdir_node = @mindmap.add_node(sub_dir.name, "subdir", p_parent_node)
|
112
119
|
@log.info("add features from #{sub_dir.path}")
|
113
|
-
|
120
|
+
read_features_and_subdirs(sub_dir, subdir_node)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# build the mindmap by attaching feature nodes to tag nodes
|
126
|
+
def read_features_and_tags(p_cm_directory, p_parent_node = nil, p_tags = {})
|
127
|
+
feature_node = nil
|
128
|
+
tags = p_tags
|
129
|
+
p_cm_directory.feature_files.each do |feature_file|
|
130
|
+
if feature_file.feature.all_tags.size > 0
|
131
|
+
feature_file.feature.all_tags.each do |tag|
|
132
|
+
# add tag nodes to root if new
|
133
|
+
if tags[tag.name] == nil
|
134
|
+
@log.info("add tag #{tag.name}")
|
135
|
+
tag_node = @mindmap.add_node(tag.name, "tag", p_parent_node)
|
136
|
+
# remember tag, so that each tag node is created only once
|
137
|
+
tags[tag.name] = tag_node
|
138
|
+
else
|
139
|
+
tag_node = tags[tag.name]
|
140
|
+
end
|
141
|
+
# add feature node to all tag nodes
|
142
|
+
feature_node = @mindmap.add_node(feature_file.feature.name, "feature", tag_node)
|
143
|
+
# add scenario nodes to features
|
144
|
+
feature_file.feature.tests.each do |scenario|
|
145
|
+
if scenario.keyword == "Scenario"
|
146
|
+
@mindmap.add_node(scenario.name, "scenario", feature_node)
|
147
|
+
elsif scenario.keyword == "Scenario Outline"
|
148
|
+
@mindmap.add_node(scenario.name, "scenario_outline", feature_node)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else
|
153
|
+
# create a tag node "no tags" unless already available
|
154
|
+
if tags[NO_TAGS_NAME] == nil
|
155
|
+
@log.info("add tag #{NO_TAGS_NAME}")
|
156
|
+
# format the no tags node with grey color using color code #999999
|
157
|
+
tag_node = @mindmap.add_node(NO_TAGS_NAME, "tag", p_parent_node, "#999999")
|
158
|
+
# remember tag, so that each tag node is created only once
|
159
|
+
tags[NO_TAGS_NAME] = tag_node
|
160
|
+
else
|
161
|
+
tag_node = tags[NO_TAGS_NAME]
|
162
|
+
end
|
163
|
+
# add feature node to root
|
164
|
+
feature_node = @mindmap.add_node(feature_file.feature.name, "feature", tag_node)
|
165
|
+
# add scenario nodes to features
|
166
|
+
feature_file.feature.tests.each do |scenario|
|
167
|
+
if scenario.keyword == "Scenario"
|
168
|
+
@mindmap.add_node(scenario.name, "scenario", feature_node)
|
169
|
+
elsif scenario.keyword == "Scenario Outline"
|
170
|
+
@mindmap.add_node(scenario.name, "scenario_outline", feature_node)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
p_cm_directory.directories.each do |sub_dir|
|
176
|
+
if sub_dir.name != "step_definitions" and sub_dir.name != "support"
|
177
|
+
@log.info("add features from #{sub_dir.path}")
|
178
|
+
tags = read_features_and_tags(sub_dir, nil, tags)
|
114
179
|
end
|
115
180
|
end
|
181
|
+
return tags
|
116
182
|
end
|
117
183
|
|
118
184
|
end
|
data/lib/mindmap.rb
CHANGED
@@ -18,13 +18,13 @@ module Featuremap
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# create a new node
|
21
|
-
def create_node(p_node_text, p_node_type)
|
22
|
-
|
21
|
+
def create_node(p_node_text, p_node_type, p_node_color = nil)
|
22
|
+
return {"color" => "#{p_node_color}", "created" => Time.now.to_i, "id" => SecureRandom.uuid.gsub(/-/,''), "modified" => Time.now.to_i, "text" => p_node_text, "type" => p_node_type, "nodes" => []}
|
23
23
|
end
|
24
24
|
|
25
25
|
# add a new node
|
26
|
-
def add_node(p_node_text, p_node_type, p_parent_node = nil)
|
27
|
-
new_node = create_node(p_node_text, p_node_type)
|
26
|
+
def add_node(p_node_text, p_node_type, p_parent_node = nil, p_node_color = nil)
|
27
|
+
new_node = create_node(p_node_text, p_node_type, p_node_color)
|
28
28
|
# add new node on top level per default
|
29
29
|
if p_parent_node.nil?
|
30
30
|
p_parent_node = @nodes[0]
|
@@ -36,9 +36,14 @@ module Featuremap
|
|
36
36
|
# turn hash of nodes into mindmap xml string
|
37
37
|
def nodes_to_s(p_nodes, p_nodes_text="")
|
38
38
|
nodes_text = p_nodes_text
|
39
|
-
#@log.debug nodes_text
|
40
39
|
p_nodes.each do |node|
|
41
|
-
|
40
|
+
#set optional node attributes
|
41
|
+
if node["color"] != nil
|
42
|
+
color = "COLOR=\"#{node["color"]}\" "
|
43
|
+
else
|
44
|
+
color = ""
|
45
|
+
end
|
46
|
+
nodes_text << "<node #{color}CREATED=\"#{node["created"]}\" ID=\"#{node["type"]}_#{node["id"]}\" MODIFIED=\"#{node["modified"]}\" TEXT=\"#{node["text"]}\">\n"
|
42
47
|
# add icons and fonts to nodes
|
43
48
|
case node["type"]
|
44
49
|
when "feature"
|
@@ -47,6 +52,8 @@ module Featuremap
|
|
47
52
|
nodes_text << "<icon BUILTIN=\"folder\"/>\n"
|
48
53
|
when "scenario_outline"
|
49
54
|
nodes_text << "<icon BUILTIN=\"list\"/>\n"
|
55
|
+
when "tag"
|
56
|
+
nodes_text << "<icon BUILTIN=\"attach\"/>\n"
|
50
57
|
end
|
51
58
|
# call function recursively for sublevel nodes
|
52
59
|
if not node["nodes"].empty?
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: featuremap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Carell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cuke_modeler
|
@@ -35,18 +35,20 @@ extensions: []
|
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
37
|
- bin/featuremap
|
38
|
-
- features/
|
39
|
-
- features/
|
40
|
-
- features/
|
41
|
-
- features/
|
38
|
+
- features/basic features/build-mindmap-on-subdirs.feature
|
39
|
+
- features/basic features/give-feedback.feature
|
40
|
+
- features/basic features/show-features.feature
|
41
|
+
- features/basic features/show-scenarios.feature
|
42
|
+
- features/step_definitions/build-mindmap-on-subdirs_steps.rb
|
43
|
+
- features/step_definitions/build-mindmap-on-tags_steps.rb
|
42
44
|
- features/step_definitions/common_steps.rb
|
43
|
-
- features/step_definitions/
|
44
|
-
- features/step_definitions/
|
45
|
-
- features/step_definitions/
|
46
|
-
- features/step_definitions/show_subdirs_steps.rb
|
45
|
+
- features/step_definitions/give-feedback_steps.rb
|
46
|
+
- features/step_definitions/show-features_steps.rb
|
47
|
+
- features/step_definitions/show-scenarios_steps.rb
|
47
48
|
- features/support/includes.rb
|
48
49
|
- features/support/testdata_gen.rb
|
49
50
|
- features/support/validate_xml.rb
|
51
|
+
- features/use tags/build-mindmap-on-tags.feature
|
50
52
|
- lib/featuremap.rb
|
51
53
|
- lib/mindmap.rb
|
52
54
|
- lib/version.rb
|
@@ -70,20 +72,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
72
|
version: '0'
|
71
73
|
requirements: []
|
72
74
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
75
|
+
rubygems_version: 2.6.14
|
74
76
|
signing_key:
|
75
77
|
specification_version: 4
|
76
78
|
summary: A script to convert Gherkin features into a mindmap
|
77
79
|
test_files:
|
78
|
-
- features/
|
79
|
-
- features/
|
80
|
-
- features/
|
81
|
-
- features/
|
80
|
+
- features/basic features/build-mindmap-on-subdirs.feature
|
81
|
+
- features/basic features/give-feedback.feature
|
82
|
+
- features/basic features/show-features.feature
|
83
|
+
- features/basic features/show-scenarios.feature
|
84
|
+
- features/step_definitions/build-mindmap-on-subdirs_steps.rb
|
85
|
+
- features/step_definitions/build-mindmap-on-tags_steps.rb
|
82
86
|
- features/step_definitions/common_steps.rb
|
83
|
-
- features/step_definitions/
|
84
|
-
- features/step_definitions/
|
85
|
-
- features/step_definitions/
|
86
|
-
- features/step_definitions/show_subdirs_steps.rb
|
87
|
+
- features/step_definitions/give-feedback_steps.rb
|
88
|
+
- features/step_definitions/show-features_steps.rb
|
89
|
+
- features/step_definitions/show-scenarios_steps.rb
|
87
90
|
- features/support/includes.rb
|
88
91
|
- features/support/testdata_gen.rb
|
89
92
|
- features/support/validate_xml.rb
|
93
|
+
- features/use tags/build-mindmap-on-tags.feature
|