class IndexShotgun::CLI
Public Instance Methods
mysql()
click to toggle source
# File lib/index_shotgun/cli.rb, line 16 def mysql analyze("mysql2") end
oracle()
click to toggle source
# File lib/index_shotgun/cli.rb, line 29 def oracle analyze("oracle_enhanced", "activerecord-oracle_enhanced-adapter") end
postgresql()
click to toggle source
# File lib/index_shotgun/cli.rb, line 42 def postgresql analyze("postgresql", "pg") end
sqlite3()
click to toggle source
# File lib/index_shotgun/cli.rb, line 48 def sqlite3 analyze("sqlite3") end
version()
click to toggle source
# File lib/index_shotgun/cli.rb, line 53 def version puts IndexShotgun::VERSION end
Private Instance Methods
analyze(adapter_name, gem_name = nil)
click to toggle source
# File lib/index_shotgun/cli.rb, line 59 def analyze(adapter_name, gem_name = nil) gem_name ||= adapter_name begin require gem_name rescue LoadError puts "[ERROR] #{adapter_name} is not installed. Please run `gem install #{gem_name}` and install gem" exit! end config = options.reverse_merge(adapter: adapter_name) ask_password = config.delete("ask_password") config[:password] = ask("Input password (hidden):", echo: false) if ask_password ActiveRecord::Base.establish_connection(config) response = IndexShotgun::Analyzer.perform puts response.message response.exit_if_failure! end