Class: Sqlui
- Inherits:
-
Object
- Object
- Sqlui
- Defined in:
- app/sqlui.rb
Overview
Main entry point.
Constant Summary collapse
- MAX_ROWS =
100_000
- MAX_BYTES =
10 MB
10 * 1_024 * 1_024
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config_file) ⇒ Sqlui
constructor
A new instance of Sqlui.
- #run ⇒ Object
Constructor Details
#initialize(config_file) ⇒ Sqlui
Returns a new instance of Sqlui.
19 20 21 22 23 24 25 26 27 28 |
# File 'app/sqlui.rb', line 19 def initialize(config_file) raise 'you must specify a configuration file' unless config_file raise 'configuration file does not exist' unless File.exist?(config_file) @config = SqluiConfig.new(config_file) @resources_dir = File.join(File.('..', File.dirname(__FILE__)), 'client', 'resources') # Connect to each database to verify each can be connected to. @config.database_configs.each { |database| database.with_client { |client| client } } end |
Class Method Details
.from_command_line(args) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/sqlui.rb', line 34 def self.from_command_line(args) if args.include?('-v') || args.include?('--version') puts Version::SQLUI exit end raise 'you must specify a configuration file' unless args.size == 1 raise 'configuration file does not exist' unless File.exist?(args[0]) Sqlui.new(args[0]) end |
.logger ⇒ Object
15 16 17 |
# File 'app/sqlui.rb', line 15 def self.logger @logger ||= WEBrick::Log.new end |
Instance Method Details
#run ⇒ Object
30 31 32 |
# File 'app/sqlui.rb', line 30 def run Server.init_and_run(@config, @resources_dir) end |