Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merged changes from 3.2.x branch

--HG--
rename : lib/nanoc3.rb => lib/nanoc.rb
rename : lib/nanoc3/cli/commands/watch.rb => lib/nanoc/cli/commands/watch.rb
rename : lib/nanoc3/cli/error_handler.rb => lib/nanoc/cli/error_handler.rb
rename : lib/nanoc3/data_sources/filesystem.rb => lib/nanoc/data_sources/filesystem.rb
  • Loading branch information...
commit 14fe2766069524cc3b15e067775348c6df7b9a41 2 parents 7f1c917 + 4c8e71c
@ddfreyne ddfreyne authored
View
1  .hgtags
@@ -47,3 +47,4 @@ db1061f651e157cc1bdfe02984fe0b12476434fe 3.2.0a3
7e05f5bf45dab9f24400432d5833b76cfc2f435f 3.2.0b2
3d5b33ba8f6bfafb856216c53fb6fd39554449df 3.2.0b3
da779528fe751264fae35a400cf6d194922f8393 3.2.0
+fee69d61785b21e456962aa3e63230e041c668f9 3.2.1
View
1  .travis.yml
@@ -0,0 +1 @@
+script: "bundle exec rake skip=Nanoc3::Filters::LessTest"
View
4 Gemfile
@@ -8,7 +8,7 @@ gem 'coderay'
gem 'erubis'
gem 'haml'
gem 'kramdown'
-gem 'less'
+gem 'less', '~> 2.0'
gem 'markaby'
gem 'maruku'
gem 'mime-types'
@@ -21,7 +21,7 @@ gem 'rdoc'
gem 'redcarpet'
gem 'RedCloth'
gem 'rubypants'
-gem 'sass'
+gem 'sass', '~> 3.1'
gem 'slim'
gem 'systemu'
gem 'typogruby'
View
92 Gemfile.lock
@@ -1,92 +0,0 @@
-PATH
- remote: .
- specs:
- nanoc3 (3.2.0)
- cri (~> 2.0)
-
-GEM
- remote: http://rubygems.org/
- specs:
- RedCloth (4.2.7)
- bluecloth (2.1.0)
- builder (3.0.0)
- coderay (0.9.8)
- cri (2.0.2)
- erubis (2.7.0)
- execjs (1.2.0)
- multi_json (~> 1.0)
- haml (3.1.2)
- kramdown (0.13.3)
- less (2.0.5)
- therubyracer (~> 0.9.2)
- libv8 (3.3.10.2)
- markaby (0.7.1)
- builder (>= 2.0.0)
- maruku (0.6.0)
- syntax (>= 1.0.0)
- mime-types (1.16)
- minitest (2.3.1)
- mocha (0.9.12)
- multi_json (1.0.3)
- mustache (0.99.4)
- nokogiri (1.5.0)
- rack (1.3.1)
- rainpress (1.0)
- rake (0.9.2)
- rdiscount (1.6.8)
- rdoc (3.8)
- redcarpet (1.17.2)
- rubypants (0.2.0)
- sass (3.1.4)
- slim (0.9.4)
- temple (~> 0.3.0)
- tilt (~> 1.2)
- syntax (1.0.0)
- systemu (2.2.0)
- temple (0.3.2)
- therubyracer (0.9.2)
- libv8 (~> 3.3.10)
- tilt (1.3.2)
- typogruby (1.0.12)
- rubypants
- uglifier (1.0.0)
- execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
- w3c_validators (1.1.1)
- nokogiri
- yard (0.7.2)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- RedCloth
- bluecloth
- builder
- coderay
- erubis
- haml
- kramdown
- less
- markaby
- maruku
- mime-types
- minitest
- mocha
- mustache
- nanoc3!
- nokogiri
- rack
- rainpress
- rake
- rdiscount
- rdoc
- redcarpet
- rubypants
- sass
- slim
- systemu
- typogruby
- uglifier
- w3c_validators
- yard
View
5 NEWS.md
@@ -6,13 +6,14 @@
* Added support for deployment using Fog [Jack Chu]
* Dropped the “3” suffix on nanoc3/Nanoc3
-## 3.2.1 (???)
+## 3.2.1 (2011-07-27)
* Made `@config` available in rules file
-* Fixed `#readpartial` issue on JRuby
+* Fixed `#readpartial` issue on JRuby [Matt Keveney]
* Fixed possible `@cache` name clash in memoization module
* Fixed options with required arguments (such as `--port` and `--host`)
* Fixed broken `#check_availability`
+* Fixed error handling in watch command
## 3.2 (2011-07-24)
View
2  lib/nanoc.rb
@@ -3,7 +3,7 @@
module Nanoc
# The current nanoc version.
- VERSION = '3.2.0'
+ VERSION = '3.2.1'
end
View
2  lib/nanoc/cli/commands/watch.rb
@@ -62,7 +62,7 @@ def run
end
puts
- self.print_error(e)
+ Nanoc3::CLI::ErrorHandler.print_error(e)
puts
end
end
View
106 lib/nanoc/cli/error_handler.rb
@@ -3,6 +3,8 @@
module Nanoc::CLI
# Catches errors and prints nice diagnostic messages, then exits.
+ #
+ # @api private
class ErrorHandler
# @option params [Nanoc::CLI::Command, nil] command The command that is
@@ -45,6 +47,63 @@ def handle_while(&block)
exit(1)
end
+ # Prints the given error to stderr. Includes message, possible resolution
+ # (see {#resolution_for}), compilation stack, backtrace, etc.
+ #
+ # @param [Error] error The error that should be described
+ #
+ # @return [void]
+ def self.print_error(error)
+ self.new.print_error(error)
+ end
+
+ # Prints the given error to stderr. Includes message, possible resolution
+ # (see {#resolution_for}), compilation stack, backtrace, etc.
+ #
+ # @param [Error] error The error that should be described
+ #
+ # @return [void]
+ def print_error(error)
+ # Header
+ $stderr.puts
+ $stderr.puts "Captain! We’ve been hit!"
+
+ # Exception and resolution (if any)
+ $stderr.puts
+ $stderr.puts '=== MESSAGE:'
+ $stderr.puts
+ $stderr.puts "#{error.class}: #{error.message}"
+ resolution = self.resolution_for(error)
+ $stderr.puts "#{resolution}" if resolution
+
+ # Compilation stack
+ $stderr.puts
+ $stderr.puts '=== COMPILATION STACK:'
+ $stderr.puts
+ if self.stack.empty?
+ $stderr.puts " (empty)"
+ else
+ self.stack.reverse.each do |obj|
+ if obj.is_a?(Nanoc::ItemRep)
+ $stderr.puts " - [item] #{obj.item.identifier} (rep #{obj.name})"
+ else # layout
+ $stderr.puts " - [layout] #{obj.identifier}"
+ end
+ end
+ end
+
+ # Backtrace
+ $stderr.puts
+ $stderr.puts '=== BACKTRACE:'
+ $stderr.puts
+ $stderr.puts error.backtrace.to_enum(:each_with_index).map { |item, index| " #{index}. #{item}" }.join("\n")
+
+ # Issue link
+ $stderr.puts
+ $stderr.puts "If you believe this is a bug in nanoc, please do report it at"
+ $stderr.puts "<https://github.com/ddfreyne/nanoc/issues/new>--thanks!"
+ end
+
protected
# @return [Boolean] true if debug output is enabled, false if not
@@ -100,53 +159,6 @@ def stack
'w3c_validators' => 'w3c_validators'
}
- # Prints the given error to stderr. Includes message, possible resolution
- # (see {#resolution_for}), compilation stack, backtrace, etc.
- #
- # @param [Error] error The error that should be described
- #
- # @return [void]
- def print_error(error)
- # Header
- $stderr.puts
- $stderr.puts "Captain! We’ve been hit!"
-
- # Exception and resolution (if any)
- $stderr.puts
- $stderr.puts '=== MESSAGE:'
- $stderr.puts
- $stderr.puts "#{error.class}: #{error.message}"
- resolution = self.resolution_for(error)
- $stderr.puts "#{resolution}" if resolution
-
- # Compilation stack
- $stderr.puts
- $stderr.puts '=== COMPILATION STACK:'
- $stderr.puts
- if self.stack.empty?
- $stderr.puts " (empty)"
- else
- self.stack.reverse.each do |obj|
- if obj.is_a?(Nanoc::ItemRep)
- $stderr.puts " - [item] #{obj.item.identifier} (rep #{obj.name})"
- else # layout
- $stderr.puts " - [layout] #{obj.identifier}"
- end
- end
- end
-
- # Backtrace
- $stderr.puts
- $stderr.puts '=== BACKTRACE:'
- $stderr.puts
- $stderr.puts error.backtrace.to_enum(:each_with_index).map { |item, index| " #{index}. #{item}" }.join("\n")
-
- # Issue link
- $stderr.puts
- $stderr.puts "If you believe this is a bug in nanoc, please do report it at"
- $stderr.puts "<https://github.com/ddfreyne/nanoc/issues/new>--thanks!"
- end
-
# Attempts to find a resolution for the given error, or nil if no
# resolution can be automatically obtained.
#
View
2  lib/nanoc/data_sources/filesystem.rb
@@ -26,7 +26,7 @@ def down
# See {Nanoc::DataSource#setup}.
def setup
# Create directories
- %w( content layouts lib ).each do |dir|
+ %w( content layouts ).each do |dir|
FileUtils.mkdir_p(dir)
vcs.add(dir)
end
View
7 test/data_sources/test_filesystem.rb
@@ -15,11 +15,11 @@ def test_setup
# Remove files to make sure they are recreated
FileUtils.rm_rf('content')
FileUtils.rm_rf('layouts/default')
- FileUtils.rm_rf('lib/default.rb')
+ FileUtils.rm_rf('lib')
# Mock VCS
vcs = mock
- vcs.expects(:add).times(3) # One time for each directory
+ vcs.expects(:add).times(2) # One time for each directory
data_source.vcs = vcs
# Recreate files
@@ -28,12 +28,11 @@ def test_setup
# Ensure essential files have been recreated
assert(File.directory?('content/'))
assert(File.directory?('layouts/'))
- assert(File.directory?('lib/'))
# Ensure no non-essential files have been recreated
assert(!File.file?('content/index.html'))
assert(!File.file?('layouts/default.html'))
- assert(!File.file?('lib/default.rb'))
+ refute(File.directory?('lib/'))
end
def test_items
View
7 test/helper.rb
@@ -101,6 +101,13 @@ def with_site(params={})
end
def setup
+ # Check skipped
+ if ENV['skip']
+ if ENV['skip'].split(',').include?(self.class.to_s)
+ skip 'manually skipped'
+ end
+ end
+
# Clean up
GC.start
Please sign in to comment.
Something went wrong with that request. Please try again.