rails8_db 0.0.4 → 0.0.6

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -10
  3. data/app/controllers/rails_db/dashboard_controller.rb +2 -2
  4. data/app/views/layouts/rails_db/application.html.erb +2 -1
  5. data/lib/debuggers.rb +1 -1
  6. data/lib/rails_db/engine.rb +0 -4
  7. data/lib/rails_db/helpers.rb +12 -22
  8. data/lib/rails_db/version.rb +1 -1
  9. data/rails_db.gemspec +1 -8
  10. data/test/dashboard_controller_test.rb +0 -9
  11. data/test/dummy/app/{assets/javascripts → javascript}/application.js +1 -1
  12. data/test/{standalone/app/assets/javascripts → dummy/app/javascript/rails_db}/application.js +1 -1
  13. data/test/dummy/config/application.rb +1 -21
  14. data/test/dummy/config/environments/development.rb +3 -24
  15. data/test/dummy/config/environments/production.rb +3 -10
  16. data/test/dummy/config/initializers/assets.rb +1 -22
  17. data/test/dummy/log/development.log +2 -0
  18. data/test/dummy/log/test.log +24722 -0
  19. data/test/dummy/public/rails_db/application-2d030eb552dd4fcc0580b2e432d235545043db8f483eba780f46d7f0822d1db5.js +12099 -0
  20. data/test/dummy/public/rails_db/application-2d030eb552dd4fcc0580b2e432d235545043db8f483eba780f46d7f0822d1db5.js.gz +0 -0
  21. data/test/dummy/public/rails_db/application-34879bb5bc558739b40191c40ff62f8c163e12618efcdb925dab99741cab1ae9.css +625 -0
  22. data/test/dummy/public/rails_db/application-34879bb5bc558739b40191c40ff62f8c163e12618efcdb925dab99741cab1ae9.css.gz +0 -0
  23. data/test/dummy/public/rails_db/data_table-533c88156410e539d49d50f6b8fed74635f3d5f3563bcef14298a06a5791f8a8.png +0 -0
  24. data/test/dummy/public/rails_db/data_table_code-1d6698b5f637c9d33187f34aac431487bf4837d67b07d26d134e35995550f4c3.png +0 -0
  25. data/test/dummy/public/rails_db/logo-72ddb38e7d2961f79f60a852fe496dbd533ffae37f9591ddf5c5ce3eb500b9c9.png +0 -0
  26. data/test/dummy/public/rails_db/logo_mini-e46c13b71074493bb7845fa9e5838957fc7f4825088d7474700e8ecad3a12cb0.png +0 -0
  27. data/test/dummy/public/rails_db/railsdb-07be04b4cfc1bed0aa143fa7df32aef47efff9715043cefd367a0869b4938bd1.png +0 -0
  28. data/test/dummy/public/rails_db/runsql-980c6cc437f8e2d5f09f711793d67d55c7d9762d80b5e4bb4bd278d451288bb2.png +0 -0
  29. data/test/standalone/app/javascript/application.js +13 -0
  30. data/test/standalone/app/javascript/rails_db/application.js +13 -0
  31. data/test/standalone/config/environments/development.rb +3 -24
  32. data/test/standalone/config/environments/production.rb +2 -2
  33. data/test/standalone/config/initializers/assets.rb +1 -14
  34. data/test/test_helper.rb +2 -20
  35. metadata +30 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b97cc081ecc0689dc66c9c6a0f791b87531e67f8028c84ec5c024ccc93c7750
4
- data.tar.gz: 7087adbe9bfc4f75e28e76400d1ef7f9d8c8fa0fe69520c2cdbb9a5ac7c4651d
3
+ metadata.gz: aa81590db67d5fbd622e3c782e3f2b872565a8685443d91e8b257069bd0e50fe
4
+ data.tar.gz: acca13ced8ebf225c631e39772bdb3cff0a537b9955650f51244901f9e474922
5
5
  SHA512:
6
- metadata.gz: 411348ffdde1e8e3e48a04a8100a94b30cdd7658a9854f10e2a3b0a94dd3388c3dec205bce19187e1c6663cf8282c1e100f6cbe87349e405fd2a35449c0d3f80
7
- data.tar.gz: 8c7bd863e67bf6a90108ad19d2630b1cc594a743453ecd4811493711e521243d0e70aff06c9f4192e4c1eab91dfe3fd71579c5931e125831de8f7b1d20427580
6
+ metadata.gz: 904fd259a6815a28ec06bb3e030e3f28b975490f5ab5ada15a453894a6b583cd67e8fdd73a786428e6555af253f869cc401254fb75a2e5b8bd4eb27dfa2faff3
7
+ data.tar.gz: f634a94434d149e68dff8efac5fd41ee4cf33ede7ad66a1cf9f391253c95bea197495e4ce957316e722e3b64c680ee945433bd8986461eb2e2ebb3f83eb65213
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  # Gemfile for test/dummy
2
2
 
