nanoc 3.6.7 → 3.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. checksums.yaml +8 -8
  2. data/CONTRIBUTING.md +9 -13
  3. data/Gemfile +5 -1
  4. data/Gemfile.lock +70 -45
  5. data/NEWS.md +15 -1
  6. data/README.md +12 -119
  7. data/doc/yardoc_handlers/identifier.rb +34 -0
  8. data/lib/nanoc/base/compilation/checksum_store.rb +2 -2
  9. data/lib/nanoc/base/compilation/compiler.rb +3 -3
  10. data/lib/nanoc/base/compilation/compiler_dsl.rb +20 -15
  11. data/lib/nanoc/base/compilation/dependency_tracker.rb +4 -4
  12. data/lib/nanoc/base/compilation/filter.rb +5 -5
  13. data/lib/nanoc/base/compilation/item_rep_proxy.rb +2 -2
  14. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +3 -3
  15. data/lib/nanoc/base/compilation/outdatedness_checker.rb +49 -46
  16. data/lib/nanoc/base/compilation/rule.rb +6 -4
  17. data/lib/nanoc/base/compilation/rule_context.rb +10 -4
  18. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +8 -7
  19. data/lib/nanoc/base/compilation/rule_memory_store.rb +2 -2
  20. data/lib/nanoc/base/compilation/rules_collection.rb +2 -2
  21. data/lib/nanoc/base/core_ext/array.rb +2 -2
  22. data/lib/nanoc/base/core_ext/date.rb +4 -2
  23. data/lib/nanoc/base/core_ext/hash.rb +3 -3
  24. data/lib/nanoc/base/core_ext/pathname.rb +1 -1
  25. data/lib/nanoc/base/directed_graph.rb +6 -6
  26. data/lib/nanoc/base/errors.rb +1 -1
  27. data/lib/nanoc/base/memoization.rb +4 -4
  28. data/lib/nanoc/base/notification_center.rb +1 -1
  29. data/lib/nanoc/base/ordered_hash.rb +207 -179
  30. data/lib/nanoc/base/plugin_registry.rb +7 -7
  31. data/lib/nanoc/base/result_data/item_rep.rb +25 -26
  32. data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
  33. data/lib/nanoc/base/source_data/configuration.rb +1 -1
  34. data/lib/nanoc/base/source_data/data_source.rb +2 -2
  35. data/lib/nanoc/base/source_data/item.rb +16 -15
  36. data/lib/nanoc/base/source_data/item_array.rb +4 -4
  37. data/lib/nanoc/base/source_data/layout.rb +5 -5
  38. data/lib/nanoc/base/source_data/site.rb +6 -6
  39. data/lib/nanoc/base/store.rb +8 -8
  40. data/lib/nanoc/cli/cleaning_stream.rb +11 -12
  41. data/lib/nanoc/cli/command_runner.rb +8 -8
  42. data/lib/nanoc/cli/commands/autocompile.rb +5 -4
  43. data/lib/nanoc/cli/commands/check.rb +12 -11
  44. data/lib/nanoc/cli/commands/compile.rb +50 -52
  45. data/lib/nanoc/cli/commands/create-item.rb +6 -6
  46. data/lib/nanoc/cli/commands/create-layout.rb +6 -6
  47. data/lib/nanoc/cli/commands/create-site.rb +10 -13
  48. data/lib/nanoc/cli/commands/deploy.rb +11 -11
  49. data/lib/nanoc/cli/commands/prune.rb +10 -10
  50. data/lib/nanoc/cli/commands/shell.rb +7 -7
  51. data/lib/nanoc/cli/commands/show-data.rb +22 -23
  52. data/lib/nanoc/cli/commands/show-plugins.rb +3 -3
  53. data/lib/nanoc/cli/commands/show-rules.rb +8 -8
  54. data/lib/nanoc/cli/commands/sync.rb +4 -2
  55. data/lib/nanoc/cli/commands/update.rb +4 -4
  56. data/lib/nanoc/cli/commands/validate-css.rb +3 -3
  57. data/lib/nanoc/cli/commands/validate-html.rb +3 -3
  58. data/lib/nanoc/cli/commands/validate-links.rb +3 -3
  59. data/lib/nanoc/cli/commands/view.rb +5 -3
  60. data/lib/nanoc/cli/commands/watch.rb +12 -12
  61. data/lib/nanoc/cli/error_handler.rb +58 -58
  62. data/lib/nanoc/cli/logger.rb +6 -6
  63. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
  64. data/lib/nanoc/cli/stream_cleaners.rb +0 -1
  65. data/lib/nanoc/cli.rb +24 -22
  66. data/lib/nanoc/data_sources/deprecated/delicious.rb +1 -1
  67. data/lib/nanoc/data_sources/deprecated/last_fm.rb +16 -14
  68. data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
  69. data/lib/nanoc/data_sources/filesystem.rb +22 -20
  70. data/lib/nanoc/data_sources/filesystem_unified.rb +4 -5
  71. data/lib/nanoc/data_sources/filesystem_verbose.rb +2 -3
  72. data/lib/nanoc/data_sources/static.rb +2 -2
  73. data/lib/nanoc/extra/auto_compiler.rb +3 -3
  74. data/lib/nanoc/extra/checking/check.rb +3 -3
  75. data/lib/nanoc/extra/checking/checks/css.rb +2 -2
  76. data/lib/nanoc/extra/checking/checks/external_links.rb +9 -9
  77. data/lib/nanoc/extra/checking/checks/html.rb +2 -3
  78. data/lib/nanoc/extra/checking/checks/internal_links.rb +6 -7
  79. data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
  80. data/lib/nanoc/extra/checking/dsl.rb +1 -1
  81. data/lib/nanoc/extra/checking/runner.rb +19 -19
  82. data/lib/nanoc/extra/chick.rb +11 -9
  83. data/lib/nanoc/extra/core_ext/pathname.rb +1 -2
  84. data/lib/nanoc/extra/core_ext/time.rb +2 -2
  85. data/lib/nanoc/extra/core_ext.rb +0 -1
  86. data/lib/nanoc/extra/deployer.rb +2 -2
  87. data/lib/nanoc/extra/deployers/fog.rb +12 -12
  88. data/lib/nanoc/extra/deployers/rsync.rb +6 -6
  89. data/lib/nanoc/extra/file_proxy.rb +1 -1
  90. data/lib/nanoc/extra/filesystem_tools.rb +5 -5
  91. data/lib/nanoc/extra/link_collector.rb +4 -3
  92. data/lib/nanoc/extra/pruner.rb +5 -5
  93. data/lib/nanoc/extra/validators/links.rb +3 -3
  94. data/lib/nanoc/extra/vcs.rb +1 -1
  95. data/lib/nanoc/filters/asciidoc.rb +3 -3
  96. data/lib/nanoc/filters/bluecloth.rb +1 -1
  97. data/lib/nanoc/filters/coderay.rb +2 -2
  98. data/lib/nanoc/filters/coffeescript.rb +2 -0
  99. data/lib/nanoc/filters/colorize_syntax.rb +16 -16
  100. data/lib/nanoc/filters/erb.rb +5 -5
  101. data/lib/nanoc/filters/erubis.rb +1 -1
  102. data/lib/nanoc/filters/haml.rb +1 -1
  103. data/lib/nanoc/filters/handlebars.rb +2 -2
  104. data/lib/nanoc/filters/kramdown.rb +1 -1
  105. data/lib/nanoc/filters/less.rb +1 -1
  106. data/lib/nanoc/filters/markaby.rb +1 -1
  107. data/lib/nanoc/filters/maruku.rb +1 -1
  108. data/lib/nanoc/filters/mustache.rb +1 -1
  109. data/lib/nanoc/filters/pandoc.rb +1 -1
  110. data/lib/nanoc/filters/rainpress.rb +1 -1
  111. data/lib/nanoc/filters/rdiscount.rb +1 -1
  112. data/lib/nanoc/filters/rdoc.rb +1 -1
  113. data/lib/nanoc/filters/redcarpet.rb +2 -2
  114. data/lib/nanoc/filters/redcloth.rb +9 -9
  115. data/lib/nanoc/filters/relativize_paths.rb +7 -8
  116. data/lib/nanoc/filters/rubypants.rb +1 -1
  117. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  118. data/lib/nanoc/filters/sass.rb +1 -1
  119. data/lib/nanoc/filters/slim.rb +1 -1
  120. data/lib/nanoc/filters/typogruby.rb +1 -1
  121. data/lib/nanoc/filters/uglify_js.rb +1 -1
  122. data/lib/nanoc/filters/xsl.rb +9 -7
  123. data/lib/nanoc/filters/yui_compressor.rb +2 -0
  124. data/lib/nanoc/helpers/blogging.rb +6 -6
  125. data/lib/nanoc/helpers/breadcrumbs.rb +1 -1
  126. data/lib/nanoc/helpers/capturing.rb +2 -2
  127. data/lib/nanoc/helpers/filtering.rb +1 -1
  128. data/lib/nanoc/helpers/html_escape.rb +3 -3
  129. data/lib/nanoc/helpers/link_to.rb +6 -6
  130. data/lib/nanoc/helpers/rendering.rb +2 -2
  131. data/lib/nanoc/helpers/tagging.rb +2 -2
  132. data/lib/nanoc/helpers/text.rb +1 -1
  133. data/lib/nanoc/helpers/xml_sitemap.rb +2 -2
  134. data/lib/nanoc/version.rb +1 -1
  135. data/lib/nanoc.rb +3 -2
  136. data/nanoc.gemspec +2 -6
  137. data/tasks/rubocop.rake +5 -0
  138. data/test/base/test_compiler_dsl.rb +20 -1
  139. data/test/cli/commands/test_compile.rb +4 -3
  140. data/test/cli/test_error_handler.rb +32 -0
  141. data/test/filters/test_erb.rb +1 -1
  142. data/test/filters/test_less.rb +1 -1
  143. data/test/filters/test_xsl.rb +95 -8
  144. metadata +30 -84
