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
|
# Nanoc::CodeSnippet represent a piece of custom code of a nanoc site.
|
6
5
|
class CodeSnippet
|
7
|
-
|
8
6
|
# A string containing the actual code in this code snippet.
|
9
7
|
#
|
10
8
|
# @return [String]
|
@@ -22,7 +20,7 @@ module Nanoc
|
|
22
20
|
#
|
23
21
|
# @param [String] filename The filename corresponding to this code snippet
|
24
22
|
#
|
25
|
-
# @param [Time, Hash]
|
23
|
+
# @param [Time, Hash] _params Extra parameters. Ignored by nanoc; it is
|
26
24
|
# only included for backwards compatibility.
|
27
25
|
def initialize(data, filename, _params = nil)
|
28
26
|
@data = data
|
@@ -52,7 +50,5 @@ module Nanoc
|
|
52
50
|
def checksum
|
53
51
|
Nanoc::Checksummer.calc(self)
|
54
52
|
end
|
55
|
-
|
56
53
|
end
|
57
|
-
|
58
54
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Represents the site configuration.
|
6
5
|
class Configuration < ::Hash
|
7
|
-
|
8
6
|
# Creates a new configuration with the given hash.
|
9
7
|
#
|
10
8
|
# @param [Hash] hash The actual configuration hash
|
@@ -18,7 +16,5 @@ module Nanoc
|
|
18
16
|
def reference
|
19
17
|
:config
|
20
18
|
end
|
21
|
-
|
22
19
|
end
|
23
|
-
|
24
20
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Responsible for loading site data. It is the (abstract) superclass for all
|
6
5
|
# data sources. Subclasses must at least implement the data reading methods
|
7
6
|
# ({#items} and {#layouts}); all other methods involving data manipulation
|
@@ -26,7 +25,6 @@ module Nanoc
|
|
26
25
|
# {#create_item} and {#create_layout} methods should be implemented as
|
27
26
|
# well.
|
28
27
|
class DataSource
|
29
|
-
|
30
28
|
# @return [String] The root path where items returned by this data source
|
31
29
|
# should be mounted.
|
32
30
|
attr_reader :items_root
|
@@ -207,7 +205,7 @@ module Nanoc
|
|
207
205
|
# files that should be generated.
|
208
206
|
#
|
209
207
|
# @return [void]
|
210
|
-
def create_item(
|
208
|
+
def create_item(content, attributes, identifier, params = {}) # rubocop:disable Lint/UnusedMethodArgument
|
211
209
|
not_implemented('create_item')
|
212
210
|
end
|
213
211
|
|
@@ -230,7 +228,7 @@ module Nanoc
|
|
230
228
|
# files that should be generated.
|
231
229
|
#
|
232
230
|
# @return [void]
|
233
|
-
def create_layout(
|
231
|
+
def create_layout(content, attributes, identifier, params = {}) # rubocop:disable Lint/UnusedMethodArgument
|
234
232
|
not_implemented('create_layout')
|
235
233
|
end
|
236
234
|
|
@@ -241,6 +239,5 @@ module Nanoc
|
|
241
239
|
"#{self.class} does not implement ##{name}"
|
242
240
|
)
|
243
241
|
end
|
244
|
-
|
245
242
|
end
|
246
243
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Represents a compileable item in a site. It has content and attributes, as
|
6
5
|
# well as an identifier (which starts and ends with a slash). It can also
|
7
6
|
# store the modification time to speed up compilation.
|
8
7
|
class Item
|
9
|
-
|
10
8
|
extend Nanoc::Memoization
|
11
9
|
|
12
10
|
# @return [Hash] This item's attributes
|
@@ -70,7 +68,7 @@ module Nanoc
|
|
70
68
|
def initialize(raw_content_or_raw_filename, attributes, identifier, params = nil)
|
71
69
|
# Parse params
|
72
70
|
params ||= {}
|
73
|
-
params = { :
|
71
|
+
params = { mtime: params } if params.is_a?(Time)
|
74
72
|
params[:binary] = false unless params.key?(:binary)
|
75
73
|
|
76
74
|
if raw_content_or_raw_filename.nil?
|
@@ -91,7 +89,7 @@ module Nanoc
|
|
91
89
|
@identifier = identifier.cleaned_identifier.freeze
|
92
90
|
|
93
91
|
# Set mtime
|
94
|
-
@attributes.merge!(:
|
92
|
+
@attributes.merge!(mtime: params[:mtime]) if params[:mtime]
|
95
93
|
|
96
94
|
@parent = nil
|
97
95
|
@children = []
|
@@ -172,7 +170,7 @@ module Nanoc
|
|
172
170
|
Nanoc::NotificationCenter.post(:visit_ended, self)
|
173
171
|
|
174
172
|
# Get captured content (hax)
|
175
|
-
# TODO [in nanoc 4.0] remove me
|
173
|
+
# TODO: [in nanoc 4.0] remove me
|
176
174
|
if key.to_s =~ /^content_for_(.*)$/
|
177
175
|
@@_content_for_warning_issued ||= false
|
178
176
|
@@_capturing_helper_included ||= false
|
@@ -295,7 +293,5 @@ module Nanoc
|
|
295
293
|
def mtime
|
296
294
|
self[:mtime]
|
297
295
|
end
|
298
|
-
|
299
296
|
end
|
300
|
-
|
301
297
|
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Acts as an array, but allows fetching items using identifiers, e.g. `@items['/blah/']`.
|
6
5
|
class ItemArray
|
7
|
-
|
8
6
|
include Enumerable
|
9
7
|
|
10
8
|
extend Forwardable
|
@@ -18,7 +16,7 @@ module Nanoc
|
|
18
16
|
:instance_eval, :instance_exec, :__send__, :__id__
|
19
17
|
]
|
20
18
|
|
21
|
-
DELEGATED_METHODS = (Array.instance_methods + Enumerable.instance_methods).map
|
19
|
+
DELEGATED_METHODS = (Array.instance_methods + Enumerable.instance_methods).map(&:to_sym) - EXCLUDED_METHODS
|
22
20
|
def_delegators :@items, *DELEGATED_METHODS
|
23
21
|
|
24
22
|
def initialize
|
@@ -65,7 +63,5 @@ module Nanoc
|
|
65
63
|
end
|
66
64
|
@mapping.freeze
|
67
65
|
end
|
68
|
-
|
69
66
|
end
|
70
|
-
|
71
67
|
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# Represents a layout in a nanoc site. It has content, attributes, an
|
6
5
|
# identifier and a modification time (to speed up compilation).
|
7
6
|
class Layout
|
8
|
-
|
9
7
|
extend Nanoc::Memoization
|
10
8
|
|
11
9
|
# @return [String] The raw content of this layout
|
@@ -40,8 +38,8 @@ module Nanoc
|
|
40
38
|
|
41
39
|
# Set mtime
|
42
40
|
params ||= {}
|
43
|
-
params = { :
|
44
|
-
@attributes.merge(:
|
41
|
+
params = { mtime: params } if params.is_a?(Time)
|
42
|
+
@attributes.merge(mtime: params[:mtime]) if params[:mtime]
|
45
43
|
end
|
46
44
|
|
47
45
|
# Requests the attribute with the given key.
|
@@ -122,7 +120,5 @@ module Nanoc
|
|
122
120
|
def mtime
|
123
121
|
self[:mtime]
|
124
122
|
end
|
125
|
-
|
126
123
|
end
|
127
|
-
|
128
124
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# The in-memory representation of a nanoc site. It holds references to the
|
6
5
|
# following site data:
|
7
6
|
#
|
@@ -17,14 +16,13 @@ module Nanoc
|
|
17
16
|
# that contains a configuration file, site data, a rakefile, a rules file,
|
18
17
|
# etc. The way site data is stored depends on the data source.
|
19
18
|
class Site
|
20
|
-
|
21
19
|
# The default configuration for a data source. A data source's
|
22
20
|
# configuration overrides these options.
|
23
21
|
DEFAULT_DATA_SOURCE_CONFIG = {
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
22
|
+
type: 'filesystem_unified',
|
23
|
+
items_root: '/',
|
24
|
+
layouts_root: '/',
|
25
|
+
config: {}
|
28
26
|
}
|
29
27
|
|
30
28
|
# The default configuration for a site. A site's configuration overrides
|
@@ -32,13 +30,13 @@ module Nanoc
|
|
32
30
|
# that lacks some options, the default value will be taken from
|
33
31
|
# `DEFAULT_CONFIG`.
|
34
32
|
DEFAULT_CONFIG = {
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
33
|
+
text_extensions: %w( css erb haml htm html js less markdown md php rb sass scss txt xhtml xml coffee hb handlebars mustache ms slim ).sort,
|
34
|
+
lib_dirs: %w( lib ),
|
35
|
+
output_dir: 'output',
|
36
|
+
data_sources: [{}],
|
37
|
+
index_filenames: ['index.html'],
|
38
|
+
enable_output_diff: false,
|
39
|
+
prune: { auto_prune: false, exclude: ['.git', '.hg', '.svn', 'CVS'] }
|
42
40
|
}
|
43
41
|
|
44
42
|
# Creates a site object for the site specified by the given
|
@@ -85,7 +83,7 @@ module Nanoc
|
|
85
83
|
raise Nanoc::Errors::UnknownDataSource.new(data_source_hash[:type]) if data_source_class.nil?
|
86
84
|
|
87
85
|
# Warn about deprecated data sources
|
88
|
-
# TODO [in nanoc 4.0] remove me
|
86
|
+
# TODO: [in nanoc 4.0] remove me
|
89
87
|
case data_source_hash[:type]
|
90
88
|
when 'filesystem'
|
91
89
|
warn "Warning: the 'filesystem' data source has been renamed to 'filesystem_verbose'. Using 'filesystem' will work in nanoc 3.1.x, but it will likely not work anymore in a future release of nanoc. Please update your data source configuration and replace 'filesystem' with 'filesystem_verbose'."
|
@@ -217,9 +215,9 @@ module Nanoc
|
|
217
215
|
# @return [void]
|
218
216
|
def freeze
|
219
217
|
config.freeze_recursively
|
220
|
-
items.each
|
221
|
-
layouts.each
|
222
|
-
code_snippets.each
|
218
|
+
items.each(&:freeze)
|
219
|
+
layouts.each(&:freeze)
|
220
|
+
code_snippets.each(&:freeze)
|
223
221
|
end
|
224
222
|
|
225
223
|
# @deprecated It is no longer necessary to explicitly load site data. It
|
@@ -251,7 +249,7 @@ module Nanoc
|
|
251
249
|
ensure_identifier_uniqueness(@layouts, 'layout')
|
252
250
|
|
253
251
|
# Load compiler too
|
254
|
-
# FIXME this should not be necessary
|
252
|
+
# FIXME: this should not be necessary
|
255
253
|
compiler.load
|
256
254
|
|
257
255
|
@loaded = true
|
@@ -301,11 +299,11 @@ module Nanoc
|
|
301
299
|
|
302
300
|
# Executes the given block, making sure that the datasources are
|
303
301
|
# available for the duration of the block
|
304
|
-
def with_datasources(&
|
305
|
-
data_sources.each
|
302
|
+
def with_datasources(&_block)
|
303
|
+
data_sources.each(&:use)
|
306
304
|
yield
|
307
305
|
ensure
|
308
|
-
data_sources.each
|
306
|
+
data_sources.each(&:unuse)
|
309
307
|
end
|
310
308
|
|
311
309
|
# Loads this site’s code and executes it.
|
@@ -327,7 +325,7 @@ module Nanoc
|
|
327
325
|
end
|
328
326
|
|
329
327
|
# Execute code snippets
|
330
|
-
@code_snippets.each
|
328
|
+
@code_snippets.each(&:load)
|
331
329
|
end
|
332
330
|
|
333
331
|
# Loads this site’s items, sets up item child-parent relationships and
|
@@ -431,5 +429,4 @@ module Nanoc
|
|
431
429
|
@config = Nanoc::Configuration.new(@config)
|
432
430
|
end
|
433
431
|
end
|
434
|
-
|
435
432
|
end
|
data/lib/nanoc/base/store.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc
|
4
|
-
|
5
4
|
# An abstract superclass for classes that need to store data to the
|
6
5
|
# filesystem, such as checksums, cached compiled content and dependency
|
7
6
|
# graphs.
|
@@ -15,7 +14,6 @@ module Nanoc
|
|
15
14
|
#
|
16
15
|
# @api private
|
17
16
|
class Store
|
18
|
-
|
19
17
|
# @return [String] The name of the file where data will be loaded from and
|
20
18
|
# stored to.
|
21
19
|
attr_reader :filename
|
@@ -52,7 +50,7 @@ module Nanoc
|
|
52
50
|
# @abstract This method must be implemented by the subclass.
|
53
51
|
#
|
54
52
|
# @return [void]
|
55
|
-
def data=(
|
53
|
+
def data=(new_data) # rubocop:disable Lint/UnusedMethodArgument
|
56
54
|
raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
|
57
55
|
end
|
58
56
|
|
@@ -134,7 +132,5 @@ module Nanoc
|
|
134
132
|
def pstore
|
135
133
|
@pstore ||= PStore.new(filename)
|
136
134
|
end
|
137
|
-
|
138
135
|
end
|
139
|
-
|
140
136
|
end
|
@@ -3,9 +3,7 @@
|
|
3
3
|
require 'tmpdir'
|
4
4
|
|
5
5
|
module Nanoc
|
6
|
-
|
7
6
|
class TempFilenameFactory
|
8
|
-
|
9
7
|
# @return [String] The root directory for all temporary filenames
|
10
8
|
attr_reader :root_dir
|
11
9
|
|
@@ -51,7 +49,5 @@ module Nanoc
|
|
51
49
|
FileUtils.rm_rf(@root_dir)
|
52
50
|
end
|
53
51
|
end
|
54
|
-
|
55
52
|
end
|
56
|
-
|
57
53
|
end
|
data/lib/nanoc/cli.rb
CHANGED
@@ -16,7 +16,6 @@ if Nanoc.on_windows?
|
|
16
16
|
end
|
17
17
|
|
18
18
|
module Nanoc::CLI
|
19
|
-
|
20
19
|
module Commands
|
21
20
|
end
|
22
21
|
|
@@ -28,7 +27,7 @@ module Nanoc::CLI
|
|
28
27
|
autoload 'ErrorHandler', 'nanoc/cli/error_handler'
|
29
28
|
|
30
29
|
# Deprecated; use CommandRunner instead
|
31
|
-
# TODO [in nanoc 4.0] remove me
|
30
|
+
# TODO: [in nanoc 4.0] remove me
|
32
31
|
autoload 'Command', 'nanoc/cli/command_runner'
|
33
32
|
|
34
33
|
# @return [Boolean] true if debug output is enabled, false if not
|
@@ -78,7 +77,7 @@ module Nanoc::CLI
|
|
78
77
|
#
|
79
78
|
# @return [void]
|
80
79
|
def self.after_setup(&block)
|
81
|
-
# TODO decide what should happen if the CLI is already set up
|
80
|
+
# TODO: decide what should happen if the CLI is already set up
|
82
81
|
add_after_setup_proc(block)
|
83
82
|
end
|
84
83
|
|
@@ -91,7 +90,7 @@ module Nanoc::CLI
|
|
91
90
|
setup_cleaning_streams
|
92
91
|
setup_commands
|
93
92
|
load_custom_commands
|
94
|
-
after_setup_procs.each
|
93
|
+
after_setup_procs.each(&:call)
|
95
94
|
end
|
96
95
|
|
97
96
|
# Sets up the root command and base subcommands.
|
@@ -224,5 +223,4 @@ module Nanoc::CLI
|
|
224
223
|
@after_setup_procs ||= []
|
225
224
|
@after_setup_procs << proc
|
226
225
|
end
|
227
|
-
|
228
226
|
end
|
@@ -1,18 +1,16 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc::CLI
|
4
|
-
|
5
4
|
# A simple ANSI colorizer for strings. When given a string and a list of
|
6
5
|
# attributes, it returns a colorized string.
|
7
6
|
module ANSIStringColorizer
|
8
|
-
|
9
|
-
# TODO complete mapping
|
7
|
+
# TODO: complete mapping
|
10
8
|
MAPPING = {
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
9
|
+
bold: "\e[1m",
|
10
|
+
red: "\e[31m",
|
11
|
+
green: "\e[32m",
|
12
|
+
yellow: "\e[33m",
|
13
|
+
blue: "\e[34m"
|
16
14
|
}
|
17
15
|
|
18
16
|
# @param [String] s The string to colorize
|
@@ -24,7 +22,5 @@ module Nanoc::CLI
|
|
24
22
|
def self.c(s, *as)
|
25
23
|
as.map { |a| MAPPING[a] }.join('') + s + "\e[0m"
|
26
24
|
end
|
27
|
-
|
28
25
|
end
|
29
|
-
|
30
26
|
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Nanoc::CLI
|
4
|
-
|
5
4
|
# An output stream that passes output through stream cleaners. This can be
|
6
5
|
# used to strip ANSI color sequences, for instance.
|
7
6
|
class CleaningStream
|
8
|
-
|
9
7
|
# @param [IO, StringIO] stream The stream to wrap
|
10
8
|
def initialize(stream)
|
11
9
|
@stream = stream
|
@@ -20,7 +18,7 @@ module Nanoc::CLI
|
|
20
18
|
#
|
21
19
|
# @return [void]
|
22
20
|
def add_stream_cleaner(klass)
|
23
|
-
unless @stream_cleaners.map
|
21
|
+
unless @stream_cleaners.map(&:class).include?(klass)
|
24
22
|
@stream_cleaners << klass.new
|
25
23
|
end
|
26
24
|
end
|
@@ -122,14 +120,12 @@ module Nanoc::CLI
|
|
122
120
|
protected
|
123
121
|
|
124
122
|
def _nanoc_clean(s)
|
125
|
-
@stream_cleaners.reduce(s) { |
|
123
|
+
@stream_cleaners.reduce(s) { |a, e| e.clean(a) }
|
126
124
|
end
|
127
125
|
|
128
126
|
def _nanoc_swallow_broken_pipe_errors_while
|
129
127
|
yield
|
130
128
|
rescue Errno::EPIPE
|
131
129
|
end
|
132
|
-
|
133
130
|
end
|
134
|
-
|
135
131
|
end
|