Class: Sqlui
- Inherits:
-
Object
- Object
- Sqlui
- Defined in:
- app/sqlui.rb
Overview
Main entry point.
Constant Summary collapse
- MAX_ROWS =
10_000- MAX_BYTES =
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.
11 12 13 14 15 16 17 18 19 20 |
# File 'app/sqlui.rb', line 11 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
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/sqlui.rb', line 26 def self.from_command_line(args) if args.include?('-v') || args.include?('--version') puts File.read('.version') 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 |
Instance Method Details
#run ⇒ Object
22 23 24 |
# File 'app/sqlui.rb', line 22 def run Server.init_and_run(@config, @resources_dir) end |