class Object

Public Instance Methods

base64(file_path) click to toggle source
# File lib/mothra/cli.rb, line 29
def base64(file_path)
  Base64.encode64(IO.read(file_path))
end
check_config() click to toggle source
# File lib/mothra/cli.rb, line 33
def check_config
  config_file = "#{Dir.home}/.mothra.yml"

  if not File.exist?(config_file)
    puts 'You should set ~/.mothra.yml first! Just: '.yellow 
    puts '`curl https://raw.githubusercontent.com/pct/mothra/master/.mothra.yml > ~/.mothra.yml`'.cyan 

    exit
  end
end
clean_bz_url(url) click to toggle source
# File lib/mothra/cli.rb, line 13
def clean_bz_url(url)
  if url.end_with? '/'
    url = url[0..-2]
  end

  url
end
get_file_name(file_path) click to toggle source
# File lib/mothra/cli.rb, line 25
def get_file_name(file_path)
  Pathname.new(file_path).basename
end
is_numeric?(obj) click to toggle source
# File lib/mothra/cli.rb, line 21
def is_numeric?(obj) 
  obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
end