nanoc-core 4.12.14 → 4.12.15
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/compiler.rb +10 -10
- data/lib/nanoc/core/content.rb +13 -13
- data/lib/nanoc/core/identifier.rb +2 -2
- data/lib/nanoc/core/item.rb +7 -0
- data/lib/nanoc/core/item_rep_builder.rb +19 -19
- data/lib/nanoc/core/layout.rb +7 -0
- data/lib/nanoc/core/outdatedness_rule.rb +15 -15
- data/lib/nanoc/core/processing_action.rb +1 -1
- data/lib/nanoc/core/pruner.rb +1 -1
- data/lib/nanoc/core/site_loader.rb +4 -5
- data/lib/nanoc/core/store.rb +16 -16
- data/lib/nanoc/core/version.rb +1 -1
- data/lib/nanoc/core.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1155c2a418cc7a640cf633fee727e370db4958398fa27a8502c6bdde7bf42fe3
|
4
|
+
data.tar.gz: 77baa912832b0f2b507517e17b7a4699feb12c66c3b1d6f7f47aca2da013576d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c00053dd8c95b7ccbf444636e9f41adf17f2f14a3cb76799a54104d69be8a61a69825e592a55ff42b330ea917995067429342d6f87119775479a9dbf47cc1b7e
|
7
|
+
data.tar.gz: ebec2ea48fac543a2becdf64330dce3f6ab8b017fda3f5078c9b7cdecd5461c9cab016ba66dbcf273f09313a32f471066a322d5cc9aea05774306ce54d9f0ef5
|
data/lib/nanoc/core/compiler.rb
CHANGED
@@ -5,6 +5,16 @@ module Nanoc
|
|
5
5
|
class Compiler
|
6
6
|
include Nanoc::Core::ContractsSupport
|
7
7
|
|
8
|
+
contract Nanoc::Core::Site => C::Any
|
9
|
+
def self.compile(site)
|
10
|
+
new_for(site).run_until_end
|
11
|
+
end
|
12
|
+
|
13
|
+
contract Nanoc::Core::Site => Nanoc::Core::Compiler
|
14
|
+
def self.new_for(site)
|
15
|
+
Nanoc::Core::CompilerLoader.new.load(site)
|
16
|
+
end
|
17
|
+
|
8
18
|
def initialize(site, compiled_content_cache:, checksum_store:, action_sequence_store:, action_provider:, dependency_store:, outdatedness_store:)
|
9
19
|
@site = site
|
10
20
|
|
@@ -21,16 +31,6 @@ module Nanoc
|
|
21
31
|
@compiled_content_store = Nanoc::Core::CompiledContentStore.new
|
22
32
|
end
|
23
33
|
|
24
|
-
contract Nanoc::Core::Site => C::Any
|
25
|
-
def self.compile(site)
|
26
|
-
new_for(site).run_until_end
|
27
|
-
end
|
28
|
-
|
29
|
-
contract Nanoc::Core::Site => Nanoc::Core::Compiler
|
30
|
-
def self.new_for(site)
|
31
|
-
Nanoc::Core::CompilerLoader.new.load(site)
|
32
|
-
end
|
33
|
-
|
34
34
|
def run_until_preprocessed
|
35
35
|
@_res_preprocessed ||= begin
|
36
36
|
preprocess_stage.call
|
data/lib/nanoc/core/content.rb
CHANGED
@@ -5,6 +5,19 @@ module Nanoc
|
|
5
5
|
class Content
|
6
6
|
include Nanoc::Core::ContractsSupport
|
7
7
|
|
8
|
+
contract C::Or[self, String, Proc], C::KeywordArgs[binary: C::Optional[C::Bool], filename: C::Optional[C::Maybe[String]]] => self
|
9
|
+
def self.create(content, binary: false, filename: nil)
|
10
|
+
if content.nil?
|
11
|
+
raise ArgumentError, 'Cannot create nil content'
|
12
|
+
elsif content.is_a?(Nanoc::Core::Content)
|
13
|
+
content
|
14
|
+
elsif binary
|
15
|
+
Nanoc::Core::BinaryContent.new(content)
|
16
|
+
else
|
17
|
+
Nanoc::Core::TextualContent.new(content, filename: filename)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
contract C::None => C::Maybe[String]
|
9
22
|
attr_reader :filename
|
10
23
|
|
@@ -24,19 +37,6 @@ module Nanoc
|
|
24
37
|
self
|
25
38
|
end
|
26
39
|
|
27
|
-
contract C::Or[self, String, Proc], C::KeywordArgs[binary: C::Optional[C::Bool], filename: C::Optional[C::Maybe[String]]] => self
|
28
|
-
def self.create(content, binary: false, filename: nil)
|
29
|
-
if content.nil?
|
30
|
-
raise ArgumentError, 'Cannot create nil content'
|
31
|
-
elsif content.is_a?(Nanoc::Core::Content)
|
32
|
-
content
|
33
|
-
elsif binary
|
34
|
-
Nanoc::Core::BinaryContent.new(content)
|
35
|
-
else
|
36
|
-
Nanoc::Core::TextualContent.new(content, filename: filename)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
40
|
contract C::None => C::Bool
|
41
41
|
def binary?
|
42
42
|
raise NotImplementedError
|
@@ -164,7 +164,7 @@ module Nanoc
|
|
164
164
|
end
|
165
165
|
|
166
166
|
s = File.extname(@string)
|
167
|
-
s && s[1
|
167
|
+
s && s[1..]
|
168
168
|
end
|
169
169
|
|
170
170
|
contract C::None => String
|
@@ -195,7 +195,7 @@ module Nanoc
|
|
195
195
|
if res.empty?
|
196
196
|
[]
|
197
197
|
else
|
198
|
-
res[1
|
198
|
+
res[1..]
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
data/lib/nanoc/core/item.rb
CHANGED
@@ -6,6 +6,25 @@ module Nanoc
|
|
6
6
|
class ItemRepBuilder
|
7
7
|
include Nanoc::Core::ContractsSupport
|
8
8
|
|
9
|
+
contract Nanoc::Core::ActionSequence, Nanoc::Core::ItemRep => C::ArrayOf[Nanoc::Core::SnapshotDef]
|
10
|
+
def self.snapshot_defs_for(action_sequence, rep)
|
11
|
+
is_binary = rep.item.content.binary?
|
12
|
+
snapshot_defs = []
|
13
|
+
|
14
|
+
action_sequence.each do |action|
|
15
|
+
case action
|
16
|
+
when Nanoc::Core::ProcessingActions::Snapshot
|
17
|
+
action.snapshot_names.each do |snapshot_name|
|
18
|
+
snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary)
|
19
|
+
end
|
20
|
+
when Nanoc::Core::ProcessingActions::Filter
|
21
|
+
is_binary = Nanoc::Core::Filter.named!(action.filter_name).to_binary?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
snapshot_defs
|
26
|
+
end
|
27
|
+
|
9
28
|
attr_reader :reps
|
10
29
|
|
11
30
|
contract Nanoc::Core::Site, Nanoc::Core::ActionProvider, Nanoc::Core::ItemRepRepo => C::Any
|
@@ -30,25 +49,6 @@ module Nanoc
|
|
30
49
|
|
31
50
|
action_sequences
|
32
51
|
end
|
33
|
-
|
34
|
-
contract Nanoc::Core::ActionSequence, Nanoc::Core::ItemRep => C::ArrayOf[Nanoc::Core::SnapshotDef]
|
35
|
-
def self.snapshot_defs_for(action_sequence, rep)
|
36
|
-
is_binary = rep.item.content.binary?
|
37
|
-
snapshot_defs = []
|
38
|
-
|
39
|
-
action_sequence.each do |action|
|
40
|
-
case action
|
41
|
-
when Nanoc::Core::ProcessingActions::Snapshot
|
42
|
-
action.snapshot_names.each do |snapshot_name|
|
43
|
-
snapshot_defs << Nanoc::Core::SnapshotDef.new(snapshot_name, binary: is_binary)
|
44
|
-
end
|
45
|
-
when Nanoc::Core::ProcessingActions::Filter
|
46
|
-
is_binary = Nanoc::Core::Filter.named!(action.filter_name).to_binary?
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
snapshot_defs
|
51
|
-
end
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/lib/nanoc/core/layout.rb
CHANGED
@@ -7,19 +7,16 @@ module Nanoc
|
|
7
7
|
include Nanoc::Core::ContractsSupport
|
8
8
|
include Singleton
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
apply(obj, outdatedness_checker)
|
13
|
-
end
|
10
|
+
def self.affects_path?
|
11
|
+
@affects_path
|
14
12
|
end
|
15
13
|
|
16
|
-
def
|
17
|
-
|
14
|
+
def self.affects_attributes?
|
15
|
+
@affects_attributes
|
18
16
|
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
"#{self.class.name}(#{reason})"
|
18
|
+
def self.affects_compiled_content?
|
19
|
+
@affects_compiled_content
|
23
20
|
end
|
24
21
|
|
25
22
|
def self.affects_props(*names)
|
@@ -46,16 +43,19 @@ module Nanoc
|
|
46
43
|
@affects_raw_content
|
47
44
|
end
|
48
45
|
|
49
|
-
def
|
50
|
-
|
46
|
+
def call(obj, outdatedness_checker)
|
47
|
+
Nanoc::Core::Instrumentor.call(:outdatedness_rule_ran, self.class) do
|
48
|
+
apply(obj, outdatedness_checker)
|
49
|
+
end
|
51
50
|
end
|
52
51
|
|
53
|
-
def
|
54
|
-
|
52
|
+
def apply(_obj, _outdatedness_checker)
|
53
|
+
raise NotImplementedError.new('Nanoc::Core::OutdatednessRule subclasses must implement #apply')
|
55
54
|
end
|
56
55
|
|
57
|
-
|
58
|
-
|
56
|
+
contract C::None => String
|
57
|
+
def inspect
|
58
|
+
"#{self.class.name}(#{reason})"
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/nanoc/core/pruner.rb
CHANGED
@@ -4,16 +4,15 @@ module Nanoc
|
|
4
4
|
module Core
|
5
5
|
class SiteLoader
|
6
6
|
ENCODING_REGEX = /\A#\s+(-\*-\s+)?(en)?coding: (?<encoding>[^\s]+)(\s+-\*-\s*)?\n{0,2}/.freeze
|
7
|
-
|
8
|
-
def new_from_cwd
|
9
|
-
site_from_config(Nanoc::Core::ConfigLoader.new.new_from_cwd)
|
10
|
-
end
|
11
|
-
|
12
7
|
# @return [Boolean]
|
13
8
|
def self.cwd_is_nanoc_site?
|
14
9
|
Nanoc::Core::ConfigLoader.cwd_is_nanoc_site?
|
15
10
|
end
|
16
11
|
|
12
|
+
def new_from_cwd
|
13
|
+
site_from_config(Nanoc::Core::ConfigLoader.new.new_from_cwd)
|
14
|
+
end
|
15
|
+
|
17
16
|
def gen_data_source_for_config(config)
|
18
17
|
data_sources_to_aggregate =
|
19
18
|
with_data_sources(config) do |data_sources|
|
data/lib/nanoc/core/store.rb
CHANGED
@@ -13,6 +13,22 @@ module Nanoc
|
|
13
13
|
class Store
|
14
14
|
include Nanoc::Core::ContractsSupport
|
15
15
|
|
16
|
+
# Logic for building tmp path from active environment and store name
|
17
|
+
# @api private
|
18
|
+
contract C::KeywordArgs[config: Nanoc::Core::Configuration, store_name: String] => C::AbsolutePathString
|
19
|
+
def self.tmp_path_for(store_name:, config:)
|
20
|
+
File.absolute_path(
|
21
|
+
File.join(tmp_path_prefix(config.output_dir), store_name),
|
22
|
+
config.dir,
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
contract String => String
|
27
|
+
def self.tmp_path_prefix(output_dir)
|
28
|
+
dir = Digest::SHA1.hexdigest(output_dir)[0..12]
|
29
|
+
File.join('tmp', 'nanoc', dir)
|
30
|
+
end
|
31
|
+
|
16
32
|
# @return [String] The name of the file where data will be loaded from and
|
17
33
|
# stored to.
|
18
34
|
attr_reader :filename
|
@@ -35,22 +51,6 @@ module Nanoc
|
|
35
51
|
@version = version
|
36
52
|
end
|
37
53
|
|
38
|
-
# Logic for building tmp path from active environment and store name
|
39
|
-
# @api private
|
40
|
-
contract C::KeywordArgs[config: Nanoc::Core::Configuration, store_name: String] => C::AbsolutePathString
|
41
|
-
def self.tmp_path_for(store_name:, config:)
|
42
|
-
File.absolute_path(
|
43
|
-
File.join(tmp_path_prefix(config.output_dir), store_name),
|
44
|
-
config.dir,
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
contract String => String
|
49
|
-
def self.tmp_path_prefix(output_dir)
|
50
|
-
dir = Digest::SHA1.hexdigest(output_dir)[0..12]
|
51
|
-
File.join('tmp', 'nanoc', dir)
|
52
|
-
end
|
53
|
-
|
54
54
|
# @group Loading and storing data
|
55
55
|
|
56
56
|
# @return The data that should be written to the disk
|
data/lib/nanoc/core/version.rb
CHANGED
data/lib/nanoc/core.rb
CHANGED
@@ -47,7 +47,7 @@ module Nanoc
|
|
47
47
|
#
|
48
48
|
# @api private
|
49
49
|
def self.version_information
|
50
|
-
"Nanoc #{Nanoc::VERSION} © 2007
|
50
|
+
"Nanoc #{Nanoc::VERSION} © 2007–… Denis Defreyne.\n" \
|
51
51
|
"Running #{RUBY_ENGINE} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} with RubyGems #{Gem::VERSION}.\n"
|
52
52
|
end
|
53
53
|
|
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.12.
|
4
|
+
version: 4.12.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: 2023-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
- !ruby/object:Gem::Version
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
|
-
rubygems_version: 3.4.
|
319
|
+
rubygems_version: 3.4.1
|
320
320
|
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: Core of Nanoc
|