Sha256: 93447be921ffa0f94834ca43969a5826b34c3ea2252c1150bd0ec642dc337981
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module IndexChecker module TaskDefinition class Base class << self def postgres_connection dbname = IndexChecker.dbname user = IndexChecker.user password = IndexChecker.password puts "You are connecting to #{dbname} database as #{user} role" begin PG.connect(dbname: dbname, user: user, password: password) rescue Exception => e puts e end end def write_results_to_file template = File.read(result_template_path) html_result = ERB.new(template).result(binding) File.write(result_file_path, html_result) end def open_file_in_browser(path) Launchy.open(path) end def result_template_path "#{gem_root_path}lib/report_template.html.erb" end def result_file_path "#{Rails.root}/index_checker/general_report.html" end def gem_root_path __FILE__.gsub('lib/index_checker/task_definition/base.rb', '') end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
index_checker-1.0.17 | lib/index_checker/task_definition/base.rb |
index_checker-1.0.16 | lib/index_checker/task_definition/base.rb |