lib/arql/app.rb in arql-0.4.3 vs lib/arql/app.rb in arql-0.4.6
- old
+ new
@@ -23,9 +23,39 @@
end
def config
instance.config
end
+
+ def create(options)
+ options = {
+ config_file: default_config_file,
+ initializer: default_initializer,
+ babel_compatable: false,
+ ssh: {}
+ }.merge(options)
+ options = OpenStruct.new(options)
+ app = App.new(options)
+ app.instance_exec do
+ show_sql if should_show_sql?
+ write_sql if should_write_sql?
+ append_sql if should_append_sql?
+ end
+ require 'arql/commands'
+ nil
+ end
+
+ def default_config_file
+ ['~/.arql.yml', '~/.arql.yaml', '~/.arql.d/init.yml', '~/.arql.d/init.yaml'].find { |f|
+ File.file?(File.expand_path(f))
+ }.try { |f| File.expand_path(f) }
+ end
+
+ def default_initializer
+ ['~/.arql.rb', '~/.arql.d/init.rb',].find { |f|
+ File.file?(File.expand_path(f))
+ }.try { |f| File.expand_path(f) }
+ end
end
def prompt
if environments.present?
environments.join('+')