@@ -1,200 +1,228 @@
1
+ # encoding: utf-8
1
2
 
2
3
  # AUTHOR
3
4
  # jan molic /mig/at/1984/dot/cz/
4
5
  #
5
6
  # DESCRIPTION
6
7
  # Hash with preserved order and some array-like extensions
7
- # Public domain.
8
+ # Public domain.
8
9
  #
9
10
  # THANKS
10
11
  # Andrew Johnson for his suggestions and fixes of Hash[],
11
12
  # merge, to_a, inspect and shift
12
13
  class OrderedHash < ::Hash
13
- attr_accessor :order
14
-
15
- class << self
16
- def [] *args
17
- hsh = OrderedHash.new
18
- if Hash === args[0]
19
- hsh.replace args[0]
20
- elsif (args.size % 2) != 0
21
- raise ArgumentError, "odd number of elements for Hash"
22
- else
23
- 0.step(args.size - 1, 2) do |a|
24
- b = a + 1
25
- hsh[args[a]] = args[b]
26
- end
27
- end
28
- hsh
29
- end
30
- end
31
- def initialize(*a, &b)
32
- super
33
- @order = []
34
- end
35
- def store_only a,b
36
- store a,b
37
- end
38
- alias orig_store store
39
- def store a,b
40
- @order.push a unless has_key? a
41
- super a,b
42
- end
43
- alias []= store
44
- def == hsh2
45
- return false if @order != hsh2.order
46
- super hsh2
47
- end
48
- def clear
49
- @order = []
50
- super
51
- end
52
- def delete key
53
- @order.delete key
54
- super
55
- end
56
- def each_key
57
- @order.each { |k| yield k }
58
- self
59
- end
60
- def each_value
61
- @order.each { |k| yield self[k] }
62
- self
63
- end
64
- def each
65
- @order.each { |k| yield k,self[k] }
66
- self
67
- end
68
- alias each_pair each
69
- def delete_if
70
- @order.clone.each { |k|
71
- delete k if yield(k)
72
- }
73
- self
74
- end
75
- def values
76
- ary = []
77
- @order.each { |k| ary.push self[k] }
78
- ary
79
- end
80
- def keys
81
- @order
82
- end
83
- def first
84
- {@order.first => self[@order.first]}
85
- end
86
- def last
87
- {@order.last => self[@order.last]}
88
- end
89
- def invert
90
- hsh2 = Hash.new
91
- @order.each { |k| hsh2[self[k]] = k }
92
- hsh2
93
- end
94
- def reject &block
95
- self.dup.delete_if &block
96
- end
97
- def reject! &block
98
- hsh2 = reject &block
99
- self == hsh2 ? nil : hsh2
100
- end
101
- def replace hsh2
102
- @order = hsh2.keys
103
- super hsh2
104
- end
105
- def shift
106
- key = @order.first
107
- key ? [key,delete(key)] : super
108
- end
109
- def unshift k,v
110
- unless self.include? k
111
- @order.unshift k
112
- orig_store(k,v)
113
- true
114
- else
115
- false
116
- end
117
- end
118
- def push k,v
119
- unless self.include? k
120
- @order.push k
121
- orig_store(k,v)
122
- true
123
- else
124
- false
14
+ attr_accessor :order
15
+
16
+ class << self
17
+ def [](*args)
18
+ hsh = OrderedHash.new
19
+ if args[0].is_a?(Hash)
20
+ hsh.replace args[0]
21
+ elsif args.size.odd?
22
+ raise ArgumentError, 'odd number of elements for Hash'
23
+ else
24
+ 0.step(args.size - 1, 2) do |a|
25
+ b = a + 1
26
+ hsh[args[a]] = args[b]
125
27
  end
