blob: 9c1ea2ba47ad77d6103b7ab161e63bec7df333c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
class Converter
class Logger
include Term::ANSIColor
def initialize(env)
@env = env
puts bold "Convert Bootstrap LESS to SASS"
puts " repo : #{env[:repo]}"
puts " branch : #{env[:branch]} #{dark "#{env[:repo]}/tree/#{env[:branch_sha]}"}"
puts " save to: #{@env[:save_at].to_json}"
puts " twbs cache: #{@env[:cache_path]}"
puts dark "-" * 60
end
def log_status(status)
puts bold status
end
def log_file_info(s)
puts " #{magenta s}"
end
def log_transform(*args, from: caller[1][/`.*'/][1..-2].sub(/^block in /, ''))
puts " #{cyan from}#{cyan ": #{args * ', '}" unless args.empty?}"
end
def log_processing(name)
puts yellow " #{File.basename(name)}"
end
def log_processed(name)
puts green " #{name}"
end
def log_http_get_file(url, cached = false)
s = " #{'CACHED ' if cached}GET #{url}..."
if cached
puts dark green s
else
puts dark cyan s
end
end
def log_http_get_files(files, from, cached = false)
s = " #{'CACHED ' if cached}GET #{files.length} files from #{from} #{files * ' '}..."
if cached
puts dark green s
else
puts dark cyan s
end
end
def puts(*args)
STDOUT.puts *args unless @silence
end
def silence_log
@silence = true
yield
ensure
@silence = false
end
end
end
|