nanoc 3.7.3 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
@@ -14,7 +14,7 @@ module Nanoc
|
|
14
14
|
extend Forwardable
|
15
15
|
|
16
16
|
def_delegators :@item_rep, :item, :name, :binary, :binary?, :compiled_content, :has_snapshot?, :raw_path, :path
|
17
|
-
def_delegator
|
17
|
+
def_delegator :@item_rep, :snapshot
|
18
18
|
|
19
19
|
# @param [Nanoc::ItemRep] item_rep The item representation that this
|
20
20
|
# proxy should behave like
|
@@ -76,13 +76,14 @@ module Nanoc
|
|
76
76
|
#
|
77
77
|
# @return [true]
|
78
78
|
#
|
79
|
-
# @see Nanoc::ItemRep#
|
80
|
-
# @see Nanoc::ItemRepRecorderProxy#
|
81
|
-
def
|
79
|
+
# @see Nanoc::ItemRep#proxy?
|
80
|
+
# @see Nanoc::ItemRepRecorderProxy#proxy?
|
81
|
+
def proxy?
|
82
82
|
true
|
83
83
|
end
|
84
|
+
alias_method :is_proxy?, :proxy?
|
84
85
|
|
85
|
-
|
86
|
+
private
|
86
87
|
|
87
88
|
def set_assigns
|
88
89
|
@item_rep.assigns = @compiler.assigns_for(@item_rep)
|
@@ -50,7 +50,7 @@ module Nanoc
|
|
50
50
|
#
|
51
51
|
# @see Nanoc::ItemRepProxy#filter, Nanoc::ItemRep#filter
|
52
52
|
def filter(name, args = {})
|
53
|
-
@rule_memory << [
|
53
|
+
@rule_memory << [:filter, name, args]
|
54
54
|
end
|
55
55
|
|
56
56
|
# @return [void]
|
@@ -58,9 +58,9 @@ module Nanoc
|
|
58
58
|
# @see Nanoc::ItemRepProxy#layout, Nanoc::ItemRep#layout
|
59
59
|
def layout(layout_identifier, extra_filter_args = nil)
|
60
60
|
if extra_filter_args
|
61
|
-
@rule_memory << [
|
61
|
+
@rule_memory << [:layout, layout_identifier, extra_filter_args]
|
62
62
|
else
|
63
|
-
@rule_memory << [
|
63
|
+
@rule_memory << [:layout, layout_identifier]
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -68,7 +68,7 @@ module Nanoc
|
|
68
68
|
#
|
69
69
|
# @see Nanoc::ItemRep#snapshot
|
70
70
|
def snapshot(snapshot_name, params = {})
|
71
|
-
@rule_memory << [
|
71
|
+
@rule_memory << [:snapshot, snapshot_name, params]
|
72
72
|
|
73
73
|
# Count
|
74
74
|
existing = Set.new
|
@@ -91,11 +91,12 @@ module Nanoc
|
|
91
91
|
#
|
92
92
|
# @return [true]
|
93
93
|
#
|
94
|
-
# @see Nanoc::ItemRep#
|
95
|
-
# @see Nanoc::ItemRepProxy#
|
96
|
-
def
|
94
|
+
# @see Nanoc::ItemRep#proxy?
|
95
|
+
# @see Nanoc::ItemRepProxy#proxy?
|
96
|
+
def proxy?
|
97
97
|
true
|
98
98
|
end
|
99
|
+
alias_method :is_proxy?, :proxy?
|
99
100
|
|
100
101
|
end
|
101
102
|
|
@@ -60,7 +60,7 @@ module Nanoc
|
|
60
60
|
end
|
61
61
|
memoize :outdatedness_reason_for
|
62
62
|
|
63
|
-
|
63
|
+
private
|
64
64
|
|
65
65
|
# Checks whether the given object is outdated and therefore needs to be
|
66
66
|
# recompiled. This method does not take dependencies into account; use
|
@@ -92,8 +92,8 @@ module Nanoc
|
|
92
92
|
rule_memory_differs_for(obj)
|
93
93
|
|
94
94
|
# Outdated if checksums are missing or different
|
95
|
-
return Nanoc::OutdatednessReasons::NotEnoughData
|
96
|
-
return Nanoc::OutdatednessReasons::SourceModified
|
95
|
+
return Nanoc::OutdatednessReasons::NotEnoughData unless checksums_available?(obj.item)
|
96
|
+
return Nanoc::OutdatednessReasons::SourceModified unless checksums_identical?(obj.item)
|
97
97
|
|
98
98
|
# Outdated if compiled file doesn't exist (yet)
|
99
99
|
return Nanoc::OutdatednessReasons::NotWritten if obj.raw_path && !File.file?(obj.raw_path)
|
@@ -116,8 +116,8 @@ module Nanoc
|
|
116
116
|
rule_memory_differs_for(obj)
|
117
117
|
|
118
118
|
# Outdated if checksums are missing or different
|
119
|
-
return Nanoc::OutdatednessReasons::NotEnoughData
|
120
|
-
return Nanoc::OutdatednessReasons::SourceModified
|
119
|
+
return Nanoc::OutdatednessReasons::NotEnoughData unless checksums_available?(obj)
|
120
|
+
return Nanoc::OutdatednessReasons::SourceModified unless checksums_identical?(obj)
|
121
121
|
|
122
122
|
# Not outdated
|
123
123
|
return nil
|
@@ -179,7 +179,7 @@ module Nanoc
|
|
179
179
|
# @return [Boolean] false if either the new or the old checksum for the
|
180
180
|
# given object is not available, true if both checksums are available
|
181
181
|
def checksums_available?(obj)
|
182
|
-
|
182
|
+
checksum_store[obj] && obj.checksum
|
183
183
|
end
|
184
184
|
memoize :checksums_available?
|
185
185
|
|
@@ -66,7 +66,7 @@ module Nanoc
|
|
66
66
|
compiler = params.fetch(:compiler) do
|
67
67
|
raise ArgumentError, 'Required :compiler option is missing'
|
68
68
|
end
|
69
|
-
rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.
|
69
|
+
rep = Nanoc::ItemRepProxy.new(rep, compiler) unless rep.proxy?
|
70
70
|
Nanoc::RuleContext.new(:rep => rep, :compiler => compiler).instance_eval(&@block)
|
71
71
|
end
|
72
72
|
|
@@ -76,7 +76,7 @@ module Nanoc
|
|
76
76
|
# @return [void]
|
77
77
|
def load
|
78
78
|
# Find rules file
|
79
|
-
rules_filenames = [
|
79
|
+
rules_filenames = ['Rules', 'rules', 'Rules.rb', 'rules.rb']
|
80
80
|
rules_filename = rules_filenames.find { |f| File.file?(f) }
|
81
81
|
raise Nanoc::Errors::NoRulesFileFound.new if rules_filename.nil?
|
82
82
|
|
@@ -141,7 +141,7 @@ module Nanoc
|
|
141
141
|
def routing_rules_for(rep)
|
142
142
|
rules = {}
|
143
143
|
@item_routing_rules.each do |rule|
|
144
|
-
next
|
144
|
+
next unless rule.applicable_to?(rep.item)
|
145
145
|
next if rule.rep_name != rep.name
|
146
146
|
next if rules.key?(rule.snapshot_name)
|
147
147
|
|
@@ -193,7 +193,7 @@ module Nanoc
|
|
193
193
|
def new_rule_memory_for_rep(rep)
|
194
194
|
recording_proxy = rep.to_recording_proxy
|
195
195
|
compilation_rule_for(rep).apply_to(recording_proxy, :compiler => @compiler)
|
196
|
-
recording_proxy.rule_memory << [
|
196
|
+
recording_proxy.rule_memory << [:write, rep.path]
|
197
197
|
make_rule_memory_serializable(recording_proxy.rule_memory)
|
198
198
|
end
|
199
199
|
memoize :new_rule_memory_for_rep
|
@@ -208,7 +208,7 @@ module Nanoc
|
|
208
208
|
def make_rule_memory_serializable(rs)
|
209
209
|
rs.map do |r|
|
210
210
|
if r[0] == :filter
|
211
|
-
[
|
211
|
+
[r[0], r[1], r[2].to_a.map { |a| Nanoc::Checksummer.calc(a) }]
|
212
212
|
else
|
213
213
|
r
|
214
214
|
end
|
@@ -231,7 +231,7 @@ module Nanoc
|
|
231
231
|
# a Boolean indicating whether the snapshot is final or not
|
232
232
|
def snapshots_for(rep)
|
233
233
|
new_rule_memory_for_rep(rep).select { |e| e[0] == :snapshot }.map do |e|
|
234
|
-
[
|
234
|
+
[e[1], e[2].fetch(:final) { true }]
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
data/lib/nanoc/base/context.rb
CHANGED
@@ -27,7 +27,7 @@ module Nanoc::ArrayExtensions
|
|
27
27
|
# @return [Array] The converted array
|
28
28
|
def stringify_keys_recursively
|
29
29
|
reduce([]) do |array, element|
|
30
|
-
array + [
|
30
|
+
array + [element.respond_to?(:stringify_keys_recursively) ? element.stringify_keys_recursively : element]
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -15,7 +15,7 @@ if needs_patch
|
|
15
15
|
|
16
16
|
class ::Date
|
17
17
|
|
18
|
-
[
|
18
|
+
[:amjd, :jd, :day_fraction, :mjd, :ld, :civil, :ordinal, :commercial, :weeknum0, :weeknum1, :time, :wday, :julian?, :gregorian?, :leap?].each do |m|
|
19
19
|
module_eval <<EOS
|
20
20
|
alias_method :__orig_#{m}, :#{m}
|
21
21
|
def #{m}
|
@@ -211,7 +211,7 @@ module Nanoc
|
|
211
211
|
result = []
|
212
212
|
@vertices.each_pair do |v1, i1|
|
213
213
|
direct_successors_of(v1).map { |v2| @vertices[v2] }.each do |i2|
|
214
|
-
result << [
|
214
|
+
result << [i1, i2]
|
215
215
|
end
|
216
216
|
end
|
217
217
|
result
|
@@ -233,7 +233,7 @@ module Nanoc
|
|
233
233
|
delete_edge(from, to)
|
234
234
|
end
|
235
235
|
|
236
|
-
|
236
|
+
private
|
237
237
|
|
238
238
|
# Invalidates cached data. This method should be called when the internal
|
239
239
|
# graph representation is changed.
|
@@ -249,7 +249,7 @@ module Nanoc
|
|
249
249
|
all_vertices = Set.new
|
250
250
|
|
251
251
|
processed_vertices = Set.new
|
252
|
-
unprocessed_vertices = [
|
252
|
+
unprocessed_vertices = [start]
|
253
253
|
|
254
254
|
until unprocessed_vertices.empty?
|
255
255
|
# Get next unprocessed vertex
|
@@ -52,7 +52,7 @@ module Nanoc
|
|
52
52
|
@__memoization_cache[method_name] ||= {}
|
53
53
|
|
54
54
|
# Recalculate if necessary
|
55
|
-
|
55
|
+
unless @__memoization_cache[method_name].key?(args)
|
56
56
|
result = send(original_method_name, *args)
|
57
57
|
@__memoization_cache[method_name][args] = result
|
58
58
|
end
|
@@ -188,7 +188,7 @@ module Nanoc
|
|
188
188
|
plugins << {
|
189
189
|
:class => klass,
|
190
190
|
:superclass => superclass,
|
191
|
-
:identifiers => [
|
191
|
+
:identifiers => [identifier]
|
192
192
|
}
|
193
193
|
end
|
194
194
|
end
|
@@ -202,9 +202,9 @@ module Nanoc
|
|
202
202
|
find(self, name)
|
203
203
|
end
|
204
204
|
|
205
|
-
|
205
|
+
protected
|
206
206
|
|
207
|
-
def resolve(class_or_name,
|
207
|
+
def resolve(class_or_name, _klass)
|
208
208
|
if class_or_name.is_a?(String)
|
209
209
|
class_or_name.scan(/\w+/).reduce(Kernel) do |memo, part|
|
210
210
|
memo.const_get(part)
|
@@ -182,14 +182,14 @@ module Nanoc
|
|
182
182
|
include Private
|
183
183
|
|
184
184
|
# @return [Nanoc::Item] The item to which this rep belongs
|
185
|
-
attr_reader
|
185
|
+
attr_reader :item
|
186
186
|
|
187
187
|
# @return [Symbol] The representation's unique name
|
188
|
-
attr_reader
|
188
|
+
attr_reader :name
|
189
189
|
|
190
190
|
# @return [Boolean] true if this rep is currently binary; false otherwise
|
191
|
-
attr_reader
|
192
|
-
alias_method
|
191
|
+
attr_reader :binary
|
192
|
+
alias_method :binary?, :binary
|
193
193
|
|
194
194
|
# @return [Array] A list of snapshots, represented as arrays where the
|
195
195
|
# first element is the snapshot name (a Symbol) and the last element is
|
@@ -242,7 +242,7 @@ module Nanoc
|
|
242
242
|
|
243
243
|
# Get name of last pre-layout snapshot
|
244
244
|
snapshot = params.fetch(:snapshot) { @content[:pre] ? :pre : :last }
|
245
|
-
is_moving = [
|
245
|
+
is_moving = [:pre, :post, :last].include?(snapshot)
|
246
246
|
|
247
247
|
# Check existance of snapshot
|
248
248
|
if !is_moving && snapshots.find { |s| s.first == snapshot && s.last == true }.nil?
|
@@ -263,9 +263,10 @@ module Nanoc
|
|
263
263
|
# given name, false otherwise
|
264
264
|
#
|
265
265
|
# @since 3.2.0
|
266
|
-
def
|
266
|
+
def snapshot?(snapshot_name)
|
267
267
|
!@content[snapshot_name].nil?
|
268
268
|
end
|
269
|
+
alias_method :has_snapshot?, :snapshot?
|
269
270
|
|
270
271
|
# Returns the item rep’s raw path. It includes the path to the output
|
271
272
|
# directory and the full filename.
|
@@ -444,11 +445,12 @@ module Nanoc
|
|
444
445
|
#
|
445
446
|
# @return [false]
|
446
447
|
#
|
447
|
-
# @see Nanoc::ItemRepRecorderProxy#
|
448
|
-
# @see Nanoc::ItemRepProxy#
|
449
|
-
def
|
448
|
+
# @see Nanoc::ItemRepRecorderProxy#proxy?
|
449
|
+
# @see Nanoc::ItemRepProxy#proxy?
|
450
|
+
def proxy?
|
450
451
|
false
|
451
452
|
end
|
453
|
+
alias_method :is_proxy?, :proxy?
|
452
454
|
|
453
455
|
# Returns an object that can be used for uniquely identifying objects.
|
454
456
|
#
|
@@ -456,14 +458,14 @@ module Nanoc
|
|
456
458
|
#
|
457
459
|
# @return [Object] An unique reference to this object
|
458
460
|
def reference
|
459
|
-
[
|
461
|
+
[type, item.identifier, name]
|
460
462
|
end
|
461
463
|
|
462
464
|
def inspect
|
463
465
|
"<#{self.class} name=\"#{name}\" binary=#{self.binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
|
464
466
|
end
|
465
467
|
|
466
|
-
|
468
|
+
private
|
467
469
|
|
468
470
|
def initialize_content
|
469
471
|
# Initialize content and filenames
|
@@ -24,7 +24,7 @@ module Nanoc
|
|
24
24
|
#
|
25
25
|
# @param [Time, Hash] params Extra parameters. Ignored by nanoc; it is
|
26
26
|
# only included for backwards compatibility.
|
27
|
-
def initialize(data, filename,
|
27
|
+
def initialize(data, filename, _params = nil)
|
28
28
|
@data = data
|
29
29
|
@filename = filename
|
30
30
|
end
|
@@ -40,7 +40,7 @@ module Nanoc
|
|
40
40
|
#
|
41
41
|
# @return [Object] An unique reference to this object
|
42
42
|
def reference
|
43
|
-
[
|
43
|
+
[:code_snippet, filename]
|
44
44
|
end
|
45
45
|
|
46
46
|
def inspect
|
@@ -207,7 +207,7 @@ module Nanoc
|
|
207
207
|
# files that should be generated.
|
208
208
|
#
|
209
209
|
# @return [void]
|
210
|
-
def create_item(
|
210
|
+
def create_item(_content, _attributes, _identifier, _params = {})
|
211
211
|
not_implemented('create_item')
|
212
212
|
end
|
213
213
|
|
@@ -230,11 +230,11 @@ module Nanoc
|
|
230
230
|
# files that should be generated.
|
231
231
|
#
|
232
232
|
# @return [void]
|
233
|
-
def create_layout(
|
233
|
+
def create_layout(_content, _attributes, _identifier, _params = {})
|
234
234
|
not_implemented('create_layout')
|
235
235
|
end
|
236
236
|
|
237
|
-
|
237
|
+
private
|
238
238
|
|
239
239
|
def not_implemented(name)
|
240
240
|
raise NotImplementedError.new(
|
@@ -26,15 +26,15 @@ module Nanoc
|
|
26
26
|
attr_accessor :identifier
|
27
27
|
|
28
28
|
# @return [Array<Nanoc::ItemRep>] This item’s list of item reps
|
29
|
-
attr_reader
|
29
|
+
attr_reader :reps
|
30
30
|
|
31
31
|
# @return [String] This item's raw, uncompiled content of this item (only
|
32
32
|
# available for textual items)
|
33
|
-
attr_reader
|
33
|
+
attr_reader :raw_content
|
34
34
|
|
35
35
|
# @return [String] The filename pointing to the file containing this
|
36
36
|
# item’s content
|
37
|
-
attr_reader
|
37
|
+
attr_reader :raw_filename
|
38
38
|
|
39
39
|
# @return [Nanoc::Site] The site this item belongs to
|
40
40
|
attr_accessor :site
|
@@ -175,7 +175,7 @@ module Nanoc
|
|
175
175
|
# TODO [in nanoc 4.0] remove me
|
176
176
|
if key.to_s =~ /^content_for_(.*)$/
|
177
177
|
@@_content_for_warning_issued ||= false
|
178
|
-
@@
|
178
|
+
@@_capturing_helper_included ||= false
|
179
179
|
|
180
180
|
# Warn
|
181
181
|
unless @@_content_for_warning_issued
|
@@ -184,9 +184,9 @@ module Nanoc
|
|
184
184
|
end
|
185
185
|
|
186
186
|
# Include capturing helper if necessary
|
187
|
-
unless @@
|
187
|
+
unless @@_capturing_helper_included
|
188
188
|
self.class.send(:include, ::Nanoc::Helpers::Capturing)
|
189
|
-
@@
|
189
|
+
@@_capturing_helper_included = true
|
190
190
|
end
|
191
191
|
|
192
192
|
# Get content
|
@@ -207,7 +207,7 @@ module Nanoc
|
|
207
207
|
|
208
208
|
# @return [Boolean] True if the item is binary; false if it is not
|
209
209
|
def binary?
|
210
|
-
|
210
|
+
@is_binary
|
211
211
|
end
|
212
212
|
|
213
213
|
# Returns the type of this object. Will always return `:item`, because
|
@@ -226,7 +226,7 @@ module Nanoc
|
|
226
226
|
#
|
227
227
|
# @return [Object] An unique reference to this object
|
228
228
|
def reference
|
229
|
-
[
|
229
|
+
[type, identifier]
|
230
230
|
end
|
231
231
|
|
232
232
|
# Prevents all further modifications to its attributes.
|