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 +4 -4
 - data/README.md +18 -10
 - data/lib/dbviewer/engine.rb +5 -0
 - data/lib/dbviewer/version.rb +1 -1
 - data/lib/generators/dbviewer/initializer_generator.rb +12 -0
 - data/lib/generators/dbviewer/templates/initializer.rb +18 -0
 - metadata +4 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a9caec4627e8912e40d85d63c9105cdc80b2bae4227e145372693855a40fbc29
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ca759885a1ec9522860d9926e1814f68457fa453832f7b3ea3298aa5c86222eb
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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  
     | 
| 
      
 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 =  
     | 
| 
      
 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 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         | 
    
        data/lib/dbviewer/engine.rb
    CHANGED
    
    | 
         @@ -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
         
     | 
    
        data/lib/dbviewer/version.rb
    CHANGED
    
    
| 
         @@ -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 
     | 
    
         
            +
              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- 
     | 
| 
      
 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:
         
     |