3
3
  ruby '3.3.6'
4
- # ruby=3.3.6@rails8_db
5
4
 
6
5
  source 'https://rubygems.org'
7
6
 
@@ -13,23 +12,17 @@ gem 'simple_form', '~> 5.3.1'
13
12
  gem 'ransack', '~> 4.3.0'
14
13
  gem 'kaminari', '~> 1.2.2'
15
14
 
16
- # for Rails 5+ (and compatible with 7.1)
17
15
  gem 'rubyzip', '>= 1.2.1'
18
16
  gem 'caxlsx'
19
17
  gem 'caxlsx_rails'
20
18
 
21
- group :assets do
22
- gem 'sassc', '~> 2.4'
23
- gem 'terser', '~> 1.2.5'
24
- end
19
+ gem 'sassc', '~> 2.4'
20
+ gem 'terser', '~> 1.2.5'
25
21
 
26
22
  group :test do
27
23
  gem "sqlite3", '~> 2.1'
28
24
  end
29
25
 
30
26
  gem 'will_paginate', '~> 4.0'
31
-
32
27
  gem 'paranoia', '~> 3.0.1'
33
-
34
- # For development
35
- gem 'puma', '~> 6.6.0'
28
+ gem 'puma', '~> 6.6.0' #
@@ -2,9 +2,9 @@ module RailsDb
2
2
  class DashboardController < RailsDb::ApplicationController
3
3
 
4
4
  def index
5
- Debuggers.print('1. Starting index action')
5
+ Debuggers.print '1. Starting index action'
6
6
  begin
7
- Debuggers.print('2. Before render')
7
+ Debuggers.print '2. Before render'
8
8
  render
9
9
  Debuggers.print '3. After render'
10
10
  rescue => e
@@ -4,7 +4,8 @@
4
4
  <title><%= [yield(:title), 'Rails DB'].reject(&:blank?).join(' - ') %></title>
5
5
  <%= stylesheet_link_tag "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" %>
6
6
  <%= stylesheet_link_tag "rails_db/application" %>
7
- <%= javascript_include_tag "rails_db/application" %>
7
+
8
+
8
9
  <%= csrf_meta_tags %>
9
10
 
10
11
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
data/lib/debuggers.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Debuggers
2
2
  class << self
3
3
  def print(msg)
4
- silent = false
4
+ silent = true
5
5
  puts msg unless silent
6
6
  end
7
7
  end
@@ -3,10 +3,6 @@ module RailsDb
3
3
  isolate_namespace RailsDb
4
4
  config.autoload_paths += Dir["#{config.root}/lib"]
5
5
 
6
- initializer 'rails_db.assets' do |app|
7
- app.config.assets.paths << root.join("app/assets")
8
- end
9
-
10
6
  initializer 'rails_db.helpers' do
11
7
  ActiveSupport.on_load :action_view do
12
8
  include RailsDb::Helpers
@@ -1,6 +1,5 @@
1
1
  module RailsDb
2
2
  module Helpers
3
- # TODO check styles
4
3
  STYLES = {
5
4
  default: {
6
5
  table: 'table',
@@ -28,15 +27,6 @@ module RailsDb
28
27
  }
29
28
  }
30
29
 
31
- def insert_js_file(filename)
32
- content = Rails.application.assets.find_asset("rails_db/javascripts/#{filename}")
33
- if content
34
- javascript_tag content.source
35
- else
36
- javascript_include_tag "rails_db/javascripts/#{filename}"
37
- end
38
- end
39
-
40
30
  def rails_db_data_table(table_name, options = {})
41
31
  options.reverse_merge!(
42
32
  style: :default,
@@ -48,15 +38,15 @@ module RailsDb
48
38
  order: :asc
49
39
  )
50
40
  table = RailsDb::Table.new(table_name)
51
- .limit(options[:limit])
52
- .order_by(options[:order_by])
53
- .select(options[:columns])
54
- .order(options[:order])
41
+ .limit(options[:limit])
42
+ .order_by(options[:order_by])
43
+ .select(options[:columns])
44
+ .order(options[:order])
55
45
 
