nanoc-core 4.11.9 → 4.11.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nanoc/core/assertions.rb +57 -0
- data/lib/nanoc/core/compilation_stage.rb +30 -0
- data/lib/nanoc/core/dependency_tracker.rb +15 -13
- data/lib/nanoc/core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bde53d2e1bec25a921b1f9113fbec46413e9609a0c23963ddb771c2d5b0a1b67
|
4
|
+
data.tar.gz: 8ec1effe075cf43aa17a959bb38ca5d39c34f29d2aed8a860e705198f07c19b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7ff9851b6196ddfb5b9ec002f127176d74d7f9da5d949c477c00b052ceb2d2d412a70cc203691306986d6c6f87d65e4be2ca963e2ab67d9089eaf2f98378ae
|
7
|
+
data.tar.gz: fa0ff8cf4addec45b8ce38d8451a1da93bcf2e53ca5de12dcd3c46454f0c9571ec665c9c2417a549b26bd3449a62ae2836c122d59a832ab18f572afc4b032c4b
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
module Core
|
5
|
+
module Assertions
|
6
|
+
class AssertionFailure < Nanoc::Core::Error
|
7
|
+
end
|
8
|
+
|
9
|
+
module Mixin
|
10
|
+
def assert(assertion)
|
11
|
+
return unless Nanoc::Core::ContractsSupport.enabled?
|
12
|
+
|
13
|
+
unless assertion.call
|
14
|
+
raise AssertionFailure, "assertion failed: #{assertion.class}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Base
|
20
|
+
def call
|
21
|
+
raise NotImplementedError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class AllItemRepsHaveCompiledContent < Nanoc::Core::Assertions::Base
|
26
|
+
include Nanoc::Core::ContractsSupport
|
27
|
+
|
28
|
+
contract C::KeywordArgs[compiled_content_cache: C::Or[Nanoc::Core::CompiledContentCache, Nanoc::Core::TextualCompiledContentCache], item_reps: Nanoc::Core::ItemRepRepo] => C::Any
|
29
|
+
def initialize(compiled_content_cache:, item_reps:)
|
30
|
+
@compiled_content_cache = compiled_content_cache
|
31
|
+
@item_reps = item_reps
|
32
|
+
end
|
33
|
+
|
34
|
+
contract C::None => C::Bool
|
35
|
+
def call
|
36
|
+
@item_reps.all? do |rep|
|
37
|
+
@compiled_content_cache[rep]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class PathIsAbsolute < Nanoc::Core::Assertions::Base
|
43
|
+
include Nanoc::Core::ContractsSupport
|
44
|
+
|
45
|
+
contract C::KeywordArgs[path: String] => C::Any
|
46
|
+
def initialize(path:)
|
47
|
+
@path = path
|
48
|
+
end
|
49
|
+
|
50
|
+
contract C::None => C::Bool
|
51
|
+
def call
|
52
|
+
Pathname.new(@path).absolute?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
module Core
|
5
|
+
class CompilationStage
|
6
|
+
def call(*args)
|
7
|
+
notify(:stage_started)
|
8
|
+
res = Nanoc::Core::Instrumentor.call(:stage_ran, self.class) do
|
9
|
+
run(*args)
|
10
|
+
end
|
11
|
+
notify(:stage_ended)
|
12
|
+
res
|
13
|
+
rescue
|
14
|
+
notify(:stage_aborted)
|
15
|
+
raise
|
16
|
+
end
|
17
|
+
|
18
|
+
def run(*)
|
19
|
+
raise NotImplementedError
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def notify(sym)
|
25
|
+
name = self.class.to_s.sub(/^.*::/, '')
|
26
|
+
Nanoc::Core::NotificationCenter.post(sym, name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -11,19 +11,6 @@ module Nanoc
|
|
11
11
|
C_ATTR = C::Or[C::IterOf[Symbol], C::Bool]
|
12
12
|
C_ARGS = C::KeywordArgs[raw_content: C::Optional[C_RAW_CONTENT], attributes: C::Optional[C_ATTR], compiled_content: C::Optional[C::Bool], path: C::Optional[C::Bool]]
|
13
13
|
|
14
|
-
class Null
|
15
|
-
include Nanoc::Core::ContractsSupport
|
16
|
-
|
17
|
-
contract C_OBJ, C_ARGS => C::Any
|
18
|
-
def enter(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end
|
19
|
-
|
20
|
-
contract C_OBJ => C::Any
|
21
|
-
def exit; end
|
22
|
-
|
23
|
-
contract C_OBJ, C_ARGS => C::Any
|
24
|
-
def bounce(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end
|
25
|
-
end
|
26
|
-
|
27
14
|
attr_reader :dependency_store
|
28
15
|
|
29
16
|
def initialize(dependency_store)
|
@@ -58,6 +45,21 @@ module Nanoc
|
|
58
45
|
enter(obj, raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
|
59
46
|
exit
|
60
47
|
end
|
48
|
+
|
49
|
+
class Null < DependencyTracker
|
50
|
+
include Nanoc::Core::ContractsSupport
|
51
|
+
|
52
|
+
def initialize; end
|
53
|
+
|
54
|
+
contract C_OBJ, C_ARGS => C::Any
|
55
|
+
def enter(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end
|
56
|
+
|
57
|
+
contract C_OBJ => C::Any
|
58
|
+
def exit; end
|
59
|
+
|
60
|
+
contract C_OBJ, C_ARGS => C::Any
|
61
|
+
def bounce(_obj, raw_content: false, attributes: false, compiled_content: false, path: false); end
|
62
|
+
end
|
61
63
|
end
|
62
64
|
end
|
63
65
|
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.10
|
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-08-
|
11
|
+
date: 2019-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ddmemoize
|
@@ -123,12 +123,14 @@ files:
|
|
123
123
|
- lib/nanoc/core/action_sequence_builder.rb
|
124
124
|
- lib/nanoc/core/action_sequence_store.rb
|
125
125
|
- lib/nanoc/core/aggregate_data_source.rb
|
126
|
+
- lib/nanoc/core/assertions.rb
|
126
127
|
- lib/nanoc/core/binary_compiled_content_cache.rb
|
127
128
|
- lib/nanoc/core/binary_content.rb
|
128
129
|
- lib/nanoc/core/checksum_collection.rb
|
129
130
|
- lib/nanoc/core/checksum_store.rb
|
130
131
|
- lib/nanoc/core/checksummer.rb
|
131
132
|
- lib/nanoc/core/code_snippet.rb
|
133
|
+
- lib/nanoc/core/compilation_stage.rb
|
132
134
|
- lib/nanoc/core/compiled_content_cache.rb
|
133
135
|
- lib/nanoc/core/compiled_content_store.rb
|
134
136
|
- lib/nanoc/core/configuration-schema.json
|