Skip to content

Commit

Permalink
Simplify logger.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Dec 7, 2016
1 parent 0b0c962 commit 3362e02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/build/logger.rb
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions lib/build/task.rb
Expand Up @@ -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
Expand All @@ -80,29 +80,29 @@ 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

def mkpath(path)
return unless wet?

unless File.exist?(path)
@logger.info('shell'){ ['mkpath', path] }
@logger.info(:shell){ ['mkpath', path] }

FileUtils.mkpath(path)
end
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/build/version.rb
Expand Up @@ -19,5 +19,5 @@
# THE SOFTWARE.

module Build
VERSION = "1.0.9"
VERSION = "1.0.10"
end

0 comments on commit 3362e02

Please sign in to comment.