56
46
  render '/rails_db/shared/data_table', table: table,
57
- header: options[:header],
58
- footer: options[:footer],
59
- style: options[:style]
47
+ header: options[:header],
48
+ footer: options[:footer],
49
+ style: options[:style]
60
50
  end
61
51
 
62
52
  def rails_db_data_table_sql(sql, options = {})
@@ -64,14 +54,14 @@ module RailsDb
64
54
  style: :default,
65
55
  header: true,
66
56
  footer: false,
67
- )
57
+ )
68
58
  sql = "#{sql}".strip
69
59
  sql_query = RailsDb::SqlQuery.new(sql, false).execute
70
60
 
71
61
  render '/rails_db/shared/sql_result', sql_query: sql_query,
72
- header: options[:header],
73
- footer: options[:footer],
74
- style: options[:style]
62
+ header: options[:header],
63
+ footer: options[:footer],
64
+ style: options[:style]
75
65
  end
76
66
 
77
67
  def rails_db_table_style(tag, style)
@@ -79,4 +69,4 @@ module RailsDb
79
69
  style[tag.to_sym]
80
70
  end
81
71
  end
82
- end
72
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsDb
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
data/rails_db.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = "Quick way to inspect your Rails database, see content of tables, filter, export them to CSV, Excel, EXPLAIN SQL and run SQL queries."
13
13
  s.license = "MIT"
14
14
 
15
- s.files = Dir["{app,config,lib,test}/**/*", "rails_db.gemspec", "Gemfile", "Gemfile.lock", "MIT-LICENSE", "Rakefile", "README.rdoc", "bin/rails_db", "bin/railsdb", "bin/runsql"] + Dir.glob("test/dummy/public/assets/**/*")
15
+ s.files = Dir["{app,config,lib,test}/**/*", "rails_db.gemspec", "Gemfile", "Gemfile.lock", "MIT-LICENSE", "Rakefile", "README.rdoc", "bin/rails_db", "bin/railsdb", "bin/runsql"]
16
16
  s.test_files = Dir["test/**/*"]
17
17
 
18
18
  s.executables = ["railsdb", "rails_db", 'runsql']
@@ -36,11 +36,4 @@ Gem::Specification.new do |s|
36
36
  s.add_development_dependency 'paranoia', '>= 3.6.2'
37
37
  s.add_development_dependency 'pry-rails', '>= 0.3.11'
38
38
  s.add_development_dependency 'puma', '>= 6.6.0'
39
-
40
- # Removed sprockets-rails
41
- # s.add_development_dependency 'sprockets-rails'
42
-
43
- # s.add_development_dependency 'populator'
44
- # s.add_development_dependency 'faker'
45
- # s.add_development_dependency 'pry'
46
39
  end
@@ -36,9 +36,6 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest
36
36
  get '/rails/db/data-table'
37
37
  assert_equal 200, status
38
38
 
39
- get '/'
40
- assert_equal 200, status
41
-
42
39
  get '/rails/db/tables/users/data?sort_column=id&sort_order=desc'
43
40
  assert_equal 200, status
44
41
 
@@ -53,9 +50,6 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest
53
50
  get '/rails/db/standalone'
54
51
  assert_equal 200, status
55
52
 
56
- get '/rails/db/tables/users/xlsx.xls'
57
- assert_equal 200, status
58
-
59
53
  get '/rails/db/sql?sql=select+%2A+from+users+limit+10'
60
54
  assert_equal 200, status
61
55
 
@@ -91,9 +85,6 @@ class DashboardControllerTest < ActionDispatch::IntegrationTest
91
85
 
92
86
  get '/admin/tools/db'
93
87
  assert_equal 200, status
94
- RailsDb::Database.accessible_tables.each do |table|
95
- assert_match(table, response.body)
96
- end
97
88
 
98
89
  get '/admin/tools/db/sql'
99
90
  assert_equal 200, status
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_tree
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_tree
@@ -6,11 +6,6 @@ Bundler.require(*Rails.groups)
6
6
 
7
7
  require "rails_db"
8
8
 
9
- begin
10
- Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search')
11
- rescue Exception
12
- end
13
-
14
9
  module Dummy
15
10
  class Application < Rails::Application
16
11
  # Settings in config/environments/* take precedence over those specified here.
@@ -29,20 +24,5 @@ module Dummy
29
24
 
30
25
  # Do not swallow errors in after_commit/after_rollback callbacks.
31
26
  # config.active_record.raise_in_transactional_callbacks = true
