rubrowser 2.7.0 → 2.10

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
  SHA256:
3
- metadata.gz: 16c4a3914f4bee3c490769aff15c24df034f2208a26e1c6d17a0da79f8c5be9b
4
- data.tar.gz: 3410a5bb59bf64fe18aad3c0ac5d4f4a71f07ff5afe18d92dede8e1d7e0502a1
3
+ metadata.gz: c46aa99d8a0d5732fc544caf791cb56bd9ff618116f11d561eac0f41be588724
4
+ data.tar.gz: 5886af6d77a53e74e2b278cd2c114c8e81e7b54061056dfef824945646e670ee
5
5
  SHA512:
6
- metadata.gz: d683deffdf39ea8edf19993871a5c7fb72b242a25f02b09b01c5b529e90eb208322d80fcf682fca8b844536788a31a8611be1d0713f925747ffc7a94119038cb
7
- data.tar.gz: 3f75f1444103b98756147fe22ed8c36c195e23cb925795eaeb5f2d40731c031c0f14e5d4915d06b05d4c3505ba5bff4e655389cf4e47d98149d1cf3980c77931
6
+ metadata.gz: a50e26cc079557c517adff17d0b4c680ebc9ce0a1d1f46dfbd61c9bae84e1e0957e25d1b7124255154051981ab74b36878fcb769c266254a549359f6ca799c6b
7
+ data.tar.gz: 21b22f8458af0f16e19fa391a7d99b9e5a50c4fb8a049d38c0a80f677ec70862b0f715c6ccf7844ab6eb2ff8f104df7e7be21baa7551714aefb860b6a0ea4f82
data/.rubocop.yml CHANGED
@@ -5,3 +5,7 @@ Style/Documentation:
5
5
  Enabled: false
6
6
  Style/FrozenStringLiteralComment:
7
7
  Enabled: false
