From 3362e028836937f65ea07f035b3c3162f08dbeed Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 7 Dec 2016 15:54:40 +1300 Subject: [PATCH] Simplify logger. --- lib/build/logger.rb | 2 +- lib/build/task.rb | 16 ++++++++-------- lib/build/version.rb | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/build/logger.rb b/lib/build/logger.rb index a0bea69..29576c6 100644 --- a/lib/build/logger.rb +++ b/lib/build/logger.rb @@ -88,7 +88,7 @@ def call(severity, datetime, progname, message) prefix = " " * (prefix.size) + "| " end - if progname == 'shell' and message.kind_of? Array + if progname == :shell and message.kind_of? Array format_command(message, buffer) elsif message.kind_of? Exception format_exception(message, buffer) diff --git a/lib/build/task.rb b/lib/build/task.rb index ab0219f..935b975 100644 --- a/lib/build/task.rb +++ b/lib/build/task.rb @@ -60,7 +60,7 @@ def wet? def spawn(*arguments) if wet? - @logger.info('shell') {arguments} + @logger.info(:shell) {arguments} status = @group.spawn(*arguments) if status != 0 @@ -80,21 +80,21 @@ def run!(*arguments) def touch(path) return unless wet? - @logger.info('shell'){ ['touch', path] } + @logger.info(:shell){ ['touch', path] } FileUtils.touch(path) end def cp(source_path, destination_path) return unless wet? - @logger.info('shell'){ ['cp', source_path, destination_path]} + @logger.info(:shell){ ['cp', source_path, destination_path]} FileUtils.copy(source_path, destination_path) end def rm(path) return unless wet? - @logger.info('shell'){ ['rm -rf', path] } + @logger.info(:shell){ ['rm -rf', path] } FileUtils.rm_rf(path) end @@ -102,7 +102,7 @@ def mkpath(path) return unless wet? unless File.exist?(path) - @logger.info('shell'){ ['mkpath', path] } + @logger.info(:shell){ ['mkpath', path] } FileUtils.mkpath(path) end @@ -111,7 +111,7 @@ def mkpath(path) def install(source_path, destination_path) return unless wet? - @logger.info('shell'){ ['install', source_path, destination_path]} + @logger.info(:shell){ ['install', source_path, destination_path]} FileUtils.install(source_path, destination_path) end @@ -127,12 +127,12 @@ def update def invoke_rule(rule, arguments, &block) arguments = rule.normalize(arguments, self) - @logger.debug('invoke') {"-> #{rule}(#{arguments.inspect})"} + @logger.debug(:invoke) {"-> #{rule}(#{arguments.inspect})"} node = RuleNode.new(rule, arguments, &block) task = invoke(node) - @logger.debug('invoke') {"<- #{rule}(...) -> #{rule.result(arguments)}"} + @logger.debug(:invoke) {"<- #{rule}(...) -> #{rule.result(arguments)}"} return rule.result(arguments) end diff --git a/lib/build/version.rb b/lib/build/version.rb index 59ef50a..204a96c 100644 --- a/lib/build/version.rb +++ b/lib/build/version.rb @@ -19,5 +19,5 @@ # THE SOFTWARE. module Build - VERSION = "1.0.9" + VERSION = "1.0.10" end