dependencytree 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -2
- data/lib/dependencytree/version.rb +1 -1
- data/lib/dependencytree.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6c9b207272aaedff4dd7cc712102bd2f2cfa4cb
|
4
|
+
data.tar.gz: 029233de8ac63dcc17fbaf8cc1e92137fd0eadd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 390ac33f9cdc9705ad310452f5f5903fa385f5b41a8ed5ad6e8092a2a61cf4fa0300f872ddaa535271a9a304d2f568a9f0cc6ce8b6ac24e78bdd0cac9d01b927
|
7
|
+
data.tar.gz: 41a9423ef8427f410dd05f4d90cfbc28bf04ff17097e9f7714c426a8420738bb2da57c3e9ce5824a51dc0793262910764e8b1659f5bb26885d1e0fcb22bd99b8
|
data/README.md
CHANGED
@@ -15,10 +15,26 @@ Install it yourself as from https://rubygems.org/ by calling:
|
|
15
15
|
|
16
16
|
Use the program in the shell and give it all ruby sources or folders containing ruby sources.
|
17
17
|
|
18
|
+
### Example
|
19
|
+
|
20
|
+
An example call would look like this:
|
21
|
+
|
18
22
|
dependencytree ./lib
|
19
23
|
|
24
|
+
### Command line options
|
25
|
+
|
26
|
+
The following is a list of possible command line options:
|
27
|
+
|
28
|
+
-v, --verbose Verbose output
|
29
|
+
-p, --pattern[=OPTIONAL] Pattern to accept source codes with (default: (?-mix:.*\.rb))
|
30
|
+
-i, --ignore[=OPTIONAL] Paths to not load (default: (?-mix:^$))
|
31
|
+
-o, --output[=OPTIONAL] Output path for the JSON file
|
32
|
+
-h, --help Show this message
|
33
|
+
|
34
|
+
### About the JSON output
|
35
|
+
|
20
36
|
The output will be a JSON of the references. The interesting parts are:
|
21
|
-
* **uuid**: Every class/module has a unique UUID for referencing. The UUID will stay unique only for one parsing run.
|
37
|
+
* **uuid**: Every class/module has a unique generated UUID for referencing. The UUID will stay unique only for one parsing run to allow graph building.
|
22
38
|
* **resolved_refs**: Resolved / found references that are pointing to the UUID of the refered class.
|
23
39
|
* **unresolved_refs**: Unresolved references that could not be found inside the sources provided.
|
24
40
|
This can be Ruby classes or other classes from gems that were not scanned.
|
@@ -31,7 +47,10 @@ The output will be a JSON of the references. The interesting parts are:
|
|
31
47
|
* **name**: The local module/class name, for example `"Stat"`.
|
32
48
|
* **full_name**: The full name of the module/class, for example `"File::Stat"`.
|
33
49
|
|
34
|
-
|
50
|
+
### Example JSON output
|
51
|
+
|
52
|
+
The following is the example for the dependency tree tool itself.
|
53
|
+
A similar output will be written for the example call given above.
|
35
54
|
|
36
55
|
```
|
37
56
|
[
|
data/lib/dependencytree.rb
CHANGED
@@ -15,12 +15,14 @@ module Dependencytree
|
|
15
15
|
return
|
16
16
|
end
|
17
17
|
if File.directory?(path)
|
18
|
+
STDERR.puts path if options[:verbose]
|
18
19
|
Dir.entries(path).each { |x|
|
19
20
|
resolved = File.join(path, x)
|
20
21
|
handle_path(options, consumer, resolved) if File.directory?(resolved) && x != "." && x != ".."
|
21
22
|
handle_path(options, consumer, resolved) if File.file?(resolved) && options[:pattern].match(resolved)
|
22
23
|
}
|
23
24
|
elsif File.file?(path)
|
25
|
+
STDERR.puts path if options[:verbose]
|
24
26
|
$LOG.debug("Handling path #{path}")
|
25
27
|
tree = Parser::CurrentRuby.parse_file(path)
|
26
28
|
$LOG.debug("Parsed tree: #{tree}") if $LOG.debug?
|
@@ -35,7 +37,6 @@ module Dependencytree
|
|
35
37
|
options[:pattern] = /.*\.rb/
|
36
38
|
OptionParser.new do |opt|
|
37
39
|
opt.on("-v", "--verbose", "Verbose output") do |o|
|
38
|
-
# TBD
|
39
40
|
options[:verbose] = true
|
40
41
|
$LOG.debug("verbose")
|
41
42
|
end
|