rails_db 1.6.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -2
  3. data/Gemfile.lock +133 -101
  4. data/app/controllers/rails_db/application_controller.rb +1 -5
  5. data/app/controllers/rails_db/sql_controller.rb +1 -5
  6. data/app/controllers/rails_db/tables_controller.rb +2 -10
  7. data/app/helpers/rails_db/tables_helper.rb +8 -3
  8. data/app/views/layouts/rails_db/application.html.erb +1 -1
  9. data/app/views/rails_db/dashboard/data_table.html.erb +1 -1
  10. data/app/views/rails_db/tables/_data.html.erb +1 -1
  11. data/app/views/rails_db/tables/_search.html.erb +1 -1
  12. data/app/views/rails_db/tables/_show.html.erb +7 -11
  13. data/lib/ext/ransack_ext.rb +0 -0
  14. data/lib/rails_db/table.rb +1 -8
  15. data/lib/rails_db/version.rb +1 -1
  16. data/rails_db.gemspec +2 -6
  17. data/test/dashboard_controller_test.rb +6 -6
  18. data/test/database_test.rb +0 -3
  19. data/test/dummy/config/application.rb +4 -1
  20. data/test/dummy/config/environments/development.rb +10 -0
  21. data/test/dummy/config/environments/production.rb +9 -1
  22. data/test/dummy/config/environments/test.rb +9 -1
  23. data/test/dummy/config/initializers/mime_types.rb +3 -0
  24. data/test/dummy/db/migrate/20151013203739_create_users.rb +7 -1
  25. data/test/dummy/db/migrate/20151013203757_create_comments.rb +1 -1
  26. data/test/dummy/db/migrate/20151013204027_populate_data.rb +1 -1
  27. data/test/dummy/db/migrate/20151014074454_create_accounts.rb +1 -1
  28. data/test/dummy/db/migrate/20151014074655_create_contacts.rb +1 -1
  29. data/test/dummy/db/migrate/20151014152932_add_bd.rb +1 -1
  30. data/test/dummy/db/migrate/20151014183823_create_projects.rb +1 -1
  31. data/test/dummy/db/migrate/20151014184243_add_long_text.rb +1 -1
  32. data/test/dummy/db/migrate/20151015145740_populate_db.rb +1 -1
  33. data/test/dummy/db/migrate/20151027192250_create_payments.rb +1 -1
  34. data/test/dummy/db/migrate/20151027223149_add_non_pk_table.rb +1 -1
  35. data/test/dummy/db/migrate/20151028191429_create_legacy_accounts.rb +1 -1
  36. data/test/dummy/db/migrate/20151121125538_add_boolean_field_to_user.rb +1 -1
  37. data/test/dummy/db/migrate/20170126124628_add_sti_model.rb +1 -1
  38. data/test/dummy/db/rails_db.sqlite3 +0 -0
  39. data/test/dummy/db/rails_db_dev.sqlite3 +0 -0
  40. data/test/dummy/db/schema.rb +72 -77
  41. data/test/rails_db_data_table_helper_test.rb +0 -4
  42. data/test/rails_db_test.rb +0 -3
  43. data/test/sql_import_test.rb +0 -4
  44. data/test/sql_query_test.rb +0 -4
  45. data/test/standalone/config/application.rb +4 -1
  46. data/test/standalone/config/environments/development.rb +10 -0
  47. data/test/standalone/config/environments/production.rb +9 -1
  48. data/test/standalone/config/environments/test.rb +9 -1
  49. data/test/standalone/config/initializers/mime_types.rb +3 -0
  50. data/test/table_test.rb +0 -1
  51. data/test/tables_helper_test.rb +0 -4
  52. data/test/test_helper.rb +1 -10
  53. metadata +7 -7
  54. data/test/standalone/config/initializers/quiet_assets.rb +0 -10
@@ -3,10 +3,6 @@ require 'test_helper'
3
3
  class RailsDbDataTableHelperTest < ActionView::TestCase
4
4
  include RailsDb::RailsDbDataTableHelper
