nanoc 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +31 -35
  4. data/NEWS.md +11 -0
  5. data/lib/nanoc/base/compilation/compiler.rb +8 -7
  6. data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -2
  7. data/lib/nanoc/base/entities/document.rb +2 -5
  8. data/lib/nanoc/base/entities/identifier.rb +6 -1
  9. data/lib/nanoc/base/views/item_rep_view.rb +1 -1
  10. data/lib/nanoc/cli/commands/check.rb +4 -2
  11. data/lib/nanoc/cli/commands/create-site.rb +4 -2
  12. data/lib/nanoc/cli/commands/deploy.rb +2 -2
  13. data/lib/nanoc/cli/commands/show-plugins.rb +2 -2
  14. data/lib/nanoc/cli/error_handler.rb +6 -6
  15. data/lib/nanoc/cli/logger.rb +5 -2
  16. data/lib/nanoc/data_sources/filesystem.rb +1 -1
  17. data/lib/nanoc/extra/checking/checks/internal_links.rb +1 -1
  18. data/lib/nanoc/extra/deployers/fog.rb +1 -1
  19. data/lib/nanoc/extra/filesystem_tools.rb +4 -2
  20. data/lib/nanoc/filters/colorize_syntax.rb +3 -3
  21. data/lib/nanoc/filters/rdiscount.rb +1 -1
  22. data/lib/nanoc/filters/sass.rb +2 -2
  23. data/lib/nanoc/filters/slim.rb +1 -1
  24. data/lib/nanoc/helpers/link_to.rb +2 -2
  25. data/lib/nanoc/version.rb +1 -1
  26. data/tasks/rubocop.rake +1 -1
  27. data/test/base/test_directed_graph.rb +4 -4
  28. data/test/base/test_outdatedness_checker.rb +11 -22
  29. data/test/cli/commands/test_compile.rb +1 -2
  30. data/test/data_sources/test_filesystem.rb +1 -1
  31. data/test/data_sources/test_filesystem_unified.rb +2 -2
  32. data/test/extra/checking/checks/test_css.rb +5 -4
  33. data/test/extra/checking/checks/test_stale.rb +1 -1
  34. data/test/filters/test_erb.rb +2 -2
  35. data/test/filters/test_relativize_paths.rb +3 -2
  36. data/test/filters/test_xsl.rb +6 -18
  37. data/test/helper.rb +14 -6
  38. data/test/helpers/test_blogging.rb +2 -2
  39. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76d4a414bdd518ff5a609bef5e8fdebe476ab1fc
4
- data.tar.gz: 3155b99958dcda234715e583c1a87cb9d6c2dc7e
3
+ metadata.gz: d4aaeac805ae4631f3075442c8fa2382ae42085a
4
+ data.tar.gz: d7b42a8044e1ff67765bb93383e1951963cc2593
5
5
  SHA512:
6
- metadata.gz: 6d9d6387aa77fd9dc6e3e0b9c35e7b52722a2273011b31cb2874879ebad7bdab958f7ce44b349c489226896a09f73f6c99c3b43fad8a9487f0bb81c0489cd9e8
7
- data.tar.gz: c69890e971f56e7c504d2741d30bd1c7f741b1f13a1106378d05f101c2a2fe44f8d00abb25dd257f3841b47c3a7d623b86cc7604a040f557922550149a807b6d
6
+ metadata.gz: eb371cfa1c4843698736980aac9b42a914732bc8e04c6af2e022548aa220c9071ff05223b47e83cf547af07d586ceffb264648aa6deec7fe232fcc852939c9c7
7
+ data.tar.gz: 4e55855d72a97dfc6bc7eaeb620e6139e9a5254ca68ab727a61244e7883f7bebd506ceb39addba87a078c47c439dcc510581cd5f5262235e3c0834876ffd4407
data/Gemfile CHANGED
@@ -41,7 +41,7 @@ gem 'redcarpet', platforms: [:ruby, :mswin]
41
41
  gem 'RedCloth'
42
42
  gem 'rouge'
43
43
  gem 'rspec'
44
- gem 'rubocop', '~> 0.31.0'
44
+ gem 'rubocop'
45
45
  gem 'rubypants'
46
46
  gem 'sass', '~> 3.2.2'
47
47
  gem 'simplecov', require: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (4.0.0)
4
+ nanoc (4.0.1)
5
5
  cri (~> 2.3)
6
6
 
7
7
  GEM
@@ -22,19 +22,20 @@ GEM
22
22
  coffee-script (2.4.1)
23
23
  coffee-script-source
24
24
  execjs
25
- coffee-script-source (1.9.1.1)
25
+ coffee-script-source (1.10.0)
26
26
  colored (1.2)
27
27
  commonjs (0.2.7)
28
28
  compass (0.12.7)
29
29
  chunky_png (~> 1.2)
30
30
  fssm (>= 0.2.7)
31
31
  sass (~> 3.2.19)
32
- coveralls (0.8.3)
32
+ coveralls (0.8.9)
33
33
  json (~> 1.8)
34
34
  rest-client (>= 1.6.8, < 2)
35
35
  simplecov (~> 0.10.0)
36
36
  term-ansicolor (~> 1.3)
37
37
  thor (~> 0.19.1)
38
+ tins (~> 1.6.0)
38
39
  crack (0.4.2)