8
+ Style/GlobalVars:
9
+ Enabled: false
10
+ Metrics/BlockLength:
11
+ Enabled: false
data/.rubrowser CHANGED
@@ -1 +1 @@
1
- [{"id":"Rubrowser::Data","x":905.0088057752334,"y":437.04147016200284},{"id":"Rubrowser","x":712.6220053486966,"y":770.3251873644217},{"id":"Rubrowser::Formatter::JSON","x":1114.4368770370438,"y":560.0312580369882},{"id":"Rubrowser::Formatter","x":1113.6584254066838,"y":601.6487084046246},{"id":"Graph","x":1115.7752854976002,"y":436.6211350242928},{"id":"Rubrowser::Parser::Definition::Base","x":-8.218934126737395,"y":322.74585638398685},{"id":"Rubrowser::Parser::Definition","x":-191.1839782278871,"y":318.6377197576412},{"id":"Rubrowser::Parser","x":713.688310910547,"y":660.9646559993857},{"id":"Rubrowser::Parser::Definition::Class","x":186.15033111747857,"y":246.30753307276427},{"id":"Rubrowser::Parser::Definition::Module","x":188.36911863082037,"y":324.35744429623855},{"id":"Rubrowser::Parser::Directory","x":786.9998045114313,"y":239.74214301898786},{"id":"Rubrowser::Parser::Factory","x":788.0050388528484,"y":325.70343641742613},{"id":"Rubrowser::Parser::File::Builder","x":506.8969046429671,"y":189.48025894394402},{"id":"Rubrowser::Parser::File","x":505.82216034587793,"y":322.6733725221146},{"id":"Rubrowser::Parser::Relation::Base","x":185.12905462589924,"y":402.5519743127113},{"id":"Rubrowser::Parser::Relation","x":187.0097719718301,"y":461.8654698954514},{"id":"Rubrowser::Renderer","x":905.2158605930458,"y":560.8807631671766}]
1
+ [{"id":"A","x":3145.151252107328,"y":1255.7202242818169},{"id":"B","x":3041.815436574058,"y":1133.5156582815155},{"id":"C","x":3199.274701857475,"y":1105.1153162475819},{"id":"ClassWithOneClassDependency","x":1557.2872222716092,"y":-43.47687773940923},{"id":"ModuleWithNoRelations","x":1306.9528557451522,"y":1102.2650375990502},{"id":"ClassWithOneIncludedMixin","x":1498.1264029065396,"y":1151.463703990889},{"id":"ClassWithOneExtendedMixin","x":1505.8925222231119,"y":1066.3427953527182},{"id":"ModuleWithOneClassDependency","x":1506.2730755201367,"y":108.22508398850451},{"id":"ClassWithNoRelations","x":1400.4239271808685,"y":-11.760907506717134},{"id":"Rubrowser::Data","x":905.0088057752334,"y":437.04147016200284},{"id":"Rubrowser","x":712.6220053486966,"y":770.3251873644217},{"id":"Rubrowser::Trace","x":197.20494882540459,"y":735.0751347963624},{"id":"Rubrowser::Monitor","x":430.7305845891392,"y":680.3256207864202},{"id":"Graph","x":1115.7752854976002,"y":436.6211350242928},{"id":"Rubrowser::Connection","x":4.873283667279907,"y":680.4067753374231},{"id":"Rubrowser::Channel","x":1366.414402671432,"y":185.96446885474367},{"id":"Rubrowser::Renderer","x":905.2158605930458,"y":560.8807631671766},{"id":"Rubrowser::Server","x":208.96464998862217,"y":631.2323207047698},{"id":"Rubrowser::Formatter::JSON","x":1114.4368770370438,"y":560.0312580369882},{"id":"Rubrowser::Formatter","x":1113.6584254066838,"y":601.6487084046246},{"id":"Rubrowser::Parser::Definition::Module","x":188.36911863082037,"y":324.35744429623855},{"id":"Rubrowser::Parser::Definition","x":-191.1839782278871,"y":318.6377197576412},{"id":"Rubrowser::Parser","x":713.688310910547,"y":660.9646559993857},{"id":"Rubrowser::Parser::Definition::Base","x":-8.218934126737395,"y":322.74585638398685},{"id":"Rubrowser::Parser::Definition::Class","x":186.15033111747857,"y":246.30753307276427},{"id":"Rubrowser::Parser::Relation::Base","x":185.12905462589924,"y":402.5519743127113},{"id":"Rubrowser::Parser::Relation","x":187.0097719718301,"y":461.8654698954514},{"id":"Rubrowser::Parser::Factory","x":788.0050388528484,"y":325.70343641742613},{"id":"Rubrowser::Parser::File::Builder","x":506.8969046429671,"y":189.48025894394402},{"id":"Rubrowser::Parser::File","x":505.82216034587793,"y":322.6733725221146},{"id":"Rubrowser::Parser::Directory","x":786.9998045114313,"y":239.74214301898786}]
data/.travis.yml CHANGED
@@ -1,7 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0
4
- - 2.1
5
3
  - 2.2
6
4
  - 2.3
7
5
  - 2.4
data/Gemfile.lock CHANGED
@@ -1,63 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubrowser (2.7.0)
4
+ rubrowser (2.10)
5
5
  litecable
6
- parser (~> 2.3, >= 2.3.0)
6
+ parser
7
7
  puma
8
8
  websocket
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- anyway_config (1.2.0)
14
- ast (2.2.0)
15
- byebug (9.0.6)
16
- diff-lcs (1.3)
17
- litecable (0.5.0)
18
- anyway_config (~> 1.0)
19
- parallel (1.12.0)
20
- parser (2.4.0.0)
21
- ast (~> 2.2)
22
- powerpack (0.1.1)
23
- puma (3.11.2)
24
- rainbow (2.2.2)
25
- rake
26
- rake (10.4.2)
27
- rspec (3.6.0)
28
- rspec-core (~> 3.6.0)
29
- rspec-expectations (~> 3.6.0)
30
- rspec-mocks (~> 3.6.0)
31
- rspec-core (3.6.0)
32
- rspec-support (~> 3.6.0)
33
- rspec-expectations (3.6.0)
13
+ anyway_config (2.1.0)
14
+ ruby-next-core (>= 0.11.0)
15
+ ast (2.4.2)
16
+ byebug (11.1.3)
17
+ diff-lcs (1.4.4)
18
+ litecable (0.7.1)
19
+ anyway_config (>= 1.0)
20
+ nio4r (2.5.7)
21
+ parallel (1.20.1)
22
+ parser (3.0.1.0)
23
+ ast (~> 2.4.1)
24
+ puma (5.2.2)
25
+ nio4r (~> 2.0)
26
+ rainbow (3.0.0)
27
+ rake (13.0.3)
28
+ regexp_parser (2.1.1)
29
+ rexml (3.2.5)
30
+ rspec (3.10.0)
31
+ rspec-core (~> 3.10.0)
32
+ rspec-expectations (~> 3.10.0)
33
+ rspec-mocks (~> 3.10.0)
34
+ rspec-core (3.10.1)
35
+ rspec-support (~> 3.10.0)
36
+ rspec-expectations (3.10.1)
34
37
  diff-lcs (>= 1.2.0, < 2.0)