5
5
 
6
- def setup
7
- clean_db
8
- end
9
-
10
6
  test "default rails_db_data_table works" do
11
7
  user = User.create(name: 'Igor')
12
8
  content = rails_db_data_table('users')
@@ -1,9 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RailsDbTest < ActiveSupport::TestCase
4
- def setup
5
- clean_db
6
- end
7
4
 
8
5
  test "truth" do
9
6
  assert_kind_of Module, RailsDb
@@ -2,10 +2,6 @@ require 'test_helper'
2
2
 
3
3
  class SqlImportTest < ActiveSupport::TestCase
4
4
 
5
- def setup
6
- clean_db
7
- end
8
-
9
5
  test "import" do
10
6
  ["accounts", "comments", "contacts", "legacy_accounts", "payments", "projects", "projects_users", "users"].each do |t|
11
7
  assert RailsDb::Database.tables.include?(t)
@@ -2,10 +2,6 @@ require 'test_helper'
2
2
 
3
3
  class DatabaseTest < ActiveSupport::TestCase
4
4
 
5
- def setup
6
- clean_db
7
- end
8
-
9
5
  test "query" do
10
6
  User.delete_all
11
7
  User.create(name: 'Igor')
@@ -7,7 +7,10 @@ require 'sprockets/railtie'
7
7
 
8
8
  require "rails_db"
9
9
 
10
- Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search')
10
+ begin
11
+ Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search')
12
+ rescue Exception
13
+ end
11
14
 
12
15
  module OverideDatabaseYmlPath
13
16
  def paths
@@ -19,6 +19,16 @@ Rails.application.configure do
19
19
  # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
+ begin
23
+ config.serve_static_files = true
24
+ rescue NoMethodError
25
+ end
26
+
27
+ begin
28
+ config.public_file_server.enabled = true
29
+ rescue NoMethodError
30
+ end
31
+
22
32
  # Raise an error on page load if there are pending migrations.
23
33
  # config.active_record.migration_error = false
24
34
 
@@ -22,7 +22,15 @@ Rails.application.configure do
22
22
 
23
23
  # Disable serving static files from the `/public` folder by default since
24
24
  # Apache or NGINX already handles this.
25
- config.serve_static_files = true
25
+ begin
26
+ config.serve_static_files = true
27
+ rescue NoMethodError
28
+ end
29
+
30
+ begin
31
+ config.public_file_server.enabled = true
32
+ rescue NoMethodError
33
+ end
26
34
 
27
35
  config.log_level = :error
28
36
 
@@ -16,7 +16,15 @@ Dummy::Application.configure do
16
16
  config.eager_load = false
17
17
 
18
18
  # Configure static file server for tests with Cache-Control for performance.
19
- config.serve_static_files = true
19
+ begin
20
+ config.serve_static_files = true
21
+ rescue NoMethodError
22
+ end
23
+
24
+ begin
25
+ config.public_file_server.enabled = true
26
+ rescue NoMethodError
27
+ end
20
28
  #config.static_cache_control = 'public, max-age=3600'
21
29
 
22
30
  # Show full error reports and disable caching.
@@ -2,3 +2,6 @@
2
2
 
3
3
  # Add new mime types for use in respond_to blocks:
4
4
  # Mime::Type.register "text/richtext", :rtf
5
+
6
+ Mime::Type.register "application/vnd.ms-excel", :xls
7
+ Mime::Type.register "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", :xlsx
@@ -3,7 +3,6 @@ require 'test_helper'
3
3
  class TableTest < ActiveSupport::TestCase
4
4
 
5
5
  def setup
6
- clean_db
7
6
  @users_table = RailsDb::Table.new('users')
8
7
  end
9
8
 
@@ -3,10 +3,6 @@ require 'test_helper'
3
3
  class TablesHelperTest < ActionView::TestCase
4
4
  include RailsDb::TablesHelper
5
5
 
6
- def setup
7
- clean_db
8
- end
9
-
10
6
  test "method column_is_checked? returns true for checkbox status if cookie does not contain hash_key for this table" do