39
40
  safe_yaml (~> 1.0.0)
40
41
  cri (2.7.0)
@@ -49,15 +50,15 @@ GEM
49
50
  ffi (1.9.10)
50
51
  fission (0.5.0)
51
52
  CFPropertyList (~> 2.2)
52
- fog (1.35.0)
53
- fog-aliyun
53
+ fog (1.36.0)
54
+ fog-aliyun (>= 0.1.0)
54
55
  fog-atmos
55
56
  fog-aws (>= 0.6.0)
56
57
  fog-brightbox (~> 0.4)
57
58
  fog-core (~> 1.32)
58
59
  fog-dynect (~> 0.0.2)
59
60
  fog-ecloud (~> 0.1)
60
- fog-google (>= 0.1.1)
61
+ fog-google (<= 0.1.0)
61
62
  fog-json
62
63
  fog-local
63
64
  fog-powerdns (>= 0.1.1)
@@ -74,7 +75,7 @@ GEM
74
75
  fog-xenserver
75
76
  fog-xml (~> 0.1.1)
76
77
  ipaddress (~> 0.5)
77
- nokogiri
78
+ nokogiri (~> 1.5, >= 1.5.11)
78
79
  fog-aliyun (0.1.0)
79
80
  fog-core (~> 1.27)
80
81
  fog-json (~> 1.0)
@@ -92,13 +93,10 @@ GEM
92
93
  fog-core (~> 1.22)
93
94
  fog-json
94
95
  inflecto (~> 0.0.2)
95
- fog-core (1.32.1)
96
+ fog-core (1.35.0)
96
97
  builder
97
98
  excon (~> 0.45)
98
99
  formatador (~> 0.2)
99
- mime-types
100
- net-scp (~> 1.1)
101
- net-ssh (>= 2.1.3)
102
100
  fog-dynect (0.0.2)
103
101
  fog-core
104
102
  fog-json
@@ -106,7 +104,7 @@ GEM
106
104
  fog-ecloud (0.3.0)
107
105
  fog-core
108
106
  fog-xml
109
- fog-google (0.1.1)
107
+ fog-google (0.1.0)
110
108
  fog-core
111
109
  fog-json
112
110
  fog-xml
@@ -131,7 +129,7 @@ GEM
131
129
  fog-core
132
130
  fog-json
133
131
  fog-xml
134
- fog-sakuracloud (1.3.3)
132
+ fog-sakuracloud (1.4.0)
135
133
  fog-core
136
134
  fog-json
137
135
  fog-serverlove (0.1.2)
@@ -176,7 +174,7 @@ GEM
176
174
  less (2.6.0)
177
175
  commonjs (~> 0.2.7)
178
176
  libv8 (3.16.14.13)
179
- listen (3.0.4)
177
+ listen (3.0.5)
180
178
  rb-fsevent (>= 0.9.3)
181
179
  rb-inotify (>= 0.9)
182
180
  markaby (0.8.0)
@@ -184,18 +182,15 @@ GEM
184
182
  maruku (0.7.2)
185
183
  metaclass (0.0.4)
186
184
  method_source (0.8.2)
187
- mime-types (2.6.2)
185
+ mime-types (2.99)
188
186
  mini_portile (0.6.2)
189
- minitest (5.8.2)
187
+ minitest (5.8.3)
190
188
  mocha (1.1.0)
191
189
  metaclass (~> 0.0.1)
192
190
  multi_json (1.11.2)
193
191
  mustache (1.0.2)
194
- net-scp (1.2.1)
195
- net-ssh (>= 2.6.5)
196
- net-ssh (3.0.1)
197
192
  netrc (0.11.0)
198
- nokogiri (1.6.6.2)
193
+ nokogiri (1.6.6.4)
199
194
  mini_portile (~> 0.6.0)
200
195
  pandoc-ruby (1.0.0)
201
196
  parser (2.2.3.0)
@@ -225,25 +220,26 @@ GEM
225
220
  mime-types (>= 1.16, < 3.0)
226
221
  netrc (~> 0.7)
227
222
  rouge (1.10.1)
228
- rspec (3.3.0)
229
- rspec-core (~> 3.3.0)
230
- rspec-expectations (~> 3.3.0)
231
- rspec-mocks (~> 3.3.0)
232
- rspec-core (3.3.2)
233
- rspec-support (~> 3.3.0)
234
- rspec-expectations (3.3.1)
223
+ rspec (3.4.0)
224
+ rspec-core (~> 3.4.0)
225
+ rspec-expectations (~> 3.4.0)
226
+ rspec-mocks (~> 3.4.0)
227
+ rspec-core (3.4.1)
228
+ rspec-support (~> 3.4.0)
229
+ rspec-expectations (3.4.0)
235
230
  diff-lcs (>= 1.2.0, < 2.0)
236
- rspec-support (~> 3.3.0)
237
- rspec-mocks (3.3.2)
231
+ rspec-support (~> 3.4.0)
232
+ rspec-mocks (3.4.0)
238
233
  diff-lcs (>= 1.2.0, < 2.0)
239
- rspec-support (~> 3.3.0)
240
- rspec-support (3.3.0)
241
- rubocop (0.31.0)
234
+ rspec-support (~> 3.4.0)
235
+ rspec-support (3.4.1)
236
+ rubocop (0.35.1)
242
237
  astrolabe (~> 1.3)
