DepGraph 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +18 -0
- data/Manifest.txt +16 -11
- data/bin/depgraph +26 -13
- data/config/hoe.rb +2 -2
- data/lib/DepGraph/version.rb +1 -1
- data/lib/{dependable_filter_manager.rb → dependency_types_manager.rb} +10 -10
- data/lib/file_system_node_finder.rb +60 -0
- data/lib/graph_creator.rb +83 -46
- data/lib/{graph.rb → graph_image_creator.rb} +48 -12
- data/lib/node.rb +44 -0
- data/lib/nodefinders/test_node_finder.rb +26 -0
- data/setup.rb +1585 -1585
- data/spec/{depgraph_spec.rb → IntegrationTests/depgraph_spec.rb} +28 -2
- data/spec/IntegrationTests/file_system_node_finder_spec.rb +57 -0
- data/spec/IntegrationTests/graph_creator_spec.rb +32 -0
- data/spec/IntegrationTests/graph_image_creator_spec.rb +53 -0
- data/spec/{dependable_filter_manager_spec.rb → UnitTests/dependency_types_manager_spec.rb} +6 -6
- data/spec/UnitTests/file_system_node_finder_spec.rb +64 -0
- data/spec/UnitTests/graph_creator_spec.rb +141 -0
- data/spec/UnitTests/graph_image_creator_spec.rb +58 -0
- data/spec/UnitTests/node_spec.rb +47 -0
- data/spec/integration_spec.opts +5 -0
- data/spec/spec_helper.rb +102 -40
- data/spec/unit_spec.opts +5 -0
- data/tasks/deployment.rake +1 -1
- data/tasks/rspec.rake +17 -5
- metadata +28 -21
- data/lib/dependent.rb +0 -73
- data/lib/file_system_dependent_finder.rb +0 -44
- data/spec/dependent_spec.rb +0 -102
- data/spec/file_system_dependent_finder_spec.rb +0 -48
- data/spec/graph_creator_spec.rb +0 -103
- data/spec/graph_spec.rb +0 -120
- data/todo.txt +0 -4
data/spec/graph_creator_spec.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
-
require 'graph_creator'
|
3
|
-
require 'rubygems'
|
4
|
-
gem 'filetesthelper'
|
5
|
-
require 'spec'
|
6
|
-
require 'filetesthelper'
|
7
|
-
include DepGraph
|
8
|
-
include FileTestHelper
|
9
|
-
|
10
|
-
describe GraphCreator do
|
11
|
-
it 'should not create a file if the graph is empty' do
|
12
|
-
create_graph_creator_with_no_dependents.create_image.should be_false
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should return a nil graph if an empty set of dependents is specified' do
|
16
|
-
create_graph_creator_with_no_dependents.create_graph.should == nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should return a nil graph if only one dependent is specified' do
|
20
|
-
create_graph_creator_with_only_one_dependent.create_graph.should == nil
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should return a nil graph if all dependents specified are equal' do
|
24
|
-
create_graph_creator_with_three_dependents_that_are_equal.create_graph.should == nil
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should return a graph with 2 nodes and no edges if 2 dependents with no dependencies are specified' do
|
28
|
-
graph = create_graph_creator_with_two_dependents_and_no_dependencies.create_graph
|
29
|
-
|
30
|
-
graph.node_count.should == 2
|
31
|
-
graph.edge_count.should == 0
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should ignore dependencies to non existent dependents' do
|
35
|
-
graph = create_graph_creator_with_two_nodes_and_one_orphan_dependency.create_graph
|
36
|
-
|
37
|
-
graph.node_count.should == 2
|
38
|
-
graph.edge_count.should == 0
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'should return a graph with one edge if two dependents with one dependable are specified' do
|
42
|
-
graph = create_graph_creator_with_two_nodes_and_one_dependency.create_graph
|
43
|
-
|
44
|
-
graph.node_count.should == 2
|
45
|
-
graph.edge_count.should == 1
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should be possible to filter dependents with a regular expression' do
|
49
|
-
graph_creator = create_dependency_chain_graph_creator('node1', 'node2', 'node3', 'node4')
|
50
|
-
graph_creator.from = 'e2$'
|
51
|
-
graph = graph_creator.create_graph
|
52
|
-
|
53
|
-
graph.node_count.should == 2
|
54
|
-
graph.edge_count.should == 1
|
55
|
-
graph.has_node?('node2').should be_true
|
56
|
-
graph.has_node?('node3').should be_true
|
57
|
-
graph.has_edge?('node2', 'node3').should be_true
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should be possible to filter dependables with a regular expression' do
|
61
|
-
graph_creator = create_dependency_chain_graph_creator('node1', 'node2', 'node3', 'node4')
|
62
|
-
graph_creator.to = 'e4$'
|
63
|
-
graph = graph_creator.create_graph
|
64
|
-
|
65
|
-
graph.node_count.should == 2
|
66
|
-
graph.edge_count.should == 1
|
67
|
-
graph.has_node?('node3').should be_true
|
68
|
-
graph.has_node?('node4').should be_true
|
69
|
-
graph.has_edge?('node3', 'node4').should be_true
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
invalid_graph_creators.each do |invalid_graph_creator_description, invalid_graph_creator|
|
74
|
-
it "should return false when trying to create an image from a #{invalid_graph_creator_description}" do
|
75
|
-
invalid_graph_creator.graph_class = NoOutputGraph
|
76
|
-
invalid_graph_creator.create_image('graph.png').should be_false
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
test_data = {
|
82
|
-
:csproj => {'file1.csproj'=>'"file2.csproj"', 'dir/file2.csproj'=>'"file1.csproj"' },
|
83
|
-
:ruby_requires => {'file1.rb'=>'require "file2"', 'dir/file2.rb'=>'require "file1"' }
|
84
|
-
}
|
85
|
-
|
86
|
-
describe GraphCreator, '(integration tests)' do
|
87
|
-
dependency_types.each do |filter_type|
|
88
|
-
it "should create a png image from the #{filter_type} dependencies found in the current directory tree" do
|
89
|
-
with_files(test_data[filter_type]) do
|
90
|
-
GraphCreator.new(filter_type).create_image('test.png')
|
91
|
-
|
92
|
-
non_empty_file_created('test.png').should be_true
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
data/spec/graph_spec.rb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
-
require 'graph'
|
3
|
-
require 'rubygems'
|
4
|
-
gem 'filetesthelper'
|
5
|
-
require 'spec'
|
6
|
-
require 'filetesthelper'
|
7
|
-
include FileTestHelper
|
8
|
-
include DepGraph
|
9
|
-
|
10
|
-
def create_empty_graph
|
11
|
-
Graph.new
|
12
|
-
end
|
13
|
-
|
14
|
-
def create_graph_with_2_nodes_and_1_edge
|
15
|
-
graph = create_empty_graph
|
16
|
-
graph.add_node('node 1')
|
17
|
-
graph.add_node('node 2')
|
18
|
-
graph.add_edge('node 1', 'node 2')
|
19
|
-
return graph
|
20
|
-
end
|
21
|
-
|
22
|
-
def create_graph_with_2_nodes_and_0_edges
|
23
|
-
graph = create_empty_graph
|
24
|
-
graph.add_node('node 1')
|
25
|
-
graph.add_node('node 2')
|
26
|
-
return graph
|
27
|
-
end
|
28
|
-
|
29
|
-
def no_output_generation
|
30
|
-
lambda {true}
|
31
|
-
end
|
32
|
-
|
33
|
-
describe Graph do
|
34
|
-
|
35
|
-
it "should start with no nodes" do
|
36
|
-
create_empty_graph.node_count.should == 0
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should be possible to add nodes" do
|
40
|
-
graph = create_graph_with_2_nodes_and_0_edges
|
41
|
-
|
42
|
-
graph.node_count.should == 2
|
43
|
-
graph.edge_count.should == 0
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should not be allowed to add a node without a name" do
|
47
|
-
lambda {create_empty_graph.add_node('')}.should raise_error
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should start with no edges" do
|
51
|
-
create_empty_graph.edge_count.should == 0
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should be possible to add an edge" do
|
55
|
-
graph = create_graph_with_2_nodes_and_1_edge
|
56
|
-
|
57
|
-
graph.node_count.should == 2
|
58
|
-
graph.edge_count.should == 1
|
59
|
-
end
|
60
|
-
|
61
|
-
it "can be reset" do
|
62
|
-
graph = create_graph_with_2_nodes_and_1_edge
|
63
|
-
|
64
|
-
graph.reset
|
65
|
-
graph.node_count.should == 0
|
66
|
-
graph.edge_count.should == 0
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should not be allowed to add edges between non existent nodes" do
|
70
|
-
lambda {create_empty_graph.add_edge('no node 1', 'no node 2')}.should raise_error
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should return true when a new image file is created" do
|
74
|
-
graph = create_graph_with_2_nodes_and_1_edge
|
75
|
-
graph.output_generation = no_output_generation
|
76
|
-
graph.create_image('graph.png').should be_true
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should return false when trying to create an empty graph" do
|
80
|
-
graph = create_empty_graph
|
81
|
-
graph.output_generation = no_output_generation
|
82
|
-
graph.create_image('graph.png').should be_false
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe Graph, '(integration tests)' do
|
87
|
-
it "should create a file with the graph image" do
|
88
|
-
with_files do
|
89
|
-
graph = create_graph_with_2_nodes_and_1_edge
|
90
|
-
graph.create_image('graph.png')
|
91
|
-
|
92
|
-
non_empty_file_created('graph.png').should be_true
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should not create an image file from an empty graph" do
|
97
|
-
with_files do
|
98
|
-
create_empty_graph.create_image('graph.png')
|
99
|
-
non_empty_file_created('graph.png').should be_false
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should not create an image file from a graph with no edges" do
|
104
|
-
with_files do
|
105
|
-
create_graph_with_2_nodes_and_0_edges.create_image('graph.png')
|
106
|
-
|
107
|
-
non_empty_file_created('graph.png').should be_false
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'can change output generation behaviour'do
|
112
|
-
graph = create_graph_with_2_nodes_and_1_edge
|
113
|
-
graph.output_generation = no_output_generation
|
114
|
-
with_files do
|
115
|
-
graph.create_image('test.png')
|
116
|
-
File.exist?('test.png').should be_false
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
data/todo.txt
DELETED