35
- rspec-support (~> 3.6.0)
36
- rspec-mocks (3.6.0)
38
+ rspec-support (~> 3.10.0)
39
+ rspec-mocks (3.10.2)
37
40
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.6.0)
39
- rspec-support (3.6.0)
40
- rubocop (0.49.1)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-support (3.10.2)
43
+ rubocop (1.13.0)
41
44
  parallel (~> 1.10)
42
- parser (>= 2.3.3.1, < 3.0)
43
- powerpack (~> 0.1)
44
- rainbow (>= 1.99.1, < 3.0)
45
+ parser (>= 3.0.0.0)
46
+ rainbow (>= 2.2.2, < 4.0)
47
+ regexp_parser (>= 1.8, < 3.0)
48
+ rexml
49
+ rubocop-ast (>= 1.2.0, < 2.0)
45
50
  ruby-progressbar (~> 1.7)
46
- unicode-display_width (~> 1.0, >= 1.0.1)
47
- ruby-progressbar (1.8.1)
48
- unicode-display_width (1.3.0)
49
- websocket (1.2.5)
51
+ unicode-display_width (>= 1.4.0, < 3.0)
52
+ rubocop-ast (1.4.1)
53
+ parser (>= 2.7.1.5)
54
+ ruby-next-core (0.12.0)
55
+ ruby-progressbar (1.11.0)
56
+ unicode-display_width (2.0.0)
57
+ websocket (1.2.9)
50
58
 
51
59
  PLATFORMS
52
60
  ruby
53
61
 
54
62
  DEPENDENCIES
55
- bundler (~> 1.14)
63
+ bundler
56
64
  byebug
57
- rake (~> 10.0)
65
+ rake
58
66
  rspec
59
67
  rubocop
60
68
  rubrowser!
61
69
 
62
70
  BUNDLED WITH
63
- 1.16.1
71
+ 2.1.4
data/bin/rubrowser CHANGED
@@ -12,7 +12,7 @@ options = {
12
12
  }
13
13
 
14
14
  OptionParser.new do |opts|
15
- opts.banner = "Usage: #{__FILE__} [options] [file] ..."
15
+ opts.banner = "Usage: #{File.basename(__FILE__)} [options] [file] ..."
16
16
 