243
- parser (>= 2.2.2.1, < 3.0)
238
+ parser (>= 2.2.3.0, < 3.0)
244
239
  powerpack (~> 0.1)
245
240
  rainbow (>= 1.99.1, < 3.0)
246
- ruby-progressbar (~> 1.4)
241
+ ruby-progressbar (~> 1.7)
242
+ tins (<= 1.6.0)
247
243
  ruby-progressbar (1.7.5)
248
244
  rubypants (0.2.0)
249
245
  safe_yaml (1.0.4)
@@ -326,7 +322,7 @@ DEPENDENCIES
326
322
  redcarpet
327
323
  rouge
328
324
  rspec
329
- rubocop (~> 0.31.0)
325
+ rubocop
330
326
  rubypants
331
327
  sass (~> 3.2.2)
332
328
  simplecov
data/NEWS.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.0.1 (2015-11-28)
4
+
5
+ Fixes:
6
+
7
+ * Fixed params documentation for :rdiscount filter (#722)
8
+ * Fixed crash when comparing item rep views (#735, #738)
9
+
10
+ Enhancements:
11
+
12
+ * Lowered minimum required Ruby version from 2.2 to 2.1 (#732)
13
+
3
14
  ## 4.0.0 (2015-11-07)
4
15
 
5
16
  Enhancements:
@@ -275,7 +275,7 @@ module Nanoc::Int
275
275
  end
276
276
 
277
277
  # TODO: Do not expose @site (necessary for captures store though…)
278
- content_or_filename_assigns.merge({
278
+ content_or_filename_assigns.merge(
279
279
  item: Nanoc::ItemView.new(rep.item),
280
280
  rep: Nanoc::ItemRepView.new(rep),
281
281
  item_rep: Nanoc::ItemRepView.new(rep),
@@ -283,7 +283,7 @@ module Nanoc::Int
283
283
  layouts: Nanoc::LayoutCollectionView.new(site.layouts),
284
284
  config: Nanoc::ConfigView.new(site.config),
285
285
  site: Nanoc::SiteView.new(site),
286
- })
286
+ )
287
287
  end
288
288
 
289
289
  # @return [Nanoc::Int::OutdatednessChecker] The outdatedness checker
@@ -291,7 +291,8 @@ module Nanoc::Int
291
291
  Nanoc::Int::OutdatednessChecker.new(
292
292
  site: @site,
293
293
  checksum_store: checksum_store,
294
- dependency_tracker: dependency_tracker)
294
+ dependency_tracker: dependency_tracker,
295
+ )
295
296
  end
296
297
  memoize :outdatedness_checker
297
298
 
@@ -325,7 +326,7 @@ module Nanoc::Int
325
326
 
326
327
  # Listen to processing start/stop
327
328
  Nanoc::Int::NotificationCenter.on(:processing_started, self) { |obj| @stack.push(obj) }
328
- Nanoc::Int::NotificationCenter.on(:processing_ended, self) { |_obj| @stack.pop }
329
+ Nanoc::Int::NotificationCenter.on(:processing_ended, self) { |_obj| @stack.pop }
329
330
 
330
331
  # Assign snapshots
331
332
  reps.each do |rep|
@@ -402,7 +403,7 @@ module Nanoc::Int
402
403
  Nanoc::Int::NotificationCenter.post(:compilation_failed, rep, e)
403
404
  raise e
404
405
  ensure
405
- Nanoc::Int::NotificationCenter.post(:visit_ended, rep.item)
406
+ Nanoc::Int::NotificationCenter.post(:visit_ended, rep.item)
406
407
  end
407
408
 
408
409
  # Clears the list of dependencies for items that will be recompiled.
@@ -421,11 +422,11 @@ module Nanoc::Int
421
422
 
422
423
  # Returns a preprocessor context, creating one if none exists yet.
423
424
  def preprocessor_context
424
- Nanoc::Int::Context.new({
425
+ Nanoc::Int::Context.new(
425
426
  config: Nanoc::MutableConfigView.new(@site.config),
426
427
  items: Nanoc::MutableItemCollectionView.new(@site.items),
427
428
  layouts: Nanoc::MutableLayoutCollectionView.new(@site.layouts),
428
- })
429
+ )
429
430
  end
430
431
  memoize :preprocessor_context
431
432
 
@@ -266,8 +266,10 @@ module Nanoc::Int
266
266
  when 'legacy'
267
267
  Nanoc::Int::Pattern.from(identifier_to_regex(arg))
268
268
  else
269
- raise Nanoc::Int::Errors::GenericTrivial,
270
- "Invalid string_pattern_type: #{@config[:string_pattern_type]}"
269
+ raise(
270
+ Nanoc::Int::Errors::GenericTrivial,
271
+ "Invalid string_pattern_type: #{@config[:string_pattern_type]}",
272
+ )
271
273
  end
272
274
  end
273
275
 
@@ -44,13 +44,10 @@ module Nanoc
44
44
  self.class.hash ^ identifier.hash
45
45
  end
46
46
 
47
- def eql?(other)
48
- self.class == other.class && identifier == other.identifier
49
- end
50
-
51
47
  def ==(other)
52
- self.eql?(other)
48
+ other.respond_to?(:identifier) && identifier == other.identifier
53
49
  end
50
+ alias_method :eql?, :==
54
51
  end
55
52
  end
56
53
  end
@@ -65,7 +65,12 @@ module Nanoc
65
65
  end
66
66
 
67
67
  def ==(other)
68
- to_s == other.to_s
68
+ case other
69
+ when Nanoc::Identifier, String
70
+ to_s == other.to_s
71
+ else
72
+ false
73
+ end
69
74
  end
70
75
  alias_method :eql?, :==
71
76
 
@@ -12,7 +12,7 @@ module Nanoc
12
12
 
13
13
  # @see Object#==
14
14
  def ==(other)
15
- item.identifier == other.item.identifier && name == other.name
15
+ other.respond_to?(:item) && other.respond_to?(:name) && item == other.item && name == other.name
16
16
  end
17
17
  alias_method :eql?, :==
18
18
 
@@ -39,8 +39,10 @@ module Nanoc::CLI::Commands
39
39
 
40
40
  def validate_options_and_arguments
41
41
  if arguments.empty? && !options[:all] && !options[:deploy] && !options[:list]
42
- raise Nanoc::Int::Errors::GenericTrivial,
43
- 'nothing to do (pass either --all, --deploy or --list or a list of checks)'
42
+ raise(
43
+ Nanoc::Int::Errors::GenericTrivial,
44
+ 'nothing to do (pass either --all, --deploy or --list or a list of checks)',
45
+ )
44
46
  end
45
47
  end
46
48
  end
@@ -290,9 +290,11 @@ EOS
290
290
 
291
291
  # Check whether site exists
292
292
  if File.exist?(path) && (!File.directory?(path) || !(Dir.entries(path) - %w(. ..)).empty?) && !options[:force]
293
- raise Nanoc::Int::Errors::GenericTrivial,
293
+ raise(
294
+ Nanoc::Int::Errors::GenericTrivial,
294
295
  "The site was not created because '#{path}' already exists. " \
295
- 'Re-run the command using --force to create the site anyway.'
296
+ 'Re-run the command using --force to create the site anyway.',
297
+ )
296
298
  end
297
299
 
298
300
  # Setup notifications
@@ -4,11 +4,11 @@ description "
4
4
  Deploys the compiled site. The compiled site contents in the output directory will be uploaded to the destination, which is specified using the `--target` option.
5
5
  "
6
6
 
7
- option :t, :target, 'specify the location to deploy to (default: `default`)', argument: :required
7
+ option :t, :target, 'specify the location to deploy to (default: `default`)', argument: :required
8
8
  flag :C, :'no-check', 'do not run the issue checks marked for deployment'
9
9
  flag :L, :list, 'list available locations to deploy to'
10
10
  flag :D, :'list-deployers', 'list available deployers'
11
- option :n, :'dry-run', 'show what would be deployed'
11
+ option :n, :'dry-run', 'show what would be deployed'
12
12
 
13
13
  module Nanoc::CLI::Commands
14
14
  class Deploy < ::Nanoc::CLI::CommandRunner
@@ -17,7 +17,7 @@ module Nanoc::CLI::Commands
17
17
  # Get list of plugins (before and after)
18
18
  plugins_before = Nanoc::Int::PluginRegistry.instance.all
19
19
  site.code_snippets if site
20
- plugins_after = Nanoc::Int::PluginRegistry.instance.all
20
+ plugins_after = Nanoc::Int::PluginRegistry.instance.all
21
21
 
22
22
  # Divide list of plugins into builtin and custom
23
23
  plugins_builtin = plugins_before
@@ -32,7 +32,7 @@ module Nanoc::CLI::Commands
32
32
  PLUGIN_CLASS_ORDER.each do |superclass|
33
33
  plugins_with_this_superclass = {
34
34
  builtin: plugins_builtin.select { |p| p[:superclass] == superclass },
35
- custom: plugins_custom.select { |p| p[:superclass] == superclass },
35
+ custom: plugins_custom.select { |p| p[:superclass] == superclass },
36
36
  }
37
37
 
38
38
  # Print kind
@@ -135,12 +135,12 @@ module Nanoc::CLI
135
135
  write_error_message(stream, error, verbose: true)
136
136
  write_compilation_stack(stream, error, verbose: true)
137
137
  write_stack_trace(stream, error, verbose: true)
138
- write_version_information(stream, verbose: true)
139
- write_system_information(stream, verbose: true)
140
- write_installed_gems(stream, verbose: true)
141
- write_environment(stream, verbose: true)
142
- write_gemfile_lock(stream, verbose: true)
143
- write_load_paths(stream, verbose: true)
138
+ write_version_information(stream, verbose: true)
139
+ write_system_information(stream, verbose: true)
140
+ write_installed_gems(stream, verbose: true)
141
+ write_environment(stream, verbose: true)
142
+ write_gemfile_lock(stream, verbose: true)
143
+ write_load_paths(stream, verbose: true)
144
144
  end
145
145
 
146
146
  protected
@@ -41,12 +41,15 @@ module Nanoc::CLI
41
41
  def file(level, action, name, duration = nil)
42
42
  log(
43
43
  level,
44
- format('%s%12s%s %s%s',
44
+ format(
45
+ '%s%12s%s %s%s',
45
46
  ACTION_COLORS[action.to_sym],
46
47
  action,
47
48
  "\e[0m",
48
49
  duration.nil? ? '' : format('[%2.2fs] ', duration),
49
- name))
50
+ name,
51
+ )
52
+ )
50
53
  end
51
54
 
52
55
  # Logs a message.
@@ -297,7 +297,7 @@ module Nanoc::DataSources
297
297
  end
298
298
 
299
299
  # Remove UTF-8 BOM (ugly)
300
- data.gsub!("\xEF\xBB\xBF", '')
300
+ data.delete!("\xEF\xBB\xBF")
301
301
 
302
302
  data
303
303
  end
@@ -65,7 +65,7 @@ module Nanoc::Extra::Checking::Checks
65
65
  end
66
66
 
67
67
  def excluded?(href)
68
- excludes = @config.fetch(:checks, {}).fetch(:internal_links, {}).fetch(:exclude, [])
68
+ excludes = @config.fetch(:checks, {}).fetch(:internal_links, {}).fetch(:exclude, [])
69
69
  excludes.any? { |pattern| Regexp.new(pattern).match(href) }
70
70
  end
71
71
  end
@@ -69,7 +69,7 @@ module Nanoc::Extra::Deployers
69
69
  truncated = set.is_truncated
70
70
  files += set
71
71
  end
72
- keys_to_destroy = files.all.map(&:key)
72
+ keys_to_destroy = files.map(&:key)
73
73
  keys_to_invalidate = []
74
74
  etags = read_etags(files)
75
75
 
@@ -100,8 +100,10 @@ module Nanoc::Extra
100
100
  when Array
101
101
  patterns.concat(extra_files.map { |extra_file| "#{dir_name}/#{extra_file}" })
102
102
  else
103
- raise Nanoc::Int::Errors::GenericTrivial,
104
- "Do not know how to handle extra_files: #{extra_files.inspect}"
103
+ raise(
104
+ Nanoc::Int::Errors::GenericTrivial,
105
+ "Do not know how to handle extra_files: #{extra_files.inspect}",
106
+ )
105
107
  end
106
108
  Dir.glob(patterns)
107
109
  end
@@ -243,9 +243,9 @@ module Nanoc::Filters
243
243
  end
244
244
 
245
245
  SIMON_HIGHLIGHT_OPT_MAP = {
246
- wrap: '-W',
247
- include_style: '-I',
248
- line_numbers: '-l',
246
+ wrap: '-W',
247
+ include_style: '-I',
248
+ line_numbers: '-l',
249
249
  }
250
250
 
251
251
  # Runs the content through [Highlight](http://www.andre-simon.de/doku/highlight/en/highlight.html).
@@ -5,7 +5,7 @@ module Nanoc::Filters
5
5
 
6
6
  # Runs the content through [RDiscount](http://github.com/rtomayko/rdiscount).
7
7
  #
8
- # @option params [Array] :symbol ([]) A list of RDiscount extensions
8
+ # @option params [Array] :extensions ([]) A list of RDiscount extensions
9
9
  #
10
10
  # @param [String] content The content to filter
11
11
  #
@@ -10,10 +10,10 @@ module Nanoc::Filters
10
10
  #
11
11
  # @return [String] The filtered content
12
12
  def run(content, params = {})
13
- options = params.merge({
13
+ options = params.merge(
14
14
  nanoc_current_filter: self,
15
15
  filename: @item && @item.raw_filename,
16
- })
16
+ )
17
17
  engine = ::Sass::Engine.new(content, options)
18
18
  engine.render
19
19
  end
@@ -13,7 +13,7 @@ module Nanoc::Filters
13
13
  # @return [String] The filtered content
14
14
  def run(content, params = {})
15
15
  params = {
16
- disable_capture: true, # Capture managed by Nanoc
16
+ disable_capture: true, # Capture managed by Nanoc
17
17
  buffer: '_erbout', # Force slim to output to the buffer used by Nanoc
18
18
  }.merge params
19
19
 
@@ -128,11 +128,11 @@ module Nanoc::Helpers
128
128
  end
129
129
 
130
130
  # Get source and destination paths
131
- dst_path = Pathname.new(path)
131
+ dst_path = Pathname.new(path)
132
132
  if @item_rep.path.nil?
133
133
  raise "Cannot get the relative path to #{path} because the current item representation, #{@item_rep.inspect}, is not outputted (its routing rule returns nil)"
134
134
  end
135
- src_path = Pathname.new(@item_rep.path)
135
+ src_path = Pathname.new(@item_rep.path)
136
136
 
137
137
  # Calculate the relative path (method depends on whether destination is
138
138
  # a directory or not).
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.0.0'
3
+ VERSION = '4.0.1'
4
4
  end
@@ -2,5 +2,5 @@ require 'rubocop/rake_task'
2
2
 
3
3
  RuboCop::RakeTask.new(:rubocop) do |task|
4
4
  task.options = %w( --display-cop-names --format simple )
5
- task.patterns = ['lib/**/*.rb']
5
+ task.patterns = ['bin/nanoc', 'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb']
6
6
  end
@@ -4,7 +4,7 @@ class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
4
4
  graph.add_edge(1, 2)
5
5
  graph.add_edge(2, 3)
6
6
 
7
- assert_equal [], graph.direct_predecessors_of(1)
7
+ assert_equal [], graph.direct_predecessors_of(1)
8
8
  assert_equal [1], graph.direct_predecessors_of(2)
9
9
  assert_equal [2], graph.direct_predecessors_of(3)
10
10
  end
@@ -14,7 +14,7 @@ class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
14
14
  graph.add_edge(1, 2)
15
15
  graph.add_edge(2, 3)
16
16
 
17
- assert_equal [], graph.predecessors_of(1).sort
17
+ assert_equal [], graph.predecessors_of(1).sort
18
18
  assert_equal [1], graph.predecessors_of(2).sort
19
19
  assert_equal [1, 2], graph.predecessors_of(3).sort
20
20
  end
@@ -26,7 +26,7 @@ class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
26
26
 
27
27
  assert_equal [2], graph.direct_successors_of(1)
28
28
  assert_equal [3], graph.direct_successors_of(2)
29
- assert_equal [], graph.direct_successors_of(3)
29
+ assert_equal [], graph.direct_successors_of(3)
30
30
  end
31
31
 
32
32
  def test_successors
@@ -36,7 +36,7 @@ class Nanoc::Int::DirectedGraphTest < Nanoc::TestCase
36
36
 
37
37
  assert_equal [2, 3], graph.successors_of(1).sort
38
38
  assert_equal [3], graph.successors_of(2).sort
39
- assert_equal [], graph.successors_of(3).sort
39
+ assert_equal [], graph.successors_of(3).sort
40
40
  end
41
41
 
42
42
  def test_edges
@@ -40,8 +40,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
40
40
  site.compiler.load
41
41
  outdatedness_checker = site.compiler.send :outdatedness_checker
42
42
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
43
- assert_equal ::Nanoc::Int::OutdatednessReasons::NotEnoughData,
44
- outdatedness_checker.outdatedness_reason_for(rep)
43
+ assert_equal ::Nanoc::Int::OutdatednessReasons::NotEnoughData, outdatedness_checker.outdatedness_reason_for(rep)
45
44
  end
46
45
  end
47
46
 
@@ -66,8 +65,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
66
65
  site.compiler.load
67
66
  outdatedness_checker = site.compiler.send :outdatedness_checker
68
67
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
69
- assert_equal ::Nanoc::Int::OutdatednessReasons::NotWritten,
70
- outdatedness_checker.outdatedness_reason_for(rep)
68
+ assert_equal ::Nanoc::Int::OutdatednessReasons::NotWritten, outdatedness_checker.outdatedness_reason_for(rep)
71
69
  end
72
70
  end
73
71
 
@@ -93,8 +91,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
93
91
  site.compiler.load
94
92
  outdatedness_checker = site.compiler.send :outdatedness_checker
95
93
  rep = site.items.find { |i| i.identifier == '/new/' }.reps[0]
96
- assert_equal ::Nanoc::Int::OutdatednessReasons::SourceModified,
97
- outdatedness_checker.outdatedness_reason_for(rep)
94
+ assert_equal ::Nanoc::Int::OutdatednessReasons::SourceModified, outdatedness_checker.outdatedness_reason_for(rep)
98
95
  end
99
96
  end
100
97
 
@@ -121,8 +118,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
121
118
 
122
119
  outdatedness_checker = site.compiler.send :outdatedness_checker
123
120
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
124
- assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
125
- outdatedness_checker.outdatedness_reason_for(rep)
121
+ assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated, outdatedness_checker.outdatedness_reason_for(rep)
126
122
  end
127
123
  end
128
124
 
@@ -155,8 +151,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
155
151
 
156
152
  outdatedness_checker = site.compiler.send :outdatedness_checker
157
153
  rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
158
- assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
159
- outdatedness_checker.outdatedness_reason_for(rep)
154
+ assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated, outdatedness_checker.outdatedness_reason_for(rep)
160
155
  end
161
156
  end
162
157
 
@@ -192,8 +187,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
192
187
 
193
188
  outdatedness_checker = site.compiler.send :outdatedness_checker
194
189
  rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
195
- assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
196
- outdatedness_checker.outdatedness_reason_for(rep)
190
+ assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated, outdatedness_checker.outdatedness_reason_for(rep)
197
191
  end
198
192
  end
199
193
 
@@ -226,8 +220,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
226
220
 
227
221
  outdatedness_checker = site.compiler.send :outdatedness_checker
228
222
  rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
229
- assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
230
- outdatedness_checker.outdatedness_reason_for(rep)
223
+ assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated, outdatedness_checker.outdatedness_reason_for(rep)
231
224
  end
232
225
  end
233
226
 
@@ -262,8 +255,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
262
255
 
263
256
  outdatedness_checker = site.compiler.send :outdatedness_checker
264
257
  rep = site.items.find { |i| i.identifier == '/a/' }.reps[0]
265
- assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated,
266
- outdatedness_checker.outdatedness_reason_for(rep)
258
+ assert_equal ::Nanoc::Int::OutdatednessReasons::DependenciesOutdated, outdatedness_checker.outdatedness_reason_for(rep)
267
259
  end
268
260
  end
269
261
 
@@ -289,8 +281,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
289
281
  site.compiler.load
290
282
  outdatedness_checker = site.compiler.send :outdatedness_checker
291
283
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
292
- assert_equal ::Nanoc::Int::OutdatednessReasons::CodeSnippetsModified,
293
- outdatedness_checker.outdatedness_reason_for(rep)
284
+ assert_equal ::Nanoc::Int::OutdatednessReasons::CodeSnippetsModified, outdatedness_checker.outdatedness_reason_for(rep)
294
285
  end
295
286
  end
296
287
 
@@ -321,8 +312,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
321
312
  site.compiler.load
322
313
  outdatedness_checker = site.compiler.send :outdatedness_checker
323
314
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
324
- assert_equal ::Nanoc::Int::OutdatednessReasons::ConfigurationModified,
325
- outdatedness_checker.outdatedness_reason_for(rep)
315
+ assert_equal ::Nanoc::Int::OutdatednessReasons::ConfigurationModified, outdatedness_checker.outdatedness_reason_for(rep)
326
316
  end
327
317
  end
328
318
 
@@ -389,8 +379,7 @@ class Nanoc::Int::OutdatednessCheckerTest < Nanoc::TestCase
389
379
  site.compiler.load
390
380
  outdatedness_checker = site.compiler.send :outdatedness_checker
391
381
  rep = site.items.find { |i| i.identifier == '/' }.reps[0]
392
- assert_equal ::Nanoc::Int::OutdatednessReasons::RulesModified,
393
- outdatedness_checker.outdatedness_reason_for(rep)
382
+ assert_equal ::Nanoc::Int::OutdatednessReasons::RulesModified, outdatedness_checker.outdatedness_reason_for(rep)
394
383
  end
395
384
  end
396
385
 
@@ -121,8 +121,7 @@ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
121
121
  assert File.file?('output/stray.html')
122
122
  Nanoc::CLI.run %w( compile )
123
123
  refute File.file?('output/stray.html')
124
- assert File.directory?('output/excluded_dir'),
125
- 'excluded_dir should still be there'
124
+ assert File.directory?('output/excluded_dir'), 'excluded_dir should still be there'
126
125
  end
127
126
  end
128
127
 
@@ -449,7 +449,7 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
449
449
  # Parse it
450
450
  result = data_source.instance_eval { parse('test.html', 'test.yaml', 'foobar') }
451
451
  assert_equal({ 'foo' => 'bar' }, result[0])
452
- assert_equal('blah blah', result[1])
452
+ assert_equal('blah blah', result[1])
453
453
  end
454
454
 
455
455
  def test_parse_internal_bad_metadata
@@ -41,12 +41,12 @@ class Nanoc::DataSources::FilesystemUnifiedTest < Nanoc::TestCase
41
41
  expected_out = [
42
42
  klass.new(
43
43
  'test 1',
44
- { 'num' => 1, :filename => 'foo/bar.html', :extension => 'html', mtime: File.mtime('foo/bar.html') },
44
+ { 'num' => 1, :filename => 'foo/bar.html', :extension => 'html', mtime: File.mtime('foo/bar.html') },
45
45
  '/bar/',
46
46
  ),
47
47
  klass.new(
48
48
  'test 2',
49
- { 'num' => 2, :filename => 'foo/b.c.html', :extension => 'c.html', mtime: File.mtime('foo/b.c.html') },
49
+ { 'num' => 2, :filename => 'foo/b.c.html', :extension => 'c.html', mtime: File.mtime('foo/b.c.html') },
50
50
  '/b/',
51
51
  ),
52
52
  klass.new(
@@ -32,8 +32,10 @@ class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
32
32
  # Check
33
33
  refute check.issues.empty?
34
34
  assert_equal 1, check.issues.size
35
- assert_equal 'line 1: Property coxlor doesn\'t exist: h1 { coxlor: rxed; }',
36
- check.issues.to_a[0].description
35
+ assert_equal(
36
+ 'line 1: Property coxlor doesn\'t exist: h1 { coxlor: rxed; }',
37
+ check.issues.to_a[0].description,
38
+ )
37
39
  end
38
40
  end
39
41
  end
@@ -53,8 +55,7 @@ class Nanoc::Extra::Checking::Checks::CSSTest < Nanoc::TestCase
53
55
  # Check
54
56
  refute check.issues.empty?
55
57
  assert_equal 1, check.issues.size
56
- assert_equal 'line 1: Parse Error: h1 { ; {',
57
- check.issues.to_a[0].description
58
+ assert_equal 'line 1: Parse Error: h1 { ; {', check.issues.to_a[0].description
58
59
  end
59
60
  end
60
61
  end
@@ -6,7 +6,7 @@ class Nanoc::Extra::Checking::Checks::StaleTest < Nanoc::TestCase
6
6
  def calc_issues
7
7
  site = Nanoc::Int::SiteLoader.new.new_from_cwd
8
8
  runner = Nanoc::Extra::Checking::Runner.new(site)
9
- issues = runner.run_checks([check_class])
9
+ runner.run_checks([check_class])
10
10
  end
11
11
 
12
12
  def test_run_ok
@@ -25,11 +25,11 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
25
25
  item_rep.expect(:name, :quux)
26
26
 
27
27
  # Create filter
28
- filter = ::Nanoc::Filters::ERB.new({
28
+ filter = ::Nanoc::Filters::ERB.new(
29
29
  item: item,
30
30
  item_rep: item_rep,
31
31
  location: 'a cheap motel',
32
- })
32
+ )
33
33
 
34
34
  # Run filter
35
35
  raised = false
@@ -562,11 +562,12 @@ XML
562
562
  </foo>
563
563
  XML
564
564
 
565
- actual_content = filter.setup_and_run(raw_content, {
565
+ options = {
566
566
  type: :xml,
567
567
  namespaces: { ex: 'http://example.org' },
568
568
  select: ['ex:a/@href'],
569
- })
569
+ }
570
+ actual_content = filter.setup_and_run(raw_content, options)
570
571
 
571
572
  assert_match(/<foo xmlns="http:\/\/example.org">/, actual_content)
572
573
  assert_match(/<bar><a href="..\/..">baz<\/a><\/bar>/, actual_content)
@@ -84,13 +84,9 @@ EOS
84
84
  def test_filter_as_layout
85
85
  if_have 'nokogiri' do
86
86
  # Create our data objects
87
- item = Nanoc::Int::Item.new(SAMPLE_XML_IN,
88
- {},
89
- '/content/')
87
+ item = Nanoc::Int::Item.new(SAMPLE_XML_IN, {}, '/content/')
90
88
  item = Nanoc::ItemView.new(item)
91
- layout = Nanoc::Int::Layout.new(SAMPLE_XSL,
92
- {},
93
- '/layout/')
89
+ layout = Nanoc::Int::Layout.new(SAMPLE_XSL, {}, '/layout/')
94
90
  layout = Nanoc::LayoutView.new(layout)
95
91
 
96
92
  # Create an instance of the filter
@@ -110,13 +106,9 @@ EOS
110
106
  def test_filter_with_params
111
107
  if_have 'nokogiri' do
112
108
  # Create our data objects
113
- item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_PARAMS,
114
- {},
115
- '/content/')
109
+ item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_PARAMS, {}, '/content/')
116
110
  item = Nanoc::ItemView.new(item)
117
- layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_PARAMS,
118
- {},
119
- '/layout/')
111
+ layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_PARAMS, {}, '/layout/')
120
112
  layout = Nanoc::LayoutView.new(layout)
