nanoc3 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +29 -0
- data/Gemfile.lock +92 -0
- data/NEWS.md +10 -1
- data/README.md +2 -0
- data/lib/nanoc3.rb +1 -1
- data/lib/nanoc3/base/compilation/compiler_dsl.rb +6 -3
- data/lib/nanoc3/base/compilation/rules_collection.rb +1 -1
- data/lib/nanoc3/base/core_ext/pathname.rb +1 -1
- data/lib/nanoc3/base/memoization.rb +5 -7
- data/lib/nanoc3/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc3/cli/commands/create_item.rb +1 -1
- data/lib/nanoc3/cli/commands/update.rb +2 -2
- data/lib/nanoc3/cli/commands/view.rb +3 -3
- data/lib/nanoc3/cli/commands/watch.rb +1 -1
- data/lib/nanoc3/cli/error_handler.rb +59 -47
- data/lib/nanoc3/data_sources/filesystem.rb +1 -1
- data/lib/nanoc3/filters/colorize_syntax.rb +5 -6
- data/nanoc3.gemspec +1 -0
- data/test/base/test_compiler_dsl.rb +15 -8
- data/test/data_sources/test_filesystem.rb +3 -4
- data/test/filters/test_rdoc.rb +7 -5
- data/test/helper.rb +7 -0
- metadata +18 -34
data/Gemfile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'bluecloth'
|
6
|
+
gem 'builder'
|
7
|
+
gem 'coderay'
|
8
|
+
gem 'erubis'
|
9
|
+
gem 'haml'
|
10
|
+
gem 'kramdown'
|
11
|
+
gem 'less', '~> 2.0'
|
12
|
+
gem 'markaby'
|
13
|
+
gem 'maruku'
|
14
|
+
gem 'mime-types'
|
15
|
+
gem 'mustache'
|
16
|
+
gem 'nokogiri'
|
17
|
+
gem 'rack'
|
18
|
+
gem 'rainpress'
|
19
|
+
gem 'rdiscount'
|
20
|
+
gem 'rdoc'
|
21
|
+
gem 'redcarpet'
|
22
|
+
gem 'RedCloth'
|
23
|
+
gem 'rubypants'
|
24
|
+
gem 'sass', '~> 3.1'
|
25
|
+
gem 'slim'
|
26
|
+
gem 'systemu'
|
27
|
+
gem 'typogruby'
|
28
|
+
gem 'uglifier'
|
29
|
+
gem 'w3c_validators'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nanoc3 (3.2.0)
|
5
|
+
cri (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
RedCloth (4.2.7)
|
11
|
+
bluecloth (2.1.0)
|
12
|
+
builder (3.0.0)
|
13
|
+
coderay (0.9.8)
|
14
|
+
cri (2.0.2)
|
15
|
+
erubis (2.7.0)
|
16
|
+
execjs (1.2.0)
|
17
|
+
multi_json (~> 1.0)
|
18
|
+
haml (3.1.2)
|
19
|
+
kramdown (0.13.3)
|
20
|
+
less (2.0.5)
|
21
|
+
therubyracer (~> 0.9.2)
|
22
|
+
libv8 (3.3.10.2)
|
23
|
+
markaby (0.7.1)
|
24
|
+
builder (>= 2.0.0)
|
25
|
+
maruku (0.6.0)
|
26
|
+
syntax (>= 1.0.0)
|
27
|
+
mime-types (1.16)
|
28
|
+
minitest (2.3.1)
|
29
|
+
mocha (0.9.12)
|
30
|
+
multi_json (1.0.3)
|
31
|
+
mustache (0.99.4)
|
32
|
+
nokogiri (1.5.0)
|
33
|
+
rack (1.3.2)
|
34
|
+
rainpress (1.0)
|
35
|
+
rake (0.9.2)
|
36
|
+
rdiscount (1.6.8)
|
37
|
+
rdoc (3.8)
|
38
|
+
redcarpet (1.17.2)
|
39
|
+
rubypants (0.2.0)
|
40
|
+
sass (3.1.5)
|
41
|
+
slim (1.0.0)
|
42
|
+
temple (~> 0.3.0)
|
43
|
+
tilt (~> 1.2)
|
44
|
+
syntax (1.0.0)
|
45
|
+
systemu (2.2.0)
|
46
|
+
temple (0.3.2)
|
47
|
+
therubyracer (0.9.2)
|
48
|
+
libv8 (~> 3.3.10)
|
49
|
+
tilt (1.3.2)
|
50
|
+
typogruby (1.0.12)
|
51
|
+
rubypants
|
52
|
+
uglifier (1.0.0)
|
53
|
+
execjs (>= 0.3.0)
|
54
|
+
multi_json (>= 1.0.2)
|
55
|
+
w3c_validators (1.1.1)
|
56
|
+
nokogiri
|
57
|
+
yard (0.7.2)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
RedCloth
|
64
|
+
bluecloth
|
65
|
+
builder
|
66
|
+
coderay
|
67
|
+
erubis
|
68
|
+
haml
|
69
|
+
kramdown
|
70
|
+
less (~> 2.0)
|
71
|
+
markaby
|
72
|
+
maruku
|
73
|
+
mime-types
|
74
|
+
minitest
|
75
|
+
mocha
|
76
|
+
mustache
|
77
|
+
nanoc3!
|
78
|
+
nokogiri
|
79
|
+
rack
|
80
|
+
rainpress
|
81
|
+
rake
|
82
|
+
rdiscount
|
83
|
+
rdoc
|
84
|
+
redcarpet
|
85
|
+
rubypants
|
86
|
+
sass (~> 3.1)
|
87
|
+
slim
|
88
|
+
systemu
|
89
|
+
typogruby
|
90
|
+
uglifier
|
91
|
+
w3c_validators
|
92
|
+
yard
|
data/NEWS.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
-
## 3.2 (
|
3
|
+
## 3.2.1 (2011-07-27)
|
4
|
+
|
5
|
+
* Made `@config` available in rules file
|
6
|
+
* Fixed `#readpartial` issue on JRuby [Matt Keveney]
|
7
|
+
* Fixed possible `@cache` name clash in memoization module
|
8
|
+
* Fixed options with required arguments (such as `--port` and `--host`)
|
9
|
+
* Fixed broken `#check_availability`
|
10
|
+
* Fixed error handling in watch command
|
11
|
+
|
12
|
+
## 3.2 (2011-07-24)
|
4
13
|
|
5
14
|
Base:
|
6
15
|
|
data/README.md
CHANGED
@@ -75,6 +75,7 @@ may be interested in the development dependencies:
|
|
75
75
|
* Colin Barrett
|
76
76
|
* Dmitry Bilunov
|
77
77
|
* Devon Luke Buchanan
|
78
|
+
* Stefan Bühler
|
78
79
|
* Brian Candler
|
79
80
|
* Michal Cichra
|
80
81
|
* Zaiste de Grengolada
|
@@ -85,6 +86,7 @@ may be interested in the development dependencies:
|
|
85
86
|
* Justin Hileman
|
86
87
|
* Starr Horne
|
87
88
|
* Tuomas Kareinen
|
89
|
+
* Matt Keveney
|
88
90
|
* Nikhil Marathe
|
89
91
|
* Daniel Mendler
|
90
92
|
* Ale Muñoz
|
data/lib/nanoc3.rb
CHANGED
@@ -9,10 +9,13 @@ module Nanoc3
|
|
9
9
|
#
|
10
10
|
# @api private
|
11
11
|
#
|
12
|
-
# @param [Nanoc3::RulesCollection] rules_collection The collection of
|
13
|
-
# to modify when loading this DSL
|
14
|
-
|
12
|
+
# @param [Nanoc3::RulesCollection] rules_collection The collection of
|
13
|
+
# rules to modify when loading this DSL
|
14
|
+
#
|
15
|
+
# @param [Hash] config The site configuration
|
16
|
+
def initialize(rules_collection, config)
|
15
17
|
@rules_collection = rules_collection
|
18
|
+
@config = config
|
16
19
|
end
|
17
20
|
|
18
21
|
# Creates a preprocessor block that will be executed after all data is
|
@@ -7,8 +7,6 @@ module Nanoc3
|
|
7
7
|
# @since 3.2.0
|
8
8
|
module Memoization
|
9
9
|
|
10
|
-
CACHE = {}
|
11
|
-
|
12
10
|
# Memoizes the method with the given name. The modified method will cache
|
13
11
|
# the results of the original method, so that calling a method twice with
|
14
12
|
# the same arguments will short-circuit and return the cached results
|
@@ -50,17 +48,17 @@ module Nanoc3
|
|
50
48
|
# Redefine
|
51
49
|
define_method(method_name) do |*args|
|
52
50
|
# Get cache
|
53
|
-
@
|
54
|
-
@
|
51
|
+
@__memoization_cache ||= {}
|
52
|
+
@__memoization_cache[method_name] ||= {}
|
55
53
|
|
56
54
|
# Recalculate if necessary
|
57
|
-
if !@
|
55
|
+
if !@__memoization_cache[method_name].has_key?(args)
|
58
56
|
result = send(original_method_name, *args)
|
59
|
-
@
|
57
|
+
@__memoization_cache[method_name][args] = result
|
60
58
|
end
|
61
59
|
|
62
60
|
# Done
|
63
|
-
@
|
61
|
+
@__memoization_cache[method_name][args]
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
@@ -9,9 +9,9 @@ on port 3000 and listen on all IP addresses. Running the autocompiler requires
|
|
9
9
|
the 'mime/types' and 'rack' gems.
|
10
10
|
EOS
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
|
13
|
+
required :o, :host, 'specify the host to listen on (default: 0.0.0.0)'
|
14
|
+
required :p, :port, 'specify the port to listen on (default: 3000)'
|
15
15
|
|
16
16
|
run do |opts, args, cmd|
|
17
17
|
Nanoc3::CLI::Commands::AutoCompile.call(opts, args, cmd)
|
@@ -8,7 +8,7 @@ Create a new item in the current site. The first data source in the site
|
|
8
8
|
configuration will be used.
|
9
9
|
EOS
|
10
10
|
|
11
|
-
|
11
|
+
required :c, :vcs, 'specify the VCS to use'
|
12
12
|
|
13
13
|
run do |opts, args, cmd|
|
14
14
|
Nanoc3::CLI::Commands::CreateItem.call(opts, args, cmd)
|
@@ -12,8 +12,8 @@ This command will change data, and it is therefore recommended to make a
|
|
12
12
|
backup in case something goes wrong.
|
13
13
|
EOS
|
14
14
|
|
15
|
-
|
16
|
-
flag
|
15
|
+
required :c, :vcs, 'select the VCS to use'
|
16
|
+
flag :y, :yes, 'update the data without warning'
|
17
17
|
|
18
18
|
run do |opts, args, cmd|
|
19
19
|
Nanoc3::CLI::Commands::Update.call(opts, args, cmd)
|
@@ -6,9 +6,9 @@ description <<-EOS
|
|
6
6
|
Start the static web server. Unless specified, the web server will run on port 3000 and listen on all IP addresses. Running this static web server requires 'adsf' (not 'asdf'!).
|
7
7
|
EOS
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
|
10
|
+
required :o, :host, 'specify the host to listen on (default: 0.0.0.0)'
|
11
|
+
required :p, :port, 'specify the port to listen on (default: 3000)'
|
12
12
|
|
13
13
|
run do |opts, args, cmd|
|
14
14
|
Nanoc3::CLI::Commands::View.call(opts, args, cmd)
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Nanoc3::CLI
|
4
4
|
|
5
5
|
# Catches errors and prints nice diagnostic messages, then exits.
|
6
|
+
#
|
7
|
+
# @api private
|
6
8
|
class ErrorHandler
|
7
9
|
|
8
10
|
# @option params [Nanoc3::CLI::Command, nil] command The command that is
|
@@ -45,6 +47,63 @@ module Nanoc3::CLI
|
|
45
47
|
exit(1)
|
46
48
|
end
|
47
49
|
|
50
|
+
# Prints the given error to stderr. Includes message, possible resolution
|
51
|
+
# (see {#resolution_for}), compilation stack, backtrace, etc.
|
52
|
+
#
|
53
|
+
# @param [Error] error The error that should be described
|
54
|
+
#
|
55
|
+
# @return [void]
|
56
|
+
def self.print_error(error)
|
57
|
+
self.new.print_error(error)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Prints the given error to stderr. Includes message, possible resolution
|
61
|
+
# (see {#resolution_for}), compilation stack, backtrace, etc.
|
62
|
+
#
|
63
|
+
# @param [Error] error The error that should be described
|
64
|
+
#
|
65
|
+
# @return [void]
|
66
|
+
def print_error(error)
|
67
|
+
# Header
|
68
|
+
$stderr.puts
|
69
|
+
$stderr.puts "Captain! We’ve been hit!"
|
70
|
+
|
71
|
+
# Exception and resolution (if any)
|
72
|
+
$stderr.puts
|
73
|
+
$stderr.puts '=== MESSAGE:'
|
74
|
+
$stderr.puts
|
75
|
+
$stderr.puts "#{error.class}: #{error.message}"
|
76
|
+
resolution = self.resolution_for(error)
|
77
|
+
$stderr.puts "#{resolution}" if resolution
|
78
|
+
|
79
|
+
# Compilation stack
|
80
|
+
$stderr.puts
|
81
|
+
$stderr.puts '=== COMPILATION STACK:'
|
82
|
+
$stderr.puts
|
83
|
+
if self.stack.empty?
|
84
|
+
$stderr.puts " (empty)"
|
85
|
+
else
|
86
|
+
self.stack.reverse.each do |obj|
|
87
|
+
if obj.is_a?(Nanoc3::ItemRep)
|
88
|
+
$stderr.puts " - [item] #{obj.item.identifier} (rep #{obj.name})"
|
89
|
+
else # layout
|
90
|
+
$stderr.puts " - [layout] #{obj.identifier}"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Backtrace
|
96
|
+
$stderr.puts
|
97
|
+
$stderr.puts '=== BACKTRACE:'
|
98
|
+
$stderr.puts
|
99
|
+
$stderr.puts error.backtrace.to_enum(:each_with_index).map { |item, index| " #{index}. #{item}" }.join("\n")
|
100
|
+
|
101
|
+
# Issue link
|
102
|
+
$stderr.puts
|
103
|
+
$stderr.puts "If you believe this is a bug in nanoc, please do report it at"
|
104
|
+
$stderr.puts "<https://github.com/ddfreyne/nanoc/issues/new>--thanks!"
|
105
|
+
end
|
106
|
+
|
48
107
|
protected
|
49
108
|
|
50
109
|
# @return [Boolean] true if debug output is enabled, false if not
|
@@ -100,53 +159,6 @@ module Nanoc3::CLI
|
|
100
159
|
'w3c_validators' => 'w3c_validators'
|
101
160
|
}
|
102
161
|
|
103
|
-
# Prints the given error to stderr. Includes message, possible resolution
|
104
|
-
# (see {#resolution_for}), compilation stack, backtrace, etc.
|
105
|
-
#
|
106
|
-
# @param [Error] error The error that should be described
|
107
|
-
#
|
108
|
-
# @return [void]
|
109
|
-
def print_error(error)
|
110
|
-
# Header
|
111
|
-
$stderr.puts
|
112
|
-
$stderr.puts "Captain! We’ve been hit!"
|
113
|
-
|
114
|
-
# Exception and resolution (if any)
|
115
|
-
$stderr.puts
|
116
|
-
$stderr.puts '=== MESSAGE:'
|
117
|
-
$stderr.puts
|
118
|
-
$stderr.puts "#{error.class}: #{error.message}"
|
119
|
-
resolution = self.resolution_for(error)
|
120
|
-
$stderr.puts "#{resolution}" if resolution
|
121
|
-
|
122
|
-
# Compilation stack
|
123
|
-
$stderr.puts
|
124
|
-
$stderr.puts '=== COMPILATION STACK:'
|
125
|
-
$stderr.puts
|
126
|
-
if self.stack.empty?
|
127
|
-
$stderr.puts " (empty)"
|
128
|
-
else
|
129
|
-
self.stack.reverse.each do |obj|
|
130
|
-
if obj.is_a?(Nanoc3::ItemRep)
|
131
|
-
$stderr.puts " - [item] #{obj.item.identifier} (rep #{obj.name})"
|
132
|
-
else # layout
|
133
|
-
$stderr.puts " - [layout] #{obj.identifier}"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
# Backtrace
|
139
|
-
$stderr.puts
|
140
|
-
$stderr.puts '=== BACKTRACE:'
|
141
|
-
$stderr.puts
|
142
|
-
$stderr.puts error.backtrace.to_enum(:each_with_index).map { |item, index| " #{index}. #{item}" }.join("\n")
|
143
|
-
|
144
|
-
# Issue link
|
145
|
-
$stderr.puts
|
146
|
-
$stderr.puts "If you believe this is a bug in nanoc, please do report it at"
|
147
|
-
$stderr.puts "<https://github.com/ddfreyne/nanoc/issues/new>--thanks!"
|
148
|
-
end
|
149
|
-
|
150
162
|
# Attempts to find a resolution for the given error, or nil if no
|
151
163
|
# resolution can be automatically obtained.
|
152
164
|
#
|
@@ -183,7 +183,7 @@ module Nanoc3::Filters
|
|
183
183
|
# @return [String] The colorized output
|
184
184
|
def pygmentize(code, language, params={})
|
185
185
|
require 'systemu'
|
186
|
-
check_availability('pygmentize
|
186
|
+
check_availability('pygmentize', '-V')
|
187
187
|
|
188
188
|
# Build command
|
189
189
|
cmd = [ 'pygmentize', '-l', language, '-f', 'html' ]
|
@@ -222,7 +222,7 @@ module Nanoc3::Filters
|
|
222
222
|
def simon_highlight(code, language, params={})
|
223
223
|
require 'systemu'
|
224
224
|
|
225
|
-
check_availability('highlight --version')
|
225
|
+
check_availability('highlight', '--version')
|
226
226
|
|
227
227
|
# Build command
|
228
228
|
cmd = [ 'highlight', '--syntax', language, '--fragment' ]
|
@@ -247,10 +247,9 @@ module Nanoc3::Filters
|
|
247
247
|
stdout.read
|
248
248
|
end
|
249
249
|
|
250
|
-
def check_availability(cmd)
|
251
|
-
|
252
|
-
|
253
|
-
end
|
250
|
+
def check_availability(*cmd)
|
251
|
+
systemu cmd
|
252
|
+
raise "Could not spawn #{cmd.join(' ')}" if $?.exitstatus != 0
|
254
253
|
end
|
255
254
|
|
256
255
|
end
|
data/nanoc3.gemspec
CHANGED
@@ -46,7 +46,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
46
46
|
|
47
47
|
def test_identifier_to_regex_without_wildcards
|
48
48
|
# Create compiler DSL
|
49
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
49
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
50
50
|
|
51
51
|
actual = compiler_dsl.instance_eval { identifier_to_regex('foo') }
|
52
52
|
expected = %r{^/foo/$}
|
@@ -60,7 +60,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
60
60
|
|
61
61
|
def test_identifier_to_regex_with_one_wildcard
|
62
62
|
# Create compiler DSL
|
63
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
63
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
64
64
|
|
65
65
|
actual = compiler_dsl.instance_eval { identifier_to_regex('foo/*/bar') }
|
66
66
|
expected = %r{^/foo/(.*?)/bar/$}
|
@@ -74,7 +74,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
74
74
|
|
75
75
|
def test_identifier_to_regex_with_two_wildcards
|
76
76
|
# Create compiler DSL
|
77
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
77
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
78
78
|
|
79
79
|
actual = compiler_dsl.instance_eval { identifier_to_regex('foo/*/bar/*/qux') }
|
80
80
|
expected = %r{^/foo/(.*?)/bar/(.*?)/qux/$}
|
@@ -88,7 +88,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
88
88
|
|
89
89
|
def test_identifier_to_regex_with_just_one_wildcard
|
90
90
|
# Create compiler DSL
|
91
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
91
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
92
92
|
|
93
93
|
actual = compiler_dsl.instance_eval { identifier_to_regex('*') }
|
94
94
|
expected = %r{^/(.*?)$}
|
@@ -102,7 +102,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
102
102
|
|
103
103
|
def test_identifier_to_regex_with_root
|
104
104
|
# Create compiler DSL
|
105
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
105
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
106
106
|
|
107
107
|
actual = compiler_dsl.instance_eval { identifier_to_regex('/') }
|
108
108
|
expected = %r{^/$}
|
@@ -116,7 +116,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
116
116
|
|
117
117
|
def test_identifier_to_regex_with_only_children
|
118
118
|
# Create compiler DSL
|
119
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
119
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
120
120
|
|
121
121
|
actual = compiler_dsl.instance_eval { identifier_to_regex('/foo/*/') }
|
122
122
|
expected = %r{^/foo/(.*?)/$}
|
@@ -130,7 +130,7 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
130
130
|
|
131
131
|
def test_identifier_to_regex_with_plus_wildcard
|
132
132
|
# Create compiler DSL
|
133
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
133
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
134
134
|
|
135
135
|
actual = compiler_dsl.instance_eval { identifier_to_regex('/foo/+') }
|
136
136
|
expected = %r{^/foo/(.+?)/$}
|
@@ -145,10 +145,17 @@ class Nanoc3::CompilerDSLTest < MiniTest::Unit::TestCase
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def test_dsl_has_no_access_to_compiler
|
148
|
-
compiler_dsl = Nanoc3::CompilerDSL.new(nil)
|
148
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, {})
|
149
149
|
assert_raises(NameError) do
|
150
150
|
compiler_dsl.instance_eval { compiler }
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
+
def test_config
|
155
|
+
$venetian = 'unsnares'
|
156
|
+
compiler_dsl = Nanoc3::CompilerDSL.new(nil, { :venetian => 'snares' })
|
157
|
+
compiler_dsl.instance_eval { $venetian = @config[:venetian] }
|
158
|
+
assert_equal 'snares', $venetian
|
159
|
+
end
|
160
|
+
|
154
161
|
end
|
@@ -15,11 +15,11 @@ class Nanoc3::DataSources::FilesystemTest < MiniTest::Unit::TestCase
|
|
15
15
|
# Remove files to make sure they are recreated
|
16
16
|
FileUtils.rm_rf('content')
|
17
17
|
FileUtils.rm_rf('layouts/default')
|
18
|
-
FileUtils.rm_rf('lib
|
18
|
+
FileUtils.rm_rf('lib')
|
19
19
|
|
20
20
|
# Mock VCS
|
21
21
|
vcs = mock
|
22
|
-
vcs.expects(:add).times(
|
22
|
+
vcs.expects(:add).times(2) # One time for each directory
|
23
23
|
data_source.vcs = vcs
|
24
24
|
|
25
25
|
# Recreate files
|
@@ -28,12 +28,11 @@ class Nanoc3::DataSources::FilesystemTest < MiniTest::Unit::TestCase
|
|
28
28
|
# Ensure essential files have been recreated
|
29
29
|
assert(File.directory?('content/'))
|
30
30
|
assert(File.directory?('layouts/'))
|
31
|
-
assert(File.directory?('lib/'))
|
32
31
|
|
33
32
|
# Ensure no non-essential files have been recreated
|
34
33
|
assert(!File.file?('content/index.html'))
|
35
34
|
assert(!File.file?('layouts/default.html'))
|
36
|
-
|
35
|
+
refute(File.directory?('lib/'))
|
37
36
|
end
|
38
37
|
|
39
38
|
def test_items
|
data/test/filters/test_rdoc.rb
CHANGED
@@ -5,12 +5,14 @@ class Nanoc3::Filters::RDocTest < MiniTest::Unit::TestCase
|
|
5
5
|
include Nanoc3::TestHelpers
|
6
6
|
|
7
7
|
def test_filter
|
8
|
-
|
9
|
-
|
8
|
+
if_have 'rdoc' do
|
9
|
+
# Get filter
|
10
|
+
filter = ::Nanoc3::Filters::RDoc.new
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
# Run filter
|
13
|
+
result = filter.run("= Foo")
|
14
|
+
assert_match(%r{<h1>Foo</h1>\Z}, result)
|
15
|
+
end
|
14
16
|
end
|
15
17
|
|
16
18
|
end
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 15
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 3
|
8
|
-
- 2
|
9
|
-
- 0
|
10
|
-
version: 3.2.0
|
5
|
+
version: 3.2.1
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Denis Defreyne
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-07-
|
19
|
-
default_executable:
|
13
|
+
date: 2011-07-27 00:00:00 Z
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
16
|
name: cri
|
@@ -26,10 +20,6 @@ dependencies:
|
|
26
20
|
requirements:
|
27
21
|
- - ~>
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 0
|
33
23
|
version: "2.0"
|
34
24
|
type: :runtime
|
35
25
|
version_requirements: *id001
|
@@ -41,9 +31,6 @@ dependencies:
|
|
41
31
|
requirements:
|
42
32
|
- - ">="
|
43
33
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
|
-
segments:
|
46
|
-
- 0
|
47
34
|
version: "0"
|
48
35
|
type: :development
|
49
36
|
version_requirements: *id002
|
@@ -55,40 +42,42 @@ dependencies:
|
|
55
42
|
requirements:
|
56
43
|
- - ">="
|
57
44
|
- !ruby/object:Gem::Version
|
58
|
-
hash: 3
|
59
|
-
segments:
|
60
|
-
- 0
|
61
45
|
version: "0"
|
62
46
|
type: :development
|
63
47
|
version_requirements: *id003
|
64
48
|
- !ruby/object:Gem::Dependency
|
65
|
-
name:
|
49
|
+
name: rake
|
66
50
|
prerelease: false
|
67
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
52
|
none: false
|
69
53
|
requirements:
|
70
54
|
- - ">="
|
71
55
|
- !ruby/object:Gem::Version
|
72
|
-
hash: 3
|
73
|
-
segments:
|
74
|
-
- 0
|
75
56
|
version: "0"
|
76
57
|
type: :development
|
77
58
|
version_requirements: *id004
|
78
59
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
60
|
+
name: rdiscount
|
80
61
|
prerelease: false
|
81
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
82
63
|
none: false
|
83
64
|
requirements:
|
84
65
|
- - ">="
|
85
66
|
- !ruby/object:Gem::Version
|
86
|
-
hash: 3
|
87
|
-
segments:
|
88
|
-
- 0
|
89
67
|
version: "0"
|
90
68
|
type: :development
|
91
69
|
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: yard
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id006
|
92
81
|
description: "nanoc is a simple but very flexible static site generator written in Ruby. It operates on local files, and therefore does not run on the server. nanoc \xE2\x80\x9Ccompiles\xE2\x80\x9D the local source files into HTML (usually), by evaluating eRuby, Markdown, etc."
|
93
82
|
email: denis.defreyne@stoneship.org
|
94
83
|
executables:
|
@@ -102,6 +91,8 @@ extra_rdoc_files:
|
|
102
91
|
- NEWS.md
|
103
92
|
files:
|
104
93
|
- ChangeLog
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
105
96
|
- LICENSE
|
106
97
|
- NEWS.md
|
107
98
|
- Rakefile
|
@@ -310,7 +301,6 @@ files:
|
|
310
301
|
- test/tasks/test_clean.rb
|
311
302
|
- nanoc3.gemspec
|
312
303
|
- .gemtest
|
313
|
-
has_rdoc: true
|
314
304
|
homepage: http://nanoc.stoneship.org/
|
315
305
|
licenses: []
|
316
306
|
|
@@ -340,23 +330,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
340
330
|
requirements:
|
341
331
|
- - ">="
|
342
332
|
- !ruby/object:Gem::Version
|
343
|
-
hash: 3
|
344
|
-
segments:
|
345
|
-
- 0
|
346
333
|
version: "0"
|
347
334
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
348
335
|
none: false
|
349
336
|
requirements:
|
350
337
|
- - ">="
|
351
338
|
- !ruby/object:Gem::Version
|
352
|
-
hash: 3
|
353
|
-
segments:
|
354
|
-
- 0
|
355
339
|
version: "0"
|
356
340
|
requirements: []
|
357
341
|
|
358
342
|
rubyforge_project:
|
359
|
-
rubygems_version: 1.6
|
343
|
+
rubygems_version: 1.8.6
|
360
344
|
signing_key:
|
361
345
|
specification_version: 3
|
362
346
|
summary: a web publishing system written in Ruby for building small to medium-sized websites.
|