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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b8edcd55cb5deaa338dde74868d85c838906507
4
- data.tar.gz: 4f641001dc8e886869ed8644a6a7e9dff4575ae9
3
+ metadata.gz: cdad8252f17bfd7452ecc2f92a7c3a8fdcabf4fa
4
+ data.tar.gz: 634067ced3e8d805c85bd24c533ccc4ea773bed2
5
5
  SHA512:
6
- metadata.gz: 48b2dc79959b7f7682f43cf6577b784db747aa8df3ad45325ca0922c65105ddca9b532bf5aabc62be1f9bf17c69e6044a5cb26ff136850c3b1166f9129049ae0
7
- data.tar.gz: 553f9b1c71c073a75c3dd4f7c773dfaae90cc7d9def1b6a8e7ef589e70610cbc979b9d0cae92d755a5a456b0b6fbb28c8fff3e177282a4e14392187ee2c24cbe
6
+ metadata.gz: 89c8513bb443d3b9d4fe76e3b38ca733e6bfe6f68dafe7b75d73755c1fcb76ef7f8d37570eb923ecd4ad17dda4cbf8cca62e7229b544587bb633d918cd27e141
7
+ data.tar.gz: 741d3bc568a8003bcc0a6c923e183ad81384e49c63eedc3c7b874ccc9961754c0c6af658215c11f6802b397de040dc27e947ced6ad74b2c5bd5e9c5c9f106ec5
data/Gemfile CHANGED
@@ -8,7 +8,6 @@ gem 'jquery-rails'
8
8
  gem 'font-awesome-rails'
9
9
  gem 'codemirror-rails'
10
10
  gem 'terminal-table'
11
- gem 'axlsx_rails'
12
11
  gem 'simple_form'
13
12
  gem 'ransack'
14
13
  gem 'kaminari'
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_db (1.0)
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.3.8)
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
@@ -1,9 +1,9 @@
1
- .date_or_time {
2
- display: inline;
1
+ select.datetime, select.date, select.time {
2
+ padding-right: 25px;
3
3
  width: auto;
4
4
  }
5
5
 
6
6
  .scrollable_form {
7
7
  max-height: 600px;
8
8
  overflow: scroll;
9
- }
9
+ }
@@ -43,7 +43,11 @@ module RailsDb
43
43
  end
44
44
 
45
45
  def xlsx
46
- render xlsx: 'table', filename: "#{@table.name}.xlsx"
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>
@@ -41,7 +41,7 @@
41
41
  </ul>
42
42
  <ul class="inline-list right main_nav">
43
43
  <li>
44
- <%= link_to '/' do %>
44
+ <%= link_to main_app.root_url do %>
45
45
  <%= fa_icon 'home' %>
46
46
  Home
47
47
  <% end %>
@@ -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
- <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>
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
- <li><%= link_to raw("#{fa_icon('file-excel-o')} Export table to Excel"), table_xlsx_path(@table, format: 'xls') %></li>
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
- <li><%= link_to raw("#{fa_icon('file-excel-o')} Export to Excel"), table_xlsx_path(@table, format: 'xls') %></li>
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
- <li><%= link_to raw("#{fa_icon('file-excel-o')} Export table to Excel"), table_xlsx_path(@table, format: 'xls') %></li>
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>
@@ -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
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module RailsDb
2
- VERSION = "1.0"
2
+ VERSION = "1.1"
3
3
  end
@@ -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
@@ -10,4 +10,10 @@
10
10
  #
11
11
 
12
12
  class Account < ActiveRecord::Base
13
+
14
+ # to test search
15
+ def self.search(name)
16
+ where('1=1')
17
+ end
18
+
13
19
  end
@@ -11,4 +11,5 @@
11
11
  #
12
12
 
13
13
  class Contact < ActiveRecord::Base
14
+ scope :search, -> { where('1=1') }
14
15
  end
@@ -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.
@@ -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 "description_880941"
56
- t.string "description_609312"
57
- t.string "description_45120"
58
- t.string "description_646956"
59
- t.string "description_359190"
60
- t.string "description_414526"
61
- t.string "description_126104"
62
- t.string "description_21394"
63
- t.string "description_200553"
64
- t.string "description_47383"
65
- t.string "description_817819"
66
- t.string "description_297200"
67
- t.string "description_732496"
68
- t.string "description_578733"
69
- t.string "description_181448"
70
- t.string "description_591849"
71
- t.string "description_29523"
72
- t.string "description_859516"
73
- t.string "description_607626"
74
- t.string "description_634417"
75
- t.integer "amount_96786"
76
- t.integer "amount_118208"
77
- t.integer "amount_354589"
78
- t.integer "amount_529364"
79
- t.integer "amount_2748"
80
- t.integer "amount_265448"
81
- t.integer "amount_87259"
82
- t.integer "amount_69192"
83
- t.integer "amount_400320"
84
- t.integer "amount_981344"
85
- t.integer "amount_724725"
86
- t.integer "amount_233529"
87
- t.integer "amount_10548"
88
- t.integer "amount_918245"
89
- t.integer "amount_400389"
90
- t.integer "amount_630390"
91
- t.integer "amount_183655"
92
- t.integer "amount_83287"
93
- t.integer "amount_252578"
94
- t.integer "amount_147921"
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
@@ -7,6 +7,8 @@ require 'sprockets/railtie'
7
7
 
8
8
  require "rails_db"
9
9
 
10
+ Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search')
11
+
10
12
  module OverideDatabaseYmlPath
11
13
  def paths
12
14
  @paths ||= begin
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.0'
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-02 00:00:00.000000000 Z
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
Binary file