121
113
 
122
114
  # Create an instance of the filter
@@ -137,13 +129,9 @@ EOS
137
129
  def test_filter_with_omit_xml_decl
138
130
  if_have 'nokogiri' do
139
131
  # Create our data objects
140
- item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL,
141
- {},
142
- '/content/')
132
+ item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL, {}, '/content/')
143
133
  item = Nanoc::ItemView.new(item)
144
- layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL,
145
- {},
146
- '/layout/')
134
+ layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL, {}, '/layout/')
147
135
  layout = Nanoc::LayoutView.new(layout)
148
136
 
149
137
  # Create an instance of the filter
@@ -199,22 +199,30 @@ EOS
199
199
  actual_out = eval(pair.first, b)
200
200
  expected_out = eval(pair.last.match(/# ?=>(.*)/)[1], b)
201
201
 
202
- assert_equal expected_out, actual_out,
203
- "Incorrect example:\n#{pair.first}"
202
+ assert_equal(
203
+ expected_out,
204
+ actual_out,
205
+ "Incorrect example:\n#{pair.first}",
206
+ )
204
207
  end
205
208
  end
206
209
  end
207
210
 
208
211
  def assert_contains_exactly(expected, actual)
209
- assert_equal expected.size, actual.size,
210
- format('Expected %s to be of same size as %s', actual.inspect, expected.inspect)
212
+ assert_equal(
213
+ expected.size,
214
+ actual.size,
215
+ format('Expected %s to be of same size as %s', actual.inspect, expected.inspect),
216
+ )
211
217
  remaining = actual.dup.to_a
212
218
  expected.each do |e|
213
219
  index = remaining.index(e)
214
220
  remaining.delete_at(index) if index
215
221
  end
216
- assert remaining.empty?,
217
- format('Expected %s to contain all the elements of %s', actual.inspect, expected.inspect)
222
+ assert(
223
+ remaining.empty?,
224
+ format('Expected %s to contain all the elements of %s', actual.inspect, expected.inspect),
225
+ )
218
226
  end
219
227
 
220
228
  def assert_raises_frozen_error
@@ -324,12 +324,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
324
324
  @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
325
325
 
326
326
  # Mock site
327
- @config = Nanoc::ConfigView.new({
327
+ @config = Nanoc::ConfigView.new(
328
328
  author_name: 'Bob',
329
329
  author_uri: 'http://example.com/~bob/',
330
330
  title: 'My Blog Or Something',
331
331
  base_url: 'http://example.com',
332
- })
332
+ )
333
333
 
334
334
  # Create feed item
335
335
  @item = mock
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-07 00:00:00.000000000 Z
11
+ date: 2015-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -353,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
353
  version: '0'
354
354
  requirements: []
355
355
  rubyforge_project:
356
- rubygems_version: 2.4.7
356
+ rubygems_version: 2.4.5.1
357
357
  signing_key:
358
358
  specification_version: 4
359
359
  summary: A static-site generator with a focus on flexibility.