nanoc 3.5.0b1 → 3.5.0b2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +19 -17
- data/NEWS.md +3 -1
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +1 -2
- data/lib/nanoc/cli/commands/check.rb +0 -1
- data/lib/nanoc/cli/commands/deploy.rb +9 -6
- data/lib/nanoc/cli/error_handler.rb +6 -3
- data/lib/nanoc/cli/logger.rb +5 -5
- data/lib/nanoc/extra/checking/checks/internal_links.rb +4 -0
- data/lib/nanoc/extra/checking/runner.rb +26 -10
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/test/extra/checking/checks/test_internal_links.rb +12 -0
- data/test/extra/checking/test_runner.rb +33 -1
- data/test/filters/test_xsl.rb +2 -4
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (3.5.
|
4
|
+
nanoc (3.5.0b1)
|
5
5
|
cri (~> 2.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
excon (0.16.10)
|
26
26
|
execjs (1.4.0)
|
27
27
|
multi_json (~> 1.0)
|
28
|
-
fog (1.
|
28
|
+
fog (1.9.0)
|
29
29
|
builder
|
30
30
|
excon (~> 0.14)
|
31
31
|
formatador (~> 0.2.0)
|
@@ -37,53 +37,55 @@ GEM
|
|
37
37
|
ruby-hmac
|
38
38
|
formatador (0.2.4)
|
39
39
|
haml (3.1.7)
|
40
|
-
handlebars (0.3.
|
40
|
+
handlebars (0.3.2)
|
41
41
|
commonjs (~> 0.2.3)
|
42
|
-
therubyracer (~> 0.
|
43
|
-
json (1.7.
|
44
|
-
kramdown (0.14.
|
42
|
+
therubyracer (~> 0.11.1)
|
43
|
+
json (1.7.6)
|
44
|
+
kramdown (0.14.2)
|
45
45
|
less (2.2.2)
|
46
46
|
commonjs (~> 0.2.6)
|
47
|
-
libv8 (3.
|
48
|
-
listen (0.
|
47
|
+
libv8 (3.11.8.13)
|
48
|
+
listen (0.7.2)
|
49
49
|
markaby (0.7.2)
|
50
50
|
builder (>= 2.0.0)
|
51
51
|
maruku (0.6.1)
|
52
52
|
syntax (>= 1.0.0)
|
53
53
|
metaclass (0.0.1)
|
54
54
|
mime-types (1.19)
|
55
|
-
minitest (4.
|
56
|
-
mocha (0.13.
|
55
|
+
minitest (4.5.0)
|
56
|
+
mocha (0.13.2)
|
57
57
|
metaclass (~> 0.0.1)
|
58
58
|
multi_json (1.5.0)
|
59
59
|
mustache (0.99.4)
|
60
60
|
net-scp (1.0.4)
|
61
61
|
net-ssh (>= 1.99.1)
|
62
|
-
net-ssh (2.6.
|
62
|
+
net-ssh (2.6.3)
|
63
63
|
nokogiri (1.5.6)
|
64
64
|
pandoc-ruby (0.6.0)
|
65
65
|
posix-spawn (0.3.6)
|
66
|
-
pygments.rb (0.3.
|
66
|
+
pygments.rb (0.3.7)
|
67
67
|
posix-spawn (~> 0.3.6)
|
68
68
|
yajl-ruby (~> 1.1.0)
|
69
|
-
rack (1.
|
69
|
+
rack (1.5.0)
|
70
70
|
rainpress (1.0)
|
71
71
|
rake (10.0.3)
|
72
72
|
rdiscount (1.6.8)
|
73
73
|
rdoc (3.12)
|
74
74
|
json (~> 1.4)
|
75
75
|
redcarpet (2.2.2)
|
76
|
+
ref (1.0.2)
|
76
77
|
ruby-hmac (0.4.0)
|
77
78
|
rubypants (0.2.0)
|
78
|
-
sass (3.2.
|
79
|
-
slim (1.3.
|
79
|
+
sass (3.2.5)
|
80
|
+
slim (1.3.6)
|
80
81
|
temple (~> 0.5.5)
|
81
82
|
tilt (~> 1.3.3)
|
82
83
|
syntax (1.0.0)
|
83
84
|
systemu (2.5.2)
|
84
85
|
temple (0.5.5)
|
85
|
-
therubyracer (0.
|
86
|
-
libv8 (~> 3.
|
86
|
+
therubyracer (0.11.3)
|
87
|
+
libv8 (~> 3.11.8.12)
|
88
|
+
ref
|
87
89
|
tilt (1.3.3)
|
88
90
|
typogruby (1.0.15)
|
89
91
|
rubypants
|
data/NEWS.md
CHANGED
@@ -10,10 +10,11 @@ Minor changes:
|
|
10
10
|
|
11
11
|
* Added `#include_rules` for modularising Rules files [Justin Hileman]
|
12
12
|
* Replaced FSSM with Listen [Takashi Uchibe]
|
13
|
-
* Made USR1 print stack trace
|
13
|
+
* Made USR1 print stack trace (not on Windows)
|
14
14
|
* Added ability to configure autocompiler host/port in config.yaml [Stuart Montgomery]
|
15
15
|
* Added static data source
|
16
16
|
* Added `:rep_select` parameter to XML sitemap to allow filtering reps
|
17
|
+
* Removed use of bright/bold colors for compatibility with Solarized
|
17
18
|
|
18
19
|
Exensions:
|
19
20
|
|
@@ -26,6 +27,7 @@ Fixes:
|
|
26
27
|
|
27
28
|
* Made syntax colorizer only use the first non-empty line when extracting the
|
28
29
|
language comment
|
30
|
+
* Fixed XSL filter
|
29
31
|
|
30
32
|
## 3.4.3 (2012-12-09)
|
31
33
|
|
data/lib/nanoc.rb
CHANGED
@@ -132,8 +132,7 @@ module Nanoc
|
|
132
132
|
# @param [Class] superclass The superclass of the plugin. For example:
|
133
133
|
# {Nanoc::Filter}, {Nanoc::Extra::VCS}.
|
134
134
|
#
|
135
|
-
# @param [Class
|
136
|
-
# This can also be a string containing the name of the class.
|
135
|
+
# @param [Class] klass The class to get the identifiers for.
|
137
136
|
#
|
138
137
|
# @return [Array<Symbol>] An array of identifiers for the given class
|
139
138
|
def identifiers_of(superclass, klass)
|
@@ -60,13 +60,16 @@ module Nanoc::CLI::Commands
|
|
60
60
|
|
61
61
|
# Check
|
62
62
|
unless options[:'no-check']
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
runner = Nanoc::Extra::Checking::Runner.new(site)
|
64
|
+
if runner.has_dsl?
|
65
|
+
puts "Running issue checks…"
|
66
|
+
ok = runner.run_for_deploy
|
67
|
+
if !ok
|
68
|
+
puts "Issues found, deploy aborted."
|
69
|
+
return
|
70
|
+
end
|
71
|
+
puts "No issues found. Deploying!"
|
68
72
|
end
|
69
|
-
puts "No issues found. Deploying!"
|
70
73
|
end
|
71
74
|
|
72
75
|
# Run
|
@@ -58,9 +58,12 @@ module Nanoc::CLI
|
|
58
58
|
exit!(0)
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
begin
|
62
|
+
Signal.trap('USR1') do
|
63
|
+
puts "Caught USR1; dumping a stack trace"
|
64
|
+
puts caller.map { |i| " #{i}" }.join("\n")
|
65
|
+
end
|
66
|
+
rescue ArgumentError
|
64
67
|
end
|
65
68
|
|
66
69
|
# Run
|
data/lib/nanoc/cli/logger.rb
CHANGED
@@ -11,11 +11,11 @@ module Nanoc::CLI
|
|
11
11
|
# Maps actions (`:create`, `:update`, `:identical`, `:skip` and `:delete`)
|
12
12
|
# onto their ANSI color codes.
|
13
13
|
ACTION_COLORS = {
|
14
|
-
:create => "\e[
|
15
|
-
:update => "\e[
|
16
|
-
:identical => "
|
17
|
-
:skip => "
|
18
|
-
:delete => "\e[
|
14
|
+
:create => "\e[32m", # green
|
15
|
+
:update => "\e[33m", # yellow
|
16
|
+
:identical => "", # (nothing)
|
17
|
+
:skip => "", # (nothing)
|
18
|
+
:delete => "\e[31m" # red
|
19
19
|
}
|
20
20
|
|
21
21
|
include Singleton
|
@@ -34,6 +34,10 @@ module Nanoc::Extra::Checking::Checks
|
|
34
34
|
path = href.sub(/#.*$/, '')
|
35
35
|
return true if path.empty?
|
36
36
|
|
37
|
+
# Remove query string
|
38
|
+
path = path.sub(/\?.*$/, '')
|
39
|
+
return true if path.empty?
|
40
|
+
|
37
41
|
# Make absolute
|
38
42
|
if path[0, 1] == '/'
|
39
43
|
path = @site.config[:output_dir] + path
|
@@ -7,24 +7,24 @@ module Nanoc::Extra::Checking
|
|
7
7
|
# @api private
|
8
8
|
class Runner
|
9
9
|
|
10
|
+
CHECKS_FILENAME = 'Checks'
|
11
|
+
|
10
12
|
# @param [Nanoc::Site] site The nanoc site this runner is for
|
11
13
|
def initialize(site)
|
12
14
|
@site = site
|
13
15
|
end
|
14
16
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
def require_dsl
|
19
|
-
if self.dsl.nil?
|
20
|
-
raise Nanoc::Errors::GenericTrivial, "No checks defined (no Checks file present)"
|
21
|
-
end
|
17
|
+
# @return [Boolean] true if a Checks file exists, false otherwise
|
18
|
+
def has_dsl?
|
19
|
+
File.exist?(CHECKS_FILENAME)
|
22
20
|
end
|
23
21
|
|
24
22
|
# Lists all available checks on stdout.
|
25
23
|
#
|
26
24
|
# @return [void]
|
27
25
|
def list_checks
|
26
|
+
self.load_dsl_if_available
|
27
|
+
|
28
28
|
puts "Available checks:"
|
29
29
|
puts
|
30
30
|
puts all_check_classes.map { |i| " " + i.identifier.to_s }.sort.join("\n")
|
@@ -34,6 +34,8 @@ module Nanoc::Extra::Checking
|
|
34
34
|
#
|
35
35
|
# @return [Boolean] true if successful, false otherwise
|
36
36
|
def run_all
|
37
|
+
self.load_dsl_if_available
|
38
|
+
|
37
39
|
self.run_check_classes(self.all_check_classes)
|
38
40
|
end
|
39
41
|
|
@@ -41,6 +43,8 @@ module Nanoc::Extra::Checking
|
|
41
43
|
#
|
42
44
|
# @return [Boolean] true if successful, false otherwise
|
43
45
|
def run_for_deploy
|
46
|
+
self.require_dsl
|
47
|
+
|
44
48
|
return true if self.dsl.nil?
|
45
49
|
self.run_check_classes(self.check_classes_named(self.dsl.deploy_checks))
|
46
50
|
end
|
@@ -51,21 +55,33 @@ module Nanoc::Extra::Checking
|
|
51
55
|
#
|
52
56
|
# @return [Boolean] true if successful, false otherwise
|
53
57
|
def run_specific(check_class_names)
|
58
|
+
self.load_dsl_if_available
|
59
|
+
|
54
60
|
self.run_check_classes(self.check_classes_named(check_class_names))
|
55
61
|
end
|
56
62
|
|
57
63
|
protected
|
58
64
|
|
59
|
-
def
|
65
|
+
def load_dsl_if_available
|
60
66
|
@dsl_loaded ||= false
|
61
67
|
if !@dsl_loaded
|
62
|
-
if
|
63
|
-
@dsl = Nanoc::Extra::Checking::DSL.from_file(
|
68
|
+
if self.has_dsl?
|
69
|
+
@dsl = Nanoc::Extra::Checking::DSL.from_file(CHECKS_FILENAME)
|
64
70
|
else
|
65
71
|
@dsl = nil
|
66
72
|
end
|
67
73
|
@dsl_loaded = true
|
68
74
|
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def require_dsl
|
78
|
+
self.load_dsl_if_available
|
79
|
+
if self.dsl.nil?
|
80
|
+
raise Nanoc::Errors::GenericTrivial, "No checks defined (no #{CHECKS_FILENAME} file present)"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def dsl
|
69
85
|
@dsl
|
70
86
|
end
|
71
87
|
|
data/lib/nanoc/filters/xsl.rb
CHANGED
@@ -43,4 +43,16 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < MiniTest::Unit::TestCa
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_remove_query_string
|
47
|
+
with_site do |site|
|
48
|
+
FileUtils.mkdir_p('output/stuff')
|
49
|
+
File.open('output/stuff/right', 'w') { |io| io.write('hi') }
|
50
|
+
|
51
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site)
|
52
|
+
|
53
|
+
assert check.send(:valid?, 'stuff/right?foo=123', 'output/origin')
|
54
|
+
refute check.send(:valid?, 'stuff/wrong?foo=123', 'output/origin')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
46
58
|
end
|
@@ -4,7 +4,7 @@ class Nanoc::Extra::Checking::RunnerTest < MiniTest::Unit::TestCase
|
|
4
4
|
|
5
5
|
include Nanoc::TestHelpers
|
6
6
|
|
7
|
-
def
|
7
|
+
def test_run_specific
|
8
8
|
with_site do |site|
|
9
9
|
File.open('output/blah', 'w') { |io| io.write('I am stale! Haha!') }
|
10
10
|
runner = Nanoc::Extra::Checking::Runner.new(site)
|
@@ -12,4 +12,36 @@ class Nanoc::Extra::Checking::RunnerTest < MiniTest::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
def test_run_specific_custom
|
16
|
+
with_site do |site|
|
17
|
+
File.open('Checks', 'w') do |io|
|
18
|
+
io.write('check :my_foo_check do ; puts "I AM FOO!" ; end')
|
19
|
+
end
|
20
|
+
|
21
|
+
runner = Nanoc::Extra::Checking::Runner.new(site)
|
22
|
+
ios = capturing_stdio do
|
23
|
+
runner.run_specific(%w( my_foo_check ))
|
24
|
+
end
|
25
|
+
|
26
|
+
assert ios[:stdout].include?('I AM FOO!')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_list_checks
|
31
|
+
with_site do |site|
|
32
|
+
File.open('Checks', 'w') do |io|
|
33
|
+
io.write('check :my_foo_check do ; end')
|
34
|
+
end
|
35
|
+
|
36
|
+
runner = Nanoc::Extra::Checking::Runner.new(site)
|
37
|
+
ios = capturing_stdio do
|
38
|
+
runner.list_checks
|
39
|
+
end
|
40
|
+
|
41
|
+
assert ios[:stdout].include?('my_foo_check')
|
42
|
+
assert ios[:stdout].include?('internal_links')
|
43
|
+
assert ios[:stderr].empty?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
15
47
|
end
|
data/test/filters/test_xsl.rb
CHANGED
@@ -82,8 +82,7 @@ EOS
|
|
82
82
|
if_have 'nokogiri' do
|
83
83
|
layout = Nanoc::Layout.new(SAMPLE_XSL, {}, '/layout/')
|
84
84
|
|
85
|
-
filter = ::Nanoc::Filters::XSL.new(
|
86
|
-
:layout => layout, :content => SAMPLE_XSL)
|
85
|
+
filter = ::Nanoc::Filters::XSL.new(:layout => layout)
|
87
86
|
result = filter.run(SAMPLE_XML_IN)
|
88
87
|
|
89
88
|
assert_equal SAMPLE_XML_OUT, result
|
@@ -94,8 +93,7 @@ EOS
|
|
94
93
|
if_have 'nokogiri' do
|
95
94
|
layout = Nanoc::Layout.new(SAMPLE_XSL_WITH_PARAMS, {}, '/layout/')
|
96
95
|
|
97
|
-
filter = ::Nanoc::Filters::XSL.new(
|
98
|
-
:layout => layout, :content => SAMPLE_XSL_WITH_PARAMS)
|
96
|
+
filter = ::Nanoc::Filters::XSL.new(:layout => layout)
|
99
97
|
result = filter.run(SAMPLE_XML_IN_WITH_PARAMS, :foo => 'bar')
|
100
98
|
|
101
99
|
assert_equal SAMPLE_XML_OUT_WITH_PARAMS, result
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.0b2
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cri
|