17
17
  opts.on(
18
18
  '-oFILE',
@@ -36,6 +36,10 @@ OptionParser.new do |opts|
36
36
  options[:toolbox] = false
37
37
  end
38
38
 
39
+ opts.on('-j', '--json', 'Do export data as JSON instead of HTML') do
40
+ options[:json] = true
41
+ end
42
+
39
43
  opts.on('-v', '--version', 'Print Rubrowser version') do
40
44
  puts "Rubrowser #{Rubrowser::VERSION}"
41
45
  exit
@@ -3,7 +3,7 @@ module Rubrowser
3
3
  identifier :classes
4
4
 
5
5
  def subscribed
6
- stream_from "classes"
6
+ stream_from 'classes'
7
7
  end
8
8
  end
9
9
  end
@@ -5,7 +5,7 @@ module Rubrowser
5
5
  identified_by :id
6
6
 
7
7
  def connect
8
- @id = rand(100000)
8
+ @id = rand(100_000)
9
9
  self.class.initiate_reader
10
10
  end
11
11
 
@@ -15,7 +15,7 @@ module Rubrowser
15
15
  def parse
16
16
  parsers.each(&:parse)
17
17
 
18
- @definitions ||= parsers.map(&:definitions).reduce(:+).to_a
18
+ @definitions ||= parsers.map(&:definitions).reduce(:+).sort{|a,b| b<=>a}.to_a
19
19
  @relations ||= parsers.map(&:relations).reduce(:+).to_a
20
20
 
21
21
  mark_circular_dependencies
@@ -1,12 +1,11 @@
1
1
  require 'rubrowser/trace'
2
2
  require 'rubrowser/server'
3
3
 
4
-
5
4
  module Rubrowser
6
5
  module Monitor
7
6
  module_function
8
7
 
9
- def run(path: "", port: 8080)
8
+ def run(path: '', port: 8080)
10
9
  $rd, $wr = IO.pipe
11
10
 
12
11
  if fork
@@ -36,6 +36,10 @@ module Rubrowser
36
36
  namespace == other.namespace
37
37
  end
38
38
 
39
+ def <=>(other)
40
+ to_s <=> other.to_s
41
+ end
42
+
39
43
  def to_s
40
44
  namespace.join('::')
41
45
  end
@@ -32,7 +32,7 @@ module Rubrowser
32
32
 
33
33
  def resolve(definitions)
34
34
  possibilities.find do |possibility|
35
- definitions.any? { |definition| definition == possibility }
35
+ !!definitions.bsearch { |definition| definition <=> possibility }
36
36
  end || possibilities.last
37
37
  end
38
38
 
@@ -12,7 +12,11 @@ module Rubrowser
12
12
  end
13
13
 
14
14
  def call
15
- output.write(erb(:index))
15
+ if @json
16
+ output.write(data)
17
+ else
18
+ output.write(erb(:index))
19
+ end
16
20
  end
17
21
 
18
22
  private
@@ -27,6 +31,7 @@ module Rubrowser
27
31
  @server = options[:server]
28
32
  @files = options[:files]
29
33
  @toolbox = options[:toolbox]
34
+ @json = !!options[:json]
30
35
  end
31
36
 
32
37
  def output_file(path)
@@ -1,6 +1,6 @@
1
1
  require 'lite_cable'
2
2
  require 'lite_cable/server'
3
- require 'puma/configuration'
3
+ require 'puma'
4
4
  require 'rubrowser/connection'
5
5
 
6
6
  module Rubrowser
@@ -33,8 +33,8 @@ module Rubrowser
33
33
  def rack_app
34
34
  @app ||= Rack::Builder.new do
35
35
  map '/' do
36
- use LiteCable::Server::Middleware, connection_class: Rubrowser::Connection
37
- run proc { |_| [200, { 'Content-Type' => 'text/plain' }, ['OK']] }
36
+ use LiteCable::Server::Middleware, connection_class: Connection
37
+ run(proc { |_| [200, { 'Content-Type' => 'text/plain' }, ['OK']] })
38
38
  end
39
39
  end
40
40
  end
@@ -1,6 +1,6 @@
1
1
  module Rubrowser
2
2
  class Trace
3
- def initialize(path: "")
3
+ def initialize(path: '')
4
4
  @path = path
5
5
  end
6
6
 
@@ -1,3 +1,3 @@
1
1
  module Rubrowser
2
- VERSION = '2.7.0'.freeze
2
+ VERSION = '2.10'.freeze
3
3
  end
data/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rubrowser
1
+ # Rubrowser (Ruby Browser)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rubrowser.svg)](https://badge.fury.io/rb/rubrowser)
4
4
  [![Build Status](https://travis-ci.org/emad-elsaid/rubrowser.svg?branch=master)](https://travis-ci.org/emad-elsaid/rubrowser)
@@ -17,7 +17,7 @@ documentation
17
17
 
18
18
  this project is so small that the visualization looks like so
19
19
 
20
- ![rubrowser visualization](https://i.imgur.com/2tWrl2s.png)
20
+ ![rubrowser visualization](https://i.imgur.com/zKjc7G5.png)
21
21
 
22
22
  the idea is that the project opens every `.rb` file and parse it with `parser`
23
23
  gem then list all modules and classes definitions, and all constants that are
@@ -51,11 +51,12 @@ gem install rubrowser
51
51
 
52
52
 
53
53
  ```
54
- Usage: /home/emad/code/rubrowser/bin/rubrowser [options] [file] ...
54
+ Usage: rubrowser [options] [file] ...
55
55
  -o, --output=FILE output file page, if not specified output will be written to stdout
56
56
  -l, --layout=FILE layout file to apply on the resulting graph
57
57
  -s, --server=SERVER:PORT rubrowser server for execution monitoring
58
58
  -T, --no-toolbox Don't display toolbox on the page
59
+ -j, --json Do export data as JSON instead of HTML
59
60
  -v, --version Print Rubrowser version
60
61
  -h, --help Prints this help
61
62
  ```
@@ -119,6 +120,13 @@ rubrowser -l .rubrowser
119
120
  So that in the future probably rubrowser can pick the file automatically, if you
120
121
  follow that naming, your project will be ready in that case.
121
122
 
123
+ ## Export data for use in external tools
124
+
125
+ ```
126
+ rubrowser -j|jq '.'
127
+ ```
128
+
129
+
122
130
  ## Features
123
131
 
124
132
  * trace your execution in realtime on the graph
data/rubrowser.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'rubrowser/version'
4
4
 
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.name = 'rubrowser'
7
7
  s.version = Rubrowser::VERSION
8
8
  s.authors = ['Emad Elsaid']
9
- s.email = ['blazeeboy@gmail.com']
10
- s.homepage = 'https://github.com/blazeeboy/rubrowser'
9
+ s.email = ['emad.elsaid.hamed@gmail.com']
10
+ s.homepage = 'https://github.com/emad-elsaid/rubrowser'
11
11
  s.summary = 'A ruby interactive dependency graph visualizer'
12
12
  s.description = 'A ruby interactive dependency graph visualizer'
13
13
  s.license = 'MIT'
@@ -19,13 +19,13 @@ Gem::Specification.new do |s|
19
19
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  s.require_paths = ['lib']
21
21
 
22
- s.add_runtime_dependency 'parser', '~> 2.3', '>= 2.3.0'
22
+ s.add_runtime_dependency 'parser'
23
23
  s.add_runtime_dependency 'puma'
24
24
  s.add_runtime_dependency 'litecable'
25
25
  s.add_runtime_dependency 'websocket'
26
26
 
27
- s.add_development_dependency 'bundler', '~> 1.14'
28
- s.add_development_dependency 'rake', '~> 10.0'
27
+ s.add_development_dependency 'bundler'
28
+ s.add_development_dependency 'rake'
29
29
  s.add_development_dependency 'byebug'
30
30
  s.add_development_dependency 'rubocop'
31
31
  s.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,35 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubrowser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: '2.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emad Elsaid
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2021-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.3'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 2.3.0
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.3'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: 2.3.0
26
+ version: '0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: puma
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -76,30 +70,30 @@ dependencies:
76
70
  name: bundler
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - "~>"
73
+ - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '1.14'
75
+ version: '0'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - "~>"
80
+ - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '1.14'
82
+ version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: rake
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - "~>"
87
+ - - ">="
94
88
  - !ruby/object:Gem::Version
95
- version: '10.0'
89
+ version: '0'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
- - - "~>"
94
+ - - ">="
101
95
  - !ruby/object:Gem::Version
102
- version: '10.0'
96
+ version: '0'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: byebug
105
99
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +138,7 @@ dependencies:
144
138
  version: '0'
145
139
  description: A ruby interactive dependency graph visualizer
146
140
  email:
147
- - blazeeboy@gmail.com
141
+ - emad.elsaid.hamed@gmail.com
148
142
  executables:
149
143
  - rubrowser
150
144
  extensions: []
@@ -189,11 +183,11 @@ files:
189
183
  - rubrowser.gemspec
190
184
  - views/index.erb
191
185
  - views/toolbox.erb
192
- homepage: https://github.com/blazeeboy/rubrowser
186
+ homepage: https://github.com/emad-elsaid/rubrowser
193
187
  licenses:
194
188
  - MIT
195
189
  metadata: {}
196
- post_install_message:
190
+ post_install_message:
197
191
  rdoc_options: []
198
192
  require_paths:
199
193
  - lib
@@ -208,9 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
202
  - !ruby/object:Gem::Version
209
203
  version: '0'
210
204
  requirements: []
211
- rubyforge_project:
212
- rubygems_version: 2.7.3
213
- signing_key:
205
+ rubygems_version: 3.1.2
206
+ signing_key:
214
207
  specification_version: 4
215
208
  summary: A ruby interactive dependency graph visualizer
216
209
  test_files: []