28
+ end
29
+ hsh
126
30
  end
127
- def pop
128
- key = @order.last
129
- key ? [key,delete(key)] : nil
130
- end
131
- def to_a
132
- ary = []
133
- each { |k,v| ary << [k,v] }
134
- ary
135
- end
136
- def to_s
137
- self.to_a.to_s
138
- end
139
- def inspect
140
- ary = []
141
- each {|k,v| ary << k.inspect + "=>" + v.inspect}
142
- '{' + ary.join(", ") + '}'
143
- end
144
- def update hsh2
145
- hsh2.each { |k,v| self[k] = v }
146
- self
147
- end
148
- alias :merge! update
149
- def merge hsh2
150
- self.dup update(hsh2)
151
- end
152
- def select
153
- ary = []
154
- each { |k,v| ary << [k,v] if yield k,v }
155
- ary
156
- end
157
- def class
158
- Hash
159
- end
160
- def __class__
161
- OrderedHash
31
+ end
32
+
33
+ def initialize(*a, &b)
34
+ super
35
+ @order = []
36
+ end
37
+
38
+ def store_only(a, b)
39
+ store a, b
40
+ end
41
+ alias_method :orig_store, :store
42
+
43
+ def store(a, b)
44
+ @order.push a unless key? a
45
+ super a, b
46
+ end
47
+ alias_method :[]=, :store
48
+
49
+ def ==(other)
50
+ return false if @order != other.order
51
+ super other
52
+ end
53
+
54
+ def clear
55
+ @order = []
56
+ super
57
+ end
58
+
59
+ def delete(key)
60
+ @order.delete key
61
+ super
62
+ end
63
+
64
+ def each_key
65
+ @order.each { |k| yield k }
66
+ self
67
+ end
68
+
69
+ def each_value
70
+ @order.each { |k| yield self[k] }
71
+ self
72
+ end
73
+
74
+ def each
75
+ @order.each { |k| yield k, self[k] }
76
+ self
77
+ end
78
+ alias_method :each_pair, :each
79
+
80
+ def delete_if
81
+ @order.clone.each do |k|
82
+ delete k if yield(k)
162
83
  end
