class IndexShotgun::CLI
Public Instance Methods
Source
# File lib/index_shotgun/cli.rb, line 29 def oracle analyze("oracle_enhanced", "activerecord-oracle_enhanced-adapter") end
Source
# File lib/index_shotgun/cli.rb, line 42 def postgresql analyze("postgresql", "pg") end
Source
# File lib/index_shotgun/cli.rb, line 53 def version puts IndexShotgun::VERSION end
Private Instance Methods
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