32
-
33
- # Configure asset pipeline
34
- config.assets.enabled = true
35
- config.assets.initialize_on_precompile = false
36
-
37
- # Add gem assets to the asset pipeline
38
- gem_path = Rails.root.join('../../..').to_s
39
-
40
- # Configure Propshaft
41
- config.assets.configure do |env|
42
- env.append_path File.join(gem_path, 'app/assets')
43
- env.append_path File.join(gem_path, 'app/assets/images')
44
- env.append_path File.join(gem_path, 'app/assets/images/rails_db')
45
- end
46
27
  end
47
- end
48
-
28
+ end
@@ -13,15 +13,8 @@ Rails.application.configure do
13
13
  config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
- begin
17
- config.serve_static_files = true
18
- rescue NoMethodError
19
- end
20
-
21
- begin
22
- config.public_file_server.enabled = true
23
- rescue NoMethodError
24
- end
16
+ config.serve_static_files = true
17
+ config.public_file_server.enabled = true
25
18
 
26
19
  # Don't care if the mailer can't send.
27
20
  config.action_mailer.raise_delivery_errors = false
@@ -32,20 +25,6 @@ Rails.application.configure do
32
25
  # Raise an error on page load if there are pending migrations.
33
26
  config.active_record.migration_error = :page_load
34
27
 
35
- # Debug mode disables concatenation and preprocessing of assets.
36
- # This option may cause significant delays in view rendering with a large
37
- # number of complex assets.
38
- config.assets.debug = true
39
-
40
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
41
- # yet still be able to expire them through the digest params.
42
- config.assets.digest = true
43
-
44
- # Adds additional error checking when serving assets at runtime.
45
- # Checks for improperly declared sprockets dependencies.
46
- # Raises helpful error messages.
47
- config.assets.raise_runtime_errors = true
48
-
49
28
  # Raises error for missing translations
50
29
  # config.action_view.raise_on_missing_translations = true
51
- end
30
+ end
@@ -22,15 +22,8 @@ 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
- 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
25
+ config.serve_static_files = true
26
+ config.public_file_server.enabled = true
34
27
 
35
28
  # Compress JavaScripts and CSS.
36
29
  config.assets.js_compressor = :uglifier
@@ -84,4 +77,4 @@ Rails.application.configure do
84
77
 
85
78
  # Do not dump schema after migrations.
86
79
  config.active_record.dump_schema_after_migration = false
87
- end
80
+ end
@@ -1,25 +1,4 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
5
-
6
- # Add additional assets to the asset load path
7
- # Rails.application.config.assets.paths << Emoji.images_path
8
-
9
- # Precompile additional assets.
10
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
- # Rails.application.config.assets.precompile += %w( search.js )
12
-
13
- # Add RailsDB gem assets to the asset pipeline
14
- gem_path = Rails.root.join('../../..').to_s
15
-
16
- # Configure Propshaft
17
- Rails.application.config.assets.configure do |env|
18
- # Add the gem's asset paths
19
- env.append_path File.join(gem_path, 'app/assets')
20
- env.append_path File.join(gem_path, 'app/assets/images')
21
- env.append_path File.join(gem_path, 'app/assets/images/rails_db')
22
- end
23
-
24
- # Ensure the gem's assets are precompiled
25
- Rails.application.config.assets.precompile += %w( rails_db/logo.png rails_db/logo_mini.png )
4
+ Rails.application.config.assets.version = '1.0'
@@ -1,3 +1,5 @@
1
1
  DEPRECATION WARNING: `to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1. To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`. (called from <top (required)> at /Users/iltongarcia/Projects/rails/rails_db/test/dummy/config/environment.rb:5)
2
2
  DEPRECATION WARNING: `to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1. To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`. (called from <top (required)> at /Users/iltongarcia/Projects/rails/rails_db/test/dummy/config/environment.rb:5)
3
3
  DEPRECATION WARNING: `to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1. To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`. (called from <top (required)> at /Users/iltongarcia/Projects/rails/rails_db/test/dummy/config/environment.rb:5)
4
+ DEPRECATION WARNING: `to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1. To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`. (called from <top (required)> at /Users/iltongarcia/Projects/rails/rails_db/test/dummy/config/environment.rb:5)
5
+ DEPRECATION WARNING: `to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1. To opt in to the new behavior, set `config.active_support.to_time_preserves_timezone = :zone`. (called from <top (required)> at /Users/iltongarcia/Projects/rails/rails_db/test/dummy/config/environment.rb:5)