dbviewer 0.4.4 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b726fcc60badaa82692f22151b9656152810ecaa9a5c59e39e0a27e0c595add5
4
- data.tar.gz: a88f8817f599d276ad814bce26fa2314bd79c7c4a5979123aa524457c7c0d534
3
+ metadata.gz: a9caec4627e8912e40d85d63c9105cdc80b2bae4227e145372693855a40fbc29
4
+ data.tar.gz: ca759885a1ec9522860d9926e1814f68457fa453832f7b3ea3298aa5c86222eb
5
5
  SHA512:
6
- metadata.gz: c0a0cfc7172bf1ea0e3146bfeb3cb739e247a8412c0fd204828fdb0e2a4f261fdbd75ef070da765c1a6cde0d1ae0bd60b842346c71512a547c9d05dd592930ae
7
- data.tar.gz: 5304c49470fe85760bf0e6aef851cb3c199963be104518c46dad24dac6e22eaae597802786c339b9a779a810a8c849f9c1b558f73672abbb7f432429bbd9c519
6
+ metadata.gz: d71176e418170a1d82439a1266687d6f125c27dd96dcf008fb05ccecc169d11dafb52f1c5940549e030f3487fe8c2408f73dda51e7ddae8e05b598cde621943f
7
+ data.tar.gz: cebdde38e2e4500a265b20b86d1e6daee3ed7ba95447b348635efb00e963f7d895b8f147ab94b2b8c50656940c74279ebfbd17a90ff3921341cec2a0121b84cd
data/README.md CHANGED
@@ -169,7 +169,13 @@ end
169
169
 
170
170
  ## ⚙️ Configuration Options
171
171
 
172
- You can configure DBViewer by creating an initializer in your application:
172
+ You can configure DBViewer by using our generator to create an initializer in your application:
173
+
174
+ ```bash
175
+ rails generate dbviewer:initializer
176
+ ```
177
+
178
+ This will create a file at `config/initializers/dbviewer.rb` with the default configuration:
173
179
 
174
180
  ```ruby
175
181
  # config/initializers/dbviewer.rb
@@ -183,16 +189,18 @@ Dbviewer.configure do |config|
183
189
  config.query_timeout = 30 # SQL query timeout in seconds
184
190
 
185
191
  # Query logging options
186
- config.enable_query_logging = true # Enable or disable query logging completely (default: true)
192
+ config.enable_query_logging = false # Enable or disable query logging completely (default: true)
187
193
  config.query_logging_mode = :memory # Storage mode for SQL queries (:memory or :file)
188
194
  config.query_log_path = "log/dbviewer.log" # Path for query log file when in :file mode
189
195
  config.max_memory_queries = 1000 # Maximum number of queries to store in memory
190
196
 
191
197
  # Authentication options
192
- config.admin_credentials = { username: "admin", password: "your_secure_password" } # Basic HTTP auth credentials
198
+ # config.admin_credentials = { username: "admin", password: "your_secure_password" } # Basic HTTP auth credentials
193
199
  end
194
200
  ```
195
201
 
202
+ You can also create this file manually if you prefer.
203
+
196
204
  The configuration is accessed through `Dbviewer.configuration` throughout the codebase. You can also access it via `Dbviewer.config` which is an alias for backward compatibility.
197
205
 
198
206
  ## 🪵 Query Logging
@@ -302,13 +310,13 @@ The simplest way to update is using Bundler:
302
310
 
303
311
  - Update your Gemfile with the desired version:
304
312
 
305
- ```ruby
306
- # For the latest version
307
- gem "dbviewer", group: :development
308
-
309
- # Or specify a version
310
- gem "dbviewer", "~> 0.3.2", group: :development
311
- ```
313
+ ```ruby
314
+ # For the latest version
315
+ gem "dbviewer", group: :development
316
+
317
+ # Or specify a version
318
+ gem "dbviewer", "~> 0.3.2", group: :development
319
+ ```
312
320
 
313
321
  - Run bundle update:
314
322
 
@@ -6,6 +6,11 @@ module Dbviewer
6
6
  config.autoload_paths << File.expand_path("../../", __FILE__)
7
7
  config.eager_load_paths << File.expand_path("../../", __FILE__)
8
8
 
9
+ # Register generators
10
+ config.app_generators do |g|
11
+ g.templates.unshift File.expand_path("../../generators/dbviewer/templates", __dir__)
12
+ end
13
+
9
14
  # Initialize the engine safely
10
15
  initializer "dbviewer.setup", after: :load_config_initializers do |app|
11
16
  Dbviewer.init
@@ -1,3 +1,3 @@
1
1
  module Dbviewer
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.6"
3
3
  end
@@ -0,0 +1,12 @@
1
+ module Dbviewer
2
+ module Generators
3
+ class InitializerGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+ desc "Creates a DBViewer initializer file at config/initializers/dbviewer.rb"
6
+
7
+ def copy_initializer_file
8
+ copy_file "initializer.rb", "config/initializers/dbviewer.rb"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ Dbviewer.configure do |config|
2
+ config.per_page_options = [ 10, 20, 50, 100, 250 ]
3
+ config.default_per_page = 20
4
+ config.max_query_length = 10000
5
+ config.cache_expiry = 300
6
+ config.max_records = 10000
7
+ config.enable_data_export = false
8
+ config.query_timeout = 30
9
+
10
+ # Query logging options
11
+ config.enable_query_logging = false
12
+ config.query_logging_mode = :memory
13
+ config.query_log_path = "log/dbviewer.log"
14
+ config.max_memory_queries = 1000
15
+
16
+ # Authentication options
17
+ # config.admin_credentials = { username: "admin", password: "your_secure_password" } # Basic HTTP auth credentials
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbviewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wailan Tirajoh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-24 00:00:00.000000000 Z
11
+ date: 2025-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -95,6 +95,8 @@ files:
95
95
  - lib/dbviewer/table_query_operations.rb
96
96
  - lib/dbviewer/table_query_params.rb
97
97
  - lib/dbviewer/version.rb
98
+ - lib/generators/dbviewer/initializer_generator.rb
99
+ - lib/generators/dbviewer/templates/initializer.rb
98
100
  - lib/tasks/dbviewer_tasks.rake
99
101
  homepage: https://github.com/wailantirajoh/dbviewer
100
102
  licenses: