class Attractor::CLI
contains methods implementing the CLI
Public Instance Methods
calc()
click to toggle source
# File lib/attractor/cli.rb, line 48 def calc file_prefix = options[:file_prefix] report! Attractor::ConsoleReporter.new(file_prefix: file_prefix, ignores: options[:ignore], calculators: calculators(options)) rescue RuntimeError => e puts "Runtime error: #{e.message}" end
clean()
click to toggle source
# File lib/attractor/cli.rb, line 30 def clean puts "Clearing attractor cache" Attractor.clear end
init()
click to toggle source
# File lib/attractor/cli.rb, line 39 def init puts "Warming attractor cache" Attractor.init(calculators(options)) end
report()
click to toggle source
# File lib/attractor/cli.rb, line 60 def report file_prefix = options[:file_prefix] open_browser = !(options[:no_open_browser] || options[:ci]) report! Attractor::HtmlReporter.new(file_prefix: file_prefix, ignores: options[:ignore], calculators: calculators(options), open_browser: open_browser) rescue RuntimeError => e puts "Runtime error: #{e.message}" end
serve()
click to toggle source
# File lib/attractor/cli.rb, line 73 def serve file_prefix = options[:file_prefix] open_browser = !(options[:no_open_browser] || options[:ci]) report! Attractor::SinatraReporter.new(file_prefix: file_prefix, ignores: options[:ignore], calculators: calculators(options), open_browser: open_browser) end
version()
click to toggle source
# File lib/attractor/cli.rb, line 23 def version puts "Attractor version #{Attractor::VERSION}" rescue RuntimeError => e puts "Runtime error: #{e.message}" end
Private Instance Methods
calculators(options)
click to toggle source
# File lib/attractor/cli.rb, line 82 def calculators(options) Attractor.calculators_for_type(options[:type], file_prefix: options[:file_prefix], minimum_churn_count: options[:minimum_churn], ignores: options[:ignore], start_ago: options[:start_ago]) end
report!(reporter)
click to toggle source
# File lib/attractor/cli.rb, line 90 def report!(reporter) if options[:watch] puts "Listening for file changes..." reporter.watch else reporter.report end end