Skip to content

Commit

Permalink
Write status information to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Oct 22, 2016
1 parent 700e575 commit 0ebe85d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/nanoc/cli/command_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def in_site_dir?
#
# @return [void]
def load_site(preprocess: false)
print 'Loading site… '
$stdout.flush
$stderr.print 'Loading site… '
$stderr.flush

if site.nil?
raise ::Nanoc::Int::Errors::GenericTrivial, 'The current working directory does not seem to be a Nanoc site.'
Expand All @@ -56,7 +56,7 @@ def load_site(preprocess: false)
site.compiler.action_provider.preprocess(site)
end

puts 'done'
$stderr.puts 'done'
end

# @return [Boolean] true if debug output is enabled, false if not
Expand Down
6 changes: 5 additions & 1 deletion spec/nanoc/cli/commands/show_rules_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@
end
end

let(:expected_err) do
"Loading site… done\n"
end

let(:expected_out) do
<<-EOS
Loading site… done
\e[1m\e[33mItem /about.md\e[0m:
Rep default: /*.md
Rep text: /**/*
Expand All @@ -100,6 +103,7 @@

it 'outputs item and layout rules' do
expect { subject }.to output(expected_out).to_stdout
expect { subject }.to output(expected_err).to_stderr
end
end
end

0 comments on commit 0ebe85d

Please sign in to comment.