84
+ self
85
+ end
163
86
 
164
- attr_accessor "to_yaml_style"
165
- def yaml_inline= bool
166
- if respond_to?("to_yaml_style")
167
- self.to_yaml_style = :inline
168
- else
169
- unless defined? @__yaml_inline_meth
170
- @__yaml_inline_meth =
171
- lambda {|opts|
172
- YAML::quick_emit(object_id, opts) {|emitter|
173
- emitter << '{ ' << map{|kv| kv.join ': '}.join(', ') << ' }'
174
- }
175
- }
176
- class << self
177
- def to_yaml opts = {}
178
- begin
179
- @__yaml_inline ? @__yaml_inline_meth[ opts ] : super
180
- rescue
181
- @to_yaml_style = :inline
182
- super
183
- end
184
- end
87
+ def values
88
+ ary = []
89
+ @order.each { |k| ary.push self[k] }
90
+ ary
91
+ end
92
+
93
+ def keys
94
+ @order
95
+ end
96
+
97
+ def first
98
+ { @order.first => self[@order.first] }
99
+ end
100
+
101
+ def last
102
+ { @order.last => self[@order.last] }
103
+ end
104
+
105
+ def invert
106
+ hsh2 = {}
107
+ @order.each { |k| hsh2[self[k]] = k }
108
+ hsh2
109
+ end
110
+
111
+ def reject(&block)
112
+ dup.delete_if(&block)
113
+ end
114
+
115
+ def reject!(&block)
116
+ hsh2 = reject(&block)
117
+ self == hsh2 ? nil : hsh2
118
+ end
119
+
120
+ def replace(hsh2)
121
+ @order = hsh2.keys
122
+ super hsh2
123
+ end
124
+
125
+ def shift
126
+ key = @order.first
127
+ key ? [key, delete(key)] : super
128
+ end
129
+
130
+ def unshift(k, v)
131
+ if self.include? k
132
+ false
133
+ else
134
+ @order.unshift k
135
+ orig_store(k, v)
136
+ true
137
+ end
138
+ end
139
+
140
+ def push(k, v)
141
+ if self.include? k
142
+ false
143
+ else
144
+ @order.push k
145
+ orig_store(k, v)
146
+ true
147
+ end
148
+ end
149
+
150
+ def pop
151
+ key = @order.last
152
+ key ? [key, delete(key)] : nil
153
+ end
154
+
155
+ def to_a
156
+ ary = []
157
+ each { |k, v| ary << [k, v] }
158
+ ary
159
+ end
160
+
161
+ def to_s
162
+ to_a.to_s
163
+ end
164
+
165
+ def inspect
166
+ ary = []
167
+ each { |k, v| ary << k.inspect + '=>' + v.inspect }
168
+ '{' + ary.join(', ') + '}'
169
+ end
170
+
171
+ def update(hsh2)
172
+ hsh2.each { |k, v| self[k] = v }
173
+ self
174
+ end
175
+ alias_method :merge!, :update
176
+
177
+ def merge(hsh2)
178
+ dup update(hsh2)
179
+ end
180
+
181
+ def select
182
+ ary = []
183
+ each { |k, v| ary << [k, v] if yield k, v }
184
+ ary
185
+ end
186
+
187
+ def class
188
+ Hash
189
+ end
190
+
191
+ def __class__
192
+ OrderedHash
193
+ end
194
+
195
+ attr_accessor 'to_yaml_style'
196
+ def yaml_inline=(bool)
197
+ if respond_to?('to_yaml_style')
198
+ self.to_yaml_style = :inline
199
+ else
200
+ unless defined? @__yaml_inline_meth
201
+ @__yaml_inline_meth =
202
+ lambda do |opts|
203
+ YAML.quick_emit(object_id, opts) do |emitter|
204
+ emitter << '{ ' << map { |kv| kv.join ': ' }.join(', ') << ' }'
205
+ end
206
+ end
207
+ class << self
208
+ def to_yaml(opts = {})
209
+ @__yaml_inline ? @__yaml_inline_meth[ opts ] : super
210
+ rescue
211
+ @to_yaml_style = :inline
212
+ super
185
213
  end
