Module: Logi::Command
- Included in:
- List, Post
- Defined in:
- lib/logi/command.rb,
lib/logi/command/list.rb,
lib/logi/command/post.rb,
lib/logi/command/wiki.rb
Defined Under Namespace
Modules: List, Post, Wiki
Class Method Summary
collapse
Class Method Details
.check_argv(path, layout) ⇒ Object
5
6
7
|
# File 'lib/logi/command.rb', line 5
def check_argv path, layout
[check_path(path), check_path(layout)]
end
|
.check_layout(layout) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/logi/command.rb', line 20
def check_layout layout
if File.exist?(layout)
layout
else
require 'logi/default'
require 'logi/logger'
extend Logi::Logger
log red("WARN: Layout does not exist: #{cyan(strip_path(layout))}")
Logi::Default.empty_layout
end
end
|
.check_path(path) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/logi/command.rb', line 9
def check_path path
if File.exist?(path)
path
else
require 'logi/logger'
extend Logi::Logger
log red("ERROR: Post does not exist: #{cyan(strip_path(path))}")
exit(1)
end
end
|
.options ⇒ Object
32
33
34
35
|
# File 'lib/logi/command.rb', line 32
def options
@options ||= {:quiet => tribool(ENV['LOGI_QUIET' ]),
:nocolor => tribool(ENV['LOGI_NOCOLOR'])}
end
|
.tribool(value) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/logi/command.rb', line 37
def tribool value
case value
when 'true'
true
when 'false'
false
else
nil
end
end
|