11
7
  status = column_is_checked?('users', 'created_at')
12
8
  assert_equal true, status
@@ -8,8 +8,6 @@ ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db
8
8
  ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
9
9
  require "rails/test_help"
10
10
 
11
- ActiveSupport::TestCase.use_transactional_fixtures = false
12
-
13
11
  puts "USING DB: #{RailsDb::Database.adapter.adapter_name}"
14
12
  puts "USING Rails: #{Gem.loaded_specs['rails'].version}"
15
13
 
@@ -18,11 +16,4 @@ puts "USING Rails: #{Gem.loaded_specs['rails'].version}"
18
16
  Minitest.backtrace_filter = Minitest::BacktraceFilter.new
19
17
 
20
18
  # Load support files
21
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
22
-
23
- def clean_db
24
- if ActiveRecord::Base.connection.table_exists? :t
25
- ActiveRecord::Base.connection.drop_table :t
26
- end
27
- ActiveRecord::Base.connection.tables.map(&:classify).map{|name| name.constantize if Object.const_defined?(name)}.compact.each(&:delete_all)
28
- end
19
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
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.6.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2018-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.0
19
+ version: 5.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.0
26
+ version: 5.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: codemirror-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -385,6 +385,7 @@ files:
385
385
  - test/dummy/db/migrate/20151121125538_add_boolean_field_to_user.rb
386
386
  - test/dummy/db/migrate/20170126124628_add_sti_model.rb
387
387
  - test/dummy/db/rails_db.sqlite3
388
+ - test/dummy/db/rails_db_dev.sqlite3
388
389
  - test/dummy/db/schema.rb
389
390
  - test/dummy/public/404.html
390
391
  - test/dummy/public/422.html
@@ -442,7 +443,6 @@ files:
442
443
  - test/standalone/config/initializers/filter_parameter_logging.rb
443
444
  - test/standalone/config/initializers/inflections.rb
444
445
  - test/standalone/config/initializers/mime_types.rb
445
- - test/standalone/config/initializers/quiet_assets.rb
446
446
  - test/standalone/config/initializers/rails_db.rb
447
447
  - test/standalone/config/initializers/session_store.rb
448
448
  - test/standalone/config/initializers/wrap_parameters.rb
@@ -479,7 +479,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
479
479
  version: '0'
480
480
  requirements: []
481
481
  rubyforge_project:
482
- rubygems_version: 2.5.2
482
+ rubygems_version: 2.6.14
483
483
  signing_key:
484
484
  specification_version: 4
485
485
  summary: Inspect your Rails DB (table content viewer, execute sql queries, export
@@ -525,7 +525,6 @@ test_files:
525
525
  - test/standalone/config/initializers/mime_types.rb
526
526
  - test/standalone/config/initializers/assets.rb
527
527
  - test/standalone/config/initializers/rails_db.rb
528
- - test/standalone/config/initializers/quiet_assets.rb
529
528
  - test/standalone/config/initializers/wrap_parameters.rb
530
529
  - test/standalone/config/initializers/filter_parameter_logging.rb
531
530
  - test/standalone/Rakefile
@@ -586,6 +585,7 @@ test_files:
586
585
  - test/dummy/Rakefile
587
586
  - test/dummy/db/schema.rb
588
587
  - test/dummy/db/rails_db.sqlite3
588
+ - test/dummy/db/rails_db_dev.sqlite3
589
589
  - test/dummy/db/migrate/20151014183823_create_projects.rb
590
590
  - test/dummy/db/migrate/20170126124628_add_sti_model.rb
591
591
  - test/dummy/db/migrate/20151014074454_create_accounts.rb
@@ -1,10 +0,0 @@
1
- Rails::Rack::Logger.class_eval do
2
- def call_with_quiet_assets(env)
3
- previous_level = Rails.logger.level
4
- Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
5
- call_without_quiet_assets(env)
6
- ensure
7
- Rails.logger.level = previous_level
8
- end
9
- alias_method_chain :call, :quiet_assets
10
- end