186
214
  end
187
215
  end
188
- @__yaml_inline = bool
189
216
  end
190
- def yaml_inline!() self.yaml_inline = true end
217
+ @__yaml_inline = bool
218
+ end
191
219
 
192
- def each_with_index
193
- @order.each_with_index { |k, index| yield k, self[k], index }
194
- self
195
- end
196
- end # class OrderedHash
220
+ def yaml_inline!
221
+ self.yaml_inline = true
222
+ end
197
223
 
198
- def OrderedHash(*a, &b)
199
- OrderedHash.new(*a, &b)
200
- end
224
+ def each_with_index
225
+ @order.each_with_index { |k, index| yield k, self[k], index }
226
+ self
227
+ end
228
+ end # class OrderedHash
@@ -28,7 +28,7 @@ module Nanoc
28
28
  # @return [Array<Symbol>] The identifiers for this plugin
29
29
  def identifiers(*identifiers)
30
30
  if identifiers.empty?
31
- Nanoc::PluginRegistry.instance.identifiers_of(self.superclass, self)
31
+ Nanoc::PluginRegistry.instance.identifiers_of(superclass, self)
32
32
  else
33
33
  register(self, *identifiers)
34
34
  end
@@ -45,11 +45,11 @@ module Nanoc
45
45
  # @overload identifier
