rails_db 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +5 -3
- data/app/assets/stylesheets/rails_db/forms.css.scss +3 -3
- data/app/controllers/rails_db/tables_controller.rb +5 -1
- data/app/views/rails_db/dashboard/index.html.erb +1 -1
- data/app/views/rails_db/shared/_header.html.erb +1 -1
- data/app/views/rails_db/sql/_results.html.erb +3 -1
- data/app/views/rails_db/tables/_data.html.erb +3 -1
- data/app/views/rails_db/tables/_edit.html.erb +1 -9
- data/app/views/rails_db/tables/_new.html.erb +1 -9
- data/app/views/rails_db/tables/_search.html.erb +3 -1
- data/app/views/rails_db/tables/_show.html.erb +3 -1
- data/lib/rails_db.rb +1 -2
- data/lib/rails_db/engine.rb +1 -1
- data/lib/rails_db/version.rb +1 -1
- data/rails_db.gemspec +1 -1
- data/test/dashboard_controller_test.rb +1 -1
- data/test/dummy/app/models/account.rb +6 -0
- data/test/dummy/app/models/contact.rb +1 -0
- data/test/dummy/config/application.rb +3 -0
- data/test/dummy/db/rails_db.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +40 -40
- data/test/standalone/config/application.rb +2 -0
- metadata +16 -18
- data/test/dummy/db/test.sqlite3 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdad8252f17bfd7452ecc2f92a7c3a8fdcabf4fa
|
4
|
+
data.tar.gz: 634067ced3e8d805c85bd24c533ccc4ea773bed2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89c8513bb443d3b9d4fe76e3b38ca733e6bfe6f68dafe7b75d73755c1fcb76ef7f8d37570eb923ecd4ad17dda4cbf8cca62e7229b544587bb633d918cd27e141
|
7
|
+
data.tar.gz: 741d3bc568a8003bcc0a6c923e183ad81384e49c63eedc3c7b874ccc9961754c0c6af658215c11f6802b397de040dc27e947ced6ad74b2c5bd5e9c5c9f106ec5
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails_db (1.
|
5
|
-
axlsx_rails
|
4
|
+
rails_db (1.1)
|
6
5
|
codemirror-rails
|
7
6
|
font-awesome-rails
|
8
7
|
jquery-rails
|
@@ -53,7 +52,7 @@ GEM
|
|
53
52
|
minitest (~> 5.1)
|
54
53
|
thread_safe (~> 0.3, >= 0.3.4)
|
55
54
|
tzinfo (~> 1.1)
|
56
|
-
addressable (2.
|
55
|
+
addressable (2.4.0)
|
57
56
|
arel (6.0.3)
|
58
57
|
axlsx (2.0.1)
|
59
58
|
htmlentities (~> 4.3.1)
|
@@ -178,3 +177,6 @@ DEPENDENCIES
|
|
178
177
|
sqlite3
|
179
178
|
terminal-table
|
180
179
|
uglifier
|
180
|
+
|
181
|
+
BUNDLED WITH
|
182
|
+
1.10.6
|
@@ -43,7 +43,11 @@ module RailsDb
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def xlsx
|
46
|
-
|
46
|
+
if defined? Axlsx
|
47
|
+
render xlsx: 'table', filename: "#{@table.name}.xlsx"
|
48
|
+
else
|
49
|
+
raise 'RailsDb could not find Axlsx, please add it to your Gemfile: "gem \'axlsx_rails\'"'
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
def truncate
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<li>filter tables for easier navigation</li>
|
17
17
|
<li>use history of your SQL queries</li>
|
18
18
|
<li>see EXPLAIN results for your queries</li>
|
19
|
-
<li>export data to CSV and Excel</li>
|
19
|
+
<li>export data to CSV and Excel (see documentation)</li>
|
20
20
|
<li>hide/show columns</li>
|
21
21
|
<li>import SQL files</li>
|
22
22
|
<li>expand/collapse sidebar</li>
|
@@ -6,7 +6,9 @@
|
|
6
6
|
<span class="radius info label">Time: <%= sql_query.data.time %> seconds</span>
|
7
7
|
<span class="radius secondary label"><a href="#" data-reveal-id="explain_modal" id='explain_modal_link'>Explain</a></span>
|
8
8
|
<span class="radius warning label"><%= link_to raw("#{fa_icon('file-text-o')} Export to CSV"), sql_csv_path(sql: sql, format: 'csv'), method: :post %></span>
|
9
|
-
|
9
|
+
<% if defined? Axlsx %>
|
10
|
+
<span class="radius warning label"><%= link_to raw("#{fa_icon('file-excel-o')} Export to Excel"), sql_xls_path(sql: sql, format: 'xls'), method: :post %></span>
|
11
|
+
<% end %>
|
10
12
|
</p>
|
11
13
|
<hr>
|
12
14
|
<%= render 'explain', sql_query: sql_query, sql: sql %>
|
@@ -31,7 +31,9 @@
|
|
31
31
|
|
32
32
|
<ul id="download-files" class="f-dropdown" data-dropdown-content>
|
33
33
|
<li><%= link_to raw("#{fa_icon('file-text-o')} Export table to CSV"), table_csv_path(@table) %></li>
|
34
|
-
|
34
|
+
<% if defined? Axlsx %>
|
35
|
+
<li><%= link_to raw("#{fa_icon('file-excel-o')} Export table to Excel"), table_xlsx_path(@table, format: 'xls') %></li>
|
36
|
+
<% end %>
|
35
37
|
</ul>
|
36
38
|
|
37
39
|
<div class='scrollable'>
|
@@ -7,15 +7,7 @@
|
|
7
7
|
<% @record.class.columns.each do |column| %>
|
8
8
|
<% name = column.name %>
|
9
9
|
<% next if name == @table.primary_key %>
|
10
|
-
|
11
|
-
<% if ['datetime', 'date', 'time'].include?(column.sql_type) %>
|
12
|
-
<div class='form-inline'>
|
13
|
-
<%= form.input name, label: name, input_html: {class: 'date_or_time'} %>
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<% else %>
|
17
|
-
<%= form.input name, label: name %>
|
18
|
-
<% end %>
|
10
|
+
<%= form.input name, label: name %>
|
19
11
|
<% end %>
|
20
12
|
</div>
|
21
13
|
<%= form.submit 'SAVE', class: 'button small' %>
|
@@ -7,15 +7,7 @@
|
|
7
7
|
<% @record.class.columns.each do |column| %>
|
8
8
|
<% name = column.name %>
|
9
9
|
<% next if [@table.primary_key, 'created_at', 'updated_at'].include?(column.name) %>
|
10
|
-
|
11
|
-
<% if ['datetime', 'date', 'time'].include?(column.sql_type) %>
|
12
|
-
<div class='form-inline'>
|
13
|
-
<%= form.input name, label: name, input_html: {class: 'date_or_time'} %>
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<% else %>
|
17
|
-
<%= form.input name, label: name %>
|
18
|
-
<% end %>
|
10
|
+
<%= form.input name, label: name %>
|
19
11
|
<% end %>
|
20
12
|
</div>
|
21
13
|
<%= form.submit 'SAVE', class: 'button small' %>
|
@@ -28,7 +28,9 @@
|
|
28
28
|
|
29
29
|
<ul id="download-files" class="f-dropdown" data-dropdown-content>
|
30
30
|
<li><%= link_to raw("#{fa_icon('file-text-o')} Export to CSV"), table_csv_path(@table) %></li>
|
31
|
-
|
31
|
+
<% if defined? Axlsx %>
|
32
|
+
<li><%= link_to raw("#{fa_icon('file-excel-o')} Export to Excel"), table_xlsx_path(@table, format: 'xls') %></li>
|
33
|
+
<% end %>
|
32
34
|
</ul>
|
33
35
|
|
34
36
|
<%= search_form_for @q, url: table_search_path(@table), method: :get, remote: true, html: { id: 'search_form', class: search_form_class } do |f| %>
|
@@ -19,7 +19,9 @@
|
|
19
19
|
|
20
20
|
<ul id="download-files" class="f-dropdown" data-dropdown-content>
|
21
21
|
<li><%= link_to raw("#{fa_icon('file-text-o')} Export table to CSV"), table_csv_path(@table) %></li>
|
22
|
-
|
22
|
+
<% if defined? Axlsx %>
|
23
|
+
<li><%= link_to raw("#{fa_icon('file-excel-o')} Export table to Excel"), table_xlsx_path(@table, format: 'xls') %></li>
|
24
|
+
<% end %>
|
23
25
|
</ul>
|
24
26
|
|
25
27
|
<ul id="drop" class="f-dropdown" data-dropdown-content>
|
data/lib/rails_db.rb
CHANGED
@@ -6,7 +6,6 @@ require "jquery-rails"
|
|
6
6
|
require 'codemirror-rails'
|
7
7
|
require 'terminal-table'
|
8
8
|
require 'csv'
|
9
|
-
require 'axlsx_rails'
|
10
9
|
require 'simple_form'
|
11
10
|
require 'ransack'
|
12
11
|
require 'kaminari'
|
@@ -57,7 +56,7 @@ module RailsDb
|
|
57
56
|
def self.use_default_configuration!
|
58
57
|
self.enabled = true
|
59
58
|
self.automatic_routes_mount = true
|
60
|
-
self.black_list_tables = white_list_tables = []
|
59
|
+
self.black_list_tables = self.white_list_tables = []
|
61
60
|
self.http_basic_authentication_enabled = false
|
62
61
|
self.verify_access_proc = proc { |controller| true }
|
63
62
|
end
|
data/lib/rails_db/engine.rb
CHANGED
@@ -4,7 +4,7 @@ module RailsDb
|
|
4
4
|
config.autoload_paths += Dir["#{config.root}/lib"]
|
5
5
|
|
6
6
|
initializer 'any_login.assets_precompile', :group => :all do |app|
|
7
|
-
app.config.assets.precompile += ['vendor/modernizr.js', 'rails_db/up_arrow.gif', 'rails_db/down_arrow.gif']
|
7
|
+
app.config.assets.precompile += ['rails_db/logo_mini.png', 'rails_db/*', 'vendor/modernizr.js', 'rails_db/up_arrow.gif', 'rails_db/down_arrow.gif', 'rails_db/logo.png']
|
8
8
|
app.config.assets.precompile += ["codemirror*", "codemirror/**/*"]
|
9
9
|
end
|
10
10
|
|
data/lib/rails_db/version.rb
CHANGED
data/rails_db.gemspec
CHANGED
@@ -25,7 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'codemirror-rails'
|
26
26
|
s.add_dependency 'launchy'
|
27
27
|
s.add_dependency 'terminal-table'
|
28
|
-
s.add_dependency 'axlsx_rails'
|
29
28
|
s.add_dependency 'simple_form'
|
30
29
|
s.add_dependency 'ransack'
|
31
30
|
s.add_dependency 'kaminari'
|
@@ -33,6 +32,7 @@ Gem::Specification.new do |s|
|
|
33
32
|
s.add_development_dependency "sqlite3"
|
34
33
|
s.add_development_dependency "mysql2", '<= 0.3.20'
|
35
34
|
s.add_development_dependency "pg"
|
35
|
+
s.add_development_dependency "axlsx_rails"
|
36
36
|
# s.add_development_dependency 'populator'
|
37
37
|
# s.add_development_dependency 'faker'
|
38
38
|
# s.add_development_dependency 'pry'
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'axlsx_rails'
|
2
3
|
|
3
4
|
class DashboardControllerTest < ActionDispatch::IntegrationTest
|
4
5
|
|
@@ -8,7 +9,6 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest
|
|
8
9
|
|
9
10
|
user = User.create(name: 'Igor')
|
10
11
|
edit_user = User.create(name: 'Edit')
|
11
|
-
account = Account.create(name: 'Igor')
|
12
12
|
|
13
13
|
get '/rails/db'
|
14
14
|
assert_equal 200, status
|
@@ -3,8 +3,11 @@ require File.expand_path('../boot', __FILE__)
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require(*Rails.groups)
|
6
|
+
|
6
7
|
require "rails_db"
|
7
8
|
|
9
|
+
Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search')
|
10
|
+
|
8
11
|
module Dummy
|
9
12
|
class Application < Rails::Application
|
10
13
|
# Settings in config/environments/* take precedence over those specified here.
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -52,46 +52,46 @@ ActiveRecord::Schema.define(version: 20151121125538) do
|
|
52
52
|
|
53
53
|
create_table "projects", force: :cascade do |t|
|
54
54
|
t.string "name"
|
55
|
-
t.string "
|
56
|
-
t.string "
|
57
|
-
t.string "
|
58
|
-
t.string "
|
59
|
-
t.string "
|
60
|
-
t.string "
|
61
|
-
t.string "
|
62
|
-
t.string "
|
63
|
-
t.string "
|
64
|
-
t.string "
|
65
|
-
t.string "
|
66
|
-
t.string "
|
67
|
-
t.string "
|
68
|
-
t.string "
|
69
|
-
t.string "
|
70
|
-
t.string "
|
71
|
-
t.string "
|
72
|
-
t.string "
|
73
|
-
t.string "
|
74
|
-
t.string "
|
75
|
-
t.integer "
|
76
|
-
t.integer "
|
77
|
-
t.integer "
|
78
|
-
t.integer "
|
79
|
-
t.integer "
|
80
|
-
t.integer "
|
81
|
-
t.integer "
|
82
|
-
t.integer "
|
83
|
-
t.integer "
|
84
|
-
t.integer "
|
85
|
-
t.integer "
|
86
|
-
t.integer "
|
87
|
-
t.integer "
|
88
|
-
t.integer "
|
89
|
-
t.integer "
|
90
|
-
t.integer "
|
91
|
-
t.integer "
|
92
|
-
t.integer "
|
93
|
-
t.integer "
|
94
|
-
t.integer "
|
55
|
+
t.string "description_911132"
|
56
|
+
t.string "description_782996"
|
57
|
+
t.string "description_824956"
|
58
|
+
t.string "description_241581"
|
59
|
+
t.string "description_725539"
|
60
|
+
t.string "description_340145"
|
61
|
+
t.string "description_243765"
|
62
|
+
t.string "description_430455"
|
63
|
+
t.string "description_163298"
|
64
|
+
t.string "description_670015"
|
65
|
+
t.string "description_64256"
|
66
|
+
t.string "description_825795"
|
67
|
+
t.string "description_130920"
|
68
|
+
t.string "description_546951"
|
69
|
+
t.string "description_678246"
|
70
|
+
t.string "description_372493"
|
71
|
+
t.string "description_413167"
|
72
|
+
t.string "description_399716"
|
73
|
+
t.string "description_605912"
|
74
|
+
t.string "description_179385"
|
75
|
+
t.integer "amount_346083"
|
76
|
+
t.integer "amount_295343"
|
77
|
+
t.integer "amount_478538"
|
78
|
+
t.integer "amount_356409"
|
79
|
+
t.integer "amount_798898"
|
80
|
+
t.integer "amount_300244"
|
81
|
+
t.integer "amount_963504"
|
82
|
+
t.integer "amount_83801"
|
83
|
+
t.integer "amount_272106"
|
84
|
+
t.integer "amount_852037"
|
85
|
+
t.integer "amount_35283"
|
86
|
+
t.integer "amount_803382"
|
87
|
+
t.integer "amount_218786"
|
88
|
+
t.integer "amount_230333"
|
89
|
+
t.integer "amount_357044"
|
90
|
+
t.integer "amount_984738"
|
91
|
+
t.integer "amount_172195"
|
92
|
+
t.integer "amount_249998"
|
93
|
+
t.integer "amount_349304"
|
94
|
+
t.integer "amount_792944"
|
95
95
|
t.datetime "created_at", null: false
|
96
96
|
t.datetime "updated_at", null: false
|
97
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,20 +122,6 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: axlsx_rails
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :runtime
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: simple_form
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +206,20 @@ dependencies:
|
|
220
206
|
- - ">="
|
221
207
|
- !ruby/object:Gem::Version
|
222
208
|
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: axlsx_rails
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
223
|
description: Quick way to inspect your Rails database, see content of tables, filter,
|
224
224
|
export them to CSV, Excel, EXPLAIN SQL and run SQL queries.
|
225
225
|
email:
|
@@ -430,7 +430,6 @@ files:
|
|
430
430
|
- test/dummy/db/rails_db.sqlite3
|
431
431
|
- test/dummy/db/rails_db_dev.sqlite3
|
432
432
|
- test/dummy/db/schema.rb
|
433
|
-
- test/dummy/db/test.sqlite3
|
434
433
|
- test/dummy/public/404.html
|
435
434
|
- test/dummy/public/422.html
|
436
435
|
- test/dummy/public/500.html
|
@@ -595,7 +594,6 @@ test_files:
|
|
595
594
|
- test/dummy/db/rails_db.sqlite3
|
596
595
|
- test/dummy/db/rails_db_dev.sqlite3
|
597
596
|
- test/dummy/db/schema.rb
|
598
|
-
- test/dummy/db/test.sqlite3
|
599
597
|
- test/dummy/public/404.html
|
600
598
|
- test/dummy/public/422.html
|
601
599
|
- test/dummy/public/500.html
|
data/test/dummy/db/test.sqlite3
DELETED
Binary file
|