Class: Vdb::Installer
- Inherits:
-
Object
- Object
- Vdb::Installer
- Defined in:
- lib/vdb/installer.rb
Overview
Handles the ‘rails vdb:install` setup steps. Keeps rake task logic out of the .rake file so it is testable.
Constant Summary collapse
- MOUNT_SNIPPET =
<<~RUBY.freeze \n # vdb — interactive database ERD (development only) mount Vdb::Engine, at: '/dev/erd' if Rails.env.development? RUBY
- INITIALIZER_CONTENT =
<<~RUBY.freeze # frozen_string_literal: true # vdb — interactive database ERD visualiser # Mount point is configured in config/routes.rb. # Remove this file and the mount if you no longer need the ERD. # # Docs: https://github.com/pniemczyk/vdb return unless Rails.env.development? Vdb.configure do |c| # HTTP Basic Auth — leave username nil to disable. # c.username = ENV.fetch('VDB_USER', nil) # c.password = ENV.fetch('VDB_PASS', nil) # Additional schema files to show as tabs (label => path). # nil resolves automatically to db/schema.rb. c.databases = { 'primary' => nil # 'audit' => Rails.root.join('db', 'audit_schema.rb') } # Title shown in the browser tab and page header. # c.title = 'Database ERD' end RUBY
Instance Method Summary collapse
-
#initialize(app_root) ⇒ Installer
constructor
A new instance of Installer.
- #run ⇒ Object
Constructor Details
#initialize(app_root) ⇒ Installer
Returns a new instance of Installer.
39 40 41 |
# File 'lib/vdb/installer.rb', line 39 def initialize(app_root) @root = Pathname.new(app_root) end |
Instance Method Details
#run ⇒ Object
43 44 45 46 47 |
# File 'lib/vdb/installer.rb', line 43 def run mount_engine create_initializer print_summary end |