46
46
  #
47
47
  # @return [Symbol] The first identifier for this plugin
48
- def identifier(identifier=nil)
48
+ def identifier(identifier = nil)
49
49
  if identifier
50
- self.identifiers(identifier)
50
+ identifiers(identifier)
51
51
  else
52
- Nanoc::PluginRegistry.instance.identifiers_of(self.superclass, self).first
52
+ Nanoc::PluginRegistry.instance.identifiers_of(superclass, self).first
53
53
  end
54
54
  end
55
55
 
@@ -94,7 +94,7 @@ module Nanoc
94
94
  #
95
95
  # @return [Nanoc::PluginRegistry] The shared plugin registry
96
96
  def self.instance
97
- @instance ||= self.new
97
+ @instance ||= new
98
98
  end
99
99
 
100
100
  # Creates a new plugin registry. This should usually not be necessary; it
@@ -160,7 +160,7 @@ module Nanoc
160
160
  def find_all(klass)
161
161
  @identifiers_to_classes[klass] ||= {}
162
162
  res = {}
163
- @identifiers_to_classes[klass].each_pair { |k,v| res[k] = resolve(v, k) }
163
+ @identifiers_to_classes[klass].each_pair { |k, v| res[k] = resolve(v, k) }
164
164
  res
165
165
  end
166
166
 
@@ -206,7 +206,7 @@ module Nanoc
206
206
 
207
207
  def resolve(class_or_name, klass)
208
208
  if class_or_name.is_a?(String)
209
- class_or_name.scan(/\w+/).inject(Kernel) do |memo, part|
209
+ class_or_name.scan(/\w+/).reduce(Kernel) do |memo, part|
210
210
  memo.const_get(part)
211
211
  end
212
212
  else
@@ -22,38 +22,38 @@ module Nanoc
22
22
  end
23
23
 
24
24
  # @deprecated Use {Nanoc::ItemRep#compiled_content} instead.
25
- def content_at_snapshot(snapshot=:pre)
25
+ def content_at_snapshot(snapshot = :pre)
26
26
  compiled_content(:snapshot => snapshot)
27
27
  end
28
28
 
29
29
  # @deprecated
30
30
  def created
31
- raise NotImplementedError, "Nanoc::ItemRep#created is no longer implemented"
31
+ raise NotImplementedError, 'Nanoc::ItemRep#created is no longer implemented'
32
32
  end
33
33
 
34
34
  # @deprecated
35
35
  def created?
36
- raise NotImplementedError, "Nanoc::ItemRep#created? is no longer implemented"
36
+ raise NotImplementedError, 'Nanoc::ItemRep#created? is no longer implemented'
37
37
  end
