diff --git a/lib/jsduck/js_parser.rb b/lib/jsduck/js_parser.rb index 36e705ae9f5c3a0130c0fef86367c946848952f0..25bf26b1b81df7ba4fb2a5067eca05227b1ea812 100644 --- a/lib/jsduck/js_parser.rb +++ b/lib/jsduck/js_parser.rb @@ -155,7 +155,7 @@ module JsDuck properties = NODE_TYPES[node["type"]] unless properties - puts "Unknown node type: "+node["type"] + $stderr.puts "Unknown node type: "+node["type"] exit(1) end diff --git a/lib/jsduck/json_duck.rb b/lib/jsduck/json_duck.rb index d7d15bf17e92578bb45a80485ec249b14908a590..3809a494d354afd51dcfdc9e5c4d4cde0f67d77a 100644 --- a/lib/jsduck/json_duck.rb +++ b/lib/jsduck/json_duck.rb @@ -37,7 +37,7 @@ module JsDuck begin self.parse(JsDuck::IO.read(filename)) rescue - puts "Oh noes! #{filename} is not a valid JSON file." + $stderr.puts "Oh noes! #{filename} is not a valid JSON file." exit(1) end end diff --git a/lib/jsduck/logger.rb b/lib/jsduck/logger.rb index 241fba8d7b38919b3db0dbd3688191213fab6eaf..71fdb719dfa28ac53d025b2a9c40dbcac0677a69 100644 --- a/lib/jsduck/logger.rb +++ b/lib/jsduck/logger.rb @@ -57,7 +57,7 @@ module JsDuck # Prints log message with optional filename appended def log(msg, filename=nil) if @verbose - puts paint(:green, msg) + " " + format(filename) + " ..." + $stderr.puts paint(:green, msg) + " " + format(filename) + " ..." end end @@ -121,10 +121,10 @@ module JsDuck # Prints fatal error message with backtrace. # The error param should be $! from resque block. def fatal(msg, error) - puts "#{paint(:red, msg)}: #{error}" - puts - puts "Here's a full backtrace:" - puts error.backtrace + $stderr.puts "#{paint(:red, msg)}: #{error}" + $stderr.puts + $stderr.puts "Here's a full backtrace:" + $stderr.puts error.backtrace end private diff --git a/lib/jsduck/options.rb b/lib/jsduck/options.rb index 79126454adf9b55199afe582f848c6d60043e41b..de5b90a59569cef083c466f8bb163d73810c0bd8 100644 --- a/lib/jsduck/options.rb +++ b/lib/jsduck/options.rb @@ -397,7 +397,7 @@ module JsDuck if File.exists?(path) config = read_json_config(path) else - puts "Oh noes! The config file #{path} doesn't exist." + $stderr.puts "Oh noes! The config file #{path} doesn't exist." exit(1) end # treat paths inside JSON config relative to the location of @@ -520,35 +520,35 @@ module JsDuck # Runs checks on the options def validate if @input_files.length == 0 && !@welcome && !@guides && !@videos && !@examples - puts "You should specify some input files, otherwise there's nothing I can do :(" + $stderr.puts "You should specify some input files, otherwise there's nothing I can do :(" exit(1) elsif @output_dir == :stdout && !@export - puts "Output to STDOUT only works when using --export option." + $stderr.puts "Output to STDOUT only works when using --export option." exit(1) elsif ![nil, :full, :api, :examples].include?(@export) - puts "Unknown export format: #{@export}" + $stderr.puts "Unknown export format: #{@export}" exit(1) elsif @output_dir != :stdout if !@output_dir - puts "You should also specify an output directory, where I could write all this amazing documentation." + $stderr.puts "You should also specify an output directory, where I could write all this amazing documentation." exit(1) elsif File.exists?(@output_dir) && !File.directory?(@output_dir) - puts "Oh noes! The output directory is not really a directory at all :(" + $stderr.puts "Oh noes! The output directory is not really a directory at all :(" exit(1) elsif !File.exists?(File.dirname(@output_dir)) - puts "Oh noes! The parent directory for #{@output_dir} doesn't exist." + $stderr.puts "Oh noes! The parent directory for #{@output_dir} doesn't exist." exit(1) elsif !@export && !File.exists?(@template_dir + "/extjs") - puts "Oh noes! The template directory does not contain extjs/ directory :(" - puts "Please copy ExtJS over to template/extjs or create symlink." - puts "For example:" - puts " $ cp -r /path/to/ext-4.0.0 " + @template_dir + "/extjs" + $stderr.puts "Oh noes! The template directory does not contain extjs/ directory :(" + $stderr.puts "Please copy ExtJS over to template/extjs or create symlink." + $stderr.puts "For example:" + $stderr.puts " $ cp -r /path/to/ext-4.0.0 " + @template_dir + "/extjs" exit(1) elsif !@export && !File.exists?(@template_dir + "/resources/css") - puts "Oh noes! CSS files for custom ExtJS theme missing :(" - puts "Please compile SASS files in template/resources/sass with compass." - puts "For example:" - puts " $ compass compile " + @template_dir + "/resources/sass" + $stderr.puts "Oh noes! CSS files for custom ExtJS theme missing :(" + $stderr.puts "Please compile SASS files in template/resources/sass with compass." + $stderr.puts "For example:" + $stderr.puts " $ compass compile " + @template_dir + "/resources/sass" exit(1) end end