nanoc-core 4.11.14 → 4.11.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0567f73c8232ed3fb519dac300d399b81c0a02caae7a9d7e5df4702805a3e1a0
4
- data.tar.gz: 69d8c9cf02cd3130b6e9488883d0da8d6a25708fc2d8ba77e6d4c3885f1c570d
3
+ metadata.gz: 1d36108ed7c1e713b65fe5119960115a3a8749efb49acb59dca207bdd82e5892
4
+ data.tar.gz: d3799629cd606d9cb73aad14f798e2eac3e549149774e374e2a92832a4bc09e4
5
5
  SHA512:
6
- metadata.gz: 3fb04e132747a9a18e8e00399bbe9739d41b7c1a14fd2096103ad212d65016965b07a8933151ea2312a7d35236efd752b03c15017af003777327796d8dd196a3
7
- data.tar.gz: 2ce3598e084831f3f345ba5575a63abbae69b422ed2872461f966c53fa6e3bf43a040b9ed5fb44475afa55d9c183dd48f27a352dc1ff8071e6eb35cb147f963d
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
@@ -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
@@ -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 ::Nanoc::Core::Error, "Cannot find rule for layout matching #{layout_identifier}"
42
+ raise Nanoc::Core::Errors::CannotDetermineFilter.new(layout_identifier)
43
43
  end
44
44
 
45
45
  filter_args = filter_name_and_args.args
@@ -111,8 +111,12 @@ module Nanoc
111
111
  end
112
112
 
113
113
  def log_delete_and_run(thing)
114
- Nanoc::Core::NotificationCenter.post(:file_pruned, thing)
115
- yield unless @dry_run
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Core
5
- VERSION = '4.11.14'
5
+ VERSION = '4.11.15'
6
6
  end
7
7
  end
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.14
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: 2019-11-10 00:00:00.000000000 Z
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.0.6
303
+ rubygems_version: 3.1.2
303
304
  signing_key:
304
305
  specification_version: 4
305
306
  summary: Core of Nanoc