router-visualizer 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/LICENSE +22 -0
- data/Rakefile +10 -0
- data/app/controllers/router_visualizer/application_controller.rb +4 -0
- data/app/controllers/router_visualizer/visualizer_controller.rb +9 -0
- data/app/views/layouts/blank.html.erb +1 -0
- data/app/views/router_visualizer/visualizer/visualize.html.erb +1 -0
- data/config/routes.rb +3 -0
- data/lib/router-visualizer.rb +4 -0
- data/lib/router-visualizer/engine.rb +5 -0
- data/lib/router-visualizer/version.rb +3 -0
- data/readme.md +47 -0
- data/router-visualizer.gemspec +21 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 40a124d4a262fb535e51473aa9741cf290e33bee
|
4
|
+
data.tar.gz: 381ebf9600b5465bd465604e53a06d4d49bfe664
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fee7978538572b4c3eaea1e5bf6e473c26fd21b600e513d8602d07ac1e037de6b44c9192895c0657e765de1cc084d9613a7d788c7ee0ba665c7d24be7ef790e0
|
7
|
+
data.tar.gz: 4e33cf8f4d1f33a2900d58b2c0ea2649aed7364c0618dbe0c91c8df0c546baffd2e34a289b02e30e29ca874dd7b5c169ece7a60787aa44c2a090b2aac9ce9afc
|
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Joseph Tibbertsma
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
2
|
+
require "router-visualizer/version"
|
3
|
+
|
4
|
+
task :build do
|
5
|
+
system "gem build router-visualizer.gemspec"
|
6
|
+
end
|
7
|
+
|
8
|
+
task :release => :build do
|
9
|
+
system "gem push router-visualizer-#{RouterVisualizer::VERSION}.gem"
|
10
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= @nfa.html_safe %>
|
data/config/routes.rb
ADDED
data/readme.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Rails Router Visualizer
|
2
|
+
|
3
|
+
This gem allows you to see a visualization of the router of your Rails 4 application.
|
4
|
+
|
5
|
+
This visualization is generated by the Rails Journey router. It was written by [tenderlove](http://tenderlove.github.io) back before Journey was incorporated into Rails. Calling `Rails.application.routes.router.visualizer` from your application will return the text of an html file titled "Routes FSM with NFA simulation". This gem just wraps this functionality into a simple engine that you can mount at some route.
|
6
|
+
|
7
|
+
The visualizer also shows a list of all of your application's routes. It doesn't list the REST methods associated with the routes.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add the gem to your app's development environment and run the `bundle` command to install it.
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'router-visualizer', group: :development
|
15
|
+
```
|
16
|
+
|
17
|
+
## Requirements
|
18
|
+
|
19
|
+
For this to work, you need the `dot` command. This command is used for drawing directed graphs; this is what Rails uses to generate the visualization of the router NFA.
|
20
|
+
|
21
|
+
If you're on OS X, you can do
|
22
|
+
|
23
|
+
```bash
|
24
|
+
$ brew install gprof2dot
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# config/routes.rb
|
31
|
+
|
32
|
+
Rails.application.routes.draw do
|
33
|
+
# ...
|
34
|
+
|
35
|
+
if Rails.env.development?
|
36
|
+
mount RouterVisualizer::Engine, at: "/routes"
|
37
|
+
end
|
38
|
+
|
39
|
+
# ...
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
Then you can navigate to `localhost:3000/routes` to see the visualization.
|
44
|
+
|
45
|
+
## What is the point of this?
|
46
|
+
|
47
|
+
I want to learn to write gems and rails engines. This is a simple starting point.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'router-visualizer/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |gem|
|
8
|
+
gem.name = "router-visualizer"
|
9
|
+
gem.version = RouterVisualizer::VERSION
|
10
|
+
gem.authors = ["Joseph Tibbertsma"]
|
11
|
+
gem.email = ["josephtibbertsma@gmail.com"]
|
12
|
+
gem.description = "Shows a NFA visualization of a rails application's router"
|
13
|
+
gem.summary = gem.description
|
14
|
+
gem.homepage = "https://github.com/jtibbertsma/router-visualizer"
|
15
|
+
gem.license = 'MIT'
|
16
|
+
|
17
|
+
gem.files = `git ls-files`.split($/)
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
|
20
|
+
gem.add_dependency 'railties', '>= 4.0'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: router-visualizer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joseph Tibbertsma
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
description: Shows a NFA visualization of a rails application's router
|
28
|
+
email:
|
29
|
+
- josephtibbertsma@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- LICENSE
|
36
|
+
- Rakefile
|
37
|
+
- app/controllers/router_visualizer/application_controller.rb
|
38
|
+
- app/controllers/router_visualizer/visualizer_controller.rb
|
39
|
+
- app/views/layouts/blank.html.erb
|
40
|
+
- app/views/router_visualizer/visualizer/visualize.html.erb
|
41
|
+
- config/routes.rb
|
42
|
+
- lib/router-visualizer.rb
|
43
|
+
- lib/router-visualizer/engine.rb
|
44
|
+
- lib/router-visualizer/version.rb
|
45
|
+
- readme.md
|
46
|
+
- router-visualizer.gemspec
|
47
|
+
homepage: https://github.com/jtibbertsma/router-visualizer
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.4.5.1
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Shows a NFA visualization of a rails application's router
|
71
|
+
test_files: []
|