nanoc 4.9.3 → 4.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +13 -7
- data/lib/nanoc/base.rb +1 -0
- data/lib/nanoc/base/assertions.rb +37 -0
- data/lib/nanoc/base/contracts_support.rb +4 -0
- data/lib/nanoc/base/entities/configuration.rb +12 -5
- data/lib/nanoc/base/repos/compiled_content_cache.rb +11 -8
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +9 -0
- data/lib/nanoc/base/services/compiler_loader.rb +1 -4
- data/lib/nanoc/cli.rb +1 -0
- data/lib/nanoc/cli/commands/compile.rb +1 -0
- data/lib/nanoc/cli/commands/create-site.rb +7 -10
- data/lib/nanoc/cli/commands/prune.rb +1 -0
- data/lib/nanoc/cli/commands/shell.rb +1 -0
- data/lib/nanoc/cli/commands/show-data.rb +1 -0
- data/lib/nanoc/cli/commands/show-plugins.rb +1 -5
- data/lib/nanoc/cli/commands/show-rules.rb +1 -0
- data/lib/nanoc/cli/commands/view.rb +5 -4
- data/lib/nanoc/cli/transform.rb +16 -0
- data/lib/nanoc/data_sources/filesystem/tools.rb +2 -4
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c20cba14ea42f548aa3d9b8d04673dfb71caeaf66196aa9ca23d7a48548ab55d
|
4
|
+
data.tar.gz: bdfec8da51cf47946e97dc3121027c3519ef5e735ad744c5dea93237e8366f3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59c881e40b1e5fbb07888cc80cce9f7d994d0b3869b8e03b5d8e8f21cd9f1272f594250345ad1ed0fb10b9926b3098672cb62e6e759e4979bcc79e1ef4f55b27
|
7
|
+
data.tar.gz: e6ce2fa2784b0c942690eeeb7c564fed7ae8a15924a4737fe9b84a519e71e8551c877ca476bceb463b2c6137352976e46d4a378aa21199a6dfe8ed0453fad779
|
data/NEWS.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.9.4 (2018-08-19)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed an issue where compiled content of items generated in the preprocessor would not be available in the postprocessor (#1341, #1348)
|
8
|
+
|
3
9
|
## 4.9.3 (2018-06-09)
|
4
10
|
|
5
11
|
Enhancements:
|
@@ -1133,7 +1139,7 @@ Fixes:
|
|
1133
1139
|
|
1134
1140
|
* Removed the list of available deployers from the `deploy` help text and moved
|
1135
1141
|
them into a new `--list-deployers` option [Damien Pollet]
|
1136
|
-
* Fixed warning about `__send__
|
1142
|
+
* Fixed warning about `__send__` and `object_id` being redefined on Ruby
|
1137
1143
|
1.8.x [Justin Hileman]
|
1138
1144
|
|
1139
1145
|
Enhancements:
|
@@ -1523,7 +1529,7 @@ Deprecated:
|
|
1523
1529
|
|
1524
1530
|
## 3.0.2 (2009-11-07)
|
1525
1531
|
|
1526
|
-
* Children-only identifier patterns no longer erroneously also match parent (e.g
|
1532
|
+
* Children-only identifier patterns no longer erroneously also match parent (e.g. `/foo/*/` no longer matches `/foo/`)
|
1527
1533
|
* The `create_site` command no longer uses those ugly HTML entities
|
1528
1534
|
* Install message now mentions the IRC channel
|
1529
1535
|
|
@@ -1658,9 +1664,9 @@ Changed:
|
|
1658
1664
|
Removed:
|
1659
1665
|
|
1660
1666
|
* Several filters have been removed and replaced by newer filters:
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1667
|
+
* `eruby`: use `erb` or `erubis` instead
|
1668
|
+
* `markdown`: use `bluecloth`, `rdiscount` or `maruku` instead
|
1669
|
+
* `textile`: use `redcloth` instead
|
1664
1670
|
|
1665
1671
|
## 2.0.4 (2008-05-04)
|
1666
1672
|
|
@@ -1739,8 +1745,8 @@ Removed:
|
|
1739
1745
|
* The `@pages` array now also contains uncompiled pages
|
1740
1746
|
* Pages with `skip_output` set to true will not be outputted
|
1741
1747
|
* Added new filters
|
1742
|
-
|
1743
|
-
|
1748
|
+
* Textile/RedCloth
|
1749
|
+
* Sass
|
1744
1750
|
* nanoc now warns before overwriting in `create_site`, `create_page` and `create_template` (but not in compile)
|
1745
1751
|
|
1746
1752
|
## 1.2 (2007-06-05)
|
data/lib/nanoc/base.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
module Assertions
|
5
|
+
class AssertionFailure < Nanoc::Int::Errors::InternalInconsistency
|
6
|
+
end
|
7
|
+
|
8
|
+
module Mixin
|
9
|
+
def assert(assertion)
|
10
|
+
return unless Nanoc::Int::ContractsSupport.enabled?
|
11
|
+
|
12
|
+
unless assertion.call
|
13
|
+
raise AssertionFailure, "assertion failed: #{assertion.class}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Base
|
19
|
+
def call
|
20
|
+
raise NotImplementedError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class AllItemRepsHaveCompiledContent < Nanoc::Assertions::Base
|
25
|
+
def initialize(compiled_content_cache:, item_reps:)
|
26
|
+
@compiled_content_cache = compiled_content_cache
|
27
|
+
@item_reps = item_reps
|
28
|
+
end
|
29
|
+
|
30
|
+
def call
|
31
|
+
@item_reps.all? do |rep|
|
32
|
+
@compiled_content_cache[rep]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -120,11 +120,6 @@ module Nanoc::Int
|
|
120
120
|
@wrapped[key] = value
|
121
121
|
end
|
122
122
|
|
123
|
-
def merge_recursively(c1, c2)
|
124
|
-
c1.merge(c2) { |_, v1, v2| v1.is_a?(Hash) && v2.is_a?(Hash) ? merge_recursively(v1, v2) : v2 }
|
125
|
-
end
|
126
|
-
private :merge_recursively
|
127
|
-
|
128
123
|
contract C::Or[Hash, self] => self
|
129
124
|
def merge(hash)
|
130
125
|
self.class.new(hash: merge_recursively(@wrapped, hash.to_h), env_name: @env_name)
|
@@ -181,5 +176,17 @@ module Nanoc::Int
|
|
181
176
|
def inspect
|
182
177
|
"<#{self.class}>"
|
183
178
|
end
|
179
|
+
|
180
|
+
private
|
181
|
+
|
182
|
+
def merge_recursively(config1, config2)
|
183
|
+
config1.merge(config2) do |_, value1, value2|
|
184
|
+
if value1.is_a?(Hash) && value2.is_a?(Hash)
|
185
|
+
merge_recursively(value1, value2)
|
186
|
+
else
|
187
|
+
value2
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
184
191
|
end
|
185
192
|
end
|
@@ -8,11 +8,10 @@ module Nanoc::Int
|
|
8
8
|
class CompiledContentCache < ::Nanoc::Int::Store
|
9
9
|
include Nanoc::Int::ContractsSupport
|
10
10
|
|
11
|
-
contract C::KeywordArgs[config: Nanoc::Int::Configuration
|
12
|
-
def initialize(config
|
11
|
+
contract C::KeywordArgs[config: Nanoc::Int::Configuration] => C::Any
|
12
|
+
def initialize(config:)
|
13
13
|
super(Nanoc::Int::Store.tmp_path_for(config: config, store_name: 'compiled_content'), 2)
|
14
14
|
|
15
|
-
@items = items
|
16
15
|
@cache = {}
|
17
16
|
end
|
18
17
|
|
@@ -36,6 +35,14 @@ module Nanoc::Int
|
|
36
35
|
@cache[rep.item.identifier][rep.name] = content
|
37
36
|
end
|
38
37
|
|
38
|
+
def prune(items:)
|
39
|
+
item_identifiers = Set.new(items.map(&:identifier))
|
40
|
+
|
41
|
+
@cache.keys.each do |key|
|
42
|
+
@cache.delete(key) unless item_identifiers.include?(key)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
39
46
|
protected
|
40
47
|
|
41
48
|
def data
|
@@ -45,12 +52,8 @@ module Nanoc::Int
|
|
45
52
|
def data=(new_data)
|
46
53
|
@cache = {}
|
47
54
|
|
48
|
-
item_identifiers = Set.new(@items.map(&:identifier))
|
49
|
-
|
50
55
|
new_data.each_pair do |item_identifier, content_per_rep|
|
51
|
-
|
52
|
-
@cache[item_identifier] ||= content_per_rep
|
53
|
-
end
|
56
|
+
@cache[item_identifier] ||= content_per_rep
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module Nanoc::Int::Compiler::Stages
|
4
4
|
class CompileReps < Nanoc::Int::Compiler::Stage
|
5
|
+
include Nanoc::Int::ContractsSupport
|
6
|
+
include Nanoc::Assertions::Mixin
|
7
|
+
|
5
8
|
def initialize(reps:, outdatedness_store:, dependency_store:, action_sequences:, compilation_context:, compiled_content_cache:)
|
6
9
|
@reps = reps
|
7
10
|
@outdatedness_store = outdatedness_store
|
@@ -21,8 +24,14 @@ module Nanoc::Int::Compiler::Stages
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
27
|
+
|
28
|
+
assert Nanoc::Assertions::AllItemRepsHaveCompiledContent.new(
|
29
|
+
compiled_content_cache: @compiled_content_cache,
|
30
|
+
item_reps: @reps,
|
31
|
+
)
|
24
32
|
ensure
|
25
33
|
@outdatedness_store.store
|
34
|
+
@compiled_content_cache.prune(items: @reps.map(&:item).uniq)
|
26
35
|
@compiled_content_cache.store
|
27
36
|
end
|
28
37
|
|
@@ -20,10 +20,7 @@ module Nanoc::Int
|
|
20
20
|
Nanoc::Int::OutdatednessStore.new(config: site.config)
|
21
21
|
|
22
22
|
compiled_content_cache =
|
23
|
-
Nanoc::Int::CompiledContentCache.new(
|
24
|
-
config: site.config,
|
25
|
-
items: site.items,
|
26
|
-
)
|
23
|
+
Nanoc::Int::CompiledContentCache.new(config: site.config)
|
27
24
|
|
28
25
|
params = {
|
29
26
|
compiled_content_cache: compiled_content_cache,
|
data/lib/nanoc/cli.rb
CHANGED
@@ -21,6 +21,7 @@ require_relative 'cli/cleaning_stream'
|
|
21
21
|
require_relative 'cli/stream_cleaners'
|
22
22
|
require_relative 'cli/error_handler'
|
23
23
|
require_relative 'cli/stack_trace_writer'
|
24
|
+
require_relative 'cli/transform'
|
24
25
|
|
25
26
|
require_relative 'cli/commands/compile_listeners/abstract'
|
26
27
|
require_relative 'cli/commands/compile_listeners/debug_printer'
|
@@ -5,6 +5,7 @@ aliases :create_site, :cs
|
|
5
5
|
summary 'create a site'
|
6
6
|
description 'Create a new site at the given path. The site will use the `filesystem` data source.'
|
7
7
|
flag nil, :force, 'force creation of new site'
|
8
|
+
param :path
|
8
9
|
|
9
10
|
module Nanoc::CLI::Commands
|
10
11
|
class CreateSite < ::Nanoc::CLI::CommandRunner
|
@@ -29,7 +30,7 @@ module Nanoc::CLI::Commands
|
|
29
30
|
data_sources:
|
30
31
|
- type: filesystem
|
31
32
|
encoding: utf-8
|
32
|
-
EOS
|
33
|
+
EOS
|
33
34
|
|
34
35
|
DEFAULT_RULES = <<~EOS unless defined? DEFAULT_RULES
|
35
36
|
#!/usr/bin/env ruby
|
@@ -59,7 +60,7 @@ EOS
|
|
59
60
|
end
|
60
61
|
|
61
62
|
layout '/**/*', :erb
|
62
|
-
EOS
|
63
|
+
EOS
|
63
64
|
|
64
65
|
DEFAULT_ITEM = <<~EOS unless defined? DEFAULT_ITEM
|
65
66
|
---
|
@@ -76,7 +77,7 @@ EOS
|
|
76
77
|
</ul>
|
77
78
|
|
78
79
|
<p>If you need any help with customizing your Nanoc web site, be sure to check out the documentation (see sidebar), and be sure to subscribe to the discussion group (also see sidebar). Enjoy!</p>
|
79
|
-
EOS
|
80
|
+
EOS
|
80
81
|
|
81
82
|
DEFAULT_STYLESHEET = <<~EOS unless defined? DEFAULT_STYLESHEET
|
82
83
|
* {
|
@@ -180,7 +181,7 @@ EOS
|
|
180
181
|
|
181
182
|
line-height: 20px;
|
182
183
|
}
|
183
|
-
EOS
|
184
|
+
EOS
|
184
185
|
|
185
186
|
DEFAULT_LAYOUT = <<~EOS unless defined? DEFAULT_LAYOUT
|
186
187
|
<!DOCTYPE HTML>
|
@@ -212,14 +213,10 @@ EOS
|
|
212
213
|
</div>
|
213
214
|
</body>
|
214
215
|
</html>
|
215
|
-
EOS
|
216
|
+
EOS
|
216
217
|
|
217
218
|
def run
|
218
|
-
|
219
|
-
if arguments.length != 1
|
220
|
-
raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
|
221
|
-
end
|
222
|
-
path = arguments[0]
|
219
|
+
path = arguments[:path]
|
223
220
|
|
224
221
|
# Check whether site exists
|
225
222
|
if File.exist?(path) && (!File.directory?(path) || !(Dir.entries(path) - %w[. ..]).empty?) && !options[:force]
|
@@ -10,6 +10,7 @@ description <<~EOS
|
|
10
10
|
Also see the `auto_prune` configuration option in `nanoc.yaml` (`config.yaml`
|
11
11
|
for older Nanoc sites), which will automatically prune after compilation.
|
12
12
|
EOS
|
13
|
+
no_params
|
13
14
|
|
14
15
|
flag :y, :yes, 'confirm deletion'
|
15
16
|
flag :n, :'dry-run', 'print files to be deleted instead of actually deleting them'
|
@@ -7,15 +7,11 @@ description <<~EOS
|
|
7
7
|
Show a list of available plugins, including filters and data sources.
|
8
8
|
If the current directory contains a Nanoc web site, the plugins defined in this site will be shown as well.
|
9
9
|
EOS
|
10
|
+
no_params
|
10
11
|
|
11
12
|
module Nanoc::CLI::Commands
|
12
13
|
class ShowPlugins < ::Nanoc::CLI::CommandRunner
|
13
14
|
def run
|
14
|
-
# Check arguments
|
15
|
-
if arguments.any?
|
16
|
-
raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
|
17
|
-
end
|
18
|
-
|
19
15
|
# Get list of plugins (before and after)
|
20
16
|
plugins_before = PLUGIN_CLASSES.keys.each_with_object({}) { |c, acc| acc[c] = c.all }
|
21
17
|
site = load_site
|
@@ -9,9 +9,10 @@ description <<~EOS
|
|
9
9
|
EOS
|
10
10
|
|
11
11
|
required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
|
12
|
-
required :o, :host, 'specify the host to listen on (default: 127.0.0.1)'
|
13
|
-
required :p, :port, 'specify the port to listen on (default: 3000)'
|
12
|
+
required :o, :host, 'specify the host to listen on (default: 127.0.0.1)', default: '127.0.0.1'
|
13
|
+
required :p, :port, 'specify the port to listen on (default: 3000)', transform: Nanoc::CLI::Transform::Port, default: 3000
|
14
14
|
flag :L, :'live-reload', 'reload on changes'
|
15
|
+
no_params
|
15
16
|
|
16
17
|
module Nanoc::CLI::Commands
|
17
18
|
class View < ::Nanoc::CLI::CommandRunner
|
@@ -30,8 +31,8 @@ module Nanoc::CLI::Commands
|
|
30
31
|
root: File.absolute_path(config[:output_dir]),
|
31
32
|
live: options[:'live-reload'],
|
32
33
|
index_filenames: config[:index_filenames],
|
33
|
-
host: (
|
34
|
-
port: (
|
34
|
+
host: options.fetch(:host),
|
35
|
+
port: options.fetch(:port),
|
35
36
|
handler: options[:handler],
|
36
37
|
)
|
37
38
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nanoc::CLI
|
4
|
+
# @api private
|
5
|
+
module Transform
|
6
|
+
module Port
|
7
|
+
RANGE = 0x0001..0xffff
|
8
|
+
|
9
|
+
def self.call(data)
|
10
|
+
Integer(data).tap do |int|
|
11
|
+
raise 'not a valid port' unless RANGE.cover?(int)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -33,6 +33,8 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
module_function
|
37
|
+
|
36
38
|
# Returns all files in the given directory and directories below it,
|
37
39
|
# following symlinks up to a maximum of `recursion_limit` times.
|
38
40
|
#
|
@@ -78,7 +80,6 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
78
80
|
end
|
79
81
|
end.compact.flatten
|
80
82
|
end
|
81
|
-
module_function :all_files_in
|
82
83
|
|
83
84
|
# Returns all files and directories in the given directory and
|
84
85
|
# directories below it.
|
@@ -114,7 +115,6 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
114
115
|
patterns = base_patterns + extra_patterns
|
115
116
|
Dir.glob(patterns)
|
116
117
|
end
|
117
|
-
module_function :all_files_and_dirs_in
|
118
118
|
|
119
119
|
# Resolves the given symlink into an absolute path.
|
120
120
|
#
|
@@ -147,7 +147,6 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
147
147
|
raise UnsupportedFileTypeError.new(absolute_target)
|
148
148
|
end
|
149
149
|
end
|
150
|
-
module_function :resolve_symlink
|
151
150
|
|
152
151
|
# Reads the content of the file with the given name and returns a string
|
153
152
|
# in UTF-8 encoding. The original encoding of the string is derived from
|
@@ -186,6 +185,5 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
186
185
|
|
187
186
|
data
|
188
187
|
end
|
189
|
-
module_function :read_file
|
190
188
|
end
|
191
189
|
end
|
data/lib/nanoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.
|
4
|
+
version: 4.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.13'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ddmemoize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- bin/nanoc
|
167
167
|
- lib/nanoc.rb
|
168
168
|
- lib/nanoc/base.rb
|
169
|
+
- lib/nanoc/base/assertions.rb
|
169
170
|
- lib/nanoc/base/changes_stream.rb
|
170
171
|
- lib/nanoc/base/contracts_support.rb
|
171
172
|
- lib/nanoc/base/core_ext.rb
|
@@ -340,6 +341,7 @@ files:
|
|
340
341
|
- lib/nanoc/cli/stream_cleaners/abstract.rb
|
341
342
|
- lib/nanoc/cli/stream_cleaners/ansi_colors.rb
|
342
343
|
- lib/nanoc/cli/stream_cleaners/utf8.rb
|
344
|
+
- lib/nanoc/cli/transform.rb
|
343
345
|
- lib/nanoc/data_sources.rb
|
344
346
|
- lib/nanoc/data_sources/filesystem.rb
|
345
347
|
- lib/nanoc/data_sources/filesystem/errors.rb
|