dependy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +4 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +7 -0
- data/Rakefile +13 -0
- data/bin/dependy +4 -0
- data/dependy.gemspec +14 -0
- data/lib/dependy.rb +6 -0
- data/lib/dependy/cli.rb +65 -0
- data/lib/dependy/graph/graph.rb +31 -0
- data/lib/dependy/graph/graph_reader.rb +53 -0
- data/lib/dependy/operations/cycle_finder.rb +27 -0
- data/lib/dependy/operations/extractor.rb +32 -0
- data/lib/dependy/operations/folder_extractor.rb +30 -0
- data/lib/dependy/operations/unused_nodes_finder.rb +18 -0
- data/spec/dependy/graph/graph_reader_spec.rb +41 -0
- data/spec/dependy/graph/graph_spec.rb +46 -0
- data/spec/dependy/operations/cycle_finder_spec.rb +20 -0
- data/spec/dependy/operations/extractor_spec.rb +14 -0
- data/spec/dependy/operations/unused_node_finder_spec.rb +20 -0
- data/spec/fixtures/graph_factory.rb +11 -0
- data/spec/fixtures/ignore_folder/File5.h +0 -0
- data/spec/fixtures/ignore_folder/File5.m +1 -0
- data/spec/fixtures/ignore_folder/File6.h +1 -0
- data/spec/fixtures/ignore_folder/File6.m +1 -0
- data/spec/fixtures/root_folder/File1.h +3 -0
- data/spec/fixtures/root_folder/File1.m +2 -0
- data/spec/fixtures/root_folder/File2.h +1 -0
- data/spec/fixtures/root_folder/File2.m +1 -0
- data/spec/fixtures/root_folder/File3.h +1 -0
- data/spec/fixtures/root_folder/File3.m +1 -0
- data/spec/fixtures/root_folder/File4.h +0 -0
- data/spec/fixtures/root_folder/File4.m +1 -0
- data/spec/spec_helper.rb +4 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7b4acecc9e415eba14a8d7121602594c4dac663e
|
4
|
+
data.tar.gz: 38092ec7142d20edb7c692ce32287ec09e390d09
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13db82cec156decb88936c0bb66c5cc3888ce3a731ca1f3d1f082e1152bec4c40dcdd79d6ad8941b0a6bcc9b825c52c4341ae549d960c6d07d271a9fb91e2aba
|
7
|
+
data.tar.gz: 0e8609c51091d5d082fe6446a78b6e43c654a65df4cc1db847f3817b7b438ef85b664def18ee3ced9fb3ffa7489a74ce7bba36bd57ee98e6f61108b5dbbadcef
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Slavko Krucaj
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# dependy [![Build Status](https://travis-ci.org/SlavkoKrucaj/dependy.svg?branch=master)](https://travis-ci.org/SlavkoKrucaj/dependy) [![Code Climate](https://codeclimate.com/github/SlavkoKrucaj/dependy/badges/gpa.svg)](https://codeclimate.com/github/SlavkoKrucaj/dependy) [![Test Coverage](https://codeclimate.com/github/SlavkoKrucaj/dependy/badges/coverage.svg)](https://codeclimate.com/github/SlavkoKrucaj/dependy)
|
2
|
+
|
3
|
+
A gem command line tool which helps you maintain dependencies for `Objective-C` projects
|
4
|
+
|
5
|
+
## License
|
6
|
+
|
7
|
+
MIT license. See the LICENSE file for more info.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
Bundler::GemHelper.install_tasks(name: 'dependy')
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new do |t|
|
9
|
+
t.pattern = 'spec/**/*_spec.rb'
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'run specs'
|
13
|
+
task default: :spec
|
data/bin/dependy
ADDED
data/dependy.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
Gem::Specification.new do |gem|
|
3
|
+
gem.name = 'dependy'
|
4
|
+
gem.version = '0.1.0'
|
5
|
+
gem.authors = ['Slavko Krucaj']
|
6
|
+
gem.email = ['slavko.krucaj@gmail.com']
|
7
|
+
gem.description = %q{Analyzing class dependency graphs}
|
8
|
+
gem.summary = %q{Tool for inspecting class dependency graphs}
|
9
|
+
gem.license = 'MIT'
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($/)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^spec/})
|
14
|
+
end
|
data/lib/dependy.rb
ADDED
data/lib/dependy/cli.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'dependy'
|
3
|
+
|
4
|
+
module Dependy
|
5
|
+
class Cli < Thor
|
6
|
+
class_option :root_folder, type: :string, aliases: '-r', required: true, desc: 'Folder containing classes'
|
7
|
+
class_option :ignore_folders, type: :string, aliases: '-i', required: true, desc: 'Ignored folders'
|
8
|
+
class_option :pattern, type: :string, aliases: '-p', required: true, desc: 'Pattern you are looking for in the files, i.e. {h,m}'
|
9
|
+
|
10
|
+
desc 'cycle', 'Scans the folder, and looks for cycles in dependencies'
|
11
|
+
def cycle
|
12
|
+
cycle_finder.cycles.each { |cycle| p cycle }
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'unused', 'Scans the folder, and looks for unused files'
|
16
|
+
def unused
|
17
|
+
unused_nodes_finder.unused_nodes.each { |unused_node| p unused_node }
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'extract', 'Example of what you get if you try to extract file "ApiCall"'
|
21
|
+
method_option :file, type: :string, aliases: '-f', required: true, desc: 'File to extract'
|
22
|
+
def extract
|
23
|
+
puts extractor.extract([options[:file]])
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'folder', 'Example of what you get if you try to extract folder "ApiLayer"'
|
27
|
+
method_option :folder, type: :string, aliases: '-f', required: true, desc: 'Folder to extract from'
|
28
|
+
def folder
|
29
|
+
puts folder_extractor.extract(options[:folder], ['Helpers', 'Translator'])
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def cycle_finder
|
34
|
+
Operations::CycleFinder.new(graph)
|
35
|
+
end
|
36
|
+
|
37
|
+
def unused_nodes_finder
|
38
|
+
Operations::UnusedNodesFinder.new(graph)
|
39
|
+
end
|
40
|
+
|
41
|
+
def extractor
|
42
|
+
Operations::Extractor.new(graph)
|
43
|
+
end
|
44
|
+
|
45
|
+
def folder_extractor
|
46
|
+
Operations::FolderExtractor.new(graph)
|
47
|
+
end
|
48
|
+
|
49
|
+
def graph
|
50
|
+
graph_reader.read
|
51
|
+
end
|
52
|
+
|
53
|
+
def graph_reader
|
54
|
+
Dependy::Graph::GraphReader.new(root_folder, [ignore_folder], '{h,m}')
|
55
|
+
end
|
56
|
+
|
57
|
+
def root_folder
|
58
|
+
options[:root_folder]
|
59
|
+
end
|
60
|
+
|
61
|
+
def ignore_folder
|
62
|
+
options[:ignore_folders].split(' ')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Dependy
|
2
|
+
module Graph
|
3
|
+
class Graph < Hash
|
4
|
+
def initialize(parent_child_list = [])
|
5
|
+
parent_child_list.each do |parent, child|
|
6
|
+
add_node_to_graph(parent)
|
7
|
+
add_node_to_graph(child)
|
8
|
+
add_relationship_between(parent, child)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def parents_for(node_name)
|
13
|
+
self[node_name][:parents]
|
14
|
+
end
|
15
|
+
|
16
|
+
def children_for(node_name)
|
17
|
+
self[node_name][:children]
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def add_node_to_graph(node_name)
|
22
|
+
self[node_name] = {parents: [], children: []} unless has_key?(node_name)
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_relationship_between(parent, child)
|
26
|
+
self[parent][:children] << child
|
27
|
+
self[child][:parents] << parent
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'dependy/graph/graph'
|
2
|
+
|
3
|
+
module Dependy
|
4
|
+
module Graph
|
5
|
+
class GraphReader
|
6
|
+
def initialize(root_folder, excluded_folders = [], pattern = '*')
|
7
|
+
@root_folder = root_folder
|
8
|
+
@excluded_folders = excluded_folders
|
9
|
+
@pattern = pattern
|
10
|
+
end
|
11
|
+
|
12
|
+
def read
|
13
|
+
Graph.new(objects_to_scan)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
attr_reader :root_folder, :excluded_folders, :pattern
|
18
|
+
|
19
|
+
def objects_to_scan
|
20
|
+
Dir.glob(lookup_pattern(root_folder)).inject([]) do |result, file|
|
21
|
+
scan_file(file).map do |import|
|
22
|
+
result.push([filename(file), import]) unless import.empty?
|
23
|
+
end
|
24
|
+
result
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def scan_file(file)
|
29
|
+
all_imports_in_file(file) - [filename(file)] - objects_to_exclude
|
30
|
+
end
|
31
|
+
|
32
|
+
def filename(file)
|
33
|
+
File.basename(file, '.*')
|
34
|
+
end
|
35
|
+
|
36
|
+
def objects_to_exclude
|
37
|
+
@objects_to_exclude ||= excluded_folders.map do |excluded_folder|
|
38
|
+
Dir.glob(lookup_pattern(excluded_folder)).map do |file|
|
39
|
+
File.basename(file, '.*')
|
40
|
+
end
|
41
|
+
end.flatten.uniq
|
42
|
+
end
|
43
|
+
|
44
|
+
def lookup_pattern(folder)
|
45
|
+
"#{folder}/**/*.#{pattern}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def all_imports_in_file(file)
|
49
|
+
File.read(file).scan(/^#import "(.*)\.h"$/).flatten
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'tsort'
|
2
|
+
|
3
|
+
module Dependy
|
4
|
+
module Operations
|
5
|
+
class CycleFinder
|
6
|
+
def initialize(graph = {})
|
7
|
+
@graph = graph
|
8
|
+
end
|
9
|
+
|
10
|
+
def cycles
|
11
|
+
strongly_connected_components.select { |scc| scc.count > 1 }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
include TSort
|
16
|
+
attr_reader :graph
|
17
|
+
|
18
|
+
def tsort_each_node(&block)
|
19
|
+
graph.each_key(&block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def tsort_each_child(node_name, &block)
|
23
|
+
graph.children_for(node_name).each(&block)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'dependy/graph/graph'
|
2
|
+
|
3
|
+
module Dependy
|
4
|
+
module Operations
|
5
|
+
class Extractor
|
6
|
+
def initialize(graph = {})
|
7
|
+
@graph = graph
|
8
|
+
end
|
9
|
+
|
10
|
+
def extract(nodes = [], ignore_nodes = [])
|
11
|
+
nodes_to_extract(nodes) - ignore_nodes
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
attr_reader :graph
|
16
|
+
|
17
|
+
def nodes_to_extract(nodes)
|
18
|
+
nodes.map do |node_name|
|
19
|
+
extract_node(node_name)
|
20
|
+
end.flatten.uniq
|
21
|
+
end
|
22
|
+
|
23
|
+
def extract_node(node_name, current_result = [])
|
24
|
+
current_result << node_name
|
25
|
+
graph.children_for(node_name).each do |child_name|
|
26
|
+
extract_node(child_name, current_result) unless current_result.include?(child_name)
|
27
|
+
end
|
28
|
+
current_result
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Dependy
|
2
|
+
module Operations
|
3
|
+
class FolderExtractor
|
4
|
+
|
5
|
+
def initialize(graph)
|
6
|
+
@graph = graph
|
7
|
+
@extractor = Extractor.new(graph)
|
8
|
+
end
|
9
|
+
|
10
|
+
def extract(folders = [], ignore_nodes = [])
|
11
|
+
extractor.extract(all_nodes_in_folders(folders), ignore_nodes)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
attr_reader :graph, :extractor
|
16
|
+
|
17
|
+
def all_nodes_in_folders(folders = [])
|
18
|
+
folders.map { |folder| scan_folder(folder) }.flatten.uniq
|
19
|
+
end
|
20
|
+
|
21
|
+
def scan_folder(folder)
|
22
|
+
Dir.glob(lookup_pattern(folder)).map { |file| File.basename(file, '.*') }
|
23
|
+
end
|
24
|
+
|
25
|
+
def lookup_pattern(folder)
|
26
|
+
"#{folder}/**/*{h,m}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'dependy/graph/graph'
|
2
|
+
|
3
|
+
module Dependy
|
4
|
+
module Operations
|
5
|
+
class UnusedNodesFinder
|
6
|
+
def initialize(graph = {})
|
7
|
+
@graph = graph
|
8
|
+
end
|
9
|
+
|
10
|
+
def unused_nodes
|
11
|
+
graph.select { |node_name| graph.parents_for(node_name).count == 0 }.keys
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
attr_reader :graph
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'dependy/graph/graph_reader'
|
2
|
+
|
3
|
+
describe Dependy::Graph::GraphReader do
|
4
|
+
context 'when given all the info' do
|
5
|
+
subject(:graph) {
|
6
|
+
root_folder = 'spec/fixtures/root_folder'
|
7
|
+
ignore_folder = 'spec/fixtures/ignore_folder'
|
8
|
+
pattern = '{h,m}'
|
9
|
+
described_class.new(root_folder, [ignore_folder], pattern)
|
10
|
+
}
|
11
|
+
|
12
|
+
it 'reads the graph' do
|
13
|
+
expected = {
|
14
|
+
'File1' => {parents: [], children: ['File2', 'File4', 'File3']},
|
15
|
+
'File2' => {parents: ['File1'], children: ['File3']},
|
16
|
+
'File4' => {parents: ['File1'], children: []},
|
17
|
+
'File3' => {parents: ['File2', 'File1'], :children => []}
|
18
|
+
}
|
19
|
+
expect(subject.read).to eql(expected)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'when given only root folder' do
|
24
|
+
subject(:graph) {
|
25
|
+
root_folder = 'spec/fixtures/root_folder'
|
26
|
+
pattern = '{h,m}'
|
27
|
+
described_class.new(root_folder, [], pattern)
|
28
|
+
}
|
29
|
+
|
30
|
+
it 'reads the graph' do
|
31
|
+
expected = {
|
32
|
+
'File1' => {parents: [], children: ['File2', 'File4', 'File5', 'File3']},
|
33
|
+
'File2' => {parents: ['File1'], children: ['File3']},
|
34
|
+
'File4' => {parents: ['File1'], children: []},
|
35
|
+
'File5' => {parents: ['File1'], children: []},
|
36
|
+
'File3' => {parents: ['File2', 'File1'], :children => []}
|
37
|
+
}
|
38
|
+
expect(subject.read).to eql(expected)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'dependy/graph/graph'
|
2
|
+
|
3
|
+
describe Dependy::Graph::Graph do
|
4
|
+
subject(:graph) { described_class.new([%w(parent child)]) }
|
5
|
+
|
6
|
+
context 'when creating graph' do
|
7
|
+
before do
|
8
|
+
@expected_graph = {
|
9
|
+
'parent' => {parents: [], children: ['child']},
|
10
|
+
'child' => {parents: ['parent'], children: []}
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should properly setup relationships' do
|
15
|
+
expect(graph).to eql(@expected_graph)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#parents_for' do
|
20
|
+
context 'when node contains parents' do
|
21
|
+
it 'returns an array of parents' do
|
22
|
+
expect(graph.parents_for('parent')).to eql([])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when node does NOT contain parents' do
|
27
|
+
it 'returns an empty array' do
|
28
|
+
expect(graph.parents_for('child')).to eql(['parent'])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#children_for' do
|
34
|
+
context 'when node contains children' do
|
35
|
+
it 'returns an array of children' do
|
36
|
+
expect(graph.children_for('parent')).to eql(['child'])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when node does NOT contain children' do
|
41
|
+
it 'returns an empty array' do
|
42
|
+
expect(graph.children_for('child')).to eql([])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'dependy/operations/cycle_finder'
|
2
|
+
require_relative '../../spec_helper'
|
3
|
+
|
4
|
+
describe Dependy::Operations::CycleFinder do
|
5
|
+
context 'when graph contains cycles' do
|
6
|
+
subject(:cycle_finder) { described_class.new(GraphFactory.graph_with_cycles) }
|
7
|
+
|
8
|
+
it 'returns an array of found cycles' do
|
9
|
+
expect(subject.cycles).to eql([['2', '3'], ['1', '4']])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when graph does NOT contain cycles' do
|
14
|
+
subject(:cycle_finder) { described_class.new(GraphFactory.graph_without_cycles) }
|
15
|
+
|
16
|
+
it 'returns an empty array' do
|
17
|
+
expect(subject.cycles).to eql([])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'dependy/operations/extractor'
|
2
|
+
require_relative '../../spec_helper'
|
3
|
+
|
4
|
+
describe Dependy::Operations::Extractor do
|
5
|
+
subject(:extractor) { described_class.new(GraphFactory.graph_with_cycles) }
|
6
|
+
|
7
|
+
it 'extracts node and all of its parents' do
|
8
|
+
expect(subject.extract(['3'])).to eql(['3', '2'])
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should NOT extract ignored nodes' do
|
12
|
+
expect(subject.extract(['3'], ['2'])).to eql(['3'])
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'dependy/operations/unused_nodes_finder'
|
2
|
+
require_relative '../../spec_helper'
|
3
|
+
|
4
|
+
describe Dependy::Operations::UnusedNodesFinder do
|
5
|
+
context 'when node with no parents exist' do
|
6
|
+
subject(:unused_node_finder) { described_class.new(GraphFactory.graph_without_cycles) }
|
7
|
+
|
8
|
+
it 'returns unused nodes' do
|
9
|
+
expect(subject.unused_nodes).to eql(['1'])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when all the nodes are used' do
|
14
|
+
subject(:unused_node_finder) { described_class.new(GraphFactory.graph_with_cycles) }
|
15
|
+
|
16
|
+
it 'returns empty array' do
|
17
|
+
expect(subject.unused_nodes).to eql([])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'dependy/graph/graph'
|
2
|
+
|
3
|
+
class GraphFactory
|
4
|
+
def self.graph_with_cycles
|
5
|
+
Dependy::Graph::Graph.new([['1', '2'], ['1', '4'], ['2', '3'], ['3', '2'], ['4', '1']])
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.graph_without_cycles
|
9
|
+
Dependy::Graph::Graph.new([['1', '2'], ['2', '3'], ['2', '4']])
|
10
|
+
end
|
11
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
#import "File5.h"
|
@@ -0,0 +1 @@
|
|
1
|
+
#import "File5.h"
|
@@ -0,0 +1 @@
|
|
1
|
+
#import "File6.h"
|
@@ -0,0 +1 @@
|
|
1
|
+
#import "File3.h"
|
@@ -0,0 +1 @@
|
|
1
|
+
#import "File2.h"
|
@@ -0,0 +1 @@
|
|
1
|
+
import "File1.h"
|
@@ -0,0 +1 @@
|
|
1
|
+
import "File3.h"
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
#import "File4.h"
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dependy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Slavko Krucaj
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Analyzing class dependency graphs
|
14
|
+
email:
|
15
|
+
- slavko.krucaj@gmail.com
|
16
|
+
executables:
|
17
|
+
- dependy
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- .travis.yml
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/dependy
|
28
|
+
- dependy.gemspec
|
29
|
+
- lib/dependy.rb
|
30
|
+
- lib/dependy/cli.rb
|
31
|
+
- lib/dependy/graph/graph.rb
|
32
|
+
- lib/dependy/graph/graph_reader.rb
|
33
|
+
- lib/dependy/operations/cycle_finder.rb
|
34
|
+
- lib/dependy/operations/extractor.rb
|
35
|
+
- lib/dependy/operations/folder_extractor.rb
|
36
|
+
- lib/dependy/operations/unused_nodes_finder.rb
|
37
|
+
- spec/dependy/graph/graph_reader_spec.rb
|
38
|
+
- spec/dependy/graph/graph_spec.rb
|
39
|
+
- spec/dependy/operations/cycle_finder_spec.rb
|
40
|
+
- spec/dependy/operations/extractor_spec.rb
|
41
|
+
- spec/dependy/operations/unused_node_finder_spec.rb
|
42
|
+
- spec/fixtures/graph_factory.rb
|
43
|
+
- spec/fixtures/ignore_folder/File5.h
|
44
|
+
- spec/fixtures/ignore_folder/File5.m
|
45
|
+
- spec/fixtures/ignore_folder/File6.h
|
46
|
+
- spec/fixtures/ignore_folder/File6.m
|
47
|
+
- spec/fixtures/root_folder/File1.h
|
48
|
+
- spec/fixtures/root_folder/File1.m
|
49
|
+
- spec/fixtures/root_folder/File2.h
|
50
|
+
- spec/fixtures/root_folder/File2.m
|
51
|
+
- spec/fixtures/root_folder/File3.h
|
52
|
+
- spec/fixtures/root_folder/File3.m
|
53
|
+
- spec/fixtures/root_folder/File4.h
|
54
|
+
- spec/fixtures/root_folder/File4.m
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
homepage:
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.4.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Tool for inspecting class dependency graphs
|
80
|
+
test_files:
|
81
|
+
- spec/dependy/graph/graph_reader_spec.rb
|
82
|
+
- spec/dependy/graph/graph_spec.rb
|
83
|
+
- spec/dependy/operations/cycle_finder_spec.rb
|
84
|
+
- spec/dependy/operations/extractor_spec.rb
|
85
|
+
- spec/dependy/operations/unused_node_finder_spec.rb
|
86
|
+
- spec/fixtures/graph_factory.rb
|
87
|
+
- spec/fixtures/ignore_folder/File5.h
|
88
|
+
- spec/fixtures/ignore_folder/File5.m
|
89
|
+
- spec/fixtures/ignore_folder/File6.h
|
90
|
+
- spec/fixtures/ignore_folder/File6.m
|
91
|
+
- spec/fixtures/root_folder/File1.h
|
92
|
+
- spec/fixtures/root_folder/File1.m
|
93
|
+
- spec/fixtures/root_folder/File2.h
|
94
|
+
- spec/fixtures/root_folder/File2.m
|
95
|
+
- spec/fixtures/root_folder/File3.h
|
96
|
+
- spec/fixtures/root_folder/File3.m
|
97
|
+
- spec/fixtures/root_folder/File4.h
|
98
|
+
- spec/fixtures/root_folder/File4.m
|
99
|
+
- spec/spec_helper.rb
|