module GreenHat::ShellHelper::Faststats

Hide from Commands

Public Class Methods

files() click to toggle source
# File lib/greenhat/shell/faststats.rb, line 198
def self.files
  %w[
    production_json
    api_json
    gitaly/current
    sidekiq/current
  ]
end
invalid_settings() click to toggle source

Default Settings from arg parse that won't work

# File lib/greenhat/shell/faststats.rb, line 170
def self.invalid_settings
  %i[page round truncate logic fuzzy_file_match]
end
parse(raw) click to toggle source
# File lib/greenhat/shell/faststats.rb, line 174
def self.parse(raw)
  file_list, flags, args = Args.parse(raw, invalid_settings)
  cmd = args.map { |opt| "--#{opt.field}=#{opt.value}" }.join(' ')
  cmd += flags.map do |flag, value|
    # Don't Include Raw
    next if flag == :raw

    case value
    when true then "--#{flag}"
    when Array then "--#{flag}=#{value.join}"
    else
      "--#{flag}=#{value}"
    end
  end.join(' ')

  # Prepare Log List
  file_list = ShellHelper.prepare_list(file_list, ShellHelper::Faststats.things, flags)

  # Convert to Things
  files = ShellHelper.find_things(file_list)

  [files, flags, cmd]
end
things() click to toggle source
# File lib/greenhat/shell/faststats.rb, line 207
def self.things
  Thing.all.select do |thing|
    files.any? { |x| thing.name.include? x }
  end
end