Skip to content

Commit

Permalink
Use stderr or stdout instead of puts (#455)
Browse files Browse the repository at this point in the history
* use  or  instead of puts

* use stderr or stdout instead of puts
  • Loading branch information
ytbryan authored and gauravtiwari committed Jun 1, 2017
1 parent fcac1a1 commit f35331c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions lib/tasks/webpacker/check_node.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ namespace :webpacker do

raise Errno::ENOENT if node_version.blank?
if Gem::Version.new(node_version.strip.tr("v", "")) < Gem::Version.new(required_node_version)
puts "Webpacker requires Node.js >= v#{required_node_version} and you are using #{node_version}"
puts "Please upgrade Node.js https://nodejs.org/en/download/"
puts "Exiting!" && exit!
$stderr.puts "Webpacker requires Node.js >= v#{required_node_version} and you are using #{node_version}"
$stderr.puts "Please upgrade Node.js https://nodejs.org/en/download/"
$stderr.puts "Exiting!" && exit!
end
rescue Errno::ENOENT
puts "Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/"
puts "Exiting!" && exit!
$stderr.puts "Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/"
$stderr.puts "Exiting!" && exit!
end
end
end
4 changes: 2 additions & 2 deletions lib/tasks/webpacker/check_yarn.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace :webpacker do

raise Errno::ENOENT if yarn_version.blank? || Gem::Version.new(yarn_version) < Gem::Version.new(required_yarn_version)
rescue Errno::ENOENT
puts "Webpacker requires Yarn version >= #{required_yarn_version}. Please download and install the latest version from https://yarnpkg.com/lang/en/docs/install/"
puts "Exiting!" && exit!
$stderr.puts "Webpacker requires Yarn version >= #{required_yarn_version}. Please download and install the latest version from https://yarnpkg.com/lang/en/docs/install/"
$stderr.puts "Exiting!" && exit!
end
end
end
2 changes: 1 addition & 1 deletion lib/tasks/webpacker/clobber.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace :webpacker do
task clobber: ["webpacker:verify_install", :environment] do
output_path = Webpacker::Configuration.output_path
FileUtils.rm_r(output_path) if File.exist?(output_path)
puts "Removed webpack output path directory #{output_path}"
$stdout.puts "Removed webpack output path directory #{output_path}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/webpacker/compile.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "webpacker/configuration"
namespace :webpacker do
desc "Compile javascript packs using webpack for production with digests"
task compile: ["webpacker:verify_install", :environment] do
puts "[Webpacker] Compiling assets 🎉"
$stdout.puts "[Webpacker] Compiling assets 🎉"

asset_host = ActionController::Base.helpers.compute_asset_host
env = { "NODE_ENV" => Webpacker.env, "ASSET_HOST" => asset_host }.freeze
Expand Down
6 changes: 3 additions & 3 deletions lib/tasks/webpacker/verify_install.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace :webpacker do
desc "Verifies if webpacker is installed"
task verify_install: [:check_node, :check_yarn, :check_webpack_binstubs] do
if File.exist?(Webpacker::Configuration.file_path)
puts "Webpacker is installed 🎉 🍰"
puts "Using #{Webpacker::Configuration.file_path} file for setting up webpack paths"
$stdout.puts "Webpacker is installed 🎉 🍰"
$stdout.puts "Using #{Webpacker::Configuration.file_path} file for setting up webpack paths"
else
puts "Configuration config/webpacker.yml file not found. \n"\
$stderr.puts "Configuration config/webpacker.yml file not found. \n"\
"Make sure webpacker:install is run successfully before " \
"running dependent tasks"
exit!
Expand Down

0 comments on commit f35331c

Please sign in to comment.