rails_notebook 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/MIT-LICENSE +20 -0
- data/Rakefile +22 -0
- data/app/assets/javascripts/rails_notebook/application.js +13 -0
- data/app/assets/stylesheets/rails_notebook/application.css +15 -0
- data/app/controllers/rails_notebook/application_controller.rb +4 -0
- data/app/helpers/rails_notebook/application_helper.rb +4 -0
- data/app/views/layouts/rails_notebook/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/lib/rails_notebook.rb +14 -0
- data/lib/rails_notebook/assets/d3.js +9553 -0
- data/lib/rails_notebook/assets/dagre-d3.js +17572 -0
- data/lib/rails_notebook/assets/jquery.jsonview.css +52 -0
- data/lib/rails_notebook/assets/jquery.jsonview.js +284 -0
- data/lib/rails_notebook/assets/jquery.qtip.min.css +2 -0
- data/lib/rails_notebook/assets/jquery.qtip.min.js +3 -0
- data/lib/rails_notebook/assets/jquery.tipsy.js +288 -0
- data/lib/rails_notebook/assets/kernel.css +7 -0
- data/lib/rails_notebook/assets/kernel.js +18 -0
- data/lib/rails_notebook/assets/kernel.json +1 -0
- data/lib/rails_notebook/assets/logo-32x32.png +0 -0
- data/lib/rails_notebook/assets/logo-64x64.png +0 -0
- data/lib/rails_notebook/assets/nv.d3.css +641 -0
- data/lib/rails_notebook/assets/nv.d3.js +13298 -0
- data/lib/rails_notebook/assets/rails_notebook.css +136 -0
- data/lib/rails_notebook/assets/rails_notebook.js +548 -0
- data/lib/rails_notebook/assets/tipsy.css +25 -0
- data/lib/rails_notebook/command.rb +104 -0
- data/lib/rails_notebook/engine.rb +9 -0
- data/lib/rails_notebook/profiler.rb +111 -0
- data/lib/rails_notebook/renderers.rb +121 -0
- data/lib/rails_notebook/route.rb +121 -0
- data/lib/rails_notebook/schemaTable.rb +27 -0
- data/lib/rails_notebook/serializers.rb +92 -0
- data/lib/rails_notebook/table.rb +28 -0
- data/lib/rails_notebook/version.rb +3 -0
- data/lib/tasks/rails_notebook_tasks.rake +8 -0
- metadata +196 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
module SchemaTable
|
2
|
+
def self.bar_chart( activeRecordRelation )
|
3
|
+
data = activeRecordRelation.count
|
4
|
+
ChartRenderer.new( data , "BarChart")
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.pie_chart( activeRecordRelation )
|
8
|
+
puts activeRecordRelation
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.line_graph( activeRecordRelation )
|
12
|
+
puts activeRecordRelation
|
13
|
+
end
|
14
|
+
|
15
|
+
class ChartRenderer
|
16
|
+
def initialize( data, chartType )
|
17
|
+
@data = data
|
18
|
+
@chartType = chartType
|
19
|
+
end
|
20
|
+
def data
|
21
|
+
@data
|
22
|
+
end
|
23
|
+
def chartType
|
24
|
+
@chartType
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module RailsNotebook
|
2
|
+
|
3
|
+
module Serializers
|
4
|
+
|
5
|
+
@to_json_serializers = [
|
6
|
+
Fixnum, String, Float, TrueClass, FalseClass, Hash, Array, Set
|
7
|
+
].to_set
|
8
|
+
|
9
|
+
@object_serializers = {
|
10
|
+
Rails::Application => [
|
11
|
+
"app",
|
12
|
+
"assets",
|
13
|
+
"assets_manifest",
|
14
|
+
"config",
|
15
|
+
"console",
|
16
|
+
"default_url_options",
|
17
|
+
"endpoint",
|
18
|
+
"engine_name",
|
19
|
+
"env_config",
|
20
|
+
"generators",
|
21
|
+
"helpers",
|
22
|
+
"helpers_paths",
|
23
|
+
"initialize!",
|
24
|
+
"initialized?",
|
25
|
+
"initializer",
|
26
|
+
"initializers",
|
27
|
+
"isolate_namespace",
|
28
|
+
"isolated?",
|
29
|
+
"key_generator",
|
30
|
+
"message_verifier",
|
31
|
+
"middleware",
|
32
|
+
"migration_railties",
|
33
|
+
"paths",
|
34
|
+
"railtie_name",
|
35
|
+
"railtie_namespace",
|
36
|
+
"railties",
|
37
|
+
"rake_tasks",
|
38
|
+
"reloaders",
|
39
|
+
"root",
|
40
|
+
"routes",
|
41
|
+
"routes?",
|
42
|
+
"routes_reloader",
|
43
|
+
"run_load_hooks!",
|
44
|
+
"runner",
|
45
|
+
"sandbox",
|
46
|
+
"sandbox?",
|
47
|
+
"secrets",
|
48
|
+
"watchable_args"
|
49
|
+
]
|
50
|
+
}
|
51
|
+
|
52
|
+
def self.serialize(obj)
|
53
|
+
if object_serializable?(obj.class)
|
54
|
+
object_attribs(obj.class).map do |method|
|
55
|
+
serialize(obj.send(method))
|
56
|
+
end
|
57
|
+
elsif to_json_serializable? obj.class
|
58
|
+
obj.to_json
|
59
|
+
else
|
60
|
+
obj.inspect.truncate(100)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def self.object_serializable?(obj_class)
|
67
|
+
object_attribs obj_class
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.to_json_serializable?(object_class)
|
71
|
+
if @to_json_serializers.include? object_class
|
72
|
+
true
|
73
|
+
elsif object_class.superclass
|
74
|
+
to_json_serializable? object_class.superclass
|
75
|
+
else
|
76
|
+
false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.object_attribs(object_class)
|
81
|
+
if @object_serializers.has_key? object_class
|
82
|
+
@object_serializers[object_class]
|
83
|
+
elsif object_class.superclass
|
84
|
+
object_attribs object_class.superclass
|
85
|
+
else
|
86
|
+
false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This is a table container class, used to display Schema.
|
2
|
+
# Author = Tsu-Shiuan Lin
|
3
|
+
|
4
|
+
class Table
|
5
|
+
|
6
|
+
def initialize( _table_name, _columns, _arrowsTo )
|
7
|
+
@table_name = _table_name
|
8
|
+
@columns = _columns
|
9
|
+
@arrowsTo = _arrowsTo
|
10
|
+
end
|
11
|
+
|
12
|
+
def table_name # Holds the table name
|
13
|
+
@table_name
|
14
|
+
end
|
15
|
+
|
16
|
+
def columns # Holds the column names of the table
|
17
|
+
@columns
|
18
|
+
end
|
19
|
+
|
20
|
+
def arrowsTo # Holds a list of the table names corresponding to the foreign keys
|
21
|
+
@arrowsTo
|
22
|
+
end
|
23
|
+
|
24
|
+
def printTable
|
25
|
+
puts "Table Name = "+ @table_name.to_s + "\n" + "Columns = " + @columns.to_s + "\n" + "Points to = " + @arrowsTo.to_s + "\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
end # end class Table
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_notebook
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brendon McLean
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: iruby
|
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: rbczmq
|
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: stackprof
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: fast_stack
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: semvergen
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Run Rails commands in your web browser for some customised, useful outputs
|
112
|
+
email:
|
113
|
+
- brendon@intellectionsoftware.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- app/assets
|
119
|
+
- app/assets/images
|
120
|
+
- app/assets/images/rails_notebook
|
121
|
+
- app/assets/javascripts
|
122
|
+
- app/assets/javascripts/rails_notebook
|
123
|
+
- app/assets/javascripts/rails_notebook/application.js
|
124
|
+
- app/assets/stylesheets
|
125
|
+
- app/assets/stylesheets/rails_notebook
|
126
|
+
- app/assets/stylesheets/rails_notebook/application.css
|
127
|
+
- app/controllers
|
128
|
+
- app/controllers/rails_notebook
|
129
|
+
- app/controllers/rails_notebook/application_controller.rb
|
130
|
+
- app/helpers
|
131
|
+
- app/helpers/rails_notebook
|
132
|
+
- app/helpers/rails_notebook/application_helper.rb
|
133
|
+
- app/views
|
134
|
+
- app/views/layouts
|
135
|
+
- app/views/layouts/rails_notebook
|
136
|
+
- app/views/layouts/rails_notebook/application.html.erb
|
137
|
+
- config/routes.rb
|
138
|
+
- lib/rails_notebook
|
139
|
+
- lib/rails_notebook/assets
|
140
|
+
- lib/rails_notebook/assets/d3.js
|
141
|
+
- lib/rails_notebook/assets/dagre-d3.js
|
142
|
+
- lib/rails_notebook/assets/jquery.jsonview.css
|
143
|
+
- lib/rails_notebook/assets/jquery.jsonview.js
|
144
|
+
- lib/rails_notebook/assets/jquery.qtip.min.css
|
145
|
+
- lib/rails_notebook/assets/jquery.qtip.min.js
|
146
|
+
- lib/rails_notebook/assets/jquery.tipsy.js
|
147
|
+
- lib/rails_notebook/assets/kernel.css
|
148
|
+
- lib/rails_notebook/assets/kernel.js
|
149
|
+
- lib/rails_notebook/assets/kernel.json
|
150
|
+
- lib/rails_notebook/assets/logo-32x32.png
|
151
|
+
- lib/rails_notebook/assets/logo-64x64.png
|
152
|
+
- lib/rails_notebook/assets/nv.d3.css
|
153
|
+
- lib/rails_notebook/assets/nv.d3.js
|
154
|
+
- lib/rails_notebook/assets/rails_notebook.css
|
155
|
+
- lib/rails_notebook/assets/rails_notebook.js
|
156
|
+
- lib/rails_notebook/assets/tipsy.css
|
157
|
+
- lib/rails_notebook/command.rb
|
158
|
+
- lib/rails_notebook/engine.rb
|
159
|
+
- lib/rails_notebook/profiler.rb
|
160
|
+
- lib/rails_notebook/renderers.rb
|
161
|
+
- lib/rails_notebook/route.rb
|
162
|
+
- lib/rails_notebook/schemaTable.rb
|
163
|
+
- lib/rails_notebook/serializers.rb
|
164
|
+
- lib/rails_notebook/table.rb
|
165
|
+
- lib/rails_notebook/version.rb
|
166
|
+
- lib/rails_notebook.rb
|
167
|
+
- lib/tasks
|
168
|
+
- lib/tasks/rails_notebook_tasks.rake
|
169
|
+
- MIT-LICENSE
|
170
|
+
- Rakefile
|
171
|
+
homepage: ''
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib/rails_notebook
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: 2.2.1
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.4.6
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: Rails Notebook is a web-based notebook environment for interactive computing
|
195
|
+
test_files: []
|
196
|
+
has_rdoc:
|