Class: Sqlui
- Inherits:
-
Object
- Object
- Sqlui
- Defined in:
- app/sqlui.rb
Overview
Main entry point.
Constant Summary collapse
- MAX_ROWS =
1_000
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.
10 11 12 13 14 15 16 17 18 19 |
# File 'app/sqlui.rb', line 10 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
25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/sqlui.rb', line 25 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
21 22 23 |
# File 'app/sqlui.rb', line 21 def run Server.init_and_run(@config, @resources_dir) end |