38
38
 
39
39
  # @deprecated
40
40
  def modified
41
- raise NotImplementedError, "Nanoc::ItemRep#modified is no longer implemented"
41
+ raise NotImplementedError, 'Nanoc::ItemRep#modified is no longer implemented'
42
42
  end
43
43
 
44
44
  # @deprecated
45
45
  def modified?
46
- raise NotImplementedError, "Nanoc::ItemRep#modified? is no longer implemented"
46
+ raise NotImplementedError, 'Nanoc::ItemRep#modified? is no longer implemented'
47
47
  end
48
48
 
49
49
  # @deprecated
50
50
  def written
51
- raise NotImplementedError, "Nanoc::ItemRep#written is no longer implemented"
51
+ raise NotImplementedError, 'Nanoc::ItemRep#written is no longer implemented'
52
52
  end
53
53
 
54
54
  # @deprecated
55
55
  def written?
56
- raise NotImplementedError, "Nanoc::ItemRep#written? is no longer implemented"
56
+ raise NotImplementedError, 'Nanoc::ItemRep#written? is no longer implemented'
57
57
  end
58
58
 
59
59
  end
@@ -118,7 +118,7 @@ module Nanoc
118
118
  # @param [Symbol, nil] snapshot The name of the snapshot to write.
119
119
  #
120
120
  # @return [void]
121
- def write(snapshot=:last)
121
+ def write(snapshot = :last)
122
122
  # Get raw path
123
123
  raw_path = self.raw_path(:snapshot => snapshot)
124
124
  return if raw_path.nil?
@@ -135,7 +135,7 @@ module Nanoc
135
135
  if self.binary?
136
136
  temp_path = temporary_filenames[:last]
137
137
  else
138
- temp_path = self.temp_filename
138
+ temp_path = temp_filename
139
139
  File.open(temp_path, 'w') { |io| io.write(@content[:last]) }
140
140
  end
141
141
 
@@ -235,15 +235,15 @@ module Nanoc
235
235
  #
236
236
  # @return [String] The compiled content at the given snapshot (or the
237
237
  # default snapshot if no snapshot is specified)
238
- def compiled_content(params={})
238
+ def compiled_content(params = {})
239
239
  # Make sure we're not binary
240
- if self.item.binary?
240
+ if item.binary?
241
241
  raise Nanoc::Errors::CannotGetCompiledContentOfBinaryItem.new(self)
242
242
  end
243
243
 
244
244
  # Notify
245
- Nanoc::NotificationCenter.post(:visit_started, self.item)
246
- Nanoc::NotificationCenter.post(:visit_ended, self.item)
245
+ Nanoc::NotificationCenter.post(:visit_started, item)
246
+ Nanoc::NotificationCenter.post(:visit_ended, item)
247
247
 
248
248
  # Get name of last pre-layout snapshot
249
249
  snapshot = params.fetch(:snapshot) { @content[:pre] ? :pre : :last }
@@ -279,9 +279,9 @@ module Nanoc
279
279
  # path should be returned
280
280
  #
281
281
  # @return [String] The item rep’s path
282
- def raw_path(params={})
283
- Nanoc3::NotificationCenter.post(:visit_started, self.item)
284
- Nanoc3::NotificationCenter.post(:visit_ended, self.item)
282
+ def raw_path(params = {})
283
+ Nanoc3::NotificationCenter.post(:visit_started, item)
284
+ Nanoc3::NotificationCenter.post(:visit_ended, item)
285
285
 
286
286
  snapshot_name = params[:snapshot] || :last
287
287
  @raw_paths[snapshot_name]
@@ -296,9 +296,9 @@ module Nanoc
296
296
  # path should be returned
297
297
  #
298
298
  # @return [String] The item rep’s path
299
- def path(params={})
300
- Nanoc3::NotificationCenter.post(:visit_started, self.item)
301
- Nanoc3::NotificationCenter.post(:visit_ended, self.item)
299
+ def path(params = {})
300
+ Nanoc3::NotificationCenter.post(:visit_started, item)
301
+ Nanoc3::NotificationCenter.post(:visit_ended, item)
302
302
 
