code-explorer 0.2.0 → 0.2.5
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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +4 -4
- data/VERSION +1 -1
- data/bin/call-graph +1 -1
- data/bin/class-dependencies +1 -1
- data/bin/code-explorer +19 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e1421e8ff444013bf10554bf968116fa04cfead
|
4
|
+
data.tar.gz: 667d98b79931104222fbfe0c9e8729cc364ef7f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 946aaa368b7332b589bee4d142090c7744ac67e1ef59e7d37beaf9d77df9793f2997fb93e8f328c14e13a66627cb07fe96b32b78bc691baca10052ec6516cf69
|
7
|
+
data.tar.gz: 21dd8f6f463c19463cedc267252693d604b90e6e250759fc8305e4166af0e4d86aeaef26f80eb256c7bd0347c7a309e30902e16ab5e71e595cf438516bd3f450
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<!-- -*- markdown -*- -->
|
2
|
+
## 0.2.5 (2016-08-03)
|
3
|
+
|
4
|
+
- Respect PATH when running the Ruby programs (by frickler01).
|
5
|
+
- Look also in `src/` for Class Inheritance, not only `lib/`.
|
6
|
+
- Offer graphs also as PNG, not only as SVG.
|
7
|
+
|
8
|
+
## 0.2.0 (2016-06-21)
|
9
|
+
|
10
|
+
- Added Class Inheritance to the code-explorer page.
|
11
|
+
- Updated README.
|
12
|
+
|
13
|
+
## 0.1.0 (2016-06-20)
|
14
|
+
|
15
|
+
- Initial release.
|
data/README.md
CHANGED
@@ -20,10 +20,10 @@ Identifies fully qualified class names and makes an inheritance graph
|
|
20
20
|
|
21
21
|
## Requirements
|
22
22
|
|
23
|
-
- [parser gem](https://github.com/whitequark/parser)
|
24
|
-
- [Graphviz](http://www.graphviz.org/)
|
25
|
-
- Sinatra
|
26
|
-
- Cheetah
|
23
|
+
- [parser gem](https://github.com/whitequark/parser) (parses Ruby)
|
24
|
+
- [Graphviz](http://www.graphviz.org/) (graph visualizer)
|
25
|
+
- [Sinatra](http://www.sinatrarb.com/) (a small web framework)
|
26
|
+
- [Cheetah](https://github.com/openSUSE/cheetah) (runs commands)
|
27
27
|
|
28
28
|
## License
|
29
29
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/bin/call-graph
CHANGED
data/bin/class-dependencies
CHANGED
data/bin/code-explorer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "sinatra"
|
4
4
|
require "cheetah"
|
@@ -19,13 +19,18 @@ end
|
|
19
19
|
get "/" do
|
20
20
|
page = ""
|
21
21
|
|
22
|
-
page <<
|
22
|
+
page << \
|
23
|
+
path_link("", "class-inheritance",
|
24
|
+
"Class inheritance in {lib,src}/ <small>svg</small>") + " " +
|
25
|
+
path_link("", "class-inheritance?format=png",
|
26
|
+
"<small>png</small>")
|
23
27
|
page << "<hr>\n"
|
24
28
|
|
25
29
|
files = Dir.glob("**/*.rb").sort
|
26
30
|
page << files.map do |f|
|
27
31
|
path_link("/files", f, f) + " " +
|
28
|
-
path_link("/call-graph", f, "call graph")
|
32
|
+
path_link("/call-graph", f, "call graph <small>svg</small>") + " "+
|
33
|
+
path_link("/call-graph", f + "?format=png", "<small>png</small>")
|
29
34
|
end.join("<br>\n")
|
30
35
|
page
|
31
36
|
end
|
@@ -35,22 +40,24 @@ def ast_for_filename(fn)
|
|
35
40
|
Parser::CurrentRuby.parse(ruby)
|
36
41
|
end
|
37
42
|
|
38
|
-
def serve_dot(dot)
|
39
|
-
type = :svg
|
43
|
+
def serve_dot(dot, type = :svg)
|
40
44
|
graph = Cheetah.run(["dot", "-T#{type}"], stdin: dot, stdout: :capture)
|
41
45
|
|
42
|
-
content_type type
|
46
|
+
content_type type.to_sym
|
43
47
|
graph
|
44
48
|
end
|
45
49
|
|
46
50
|
get "/class-inheritance" do
|
47
|
-
|
51
|
+
format = params["format"]
|
52
|
+
format = "svg" unless ["svg", "png"].include?(format)
|
53
|
+
|
54
|
+
files = Dir.glob("{lib,src}/**/*.rb").sort
|
48
55
|
asts = files.map {|fn| ast_for_filename(fn)}
|
49
56
|
cs = CodeExplorer::Consts.new
|
50
57
|
cs.report_modules(asts)
|
51
58
|
graph = cs.superclasses
|
52
59
|
|
53
|
-
serve_dot(dot_from_hash(graph))
|
60
|
+
serve_dot(dot_from_hash(graph), format)
|
54
61
|
end
|
55
62
|
|
56
63
|
get "/files/*" do |path|
|
@@ -59,7 +66,10 @@ get "/files/*" do |path|
|
|
59
66
|
end
|
60
67
|
|
61
68
|
get "/call-graph/*" do |path|
|
69
|
+
format = params["format"]
|
70
|
+
format = "svg" unless ["svg", "png"].include?(format)
|
71
|
+
|
62
72
|
dot = call_graph(path)
|
63
73
|
|
64
|
-
serve_dot(dot)
|
74
|
+
serve_dot(dot, format)
|
65
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code-explorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Vidner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -62,6 +62,7 @@ executables:
|
|
62
62
|
extensions: []
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
+
- CHANGELOG.md
|
65
66
|
- README.md
|
66
67
|
- VERSION
|
67
68
|
- bin/call-graph
|