Top Level Namespace
Defined Under Namespace
Modules: Mothra
Classes: CLI
Instance Method Summary
collapse
Instance Method Details
#base64(file_path) ⇒ Object
29
30
31
|
# File 'lib/mothra/cli.rb', line 29
def base64(file_path)
Base64.encode64(IO.read(file_path))
end
|
#check_config ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# 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) ⇒ Object
13
14
15
16
17
18
19
|
# 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) ⇒ Object
25
26
27
|
# File 'lib/mothra/cli.rb', line 25
def get_file_name(file_path)
Pathname.new(file_path).basename
end
|
#is_numeric?(obj) ⇒ Boolean
21
22
23
|
# File 'lib/mothra/cli.rb', line 21
def is_numeric?(obj)
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
end
|