nanoc-core 4.11.14 → 4.11.15
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/lib/nanoc/core/changes_stream.rb +55 -0
- data/lib/nanoc/core/checksum_store.rb +1 -1
- data/lib/nanoc/core/contracts_support.rb +20 -0
- data/lib/nanoc/core/errors.rb +11 -0
- data/lib/nanoc/core/executor.rb +1 -1
- data/lib/nanoc/core/pruner.rb +6 -2
- data/lib/nanoc/core/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d36108ed7c1e713b65fe5119960115a3a8749efb49acb59dca207bdd82e5892
|
4
|
+
data.tar.gz: d3799629cd606d9cb73aad14f798e2eac3e549149774e374e2a92832a4bc09e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aea180789234158ce9d449d922e2bc88b4daf2ba877870eb865cfc0fbae52ac60995439294f2a70bc2c705a248d1dc512431a3df45beda5c4567a8046c06349
|
7
|
+
data.tar.gz: edd1525adfe8ca4e64a227b6dc57c131a674d6bc56071d0befe29b1c765a97933b76102f5acfbf44c7f130c7b746e5494604183392331f7756170064dfec8cd1
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
module Core
|
5
|
+
class ChangesStream
|
6
|
+
class ChangesListener
|
7
|
+
def initialize(y)
|
8
|
+
@y = y
|
9
|
+
end
|
10
|
+
|
11
|
+
def unknown
|
12
|
+
@y << :unknown
|
13
|
+
end
|
14
|
+
|
15
|
+
def lib
|
16
|
+
@y << :lib
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_stop(&block)
|
20
|
+
if block_given?
|
21
|
+
@to_stop = block
|
22
|
+
else
|
23
|
+
@to_stop
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(enum: nil)
|
29
|
+
@enum = enum
|
30
|
+
@enum ||=
|
31
|
+
Enumerator.new do |y|
|
32
|
+
@listener = ChangesListener.new(y)
|
33
|
+
yield(@listener)
|
34
|
+
end.lazy
|
35
|
+
end
|
36
|
+
|
37
|
+
def stop
|
38
|
+
@listener&.to_stop&.call
|
39
|
+
end
|
40
|
+
|
41
|
+
def map
|
42
|
+
self.class.new(enum: @enum.map { |e| yield(e) })
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_enum
|
46
|
+
@enum
|
47
|
+
end
|
48
|
+
|
49
|
+
def each
|
50
|
+
@enum.each { |e| yield(e) }
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -64,7 +64,7 @@ module Nanoc
|
|
64
64
|
|
65
65
|
@checksums = {}
|
66
66
|
new_data.each_pair do |key, checksum|
|
67
|
-
if references.include?(key) || references.include?(key.first)
|
67
|
+
if references.include?(key) || (key.respond_to?(:first) && references.include?(key.first))
|
68
68
|
@checksums[key] = checksum
|
69
69
|
end
|
70
70
|
end
|
@@ -103,6 +103,8 @@ module Nanoc
|
|
103
103
|
::Contracts.const_set('Named', EnabledContracts::Named)
|
104
104
|
::Contracts.const_set('IterOf', EnabledContracts::IterOf)
|
105
105
|
::Contracts.const_set('AbsolutePathString', EnabledContracts::AbsolutePathString)
|
106
|
+
|
107
|
+
warn_about_performance
|
106
108
|
end
|
107
109
|
|
108
110
|
@_contracts_support__should_enable
|
@@ -126,6 +128,24 @@ module Nanoc
|
|
126
128
|
base.const_set('C', DisabledContracts)
|
127
129
|
end
|
128
130
|
end
|
131
|
+
|
132
|
+
def self.warn_about_performance
|
133
|
+
return if ENV.key?('CI')
|
134
|
+
return if ENV.key?('NANOC_DEV_MODE')
|
135
|
+
|
136
|
+
puts '-' * 78
|
137
|
+
puts 'A NOTE ABOUT PERFORMANCE:'
|
138
|
+
puts 'The `contracts` gem is loaded, which enables extra run-time checks, but can drastically reduce Nanoc’s performance. The `contracts` gem is intended for development purposes, and is not recommended for day-to-day Nanoc usage.'
|
139
|
+
puts
|
140
|
+
|
141
|
+
if defined?(Bundler)
|
142
|
+
puts 'To speed up compilation, remove `contracts` from the Gemfile and run `bundle install`.'
|
143
|
+
else
|
144
|
+
puts 'To speed up compilation, either uninstall the `contracts` gem, or use Bundler (https://bundler.io/) with a Gemfile that doesn’t include `contracts`.'
|
145
|
+
end
|
146
|
+
|
147
|
+
puts '-' * 78
|
148
|
+
end
|
129
149
|
end
|
130
150
|
end
|
131
151
|
end
|
data/lib/nanoc/core/errors.rb
CHANGED
@@ -88,6 +88,17 @@ module Nanoc
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
# Error that is raised during site compilation when a layout is compiled
|
92
|
+
# for which the filter cannot be determined. This is similar to the
|
93
|
+
# {UnknownFilter} error, but specific for filters for layouts.
|
94
|
+
class CannotDetermineFilter < ::Nanoc::Core::Error
|
95
|
+
# @param [String] layout_identifier The identifier of the layout for
|
96
|
+
# which the filter could not be determined
|
97
|
+
def initialize(layout_identifier)
|
98
|
+
super("The filter to be used for the “#{layout_identifier}” layout could not be determined. Make sure the layout does have a filter.")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
91
102
|
# Error that is raised when the compiled content of a binary item is attempted to be accessed.
|
92
103
|
class CannotGetCompiledContentOfBinaryItem < ::Nanoc::Core::Error
|
93
104
|
# @param [Nanoc::Core::ItemRep] rep The binary item representation whose compiled content was attempted to be accessed
|
data/lib/nanoc/core/executor.rb
CHANGED
@@ -39,7 +39,7 @@ module Nanoc
|
|
39
39
|
filter_name_and_args = @compilation_context.filter_name_and_args_for_layout(layout)
|
40
40
|
filter_name = filter_name_and_args.name
|
41
41
|
if filter_name.nil?
|
42
|
-
raise
|
42
|
+
raise Nanoc::Core::Errors::CannotDetermineFilter.new(layout_identifier)
|
43
43
|
end
|
44
44
|
|
45
45
|
filter_args = filter_name_and_args.args
|
data/lib/nanoc/core/pruner.rb
CHANGED
@@ -111,8 +111,12 @@ module Nanoc
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def log_delete_and_run(thing)
|
114
|
-
|
115
|
-
|
114
|
+
if @dry_run
|
115
|
+
Nanoc::Core::NotificationCenter.post(:file_listed_for_pruning, thing)
|
116
|
+
else
|
117
|
+
Nanoc::Core::NotificationCenter.post(:file_pruned, thing)
|
118
|
+
yield
|
119
|
+
end
|
116
120
|
end
|
117
121
|
end
|
118
122
|
end
|
data/lib/nanoc/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.11.
|
4
|
+
version: 4.11.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ddmemoize
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/nanoc/core/basic_item_view.rb
|
158
158
|
- lib/nanoc/core/binary_compiled_content_cache.rb
|
159
159
|
- lib/nanoc/core/binary_content.rb
|
160
|
+
- lib/nanoc/core/changes_stream.rb
|
160
161
|
- lib/nanoc/core/checksum_collection.rb
|
161
162
|
- lib/nanoc/core/checksum_store.rb
|
162
163
|
- lib/nanoc/core/checksummer.rb
|
@@ -299,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
300
|
- !ruby/object:Gem::Version
|
300
301
|
version: '0'
|
301
302
|
requirements: []
|
302
|
-
rubygems_version: 3.
|
303
|
+
rubygems_version: 3.1.2
|
303
304
|
signing_key:
|
304
305
|
specification_version: 4
|
305
306
|
summary: Core of Nanoc
|