code-explorer 0.2.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37cc2f42a16925fac9f2dde64d9e2a174d915187
4
- data.tar.gz: e016d6a05e33163a83a970f8a70b693ccff90fdd
3
+ metadata.gz: 3e1421e8ff444013bf10554bf968116fa04cfead
4
+ data.tar.gz: 667d98b79931104222fbfe0c9e8729cc364ef7f4
5
5
  SHA512:
6
- metadata.gz: c47e95b326b405eecbe74654071c93db23f4ffa32ddb7c99b4da13fc247d56989c20d9892b5abebd32140ec9d23a9bddc9c8190aa69af26bb67938b4aed15cbe
7
- data.tar.gz: 8514c9663ddeebce427ba42c8f0d315d5213319df57855501e0778b169359cc4d4f22d3c1ecae7384bc4d3bf8ab5f801212005f97249fd11bcc66e00d5ac3e5c
6
+ metadata.gz: 946aaa368b7332b589bee4d142090c7744ac67e1ef59e7d37beaf9d77df9793f2997fb93e8f328c14e13a66627cb07fe96b32b78bc691baca10052ec6516cf69
7
+ data.tar.gz: 21dd8f6f463c19463cedc267252693d604b90e6e250759fc8305e4166af0e4d86aeaef26f80eb256c7bd0347c7a309e30902e16ab5e71e595cf438516bd3f450
@@ -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.0
1
+ 0.2.5
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # method dependency graph
4
4
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # class dependency graph
4
4
 
@@ -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 << path_link("", "class-inheritance", "Class inheritance in /lib/")
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
- files = Dir.glob("lib/**/*.rb").sort
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.0
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-06-21 00:00:00.000000000 Z
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