nanoc 4.8.19 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/NEWS.md +21 -0
- data/lib/nanoc.rb +5 -4
- data/lib/nanoc/base/entities/directed_graph.rb +4 -4
- data/lib/nanoc/base/entities/identifier.rb +5 -0
- data/lib/nanoc/base/feature.rb +1 -2
- data/lib/nanoc/base/repos/dependency_store.rb +4 -4
- data/lib/nanoc/base/services/compiler/phases/abstract.rb +8 -0
- data/lib/nanoc/base/services/compiler/phases/write.rb +58 -1
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +39 -29
- data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +2 -2
- data/lib/nanoc/base/services/instrumentor.rb +1 -1
- data/lib/nanoc/base/services/item_rep_writer.rb +2 -2
- data/lib/nanoc/base/views/compilation_item_rep_view.rb +7 -0
- data/lib/nanoc/checking.rb +4 -1
- data/lib/nanoc/checking/check.rb +7 -0
- data/lib/nanoc/checking/checks/external_links.rb +21 -12
- data/lib/nanoc/checking/dsl.rb +5 -7
- data/lib/nanoc/checking/loader.rb +50 -0
- data/lib/nanoc/checking/runner.rb +18 -40
- data/lib/nanoc/cli.rb +1 -1
- data/lib/nanoc/cli/ansi_string_colorizer.rb +4 -4
- data/lib/nanoc/cli/cleaning_stream.rb +12 -12
- data/lib/nanoc/cli/commands/check.rb +5 -15
- data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +7 -7
- data/lib/nanoc/cli/commands/compile_listeners/file_action_printer.rb +12 -2
- data/lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb +27 -19
- data/lib/nanoc/cli/commands/deploy.rb +1 -1
- data/lib/nanoc/cli/commands/show-rules.rb +2 -2
- data/lib/nanoc/cli/error_handler.rb +1 -4
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -2
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -2
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -2
- data/lib/nanoc/data_sources/filesystem/parser.rb +1 -1
- data/lib/nanoc/deploying/deployers/fog.rb +3 -3
- data/lib/nanoc/extra.rb +1 -2
- data/lib/nanoc/filters/colorize_syntax.rb +2 -2
- data/lib/nanoc/filters/relativize_paths.rb +2 -2
- data/lib/nanoc/helpers/blogging.rb +11 -11
- data/lib/nanoc/rule_dsl/compilation_rule_context.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- metadata +27 -13
- data/lib/nanoc/extra/parallel_collection.rb +0 -57
@@ -150,10 +150,7 @@ module Nanoc::CLI
|
|
150
150
|
|
151
151
|
# @api private
|
152
152
|
def forwards_stack_trace?
|
153
|
-
|
154
|
-
ruby_2_5_used = ruby_version.start_with?('2.5')
|
155
|
-
|
156
|
-
feature_enabled || ruby_2_5_used
|
153
|
+
ruby_version.start_with?('2.5')
|
157
154
|
end
|
158
155
|
|
159
156
|
# @api private
|
@@ -11,10 +11,10 @@ module Nanoc::CLI::StreamCleaners
|
|
11
11
|
class Abstract
|
12
12
|
# Returns a cleaned version of the given string.
|
13
13
|
#
|
14
|
-
# @param [String]
|
14
|
+
# @param [String] str The string to clean
|
15
15
|
#
|
16
16
|
# @return [String] The cleaned string
|
17
|
-
def clean(
|
17
|
+
def clean(str) # rubocop:disable Lint/UnusedMethodArgument
|
18
18
|
raise NotImplementedError, 'Subclasses of Nanoc::CLI::StreamCleaners::Abstract must implement #clean'
|
19
19
|
end
|
20
20
|
end
|
@@ -6,9 +6,9 @@ module Nanoc::CLI::StreamCleaners
|
|
6
6
|
# @api private
|
7
7
|
class UTF8 < Abstract
|
8
8
|
# @see Nanoc::CLI::StreamCleaners::Abstract#clean
|
9
|
-
def clean(
|
9
|
+
def clean(str)
|
10
10
|
# FIXME: this decomposition is not generally usable
|
11
|
-
|
11
|
+
str
|
12
12
|
.unicode_normalize(:nfkd)
|
13
13
|
.tr('─┼“”‘’', '-+""\'\'')
|
14
14
|
.gsub('©', '(c)')
|
data/lib/nanoc/extra.rb
CHANGED
@@ -15,8 +15,7 @@ module Nanoc::Extra
|
|
15
15
|
Pruner = Nanoc::Pruner
|
16
16
|
end
|
17
17
|
|
18
|
-
require_relative 'extra/link_collector
|
18
|
+
require_relative 'extra/link_collector'
|
19
19
|
require_relative 'extra/piper'
|
20
20
|
require_relative 'extra/jruby_nokogiri_warner'
|
21
21
|
require_relative 'extra/core_ext'
|
22
|
-
require_relative 'extra/parallel_collection'
|
@@ -128,8 +128,8 @@ module Nanoc::Filters
|
|
128
128
|
protected
|
129
129
|
|
130
130
|
# Removes the first blank lines and any whitespace at the end.
|
131
|
-
def strip(
|
132
|
-
|
131
|
+
def strip(str)
|
132
|
+
str.lines.drop_while { |line| line.strip.empty? }.join.rstrip
|
133
133
|
end
|
134
134
|
|
135
135
|
def colorizer_name_for(language)
|
@@ -137,25 +137,25 @@ module Nanoc::Helpers
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
def build_for_article(
|
140
|
+
def build_for_article(article, xml)
|
141
141
|
# Get URL
|
142
|
-
url = url_for(
|
142
|
+
url = url_for(article)
|
143
143
|
return if url.nil?
|
144
144
|
|
145
145
|
xml.entry do
|
146
146
|
# Add primary attributes
|
147
|
-
xml.id atom_tag_for(
|
148
|
-
xml.title
|
147
|
+
xml.id atom_tag_for(article)
|
148
|
+
xml.title article[:title], type: 'html'
|
149
149
|
|
150
150
|
# Add dates
|
151
|
-
xml.published attribute_to_time(
|
152
|
-
xml.updated attribute_to_time(
|
151
|
+
xml.published attribute_to_time(article[:created_at]).__nanoc_to_iso8601_time
|
152
|
+
xml.updated attribute_to_time(article[:updated_at] || article[:created_at]).__nanoc_to_iso8601_time
|
153
153
|
|
154
154
|
# Add specific author information
|
155
|
-
if
|
155
|
+
if article[:author_name] || article[:author_uri]
|
156
156
|
xml.author do
|
157
|
-
xml.name
|
158
|
-
xml.uri
|
157
|
+
xml.name article[:author_name] || author_name
|
158
|
+
xml.uri article[:author_uri] || author_uri
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
@@ -163,8 +163,8 @@ module Nanoc::Helpers
|
|
163
163
|
xml.link(rel: 'alternate', href: url)
|
164
164
|
|
165
165
|
# Add content
|
166
|
-
summary = excerpt_proc.call(
|
167
|
-
xml.content content_proc.call(
|
166
|
+
summary = excerpt_proc.call(article)
|
167
|
+
xml.content content_proc.call(article), type: 'html'
|
168
168
|
xml.summary summary, type: 'html' unless summary.nil?
|
169
169
|
end
|
170
170
|
end
|
data/lib/nanoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -42,18 +42,18 @@ dependencies:
|
|
42
42
|
name: ddmemoize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0
|
47
|
+
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: ddmetrics
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: ddplugin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0
|
75
|
+
version: '1.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0
|
82
|
+
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: hamster
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: parallel
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.12'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.12'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: ref
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -282,6 +296,7 @@ files:
|
|
282
296
|
- lib/nanoc/checking/checks/w3c_validator.rb
|
283
297
|
- lib/nanoc/checking/dsl.rb
|
284
298
|
- lib/nanoc/checking/issue.rb
|
299
|
+
- lib/nanoc/checking/loader.rb
|
285
300
|
- lib/nanoc/checking/runner.rb
|
286
301
|
- lib/nanoc/cli.rb
|
287
302
|
- lib/nanoc/cli/ansi_string_colorizer.rb
|
@@ -328,7 +343,6 @@ files:
|
|
328
343
|
- lib/nanoc/extra/core_ext/time.rb
|
329
344
|
- lib/nanoc/extra/jruby_nokogiri_warner.rb
|
330
345
|
- lib/nanoc/extra/link_collector.rb
|
331
|
-
- lib/nanoc/extra/parallel_collection.rb
|
332
346
|
- lib/nanoc/extra/piper.rb
|
333
347
|
- lib/nanoc/filters.rb
|
334
348
|
- lib/nanoc/filters/asciidoc.rb
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Extra
|
4
|
-
# @api private
|
5
|
-
class ParallelCollection
|
6
|
-
STOP = Object.new
|
7
|
-
|
8
|
-
include Nanoc::Int::ContractsSupport
|
9
|
-
|
10
|
-
contract C::RespondTo[:each], C::KeywordArgs[parallelism: Integer] => C::Any
|
11
|
-
def initialize(enum, parallelism: 2)
|
12
|
-
@enum = enum
|
13
|
-
@parallelism = parallelism
|
14
|
-
end
|
15
|
-
|
16
|
-
contract C::Func[C::Any => C::Any] => self
|
17
|
-
def each
|
18
|
-
queue = SizedQueue.new(2 * @parallelism)
|
19
|
-
error = nil
|
20
|
-
|
21
|
-
threads = (1..@parallelism).map do
|
22
|
-
Thread.new do
|
23
|
-
loop do
|
24
|
-
begin
|
25
|
-
elem = queue.pop
|
26
|
-
break if error
|
27
|
-
break if STOP.equal?(elem)
|
28
|
-
yield elem
|
29
|
-
rescue => err
|
30
|
-
error = err
|
31
|
-
break
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
@enum.each { |e| queue << e }
|
38
|
-
@parallelism.times { queue << STOP }
|
39
|
-
|
40
|
-
threads.each(&:join)
|
41
|
-
|
42
|
-
raise error if error
|
43
|
-
self
|
44
|
-
end
|
45
|
-
|
46
|
-
contract C::Func[C::Any => C::Any] => C::RespondTo[:each]
|
47
|
-
def map
|
48
|
-
[].tap do |all|
|
49
|
-
mutex = Mutex.new
|
50
|
-
each do |e|
|
51
|
-
res = yield(e)
|
52
|
-
mutex.synchronize { all << res }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|