code-explorer 0.2.5 → 0.3.0

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: 3e1421e8ff444013bf10554bf968116fa04cfead
4
- data.tar.gz: 667d98b79931104222fbfe0c9e8729cc364ef7f4
3
+ metadata.gz: 727c00ca0eb3b407c3c652df498a3c144435c3f7
4
+ data.tar.gz: e2f631eabc5a8db7105ac431e25560cac7d2b7c8
5
5
  SHA512:
6
- metadata.gz: 946aaa368b7332b589bee4d142090c7744ac67e1ef59e7d37beaf9d77df9793f2997fb93e8f328c14e13a66627cb07fe96b32b78bc691baca10052ec6516cf69
7
- data.tar.gz: 21dd8f6f463c19463cedc267252693d604b90e6e250759fc8305e4166af0e4d86aeaef26f80eb256c7bd0347c7a309e30902e16ab5e71e595cf438516bd3f450
6
+ metadata.gz: 862c73bfaac7f8b205a28b9fe48bf7567fe9ca7c44442dcead4e688d7d5b545b0bf2a5f9f103e025b43d612d1b1c432ea5035495aaa97c28995e0e78dbdc5771
7
+ data.tar.gz: ef2838e35109d04dec641eebf48932947c6156e3ccc2056038c1c40db1d13f900e7b0d937bfe63621f6f45338bc181741eecdfce15deff1280ed5c9131438445
@@ -1,4 +1,11 @@
1
1
  <!-- -*- markdown -*- -->
2
+ ## 0.2.6 (2017-08-16)
3
+
4
+ - Fixed running the web server from an installed gem.
5
+ - Using [CodeRay][] for syntag highlighting.
6
+
7
+ [CodeRay]: http://coderay.rubychan.de/
8
+
2
9
  ## 0.2.5 (2016-08-03)
3
10
 
4
11
  - Respect PATH when running the Ruby programs (by frickler01).
data/README.md CHANGED
@@ -24,6 +24,7 @@ Identifies fully qualified class names and makes an inheritance graph
24
24
  - [Graphviz](http://www.graphviz.org/) (graph visualizer)
25
25
  - [Sinatra](http://www.sinatrarb.com/) (a small web framework)
26
26
  - [Cheetah](https://github.com/openSUSE/cheetah) (runs commands)
27
+ - [CodeRay](http://coderay.rubychan.de/) (syntax highlighting)
27
28
 
28
29
  ## License
29
30
 
@@ -33,7 +34,7 @@ MIT
33
34
 
34
35
  ```sh
35
36
  bundle install --path vendor/bundle
36
- bundle exec bin/code-explorer # otherwise Sinatra will not start
37
+ bundle exec code-explorer
37
38
  ```
38
39
 
39
40
  ## Example
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.3.0
@@ -14,6 +14,8 @@ end
14
14
  configure do
15
15
  mime_type :png, "image/png"
16
16
  mime_type :svg, "image/svg+xml"
17
+ puts "Browse:"
18
+ puts " xdg-open http://localhost:#{settings.port}/"
17
19
  end
18
20
 
19
21
  get "/" do
@@ -73,3 +75,5 @@ get "/call-graph/*" do |path|
73
75
 
74
76
  serve_dot(dot, format)
75
77
  end
78
+
79
+ Sinatra::Application.run!
@@ -1,18 +1,10 @@
1
+ require "coderay"
1
2
 
2
- # relies on escape_html
3
-
4
- # convert plain text to HTML where lines are hyperlinkable (emulate RFC 5147)
3
+ # Convert plain text to HTML where lines are hyperlinkable.
4
+ # Emulate RFC 5147 fragment identifier: #line=42
5
5
  def numbered_lines(text)
6
- lines = text.lines
7
- count_width = lines.count.to_s.size
8
- lines.each_with_index.map do |line, i|
9
- i += 1 # lines are counted from 1
10
-
11
- show_line_num = i.to_s.rjust(count_width).gsub(" ", "&nbsp;")
12
- escaped_line = escape_html(line.chomp).gsub(" ", "&nbsp;")
13
- id = "line=#{i}" # RFC 5147 fragment identifier
14
-
15
- "<tt><a id='#{id}' href='##{id}'>#{show_line_num}</a></tt> " \
16
- "<code>#{escaped_line}</code><br>\n"
17
- end.join("")
6
+ # but CodeRay wants to remove the equal sign;
7
+ tag = "lI" + "-Ne" # avoid the literal tag if we process our own source
8
+ html = CodeRay.scan(text, :ruby).page(line_number_anchors: tag)
9
+ html.gsub(tag, "line=")
18
10
  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.5
4
+ version: 0.3.0
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-08-03 00:00:00.000000000 Z
11
+ date: 2017-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coderay
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
55
69
  description: Find your way around source code written in Ruby
56
70
  email: martin@vidner.net
57
71
  executables:
@@ -95,9 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
109
  version: '0'
96
110
  requirements: []
97
111
  rubyforge_project:
98
- rubygems_version: 2.2.2
112
+ rubygems_version: 2.2.5
99
113
  signing_key:
100
114
  specification_version: 4
101
115
  summary: Explore Ruby code
102
116
  test_files: []
103
- has_rdoc: