Skip to content

Commit

Permalink
Separates verbose event logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bougyman committed Apr 11, 2024
1 parent d344723 commit dedf255
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions exe/namespacer
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ def rubocop_friendly?(path)
mime = magic.file(path.to_s)
return true if mime.include?('text/x-ruby')

warn "File #{path} is not a Ruby file (#{mime})"
warn "File #{path} is not a Ruby file (#{mime})" if Rubyists::Namespacer.cli_options.verbose
false
end

def log_namespace(namespace, write_path, opts)
def log_namespace(namespace, write_path)
opts = Rubyists::Namespacer.cli_options
return unless opts.verbose

msg = "Namespacing #{write_path} with #{namespace}"
Expand All @@ -126,7 +127,7 @@ def namespace_file(namespace, path)
opts = Rubyists::Namespacer.cli_options
namespaced = Rubyists::Namespacer.namespace!(path.read, namespace)
write_path = opts.in_place ? path : new_path(path)
log_namespace namespace, write_path, opts
log_namespace namespace, write_path
cmd = rubocop_cmd(write_path, namespaced)
warn "Writing namespaced file to #{write_path}" if opts.verbose
write_path.write(cmd.out)
Expand Down

0 comments on commit dedf255

Please sign in to comment.