nanoc 3.7.4 → 3.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +19 -18
- data/LICENSE +1 -1
- data/NEWS.md +14 -0
- data/Rakefile +1 -1
- data/doc/yardoc_handlers/identifier.rb +1 -5
- data/lib/nanoc.rb +1 -3
- data/lib/nanoc/base.rb +1 -4
- data/lib/nanoc/base/checksummer.rb +10 -12
- data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
- data/lib/nanoc/base/compilation/compiler.rb +27 -31
- data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
- data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
- data/lib/nanoc/base/compilation/filter.rb +1 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -5
- data/lib/nanoc/base/compilation/rule_context.rb +7 -11
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
- data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
- data/lib/nanoc/base/context.rb +0 -3
- data/lib/nanoc/base/core_ext.rb +0 -1
- data/lib/nanoc/base/core_ext/array.rb +0 -2
- data/lib/nanoc/base/core_ext/hash.rb +0 -2
- data/lib/nanoc/base/core_ext/pathname.rb +0 -2
- data/lib/nanoc/base/core_ext/string.rb +0 -2
- data/lib/nanoc/base/directed_graph.rb +0 -4
- data/lib/nanoc/base/errors.rb +1 -39
- data/lib/nanoc/base/memoization.rb +0 -4
- data/lib/nanoc/base/notification_center.rb +1 -7
- data/lib/nanoc/base/plugin_registry.rb +4 -10
- data/lib/nanoc/base/result_data/item_rep.rb +8 -16
- data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
- data/lib/nanoc/base/source_data/configuration.rb +0 -4
- data/lib/nanoc/base/source_data/data_source.rb +2 -5
- data/lib/nanoc/base/source_data/item.rb +3 -7
- data/lib/nanoc/base/source_data/item_array.rb +1 -5
- data/lib/nanoc/base/source_data/layout.rb +2 -6
- data/lib/nanoc/base/source_data/site.rb +20 -23
- data/lib/nanoc/base/store.rb +1 -5
- data/lib/nanoc/base/temp_filename_factory.rb +0 -4
- data/lib/nanoc/cli.rb +3 -5
- data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
- data/lib/nanoc/cli/cleaning_stream.rb +2 -6
- data/lib/nanoc/cli/command_runner.rb +1 -5
- data/lib/nanoc/cli/commands/autocompile.rb +2 -6
- data/lib/nanoc/cli/commands/check.rb +0 -4
- data/lib/nanoc/cli/commands/compile.rb +12 -27
- data/lib/nanoc/cli/commands/create-item.rb +1 -5
- data/lib/nanoc/cli/commands/create-layout.rb +0 -4
- data/lib/nanoc/cli/commands/create-site.rb +2 -8
- data/lib/nanoc/cli/commands/deploy.rb +3 -7
- data/lib/nanoc/cli/commands/prune.rb +2 -6
- data/lib/nanoc/cli/commands/shell.rb +4 -8
- data/lib/nanoc/cli/commands/show-data.rb +3 -7
- data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
- data/lib/nanoc/cli/commands/show-rules.rb +11 -15
- data/lib/nanoc/cli/commands/sync.rb +0 -4
- data/lib/nanoc/cli/commands/update.rb +1 -7
- data/lib/nanoc/cli/commands/validate-css.rb +0 -4
- data/lib/nanoc/cli/commands/validate-html.rb +0 -4
- data/lib/nanoc/cli/commands/validate-links.rb +0 -4
- data/lib/nanoc/cli/commands/view.rb +3 -7
- data/lib/nanoc/cli/commands/watch.rb +4 -10
- data/lib/nanoc/cli/error_handler.rb +9 -13
- data/lib/nanoc/cli/logger.rb +8 -12
- data/lib/nanoc/cli/stream_cleaners.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
- data/lib/nanoc/data_sources.rb +2 -4
- data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
- data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
- data/lib/nanoc/data_sources/filesystem.rb +10 -13
- data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
- data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
- data/lib/nanoc/data_sources/static.rb +4 -8
- data/lib/nanoc/extra.rb +2 -4
- data/lib/nanoc/extra/auto_compiler.rb +2 -6
- data/lib/nanoc/extra/checking.rb +0 -4
- data/lib/nanoc/extra/checking/check.rb +0 -4
- data/lib/nanoc/extra/checking/checks.rb +0 -2
- data/lib/nanoc/extra/checking/checks/css.rb +6 -6
- data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
- data/lib/nanoc/extra/checking/checks/html.rb +6 -6
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
- data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
- data/lib/nanoc/extra/checking/dsl.rb +0 -4
- data/lib/nanoc/extra/checking/issue.rb +0 -4
- data/lib/nanoc/extra/checking/runner.rb +4 -7
- data/lib/nanoc/extra/chick.rb +7 -17
- data/lib/nanoc/extra/core_ext.rb +0 -1
- data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
- data/lib/nanoc/extra/core_ext/time.rb +0 -2
- data/lib/nanoc/extra/deployer.rb +0 -4
- data/lib/nanoc/extra/deployers.rb +0 -4
- data/lib/nanoc/extra/deployers/fog.rb +7 -11
- data/lib/nanoc/extra/deployers/rsync.rb +1 -5
- data/lib/nanoc/extra/file_proxy.rb +1 -5
- data/lib/nanoc/extra/filesystem_tools.rb +37 -12
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
- data/lib/nanoc/extra/link_collector.rb +3 -7
- data/lib/nanoc/extra/piper.rb +0 -6
- data/lib/nanoc/extra/pruner.rb +1 -7
- data/lib/nanoc/extra/validators.rb +0 -4
- data/lib/nanoc/extra/validators/links.rb +0 -4
- data/lib/nanoc/extra/validators/w3c.rb +0 -4
- data/lib/nanoc/extra/vcs.rb +3 -7
- data/lib/nanoc/extra/vcses.rb +0 -2
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
- data/lib/nanoc/extra/vcses/dummy.rb +0 -4
- data/lib/nanoc/extra/vcses/git.rb +0 -4
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
- data/lib/nanoc/extra/vcses/subversion.rb +0 -4
- data/lib/nanoc/filters.rb +0 -2
- data/lib/nanoc/filters/asciidoc.rb +1 -5
- data/lib/nanoc/filters/bluecloth.rb +0 -2
- data/lib/nanoc/filters/coderay.rb +0 -2
- data/lib/nanoc/filters/coffeescript.rb +0 -4
- data/lib/nanoc/filters/colorize_syntax.rb +17 -15
- data/lib/nanoc/filters/erb.rb +1 -3
- data/lib/nanoc/filters/erubis.rb +2 -4
- data/lib/nanoc/filters/haml.rb +2 -4
- data/lib/nanoc/filters/handlebars.rb +0 -4
- data/lib/nanoc/filters/kramdown.rb +7 -4
- data/lib/nanoc/filters/less.rb +1 -3
- data/lib/nanoc/filters/markaby.rb +0 -2
- data/lib/nanoc/filters/maruku.rb +0 -2
- data/lib/nanoc/filters/mustache.rb +1 -5
- data/lib/nanoc/filters/pandoc.rb +0 -2
- data/lib/nanoc/filters/rainpress.rb +0 -2
- data/lib/nanoc/filters/rdiscount.rb +0 -2
- data/lib/nanoc/filters/rdoc.rb +0 -2
- data/lib/nanoc/filters/redcarpet.rb +0 -4
- data/lib/nanoc/filters/redcloth.rb +0 -2
- data/lib/nanoc/filters/relativize_paths.rb +2 -4
- data/lib/nanoc/filters/rubypants.rb +0 -2
- data/lib/nanoc/filters/sass.rb +2 -4
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
- data/lib/nanoc/filters/slim.rb +2 -6
- data/lib/nanoc/filters/typogruby.rb +0 -4
- data/lib/nanoc/filters/uglify_js.rb +0 -2
- data/lib/nanoc/filters/xsl.rb +1 -5
- data/lib/nanoc/filters/yui_compressor.rb +0 -4
- data/lib/nanoc/helpers.rb +0 -2
- data/lib/nanoc/helpers/blogging.rb +12 -20
- data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
- data/lib/nanoc/helpers/capturing.rb +2 -10
- data/lib/nanoc/helpers/filtering.rb +0 -4
- data/lib/nanoc/helpers/html_escape.rb +3 -7
- data/lib/nanoc/helpers/link_to.rb +0 -4
- data/lib/nanoc/helpers/rendering.rb +8 -12
- data/lib/nanoc/helpers/tagging.rb +0 -4
- data/lib/nanoc/helpers/text.rb +1 -5
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
- data/lib/nanoc/tasks/clean.rb +1 -7
- data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
- data/lib/nanoc/tasks/validate.rake +0 -4
- data/lib/nanoc/version.rb +1 -3
- data/nanoc.gemspec +12 -9
- data/tasks/rubocop.rake +1 -1
- data/tasks/test.rake +6 -7
- data/test/base/checksummer_spec.rb +28 -44
- data/test/base/core_ext/array_spec.rb +1 -9
- data/test/base/core_ext/hash_spec.rb +7 -19
- data/test/base/core_ext/pathname_spec.rb +2 -4
- data/test/base/core_ext/string_spec.rb +0 -4
- data/test/base/temp_filename_factory_spec.rb +0 -8
- data/test/base/test_checksum_store.rb +0 -2
- data/test/base/test_code_snippet.rb +0 -2
- data/test/base/test_compiler.rb +15 -17
- data/test/base/test_compiler_dsl.rb +7 -9
- data/test/base/test_context.rb +2 -4
- data/test/base/test_data_source.rb +0 -2
- data/test/base/test_dependency_tracker.rb +0 -2
- data/test/base/test_directed_graph.rb +2 -4
- data/test/base/test_filter.rb +5 -7
- data/test/base/test_item.rb +17 -13
- data/test/base/test_item_array.rb +2 -4
- data/test/base/test_item_rep.rb +79 -73
- data/test/base/test_layout.rb +3 -5
- data/test/base/test_memoization.rb +13 -21
- data/test/base/test_notification_center.rb +0 -2
- data/test/base/test_outdatedness_checker.rb +34 -36
- data/test/base/test_plugin.rb +0 -2
- data/test/base/test_rule.rb +3 -5
- data/test/base/test_rule_context.rb +4 -6
- data/test/base/test_site.rb +9 -17
- data/test/base/test_store.rb +2 -6
- data/test/cli/commands/test_check.rb +1 -3
- data/test/cli/commands/test_compile.rb +24 -15
- data/test/cli/commands/test_create_item.rb +1 -3
- data/test/cli/commands/test_create_layout.rb +0 -2
- data/test/cli/commands/test_create_site.rb +0 -3
- data/test/cli/commands/test_deploy.rb +9 -11
- data/test/cli/commands/test_help.rb +0 -2
- data/test/cli/commands/test_info.rb +0 -2
- data/test/cli/commands/test_prune.rb +6 -8
- data/test/cli/commands/test_sync.rb +0 -2
- data/test/cli/commands/test_update.rb +0 -2
- data/test/cli/commands/test_watch.rb +4 -6
- data/test/cli/test_cleaning_stream.rb +4 -6
- data/test/cli/test_cli.rb +9 -5
- data/test/cli/test_error_handler.rb +9 -7
- data/test/cli/test_logger.rb +0 -2
- data/test/data_sources/test_filesystem.rb +8 -10
- data/test/data_sources/test_filesystem_unified.rb +35 -34
- data/test/data_sources/test_filesystem_verbose.rb +31 -33
- data/test/data_sources/test_static.rb +20 -21
- data/test/extra/checking/checks/test_css.rb +23 -2
- data/test/extra/checking/checks/test_external_links.rb +2 -4
- data/test/extra/checking/checks/test_html.rb +4 -3
- data/test/extra/checking/checks/test_internal_links.rb +1 -3
- data/test/extra/checking/checks/test_stale.rb +4 -6
- data/test/extra/checking/test_check.rb +0 -2
- data/test/extra/checking/test_dsl.rb +1 -3
- data/test/extra/checking/test_runner.rb +0 -2
- data/test/extra/core_ext/test_pathname.rb +0 -3
- data/test/extra/core_ext/test_time.rb +0 -2
- data/test/extra/deployers/test_fog.rb +13 -15
- data/test/extra/deployers/test_rsync.rb +4 -6
- data/test/extra/test_auto_compiler.rb +47 -25
- data/test/extra/test_file_proxy.rb +1 -3
- data/test/extra/test_filesystem_tools.rb +47 -7
- data/test/extra/test_link_collector.rb +0 -2
- data/test/extra/test_piper.rb +3 -5
- data/test/extra/test_vcs.rb +0 -2
- data/test/extra/validators/test_links.rb +0 -1
- data/test/extra/validators/test_w3c.rb +2 -4
- data/test/filters/test_asciidoc.rb +0 -2
- data/test/filters/test_bluecloth.rb +0 -2
- data/test/filters/test_coderay.rb +2 -4
- data/test/filters/test_coffeescript.rb +0 -2
- data/test/filters/test_colorize_syntax.rb +16 -18
- data/test/filters/test_erb.rb +12 -14
- data/test/filters/test_erubis.rb +4 -6
- data/test/filters/test_haml.rb +7 -9
- data/test/filters/test_handlebars.rb +10 -12
- data/test/filters/test_kramdown.rb +13 -1
- data/test/filters/test_less.rb +9 -11
- data/test/filters/test_markaby.rb +0 -2
- data/test/filters/test_maruku.rb +0 -2
- data/test/filters/test_mustache.rb +4 -6
- data/test/filters/test_pandoc.rb +1 -3
- data/test/filters/test_rainpress.rb +1 -3
- data/test/filters/test_rdiscount.rb +1 -3
- data/test/filters/test_rdoc.rb +0 -2
- data/test/filters/test_redcarpet.rb +6 -8
- data/test/filters/test_redcloth.rb +1 -3
- data/test/filters/test_relativize_paths.rb +29 -34
- data/test/filters/test_rubypants.rb +0 -2
- data/test/filters/test_sass.rb +8 -10
- data/test/filters/test_slim.rb +2 -4
- data/test/filters/test_typogruby.rb +0 -3
- data/test/filters/test_uglify_js.rb +2 -4
- data/test/filters/test_xsl.rb +16 -18
- data/test/filters/test_yui_compressor.rb +3 -5
- data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +11 -15
- data/test/helpers/test_blogging.rb +61 -63
- data/test/helpers/test_breadcrumbs.rb +0 -2
- data/test/helpers/test_capturing.rb +4 -6
- data/test/helpers/test_filtering.rb +2 -4
- data/test/helpers/test_html_escape.rb +0 -2
- data/test/helpers/test_link_to.rb +5 -6
- data/test/helpers/test_rendering.rb +2 -4
- data/test/helpers/test_tagging.rb +9 -11
- data/test/helpers/test_text.rb +6 -8
- data/test/helpers/test_xml_sitemap.rb +11 -13
- data/test/tasks/test_clean.rb +0 -2
- data/test/test_gem.rb +1 -3
- metadata +15 -14
- data/Gemfile.lock +0 -252
- data/lib/nanoc/base/core_ext/date.rb +0 -29
- data/lib/nanoc/base/ordered_hash.rb +0 -228
- data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
- data/test/base/core_ext/date_spec.rb +0 -15
- data/test/extra/core_ext/test_enumerable.rb +0 -28
@@ -1,10 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Contains methods that will be executed by the site’s `Rules` file.
|
6
5
|
class CompilerDSL
|
7
|
-
|
8
6
|
# The current rules filename.
|
9
7
|
#
|
10
8
|
# @return [String] The current rules filename.
|
@@ -122,7 +120,7 @@ module Nanoc
|
|
122
120
|
snapshot_name = params[:snapshot] || :last
|
123
121
|
|
124
122
|
# Create rule
|
125
|
-
rule = Rule.new(identifier_to_regex(identifier), rep_name, block, :
|
123
|
+
rule = Rule.new(identifier_to_regex(identifier), rep_name, block, snapshot_name: snapshot_name)
|
126
124
|
@rules_collection.add_item_routing_rule(rule)
|
127
125
|
end
|
128
126
|
|
@@ -199,7 +197,7 @@ module Nanoc
|
|
199
197
|
# data source.
|
200
198
|
item[:extension].nil? || (item[:content_filename].nil? && item.identifier =~ %r{#{item[:extension]}/$}) ? item.identifier.chop : item.identifier.chop + '.' + item[:extension]
|
201
199
|
end
|
202
|
-
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, routing_block, :
|
200
|
+
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, routing_block, snapshot_name: :last)
|
203
201
|
@rules_collection.add_item_routing_rule(routing_rule)
|
204
202
|
end
|
205
203
|
|
@@ -230,7 +228,7 @@ module Nanoc
|
|
230
228
|
compilation_rule = Rule.new(identifier_to_regex(identifier), rep_name, proc {})
|
231
229
|
@rules_collection.add_item_compilation_rule(compilation_rule)
|
232
230
|
|
233
|
-
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, proc {}, :
|
231
|
+
routing_rule = Rule.new(identifier_to_regex(identifier), rep_name, proc {}, snapshot_name: :last)
|
234
232
|
@rules_collection.add_item_routing_rule(routing_rule)
|
235
233
|
end
|
236
234
|
|
@@ -271,7 +269,5 @@ module Nanoc
|
|
271
269
|
identifier
|
272
270
|
end
|
273
271
|
end
|
274
|
-
|
275
272
|
end
|
276
|
-
|
277
273
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Responsible for remembering dependencies between items and layouts. It is
|
6
5
|
# used to speed up compilation by only letting an item be recompiled when it
|
7
6
|
# is outdated or any of its dependencies (or dependencies’ dependencies,
|
@@ -20,7 +19,6 @@ module Nanoc
|
|
20
19
|
#
|
21
20
|
# @api private
|
22
21
|
class DependencyTracker < ::Nanoc::Store
|
23
|
-
|
24
22
|
# @return [Array<Nanoc::Item, Nanoc::Layout>] The list of items and
|
25
23
|
# layouts that are being tracked by the dependency tracker
|
26
24
|
attr_reader :objects
|
@@ -176,8 +174,8 @@ module Nanoc
|
|
176
174
|
|
177
175
|
def data
|
178
176
|
{
|
179
|
-
:
|
180
|
-
:
|
177
|
+
edges: @graph.edges,
|
178
|
+
vertices: @graph.vertices.map { |obj| obj && obj.reference }
|
181
179
|
}
|
182
180
|
end
|
183
181
|
|
@@ -207,7 +205,5 @@ module Nanoc
|
|
207
205
|
end
|
208
206
|
end
|
209
207
|
end
|
210
|
-
|
211
208
|
end
|
212
|
-
|
213
209
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Nanoc::Filter is responsible for filtering items. It is the superclass
|
6
5
|
# for all textual filters.
|
7
6
|
#
|
@@ -27,7 +26,6 @@ module Nanoc
|
|
27
26
|
#
|
28
27
|
# @abstract Subclass and override {#run} to implement a custom filter.
|
29
28
|
class Filter < Context
|
30
|
-
|
31
29
|
TMP_BINARY_ITEMS_DIR = 'binary_items'
|
32
30
|
|
33
31
|
# A hash containing variables that will be made available during
|
@@ -39,7 +37,6 @@ module Nanoc
|
|
39
37
|
extend Nanoc::PluginRegistry::PluginMethods
|
40
38
|
|
41
39
|
class << self
|
42
|
-
|
43
40
|
# Sets the new type for the filter. The type can be `:binary` (default)
|
44
41
|
# or `:text`. The given argument can either be a symbol indicating both
|
45
42
|
# “from” and “to” types, or a hash where the only key is the “from” type
|
@@ -100,7 +97,6 @@ module Nanoc
|
|
100
97
|
true
|
101
98
|
end
|
102
99
|
end
|
103
|
-
|
104
100
|
end
|
105
101
|
|
106
102
|
# Creates a new filter that has access to the given assigns.
|
@@ -135,7 +131,7 @@ module Nanoc
|
|
135
131
|
# @return [String, void] If the filter output binary content, the return
|
136
132
|
# value is undefined; if the filter outputs textual content, the return
|
137
133
|
# value will be the filtered content.
|
138
|
-
def run(
|
134
|
+
def run(content_or_filename, params = {}) # rubocop:disable Lint/UnusedMethodArgument
|
139
135
|
raise NotImplementedError.new('Nanoc::Filter subclasses must implement #run')
|
140
136
|
end
|
141
137
|
|
@@ -186,7 +182,5 @@ module Nanoc
|
|
186
182
|
raise Nanoc::Errors::UnmetDependency.new(rep) if rep
|
187
183
|
end
|
188
184
|
end
|
189
|
-
|
190
185
|
end
|
191
|
-
|
192
186
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Represents an item representation, but provides an interface that is
|
6
5
|
# easier to use when writing compilation and routing rules. It is also
|
7
6
|
# responsible for fetching the necessary information from the compiler, such
|
@@ -10,7 +9,6 @@ module Nanoc
|
|
10
9
|
# The API provided by item representation proxies allows layout identifiers
|
11
10
|
# to be given as literals instead of as references to {Nanoc::Layout}.
|
12
11
|
class ItemRepProxy
|
13
|
-
|
14
12
|
extend Forwardable
|
15
13
|
|
16
14
|
def_delegators :@item_rep, :item, :name, :binary, :binary?, :compiled_content, :has_snapshot?, :raw_path, :path
|
@@ -98,7 +96,5 @@ module Nanoc
|
|
98
96
|
raise Nanoc::Errors::UnknownLayout.new(layout_identifier) if layout.nil?
|
99
97
|
layout
|
100
98
|
end
|
101
|
-
|
102
99
|
end
|
103
|
-
|
104
100
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Represents a fake iem representation that does not actually perform any
|
6
5
|
# actual filtering, layouting or snapshotting, but instead keeps track of
|
7
6
|
# what would happen if a real item representation would have been used
|
@@ -15,7 +14,6 @@ module Nanoc
|
|
15
14
|
#
|
16
15
|
# @api private
|
17
16
|
class ItemRepRecorderProxy
|
18
|
-
|
19
17
|
extend Forwardable
|
20
18
|
|
21
19
|
def_delegators :@item_rep, :item, :name, :binary, :binary?, :compiled_content, :has_snapshot?, :raw_path, :path, :assigns, :assigns=
|
@@ -97,7 +95,5 @@ module Nanoc
|
|
97
95
|
true
|
98
96
|
end
|
99
97
|
alias_method :is_proxy?, :proxy?
|
100
|
-
|
101
98
|
end
|
102
|
-
|
103
99
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Responsible for determining whether an item or a layout is outdated.
|
6
5
|
#
|
7
6
|
# @api private
|
8
7
|
class OutdatednessChecker
|
9
|
-
|
10
8
|
extend Nanoc::Memoization
|
11
9
|
|
12
10
|
# @option params [Nanoc::Site] :site (nil) The site this outdatedness
|
@@ -220,7 +218,5 @@ module Nanoc
|
|
220
218
|
def site
|
221
219
|
@site
|
222
220
|
end
|
223
|
-
|
224
221
|
end
|
225
|
-
|
226
222
|
end
|
@@ -1,14 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Module that contains all outdatedness reasons.
|
6
5
|
module OutdatednessReasons
|
7
|
-
|
8
6
|
# A generic outdatedness reason. An outdatedness reason is basically a
|
9
7
|
# descriptive message that explains why a given object is outdated.
|
10
8
|
class Generic
|
11
|
-
|
12
9
|
# @return [String] A descriptive message for this outdatedness reason
|
13
10
|
attr_reader :message
|
14
11
|
|
@@ -17,7 +14,6 @@ module Nanoc
|
|
17
14
|
def initialize(message)
|
18
15
|
@message = message
|
19
16
|
end
|
20
|
-
|
21
17
|
end
|
22
18
|
|
23
19
|
CodeSnippetsModified = Generic.new(
|
@@ -40,7 +36,5 @@ module Nanoc
|
|
40
36
|
|
41
37
|
SourceModified = Generic.new(
|
42
38
|
'The source file of this item has been modified since the last time the site was compiled.')
|
43
|
-
|
44
39
|
end
|
45
|
-
|
46
40
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Contains the processing information for a item.
|
6
5
|
class Rule
|
7
|
-
|
8
6
|
# @return [Regexp] The regex that determines which items this rule can be
|
9
7
|
# applied to. This rule can be applied to items with a identifier
|
10
8
|
# matching this regex.
|
@@ -67,9 +65,7 @@ module Nanoc
|
|
67
65
|
raise ArgumentError, 'Required :compiler option is missing'
|
68
66
|
end
|
69
67
|
rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.proxy?
|
70
|
-
Nanoc::RuleContext.new(:
|
68
|
+
Nanoc::RuleContext.new(rep: rep, compiler: compiler).instance_eval(&@block)
|
71
69
|
end
|
72
|
-
|
73
70
|
end
|
74
|
-
|
75
71
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Provides a context in which compilation and routing rules can be executed.
|
6
5
|
# It provides access to the item representation that is being compiled or
|
7
6
|
# routed.
|
@@ -17,7 +16,6 @@ module Nanoc
|
|
17
16
|
#
|
18
17
|
# @api private
|
19
18
|
class RuleContext < Context
|
20
|
-
|
21
19
|
# @option params [Nanoc::ItemRep] :rep The item representation that will
|
22
20
|
# be processed in this rule context
|
23
21
|
#
|
@@ -35,13 +33,13 @@ module Nanoc
|
|
35
33
|
end
|
36
34
|
|
37
35
|
super({
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
36
|
+
rep: rep,
|
37
|
+
item_rep: rep,
|
38
|
+
item: rep.item,
|
39
|
+
site: compiler.site,
|
40
|
+
config: compiler.site.config,
|
41
|
+
items: compiler.site.items,
|
42
|
+
layouts: compiler.site.layouts
|
45
43
|
})
|
46
44
|
end
|
47
45
|
|
@@ -85,7 +83,5 @@ module Nanoc
|
|
85
83
|
def snapshot(snapshot_name)
|
86
84
|
rep.snapshot(snapshot_name)
|
87
85
|
end
|
88
|
-
|
89
86
|
end
|
90
|
-
|
91
87
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Calculates rule memories for objects that can be run through a rule (item
|
6
5
|
# representations and layouts).
|
7
6
|
#
|
8
7
|
# @api private
|
9
8
|
class RuleMemoryCalculator
|
10
|
-
|
11
9
|
extend Nanoc::Memoization
|
12
10
|
|
13
11
|
# @option params [Nanoc::RulesCollection] rules_collection The rules
|
@@ -35,7 +33,5 @@ module Nanoc
|
|
35
33
|
result
|
36
34
|
end
|
37
35
|
memoize :[]
|
38
|
-
|
39
36
|
end
|
40
|
-
|
41
37
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Stores rule memories for objects that can be run through a rule (item
|
6
5
|
# representations and layouts).
|
7
6
|
#
|
8
7
|
# @api private
|
9
8
|
class RuleMemoryStore < ::Nanoc::Store
|
10
|
-
|
11
9
|
# @option params [Nanoc::Site] site The site where this rule memory store
|
12
10
|
# belongs to
|
13
11
|
def initialize(params = {})
|
@@ -47,7 +45,5 @@ module Nanoc
|
|
47
45
|
def data=(new_data)
|
48
46
|
@rule_memories = new_data
|
49
47
|
end
|
50
|
-
|
51
48
|
end
|
52
|
-
|
53
49
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Keeps track of the rules in a site.
|
6
5
|
#
|
7
6
|
# @api private
|
8
7
|
class RulesCollection
|
9
|
-
|
10
8
|
# @return [String] the contents of the Rules file
|
11
9
|
#
|
12
10
|
# @api private
|
@@ -41,8 +39,8 @@ module Nanoc
|
|
41
39
|
|
42
40
|
@item_compilation_rules = []
|
43
41
|
@item_routing_rules = []
|
44
|
-
@layout_filter_mapping =
|
45
|
-
@preprocessors =
|
42
|
+
@layout_filter_mapping = {}
|
43
|
+
@preprocessors = {}
|
46
44
|
end
|
47
45
|
|
48
46
|
# Add the given rule to the list of item compilation rules.
|
@@ -101,8 +99,8 @@ module Nanoc
|
|
101
99
|
def unload
|
102
100
|
@item_compilation_rules = []
|
103
101
|
@item_routing_rules = []
|
104
|
-
@layout_filter_mapping =
|
105
|
-
@preprocessors =
|
102
|
+
@layout_filter_mapping = {}
|
103
|
+
@preprocessors = {}
|
106
104
|
end
|
107
105
|
|
108
106
|
# Finds the first matching compilation rule for the given item
|
@@ -192,7 +190,7 @@ module Nanoc
|
|
192
190
|
# @return [Array] The rule memory for the given item representation
|
193
191
|
def new_rule_memory_for_rep(rep)
|
194
192
|
recording_proxy = rep.to_recording_proxy
|
195
|
-
compilation_rule_for(rep).apply_to(recording_proxy, :
|
193
|
+
compilation_rule_for(rep).apply_to(recording_proxy, compiler: @compiler)
|
196
194
|
recording_proxy.rule_memory << [:write, rep.path]
|
197
195
|
make_rule_memory_serializable(recording_proxy.rule_memory)
|
198
196
|
end
|
@@ -253,7 +251,5 @@ module Nanoc
|
|
253
251
|
def rule_memory_calculator
|
254
252
|
@compiler.rule_memory_calculator
|
255
253
|
end
|
256
|
-
|
257
254
|
end
|
258
|
-
|
259
255
|
end
|
data/lib/nanoc/base/context.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Provides a context and a binding for use in filters such as the ERB and
|
6
5
|
# Haml ones.
|
7
6
|
class Context
|
8
|
-
|
9
7
|
# Creates a new context based off the contents of the hash.
|
10
8
|
#
|
11
9
|
# Each pair in the hash will be converted to an instance variable and an
|
@@ -42,6 +40,5 @@ module Nanoc
|
|
42
40
|
def get_binding
|
43
41
|
binding
|
44
42
|
end
|
45
|
-
|
46
43
|
end
|
47
44
|
end
|
data/lib/nanoc/base/core_ext.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc::ArrayExtensions
|
4
|
-
|
5
4
|
# Returns a new array where all items' keys are recursively converted to
|
6
5
|
# symbols by calling {Nanoc::ArrayExtensions#symbolize_keys_recursively} or
|
7
6
|
# {Nanoc::HashExtensions#symbolize_keys_recursively}.
|
@@ -66,7 +65,6 @@ module Nanoc::ArrayExtensions
|
|
66
65
|
def checksum
|
67
66
|
Nanoc::Checksummer.calc(self)
|
68
67
|
end
|
69
|
-
|
70
68
|
end
|
71
69
|
|
72
70
|
class Array
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc::HashExtensions
|
4
|
-
|
5
4
|
# Returns a new hash where all keys are recursively converted to symbols by
|
6
5
|
# calling {Nanoc::ArrayExtensions#symbolize_keys_recursively} or
|
7
6
|
# {Nanoc::HashExtensions#symbolize_keys_recursively}.
|
@@ -68,7 +67,6 @@ module Nanoc::HashExtensions
|
|
68
67
|
def checksum
|
69
68
|
Nanoc::Checksummer.calc(self)
|
70
69
|
end
|
71
|
-
|
72
70
|
end
|
73
71
|
|
74
72
|
class Hash
|