mindmap 0.1.0
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 +7 -0
- data/.gitignore +10 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +207 -0
- data/Rakefile +1 -0
- data/bin/console +7 -0
- data/bin/setup +6 -0
- data/example/Gemfile +5 -0
- data/example/config.ru +3 -0
- data/example/nodes/directory_node.rb +33 -0
- data/example/nodes/file_node.rb +13 -0
- data/example/nodes/root_node.rb +5 -0
- data/example/public/.gitkeep +0 -0
- data/example/views/.gitkeep +0 -0
- data/exe/mindmap +7 -0
- data/lib/mindmap.rb +22 -0
- data/lib/mindmap/application.rb +28 -0
- data/lib/mindmap/cli.rb +23 -0
- data/lib/mindmap/node.rb +36 -0
- data/lib/mindmap/renderer.rb +33 -0
- data/lib/mindmap/version.rb +3 -0
- data/mindmap.gemspec +28 -0
- data/public/assets/index.js +53 -0
- data/public/favicon.ico +0 -0
- data/public/index.html +19 -0
- data/views/tag.html.erb +15 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d48f12770e8cd94db047051cd34ef88e0f8034566cb6807baefd3e482992df4d
|
4
|
+
data.tar.gz: 7db3a47094521a723d4fb86626800b041160a4a1f662646354bfe12da1aac64b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ca4ae555fad394b6450ff6e8cbc20902dda34e500d768388aff67cb38ada04695aebd8351a18ec304bc125ae2fce07678b1afde9a2764f8b655c641f2697667
|
7
|
+
data.tar.gz: dab7e80341f957a989d3e64dae687db8677164bb1767cc8e141deddc002cf810f6f4f32f2031aa6a9c8763d6b8d9b7de1858166bbbc05cc0681b64f9ccce2552
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Emad Elsaid
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
# Mindmap
|
2
|
+
|
3
|
+
Mindmap is a tiny framework to render and browser a graph like structure,
|
4
|
+
assuming you have set of simple classes that are related to each other.
|
5
|
+
|
6
|
+
# Rational
|
7
|
+
|
8
|
+
It started with another project I'm working on called
|
9
|
+
[rubrowser](https://github.com/emad-elsaid/rubrowser) it statically analyse your
|
10
|
+
ruby code and visualize it in a graph, I thought that this kind of data
|
11
|
+
(tree/graph like) is everywhere, like my servers, that I can see files,
|
12
|
+
processes and other open sockets on it, through it I can open another server in
|
13
|
+
my network, browse through it, open a process there...and so on.
|
14
|
+
|
15
|
+
Or Imagine how many times you went to wikipedia and you found yourself on a page
|
16
|
+
and you can't remember what makes you land here after couple hours of reading.
|
17
|
+
|
18
|
+
so I wanted a setup that does the following:
|
19
|
+
|
20
|
+
* A shared library that visualize a data structure of nodes linked to each other
|
21
|
+
* every node could be rendered in any form
|
22
|
+
* I need to see where I was and the trail that led me to that point and I can
|
23
|
+
get back and take another path
|
24
|
+
* it should be as simple as possible to generate new graph project and put my
|
25
|
+
files in it.
|
26
|
+
* I wanted to have ready made views, and the ability to override them and define
|
27
|
+
my own views.
|
28
|
+
|
29
|
+
At first I thought of D3 and visualizing these nodes and make it interactive,
|
30
|
+
but I had to discard this idea as visualizing nodes in different forms will be
|
31
|
+
extermily hard for users, not to mention the graph will be very crowded.
|
32
|
+
|
33
|
+
So I settled on a page that renders the root node children first, then when you
|
34
|
+
try to open a node, I append children to the page and the path goes on
|
35
|
+
endlessly, you can scroll back at any time and open another node it'll clear
|
36
|
+
every thing under it's level then showing you the node children...and so on.
|
37
|
+
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
Install it with
|
41
|
+
|
42
|
+
$ gem install mindmap
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
First create a new project, like you do with rails
|
47
|
+
|
48
|
+
$ mindmap new hello
|
49
|
+
|
50
|
+
That will create a new directory `hello` with some skeleton in it.
|
51
|
+
|
52
|
+
```
|
53
|
+
example/
|
54
|
+
├── config.ru
|
55
|
+
├── Gemfile
|
56
|
+
├── nodes
|
57
|
+
│ ├── directory_node.rb
|
58
|
+
│ ├── file_node.rb
|
59
|
+
│ └── root_node.rb
|
60
|
+
├── public
|
61
|
+
└── views
|
62
|
+
|
63
|
+
3 directories, 5 files
|
64
|
+
```
|
65
|
+
|
66
|
+
it's a rack application you can start it by `rackup` or
|
67
|
+
|
68
|
+
$ mindmap server
|
69
|
+
|
70
|
+
the project contains an example nodes to browse the file system content, you can
|
71
|
+
start the server and open `http://localhost:9292` in your browser to see it in
|
72
|
+
action.
|
73
|
+
|
74
|
+
## Project structure
|
75
|
+
|
76
|
+
* config.ru : a rack config file that starts mindmap application and serves
|
77
|
+
files from the public directory in both the gem and your project, with your
|
78
|
+
project public directory having precedence, so any file you put there will
|
79
|
+
override the library file.
|
80
|
+
* Gemfile : the project has only one direct depedency `mindmap`
|
81
|
+
* nodes : a directory that has your classes that needs to be visualized, by
|
82
|
+
default it contains classes that visualize the file system.
|
83
|
+
* public : the public directory, you can serve any files from there
|
84
|
+
* views : that directory will hold your custom node views, if you'll use the
|
85
|
+
library views then you don't need that directory
|
86
|
+
|
87
|
+
## How to write your Nodes
|
88
|
+
|
89
|
+
the `ndoes` directory holds your nodes, they're all loaded by default when
|
90
|
+
starting the mindmap server, the following is a commented example for a node class
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
# a node class name MUST end with "Node"
|
94
|
+
class DirectoryNode
|
95
|
+
# node class MUST include the Node module
|
96
|
+
# it include methods to render the node and
|
97
|
+
# an initializer for the class
|
98
|
+
include Mindmap::Node
|
99
|
+
|
100
|
+
# you can define attributes/member variables as you wish
|
101
|
+
# if you're using one of the library views you'll need to defind
|
102
|
+
# a specific methods to make it works
|
103
|
+
attr_accessor :path
|
104
|
+
|
105
|
+
def name
|
106
|
+
File.basename(path)
|
107
|
+
end
|
108
|
+
|
109
|
+
# children_title is the title that will be displayed on this
|
110
|
+
# node children container when opened
|
111
|
+
def children_title
|
112
|
+
path
|
113
|
+
end
|
114
|
+
|
115
|
+
# it must return an array of other nodes that this node is related to
|
116
|
+
def children
|
117
|
+
Dir
|
118
|
+
.entries(path)
|
119
|
+
.sort
|
120
|
+
.reject! { |file| ['.', '..'].include?(file) }
|
121
|
+
.map { |file| child(File.expand_path(file, path)) }
|
122
|
+
end
|
123
|
+
|
124
|
+
# returns the view ERB file name to render this node
|
125
|
+
# if you didn't define this method the default value will be
|
126
|
+
# the class name underscored, so a DirectoryNode class
|
127
|
+
# will be rendered using `directory_node.html.erb` template
|
128
|
+
# here we use a library view called tag
|
129
|
+
def view
|
130
|
+
:tag
|
131
|
+
end
|
132
|
+
|
133
|
+
private
|
134
|
+
|
135
|
+
def child(file_path)
|
136
|
+
return DirectoryNode.new(path: file_path) if File.directory?(file_path)
|
137
|
+
|
138
|
+
FileNode.new(path: file_path)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
```
|
142
|
+
|
143
|
+
# How it works?
|
144
|
+
|
145
|
+
when you start the mindmap server, it loads all library code then loads the
|
146
|
+
project nodes, it serves files from library public and project public
|
147
|
+
directories.
|
148
|
+
|
149
|
+
when browsing to `localhost:9292` it'll serve the `public/index.html` which is
|
150
|
+
an empty page that load jquery and bulma css framework and
|
151
|
+
`public/assets/index.js`
|
152
|
+
|
153
|
+
`index.js` is what does the interaction part of the page, it request the `root`
|
154
|
+
node, so your `nodes` directory must contain that class, mindmap will handle the
|
155
|
+
request, creating `RootNode` object givving it all `parameters` sent with the
|
156
|
+
request as a hash, `Mindmap::Node#initializer` will assign any key value to the
|
157
|
+
object if the `key=` method is public, then mindmap will call the node children.
|
158
|
+
|
159
|
+
for every child we'll render it and return the result to the page, the page will
|
160
|
+
append the response, then wait until you click on any link that refer to a local
|
161
|
+
page, whe you do it'll handle the request, will request the link content with
|
162
|
+
ajax sending the `data-params` of the link as parameters to the ajax POST
|
163
|
+
request.
|
164
|
+
|
165
|
+
mindmap will know the node from the page, for example requesting `/file` will
|
166
|
+
signal mindmap to create a `FileNode` object with the passed arguments,
|
167
|
+
`/directory/specific_dir` will create a `Directory::SpecificDir` object...etc
|
168
|
+
|
169
|
+
|
170
|
+
# How rendering nodes works
|
171
|
+
|
172
|
+
the renderer will get the view name by calling `view` method, then search for a
|
173
|
+
file first in the project views directory then in the library directory, when
|
174
|
+
found it'll be rendered as an ERB template with the node as a bounding context,
|
175
|
+
so any method called in the view will be executed from the node.
|
176
|
+
|
177
|
+
# How to form links in your views
|
178
|
+
|
179
|
+
any link that points to a URL that starts with '/' is concidered an AJAX link
|
180
|
+
and mindmap javascript will call the URL with a post request passing the
|
181
|
+
`data-params` attribute as parameters in the request, so it's a good idea that
|
182
|
+
you set some hash there that when gets assigned to the object it'll tell him
|
183
|
+
what to do, an ID in most cases, or for our example nodes the file path, for
|
184
|
+
others maybe UUID, by default the views will serialize the object as JSON and
|
185
|
+
put it in the attribute, you can be selective with your views implementation if
|
186
|
+
you wish, also `data-children-title` attribute is used by the mindmap javascript
|
187
|
+
to use it as a title for the response when appended to the page, it's a good
|
188
|
+
idea to print the node `children_title` in it.
|
189
|
+
|
190
|
+
The example nodes are really simple and can give you some help in understanding
|
191
|
+
how it works.
|
192
|
+
|
193
|
+
# Root Node
|
194
|
+
|
195
|
+
every graph must have an entry point, `RootNode` is our entry point, this nodes
|
196
|
+
doesn't have to have any views, an object is created from that class when the
|
197
|
+
page loads, and the children will be called an rendered, so the node itself
|
198
|
+
doesn't have to do anything but implmenting `children` method returning an array
|
199
|
+
of nodes to start with.
|
200
|
+
|
201
|
+
## Contributing
|
202
|
+
|
203
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/emad-elsaid/mindmap.
|
204
|
+
|
205
|
+
## License
|
206
|
+
|
207
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/example/Gemfile
ADDED
data/example/config.ru
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
class DirectoryNode
|
2
|
+
include Mindmap::Node
|
3
|
+
|
4
|
+
attr_accessor :path
|
5
|
+
|
6
|
+
def name
|
7
|
+
File.basename(path)
|
8
|
+
end
|
9
|
+
|
10
|
+
def children_title
|
11
|
+
path
|
12
|
+
end
|
13
|
+
|
14
|
+
def children
|
15
|
+
Dir
|
16
|
+
.entries(path)
|
17
|
+
.sort
|
18
|
+
.reject! { |file| ['.', '..'].include?(file) }
|
19
|
+
.map { |file| child(File.expand_path(file, path)) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def view
|
23
|
+
:tag
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def child(file_path)
|
29
|
+
return DirectoryNode.new(path: file_path) if File.directory?(file_path)
|
30
|
+
|
31
|
+
FileNode.new(path: file_path)
|
32
|
+
end
|
33
|
+
end
|
File without changes
|
File without changes
|
data/exe/mindmap
ADDED
data/lib/mindmap.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
|
3
|
+
Dir[File.expand_path('./mindmap/**/*.rb', __dir__)].each { |fl| require fl }
|
4
|
+
Dir[File.expand_path('./nodes/**/*.rb', Dir.pwd)].each { |fl| require fl }
|
5
|
+
|
6
|
+
module Mindmap
|
7
|
+
def self.application
|
8
|
+
apps = []
|
9
|
+
|
10
|
+
apps.unshift Application.new
|
11
|
+
apps.unshift Rack::Static.new(apps.first, urls: [''], root: File.expand_path('../public', __dir__), index: 'index.html')
|
12
|
+
|
13
|
+
|
14
|
+
project_public = File.expand_path('./public', Dir.pwd)
|
15
|
+
|
16
|
+
if File.exist?(project_public)
|
17
|
+
apps.unshift Rack::Static.new(apps.first, urls: [''], root: project_public, index: 'index.html')
|
18
|
+
end
|
19
|
+
|
20
|
+
Rack::Cascade.new(apps)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Mindmap
|
4
|
+
class Application
|
5
|
+
def call(env)
|
6
|
+
request = Rack::Request.new(env)
|
7
|
+
|
8
|
+
[200, headers, [render_page(request)]]
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def render_page(request)
|
14
|
+
node_name = request.path.camelize + 'Node'
|
15
|
+
node_klass = node_name.constantize
|
16
|
+
|
17
|
+
params = request.params.with_indifferent_access
|
18
|
+
node = node_klass.new(params)
|
19
|
+
node.children.map(&:render).join
|
20
|
+
end
|
21
|
+
|
22
|
+
def headers
|
23
|
+
{
|
24
|
+
'Content-Type' => 'text/html;charset=utf-8'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/mindmap/cli.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Mindmap
|
5
|
+
class CLI < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
desc 'new PROJECT_NAME', 'Create a new mindmap project'
|
9
|
+
def new(name)
|
10
|
+
directory('example', name)
|
11
|
+
|
12
|
+
inside(name) do
|
13
|
+
run('bundle install')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'server', 'Start a web server'
|
18
|
+
def server
|
19
|
+
trap(:INT) { exit }
|
20
|
+
run('rackup', verbose: false)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/mindmap/node.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Mindmap
|
4
|
+
# a module that must be encluded to any graph node
|
5
|
+
# it has methods needed by the framework to render the node
|
6
|
+
module Node
|
7
|
+
include ERB::Util
|
8
|
+
|
9
|
+
def initialize(params = {})
|
10
|
+
assign_params(params)
|
11
|
+
end
|
12
|
+
|
13
|
+
# assign a hash values to params with the same name
|
14
|
+
def assign_params(params)
|
15
|
+
params.each do |key, value|
|
16
|
+
public_send("#{key}=", value) if self.class.public_method_defined?("#{key}=")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# renders the node ERB view file and returns the result
|
21
|
+
def render
|
22
|
+
Renderer.render(view, binding)
|
23
|
+
end
|
24
|
+
|
25
|
+
# The path to the view file relative to the "views" directory
|
26
|
+
# by default the file is the class name underscored e.g
|
27
|
+
# if node class is `Graph::NodeName` it returns `graph/node_name`
|
28
|
+
def view
|
29
|
+
self.class.name.underscore
|
30
|
+
end
|
31
|
+
|
32
|
+
def url
|
33
|
+
'/' + self.class.name.underscore.gsub('_node', '')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Mindmap
|
4
|
+
# Renders a view file from either the library views
|
5
|
+
# or the project views with a binding
|
6
|
+
class Renderer
|
7
|
+
class << self
|
8
|
+
def render(view, binding)
|
9
|
+
erb(view).result(binding)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def erb(view)
|
15
|
+
@erb ||= {}
|
16
|
+
@erb[view] ||= ERB.new(view_content(view))
|
17
|
+
end
|
18
|
+
|
19
|
+
def view_content(view)
|
20
|
+
view_path = view_paths(view).find { |file| File.exist?(file) }
|
21
|
+
raise(StandardError, "#{view} view file not found") unless view_path
|
22
|
+
File.read(view_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
def view_paths(view)
|
26
|
+
[
|
27
|
+
File.expand_path("./views/#{view}.html.erb", Dir.pwd),
|
28
|
+
File.expand_path("../../views/#{view}.html.erb", __dir__)
|
29
|
+
]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/mindmap.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'mindmap/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'mindmap'
|
7
|
+
spec.version = Mindmap::VERSION
|
8
|
+
spec.authors = ['Emad Elsaid']
|
9
|
+
spec.email = ['emad.elsaid@blacklane.com']
|
10
|
+
|
11
|
+
spec.summary = 'A very specific and opinionated web framework to traverse a graph data structure'
|
12
|
+
spec.description = 'A very specific and opinionated web framework to traverse a graph data structure'
|
13
|
+
spec.homepage = 'https://github.com/emad-elsaid/mindmap'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_dependency 'activesupport'
|
24
|
+
spec.add_dependency 'rack'
|
25
|
+
spec.add_dependency 'thor'
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
const childrenContainer = function (title, content){
|
2
|
+
var contents = $('<div class="card">')
|
3
|
+
|
4
|
+
if( title ){
|
5
|
+
contents.append('<div class="card-header"><p class="card-header-title">'+ title +'</p></div>')
|
6
|
+
}
|
7
|
+
|
8
|
+
contents.append('<div class="card-content">' + content + '</div>')
|
9
|
+
|
10
|
+
var children = $("<div>", {class: "children"}).html(contents)
|
11
|
+
|
12
|
+
return children
|
13
|
+
}
|
14
|
+
|
15
|
+
const insertChildren = function (content, element){
|
16
|
+
var parentContainer = $(element).parents(".children")
|
17
|
+
|
18
|
+
parentContainer
|
19
|
+
.nextAll()
|
20
|
+
.remove()
|
21
|
+
|
22
|
+
var title = $(element).data('children-title'),
|
23
|
+
children = childrenContainer(title, content)
|
24
|
+
|
25
|
+
children.insertAfter(parentContainer)
|
26
|
+
|
27
|
+
$('html, body').animate({
|
28
|
+
scrollTop: children.offset().top
|
29
|
+
}, 500);
|
30
|
+
}
|
31
|
+
|
32
|
+
$.get("/root", function(response){
|
33
|
+
$('body').html(childrenContainer(null, response));
|
34
|
+
})
|
35
|
+
|
36
|
+
$(document).on('click', 'a[href^="/"]', function(evt){
|
37
|
+
var element = this,
|
38
|
+
params = $(this).data('params')
|
39
|
+
evt.preventDefault()
|
40
|
+
evt.stopPropagation()
|
41
|
+
|
42
|
+
$.ajax({
|
43
|
+
type: "POST",
|
44
|
+
url: this.href,
|
45
|
+
data: params,
|
46
|
+
success: function (data, text) {
|
47
|
+
insertChildren(data, element)
|
48
|
+
},
|
49
|
+
error: function (request, status, error) {
|
50
|
+
insertChildren(request.responseText, element)
|
51
|
+
}
|
52
|
+
});
|
53
|
+
})
|
data/public/favicon.ico
ADDED
File without changes
|
data/public/index.html
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<title></title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
8
|
+
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
|
9
|
+
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
10
|
+
<script type="application/javascript" src="/assets/index.js"></script>
|
11
|
+
|
12
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.0/css/bulma.css" rel="stylesheet"/>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div id="content" class="section"></div>
|
17
|
+
</body>
|
18
|
+
|
19
|
+
</html>
|
data/views/tag.html.erb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class="content is-inline-block">
|
2
|
+
<div class="tags has-addons">
|
3
|
+
|
4
|
+
<span class="tag is-dark is-medium">
|
5
|
+
<%= name %>
|
6
|
+
</span>
|
7
|
+
|
8
|
+
<% if respond_to?(:children) %>
|
9
|
+
<a href="<%= url %>" class="tag is-link is-medium" data-params="<%= html_escape(to_json) %>" data-children-title="<%= children_title %>">
|
10
|
+
<i class="fas fa-folder"></i>
|
11
|
+
</a>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
</div>
|
15
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mindmap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emad Elsaid
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.16'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.16'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description: A very specific and opinionated web framework to traverse a graph data
|
84
|
+
structure
|
85
|
+
email:
|
86
|
+
- emad.elsaid@blacklane.com
|
87
|
+
executables:
|
88
|
+
- mindmap
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/console
|
99
|
+
- bin/setup
|
100
|
+
- example/Gemfile
|
101
|
+
- example/config.ru
|
102
|
+
- example/nodes/directory_node.rb
|
103
|
+
- example/nodes/file_node.rb
|
104
|
+
- example/nodes/root_node.rb
|
105
|
+
- example/public/.gitkeep
|
106
|
+
- example/views/.gitkeep
|
107
|
+
- exe/mindmap
|
108
|
+
- lib/mindmap.rb
|
109
|
+
- lib/mindmap/application.rb
|
110
|
+
- lib/mindmap/cli.rb
|
111
|
+
- lib/mindmap/node.rb
|
112
|
+
- lib/mindmap/renderer.rb
|
113
|
+
- lib/mindmap/version.rb
|
114
|
+
- mindmap.gemspec
|
115
|
+
- public/assets/index.js
|
116
|
+
- public/favicon.ico
|
117
|
+
- public/index.html
|
118
|
+
- views/tag.html.erb
|
119
|
+
homepage: https://github.com/emad-elsaid/mindmap
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.7.3
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: A very specific and opinionated web framework to traverse a graph data structure
|
143
|
+
test_files: []
|