303
303
  snapshot_name = params[:snapshot] || :last
304
304
  @paths[snapshot_name]
@@ -320,7 +320,7 @@ module Nanoc
320
320
  # the filter's #run method
321
321
  #
322
322
  # @return [void]
323
- def filter(filter_name, filter_args={})
323
+ def filter(filter_name, filter_args = {})
324
324
  # Get filter class
325
325
  klass = filter_named(filter_name)
326
326
  raise Nanoc::Errors::UnknownFilter.new(filter_name) if klass.nil?
@@ -352,8 +352,7 @@ module Nanoc
352
352
 
353
353
  # Check whether file was written
354
354
  if self.binary? && !File.file?(filter.output_filename)
355
- raise RuntimeError,
356
- "The #{filter_name.inspect} filter did not write anything to the required output file, #{filter.output_filename}."
355
+ raise "The #{filter_name.inspect} filter did not write anything to the required output file, #{filter.output_filename}."
357
356
  end
358
357
 
359
358
  # Create snapshot
@@ -426,10 +425,10 @@ module Nanoc
426
425
  # snapshot (such as `:pre`, `:post` or `:last`)
427
426
  #
428
427
  # @return [void]
429
- def snapshot(snapshot_name, params={})
428
+ def snapshot(snapshot_name, params = {})
430
429
  is_final = params.fetch(:final) { true }
431
430
  @content[snapshot_name] = @content[:last] unless self.binary?
432
- self.write(snapshot_name) if is_final
431
+ write(snapshot_name) if is_final
433
432
  end
434
433
 
435
434
  # Returns a recording proxy that is used for determining whether the
@@ -462,11 +461,11 @@ module Nanoc
462
461
  #
463
462
  # @return [Object] An unique reference to this object
464
463
  def reference
465
- [ type, self.item.identifier, self.name ]
464
+ [ type, item.identifier, name ]
466
465
  end
467
466
 
468
467
  def inspect
469
- "<#{self.class} name=\"#{self.name}\" binary=#{self.binary?} raw_path=\"#{self.raw_path}\" item.identifier=\"#{self.item.identifier}\">"
468
+ "<#{self.class} name=\"#{name}\" binary=#{self.binary?} raw_path=\"#{raw_path}\" item.identifier=\"#{item.identifier}\">"
470
469
  end
471
470
 
472
471
  private
@@ -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, params=nil)
27
+ def initialize(data, filename, params = nil)
28
28
  @data = data
29
29
  @filename = filename
30
30
  end
@@ -44,7 +44,7 @@ module Nanoc
44
44
  end
45
45
 
46
46
  def inspect
47
- "<#{self.class} filename=\"#{self.filename}\">"
47
+ "<#{self.class} filename=\"#{filename}\">"
48
48
  end
49
49
 
50
50
  # @return [String] The checksum for this object. If its contents change,
@@ -9,7 +9,7 @@ module Nanoc
9
9
  #
10
10
  # @param [Hash] hash The actual configuration hash
11
11
  def initialize(hash)
12
- self.replace(hash)
12
+ replace(hash)
13
13
  end
14
14
 
15
15
  # Returns an object that can be used for uniquely identifying objects.
@@ -207,7 +207,7 @@ module Nanoc
207
207
  # files that should be generated.
208
208
  #
209
209
  # @return [void]
210
- def create_item(content, attributes, identifier, params={})
210
+ def create_item(content, attributes, identifier, params = {})
211
211
  not_implemented('create_item')
212
212
  end
213
213
 
@@ -230,7 +230,7 @@ module Nanoc
230
230
  # files that should be generated.
231
231
  #
232
232
  # @return [void]
233
- def create_layout(content, attributes, identifier, params={})
233
+ def create_layout(content, attributes, identifier, params = {})
234
234
  not_implemented('create_layout')
235
235
  end
236
236