nanoc 4.11.2 → 4.11.3
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.
- checksums.yaml +4 -4
- data/NEWS.md +15 -8
- data/README.md +1 -1
- data/lib/nanoc.rb +4 -1
- data/lib/nanoc/base/entities.rb +0 -2
- data/lib/nanoc/base/entities/site.rb +8 -1
- data/lib/nanoc/base/errors.rb +0 -19
- data/lib/nanoc/base/services.rb +0 -3
- data/lib/nanoc/base/services/compiler/stage.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/load_stores.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +1 -1
- data/lib/nanoc/base/services/compiler_loader.rb +1 -1
- data/lib/nanoc/base/services/executor.rb +1 -1
- data/lib/nanoc/base/services/item_rep_builder.rb +22 -1
- data/lib/nanoc/base/services/outdatedness_checker.rb +2 -2
- data/lib/nanoc/base/services/outdatedness_rule.rb +1 -1
- data/lib/nanoc/checking/check.rb +1 -1
- data/lib/nanoc/checking/checks/external_links.rb +5 -0
- data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +2 -8
- data/lib/nanoc/cli/commands/create-site.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/commands/show-rules.rb +1 -1
- data/lib/nanoc/deploying/deployers.rb +2 -0
- data/lib/nanoc/deploying/deployers/git.rb +8 -16
- data/lib/nanoc/deploying/deployers/rsync.rb +1 -2
- data/lib/nanoc/extra.rb +0 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -5
- data/lib/nanoc/filters/colorize_syntax/colorizers.rb +3 -14
- data/lib/nanoc/filters/kramdown.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rainpress.rb +1 -1
- data/lib/nanoc/filters/rdiscount.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +4 -4
- data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
- data/lib/nanoc/helpers/capturing.rb +1 -1
- data/lib/nanoc/helpers/child_parent.rb +1 -1
- data/lib/nanoc/helpers/filtering.rb +1 -1
- data/lib/nanoc/helpers/html_escape.rb +1 -1
- data/lib/nanoc/helpers/link_to.rb +1 -1
- data/lib/nanoc/helpers/rendering.rb +1 -1
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/text.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +1 -1
- data/lib/nanoc/rule_dsl/action_provider.rb +1 -1
- data/lib/nanoc/rule_dsl/action_recorder.rb +2 -2
- data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +4 -4
- data/lib/nanoc/spec.rb +2 -7
- data/lib/nanoc/version.rb +1 -1
- metadata +62 -12
- data/lib/nanoc/base/entities/action_sequence.rb +0 -80
- data/lib/nanoc/base/entities/checksum_collection.rb +0 -34
- data/lib/nanoc/base/services/action_provider.rb +0 -34
- data/lib/nanoc/base/services/action_sequence_builder.rb +0 -55
- data/lib/nanoc/base/services/instrumentor.rb +0 -17
- data/lib/nanoc/extra/piper.rb +0 -47
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class ActionSequence
|
6
|
-
include Nanoc::Core::ContractsSupport
|
7
|
-
include Enumerable
|
8
|
-
DDMemoize.activate(self)
|
9
|
-
|
10
|
-
attr_reader :item_rep
|
11
|
-
attr_reader :actions
|
12
|
-
|
13
|
-
def initialize(item_rep, actions: [])
|
14
|
-
@item_rep = item_rep
|
15
|
-
@actions = actions
|
16
|
-
end
|
17
|
-
|
18
|
-
contract C::None => Numeric
|
19
|
-
def size
|
20
|
-
@actions.size
|
21
|
-
end
|
22
|
-
|
23
|
-
contract Numeric => C::Maybe[Nanoc::Core::ProcessingAction]
|
24
|
-
def [](idx)
|
25
|
-
@actions[idx]
|
26
|
-
end
|
27
|
-
|
28
|
-
contract C::None => C::ArrayOf[Nanoc::Core::ProcessingAction]
|
29
|
-
def snapshot_actions
|
30
|
-
@actions.select { |a| a.is_a?(Nanoc::Core::ProcessingActions::Snapshot) }
|
31
|
-
end
|
32
|
-
|
33
|
-
contract C::None => Array
|
34
|
-
def paths
|
35
|
-
snapshot_actions.map { |a| [a.snapshot_names, a.paths] }
|
36
|
-
end
|
37
|
-
|
38
|
-
memoized def serialize
|
39
|
-
serialize_uncached
|
40
|
-
end
|
41
|
-
|
42
|
-
contract C::None => Array
|
43
|
-
def serialize_uncached
|
44
|
-
to_a.map(&:serialize)
|
45
|
-
end
|
46
|
-
|
47
|
-
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
|
48
|
-
def each
|
49
|
-
@actions.each { |a| yield(a) }
|
50
|
-
self
|
51
|
-
end
|
52
|
-
|
53
|
-
contract C::Func[Nanoc::Core::ProcessingAction => C::Any] => self
|
54
|
-
def map
|
55
|
-
self.class.new(
|
56
|
-
@item_rep,
|
57
|
-
actions: @actions.map { |a| yield(a) },
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
def snapshots_defs
|
62
|
-
is_binary = @item_rep.item.content.binary?
|
63
|
-
snapshot_defs = []
|
64
|
-
|
65
|
-
each do |action|
|
66
|
-
case action
|
67
|
-
when Nanoc::Core::ProcessingActions::Snapshot
|
68
|
-
action.snapshot_names.each do |snapshot_name|
|
69
|
-
snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary)
|
70
|
-
end
|
71
|
-
when Nanoc::Core::ProcessingActions::Filter
|
72
|
-
is_binary = Nanoc::Filter.named!(action.filter_name).to_binary?
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
snapshot_defs
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class ChecksumCollection
|
6
|
-
include Nanoc::Core::ContractsSupport
|
7
|
-
|
8
|
-
c_obj = C::Or[Nanoc::Core::Item, Nanoc::Core::Layout, Nanoc::Core::Configuration, Nanoc::Core::CodeSnippet]
|
9
|
-
|
10
|
-
def initialize(checksums)
|
11
|
-
@checksums = checksums
|
12
|
-
end
|
13
|
-
|
14
|
-
contract c_obj => C::Maybe[String]
|
15
|
-
def checksum_for(obj)
|
16
|
-
@checksums[obj.reference]
|
17
|
-
end
|
18
|
-
|
19
|
-
contract c_obj => C::Maybe[String]
|
20
|
-
def content_checksum_for(obj)
|
21
|
-
@checksums[[obj.reference, :content]]
|
22
|
-
end
|
23
|
-
|
24
|
-
contract c_obj => C::Maybe[C::HashOf[Symbol, String]]
|
25
|
-
def attributes_checksum_for(obj)
|
26
|
-
@checksums[[obj.reference, :each_attribute]]
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_h
|
30
|
-
@checksums
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
# @private
|
6
|
-
class ActionProvider
|
7
|
-
extend DDPlugin::Plugin
|
8
|
-
|
9
|
-
def self.for(_site)
|
10
|
-
raise NotImplementedError
|
11
|
-
end
|
12
|
-
|
13
|
-
def rep_names_for(_item)
|
14
|
-
raise NotImplementedError
|
15
|
-
end
|
16
|
-
|
17
|
-
def action_sequence_for(_obj)
|
18
|
-
raise NotImplementedError
|
19
|
-
end
|
20
|
-
|
21
|
-
def need_preprocessing?
|
22
|
-
raise NotImplementedError
|
23
|
-
end
|
24
|
-
|
25
|
-
def preprocess(_site)
|
26
|
-
raise NotImplementedError
|
27
|
-
end
|
28
|
-
|
29
|
-
def postprocess(_site, _reps)
|
30
|
-
raise NotImplementedError
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
class ActionSequenceBuilder
|
6
|
-
include Nanoc::Core::ContractsSupport
|
7
|
-
|
8
|
-
def self.build(rep)
|
9
|
-
builder = new(rep)
|
10
|
-
yield(builder)
|
11
|
-
builder.action_sequence
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(item_rep)
|
15
|
-
@item_rep = item_rep
|
16
|
-
@actions = []
|
17
|
-
end
|
18
|
-
|
19
|
-
contract Symbol, Hash => self
|
20
|
-
def add_filter(filter_name, params)
|
21
|
-
@actions << Nanoc::Core::ProcessingActions::Filter.new(filter_name, params)
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
|
-
contract String, C::Maybe[Hash] => self
|
26
|
-
def add_layout(layout_identifier, params)
|
27
|
-
@actions << Nanoc::Core::ProcessingActions::Layout.new(layout_identifier, params)
|
28
|
-
self
|
29
|
-
end
|
30
|
-
|
31
|
-
contract Symbol, C::Maybe[String] => self
|
32
|
-
def add_snapshot(snapshot_name, path)
|
33
|
-
will_add_snapshot(snapshot_name)
|
34
|
-
@actions << Nanoc::Core::ProcessingActions::Snapshot.new([snapshot_name], path ? [path] : [])
|
35
|
-
self
|
36
|
-
end
|
37
|
-
|
38
|
-
contract C::None => Nanoc::Int::ActionSequence
|
39
|
-
def action_sequence
|
40
|
-
Nanoc::Int::ActionSequence.new(@item_rep, actions: @actions)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def will_add_snapshot(name)
|
46
|
-
@_snapshot_names ||= Set.new
|
47
|
-
if @_snapshot_names.include?(name)
|
48
|
-
raise Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName.new(@item_rep, name)
|
49
|
-
else
|
50
|
-
@_snapshot_names << name
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
module Int
|
5
|
-
# @api private
|
6
|
-
class Instrumentor
|
7
|
-
def self.call(key, *args)
|
8
|
-
stopwatch = DDMetrics::Stopwatch.new
|
9
|
-
stopwatch.start
|
10
|
-
yield
|
11
|
-
ensure
|
12
|
-
stopwatch.stop
|
13
|
-
Nanoc::Core::NotificationCenter.post(key, stopwatch.duration, *args)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/nanoc/extra/piper.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Extra
|
4
|
-
# @api private
|
5
|
-
class Piper
|
6
|
-
class Error < ::Nanoc::Int::Errors::Generic
|
7
|
-
def initialize(command, exit_code)
|
8
|
-
@command = command
|
9
|
-
@exit_code = exit_code
|
10
|
-
end
|
11
|
-
|
12
|
-
def message
|
13
|
-
"command exited with a nonzero status code #{@exit_code} (command: #{@command.join(' ')})"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
# @param [IO] stdout
|
18
|
-
# @param [IO] stderr
|
19
|
-
def initialize(stdout: $stdout, stderr: $stderr)
|
20
|
-
@stdout = stdout
|
21
|
-
@stderr = stderr
|
22
|
-
end
|
23
|
-
|
24
|
-
# @param [Array<String>] cmd
|
25
|
-
#
|
26
|
-
# @param [String, nil] input
|
27
|
-
def run(cmd, input)
|
28
|
-
Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thr|
|
29
|
-
stdout_thread = Thread.new { @stdout << stdout.read }
|
30
|
-
stderr_thread = Thread.new { @stderr << stderr.read }
|
31
|
-
|
32
|
-
if input
|
33
|
-
stdin << input
|
34
|
-
end
|
35
|
-
stdin.close
|
36
|
-
|
37
|
-
stdout_thread.join
|
38
|
-
stderr_thread.join
|
39
|
-
|
40
|
-
exit_status = wait_thr.value
|
41
|
-
unless exit_status.success?
|
42
|
-
raise Error.new(cmd, exit_status.to_i)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|