nanoc 3.7.3 → 3.7.4

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 (182) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +71 -46
  3. data/NEWS.md +14 -0
  4. data/lib/nanoc.rb +1 -1
  5. data/lib/nanoc/base/checksummer.rb +1 -1
  6. data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
  7. data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
  8. data/lib/nanoc/base/compilation/compiler.rb +11 -10
  9. data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
  10. data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
  11. data/lib/nanoc/base/compilation/filter.rb +1 -1
  12. data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
  13. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
  14. data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
  15. data/lib/nanoc/base/compilation/rule.rb +1 -1
  16. data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
  17. data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
  18. data/lib/nanoc/base/context.rb +1 -1
  19. data/lib/nanoc/base/core_ext/array.rb +1 -1
  20. data/lib/nanoc/base/core_ext/date.rb +1 -1
  21. data/lib/nanoc/base/core_ext/hash.rb +1 -1
  22. data/lib/nanoc/base/directed_graph.rb +3 -3
  23. data/lib/nanoc/base/memoization.rb +1 -1
  24. data/lib/nanoc/base/notification_center.rb +1 -1
  25. data/lib/nanoc/base/ordered_hash.rb +1 -1
  26. data/lib/nanoc/base/plugin_registry.rb +3 -3
  27. data/lib/nanoc/base/result_data/item_rep.rb +13 -11
  28. data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
  29. data/lib/nanoc/base/source_data/data_source.rb +3 -3
  30. data/lib/nanoc/base/source_data/item.rb +8 -8
  31. data/lib/nanoc/base/source_data/item_array.rb +1 -1
  32. data/lib/nanoc/base/source_data/layout.rb +1 -1
  33. data/lib/nanoc/base/source_data/site.rb +27 -18
  34. data/lib/nanoc/base/store.rb +3 -3
  35. data/lib/nanoc/base/temp_filename_factory.rb +2 -2
  36. data/lib/nanoc/cli.rb +6 -6
  37. data/lib/nanoc/cli/cleaning_stream.rb +1 -1
  38. data/lib/nanoc/cli/command_runner.rb +4 -3
  39. data/lib/nanoc/cli/commands/autocompile.rb +3 -3
  40. data/lib/nanoc/cli/commands/check.rb +3 -3
  41. data/lib/nanoc/cli/commands/compile.rb +23 -23
  42. data/lib/nanoc/cli/commands/create-item.rb +5 -5
  43. data/lib/nanoc/cli/commands/create-layout.rb +14 -14
  44. data/lib/nanoc/cli/commands/create-site.rb +6 -6
  45. data/lib/nanoc/cli/commands/deploy.rb +8 -8
  46. data/lib/nanoc/cli/commands/nanoc.rb +3 -3
  47. data/lib/nanoc/cli/commands/prune.rb +3 -3
  48. data/lib/nanoc/cli/commands/shell.rb +4 -4
  49. data/lib/nanoc/cli/commands/show-data.rb +5 -5
  50. data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
  51. data/lib/nanoc/cli/commands/show-rules.rb +4 -4
  52. data/lib/nanoc/cli/commands/sync.rb +1 -1
  53. data/lib/nanoc/cli/commands/update.rb +13 -13
  54. data/lib/nanoc/cli/commands/validate-css.rb +3 -3
  55. data/lib/nanoc/cli/commands/validate-html.rb +3 -3
  56. data/lib/nanoc/cli/commands/validate-links.rb +6 -6
  57. data/lib/nanoc/cli/commands/view.rb +4 -4
  58. data/lib/nanoc/cli/commands/watch.rb +11 -11
  59. data/lib/nanoc/cli/error_handler.rb +10 -10
  60. data/lib/nanoc/cli/logger.rb +1 -1
  61. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
  62. data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
  63. data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
  64. data/lib/nanoc/data_sources/filesystem.rb +16 -16
  65. data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
  66. data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
  67. data/lib/nanoc/data_sources/static.rb +1 -1
  68. data/lib/nanoc/extra/auto_compiler.rb +2 -2
  69. data/lib/nanoc/extra/checking/check.rb +11 -1
  70. data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
  71. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
  72. data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
  73. data/lib/nanoc/extra/checking/runner.rb +10 -9
  74. data/lib/nanoc/extra/chick.rb +2 -2
  75. data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
  76. data/lib/nanoc/extra/deployers/fog.rb +2 -2
  77. data/lib/nanoc/extra/deployers/rsync.rb +3 -3
  78. data/lib/nanoc/extra/file_proxy.rb +3 -3
  79. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
  80. data/lib/nanoc/extra/link_collector.rb +3 -3
  81. data/lib/nanoc/extra/piper.rb +2 -2
  82. data/lib/nanoc/extra/pruner.rb +4 -3
  83. data/lib/nanoc/extra/validators/links.rb +2 -2
  84. data/lib/nanoc/extra/validators/w3c.rb +1 -1
  85. data/lib/nanoc/extra/vcs.rb +5 -5
  86. data/lib/nanoc/extra/vcses/dummy.rb +1 -1
  87. data/lib/nanoc/filters/asciidoc.rb +1 -1
  88. data/lib/nanoc/filters/bluecloth.rb +1 -1
  89. data/lib/nanoc/filters/coffeescript.rb +1 -1
  90. data/lib/nanoc/filters/colorize_syntax.rb +19 -21
  91. data/lib/nanoc/filters/erubis.rb +1 -1
  92. data/lib/nanoc/filters/handlebars.rb +1 -1
  93. data/lib/nanoc/filters/less.rb +2 -2
  94. data/lib/nanoc/filters/markaby.rb +1 -1
  95. data/lib/nanoc/filters/mustache.rb +1 -1
  96. data/lib/nanoc/filters/rdoc.rb +1 -1
  97. data/lib/nanoc/filters/relativize_paths.rb +5 -5
  98. data/lib/nanoc/filters/rubypants.rb +1 -1
  99. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  100. data/lib/nanoc/filters/typogruby.rb +1 -1
  101. data/lib/nanoc/filters/xsl.rb +1 -1
  102. data/lib/nanoc/helpers/blogging.rb +12 -12
  103. data/lib/nanoc/helpers/capturing.rb +3 -3
  104. data/lib/nanoc/helpers/html_escape.rb +6 -6
  105. data/lib/nanoc/helpers/tagging.rb +1 -1
  106. data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
  107. data/lib/nanoc/tasks/clean.rake +1 -1
  108. data/lib/nanoc/tasks/clean.rb +1 -1
  109. data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
  110. data/lib/nanoc/version.rb +1 -1
  111. data/tasks/rubocop.rake +1 -0
  112. data/test/base/core_ext/array_spec.rb +7 -7
  113. data/test/base/core_ext/hash_spec.rb +1 -1
  114. data/test/base/test_checksum_store.rb +1 -1
  115. data/test/base/test_compiler.rb +14 -14
  116. data/test/base/test_compiler_dsl.rb +13 -13
  117. data/test/base/test_context.rb +2 -2
  118. data/test/base/test_dependency_tracker.rb +42 -42
  119. data/test/base/test_directed_graph.rb +102 -102
  120. data/test/base/test_item.rb +21 -21
  121. data/test/base/test_item_array.rb +19 -19
  122. data/test/base/test_item_rep.rb +50 -50
  123. data/test/base/test_layout.rb +6 -6
  124. data/test/base/test_outdatedness_checker.rb +2 -2
  125. data/test/base/test_rule_context.rb +2 -2
  126. data/test/base/test_site.rb +5 -5
  127. data/test/cli/commands/test_compile.rb +7 -7
  128. data/test/cli/commands/test_create_site.rb +2 -2
  129. data/test/cli/commands/test_deploy.rb +10 -10
  130. data/test/cli/commands/test_prune.rb +2 -2
  131. data/test/cli/commands/test_sync.rb +1 -1
  132. data/test/cli/commands/test_watch.rb +7 -7
  133. data/test/cli/test_cleaning_stream.rb +4 -4
  134. data/test/cli/test_cli.rb +3 -3
  135. data/test/cli/test_error_handler.rb +3 -3
  136. data/test/data_sources/test_filesystem.rb +19 -19
  137. data/test/data_sources/test_filesystem_unified.rb +30 -30
  138. data/test/data_sources/test_filesystem_verbose.rb +3 -3
  139. data/test/data_sources/test_static.rb +9 -9
  140. data/test/extra/checking/checks/test_stale.rb +8 -8
  141. data/test/extra/checking/test_check.rb +11 -1
  142. data/test/extra/checking/test_dsl.rb +1 -1
  143. data/test/extra/core_ext/test_enumerable.rb +2 -2
  144. data/test/extra/deployers/test_fog.rb +10 -10
  145. data/test/extra/deployers/test_rsync.rb +2 -2
  146. data/test/extra/test_auto_compiler.rb +28 -28
  147. data/test/extra/test_filesystem_tools.rb +3 -3
  148. data/test/extra/test_link_collector.rb +39 -20
  149. data/test/extra/validators/test_w3c.rb +5 -5
  150. data/test/filters/test_asciidoc.rb +2 -2
  151. data/test/filters/test_bluecloth.rb +1 -1
  152. data/test/filters/test_coffeescript.rb +1 -1
  153. data/test/filters/test_colorize_syntax.rb +20 -13
  154. data/test/filters/test_erb.rb +1 -1
  155. data/test/filters/test_kramdown.rb +1 -1
  156. data/test/filters/test_less.rb +10 -10
  157. data/test/filters/test_markaby.rb +2 -2
  158. data/test/filters/test_maruku.rb +2 -2
  159. data/test/filters/test_pandoc.rb +3 -3
  160. data/test/filters/test_rainpress.rb +4 -4
  161. data/test/filters/test_rdiscount.rb +2 -2
  162. data/test/filters/test_rdoc.rb +1 -1
  163. data/test/filters/test_redcarpet.rb +5 -5
  164. data/test/filters/test_redcloth.rb +5 -5
  165. data/test/filters/test_relativize_paths.rb +33 -31
  166. data/test/filters/test_rubypants.rb +2 -2
  167. data/test/filters/test_sass.rb +8 -8
  168. data/test/filters/test_slim.rb +3 -3
  169. data/test/filters/test_uglify_js.rb +1 -1
  170. data/test/filters/test_yui_compressor.rb +3 -3
  171. data/test/gem_loader.rb +1 -1
  172. data/test/helper.rb +14 -16
  173. data/test/helpers/test_blogging.rb +28 -28
  174. data/test/helpers/test_breadcrumbs.rb +12 -12
  175. data/test/helpers/test_capturing.rb +7 -7
  176. data/test/helpers/test_filtering.rb +16 -16
  177. data/test/helpers/test_link_to.rb +3 -3
  178. data/test/helpers/test_rendering.rb +1 -1
  179. data/test/helpers/test_tagging.rb +11 -11
  180. data/test/helpers/test_xml_sitemap.rb +18 -18
  181. data/test/tasks/test_clean.rb +8 -8
  182. metadata +2 -2
@@ -101,7 +101,7 @@ module Nanoc::Helpers
101
101
  if block_given? # Set content
102
102
  # Get args
103
103
  if args.size != 1
104
- raise ArgumentError, 'expected 1 argument (the name ' +
104
+ raise ArgumentError, 'expected 1 argument (the name ' \
105
105
  "of the capture) but got #{args.size} instead"
106
106
  end
107
107
  name = args[0]
@@ -112,7 +112,7 @@ module Nanoc::Helpers
112
112
  else # Get content
113
113
  # Get args
114
114
  if args.size != 2
115
- raise ArgumentError, 'expected 2 arguments (the item ' +
115
+ raise ArgumentError, 'expected 2 arguments (the item ' \
116
116
  "and the name of the capture) but got #{args.size} instead"
117
117
  end
118
118
  item = args[0]
@@ -128,7 +128,7 @@ module Nanoc::Helpers
128
128
  # item from which we use content. For this, we need to manually edit
129
129
  # the content attribute to reset it. :(
130
130
  # FIXME clean this up
131
- if !@site.captures_store_compiled_items.include? item
131
+ unless @site.captures_store_compiled_items.include? item
132
132
  @site.captures_store_compiled_items << item
133
133
  item.forced_outdated = true
134
134
  item.reps.each do |r|
@@ -38,13 +38,13 @@ module Nanoc::Helpers
38
38
  buffer = eval('_erbout', block.binding)
39
39
  buffer << escaped_data
40
40
  elsif string
41
- string.gsub('&', '&amp;').
42
- gsub('<', '&lt;').
43
- gsub('>', '&gt;').
44
- gsub('"', '&quot;')
41
+ string.gsub('&', '&amp;')
42
+ .gsub('<', '&lt;')
43
+ .gsub('>', '&gt;')
44
+ .gsub('"', '&quot;')
45
45
  else
46
- raise "The #html_escape or #h function needs either a " \
47
- "string or a block to HTML-escape, but neither a string nor a block was given"
46
+ raise 'The #html_escape or #h function needs either a ' \
47
+ 'string or a block to HTML-escape, but neither a string nor a block was given'
48
48
  end
49
49
  end
50
50
 
@@ -63,7 +63,7 @@ module Nanoc::Helpers
63
63
  #
64
64
  # @return [String] A link for the given tag and the given base URL
65
65
  def link_for_tag(tag, base_url)
66
- %[<a href="#{h base_url}#{h tag}" rel="tag">#{h tag}</a>]
66
+ %(<a href="#{h base_url}#{h tag}" rel="tag">#{h tag}</a>)
67
67
  end
68
68
 
69
69
  end
@@ -64,10 +64,10 @@ module Nanoc::Helpers
64
64
  reps.reject! { |r| !select_proc[r] } if select_proc
65
65
  reps.sort_by { |r| r.name.to_s }.each do |rep|
66
66
  xml.url do
67
- xml.loc @site.config[:base_url] + rep.path
68
- xml.lastmod item[:mtime].to_iso8601_date unless item[:mtime].nil?
69
- xml.changefreq item[:changefreq] unless item[:changefreq].nil?
70
- xml.priority item[:priority] unless item[:priority].nil?
67
+ xml.loc @site.config[:base_url] + rep.path
68
+ xml.lastmod item[:mtime].to_iso8601_date unless item[:mtime].nil?
69
+ xml.changefreq item[:changefreq] unless item[:changefreq].nil?
70
+ xml.priority item[:priority] unless item[:priority].nil?
71
71
  end
72
72
  end
73
73
  end
@@ -5,7 +5,7 @@ task :clean do
5
5
  # Load site
6
6
  site = Nanoc::Site.new('.')
7
7
  if site.nil?
8
- $stderr.puts 'The current working directory does not seem to be a ' +
8
+ $stderr.puts 'The current working directory does not seem to be a ' \
9
9
  'valid/complete nanoc site directory; aborting.'
10
10
  exit 1
11
11
  end
@@ -14,7 +14,7 @@ module Nanoc::Tasks
14
14
  end
15
15
  end
16
16
 
17
- private
17
+ private
18
18
 
19
19
  def filenames
20
20
  @site.items.map do |item|
@@ -6,10 +6,10 @@ namespace :deploy do
6
6
 
7
7
  desc 'Upload the compiled site using rsync'
8
8
  task :rsync do
9
- dry_run = !!ENV['dry_run']
9
+ dry_run = ENV['dry_run']
10
10
  config_name = ENV['config'] || :default
11
11
 
12
- cmd = [ 'deploy', '-t', config_name ]
12
+ cmd = ['deploy', '-t', config_name]
13
13
  cmd << '-n' if dry_run
14
14
 
15
15
  Nanoc::CLI.run cmd
@@ -3,6 +3,6 @@
3
3
  module Nanoc
4
4
 
5
5
  # The current nanoc version.
6
- VERSION = '3.7.3'
6
+ VERSION = '3.7.4'
7
7
 
8
8
  end
@@ -2,6 +2,7 @@ begin
2
2
  require 'rubocop/rake_task'
3
3
 
4
4
  RuboCop::RakeTask.new(:rubocop) do |task|
5
+ task.options = %w( --display-cop-names --format simple )
5
6
  task.patterns = ['lib/**/*.rb']
6
7
  end
7
8
  rescue LoadError
@@ -3,8 +3,8 @@
3
3
  describe 'Array#symbolize_keys_recursively' do
4
4
 
5
5
  it 'should convert keys to symbols' do
6
- array_old = [ :abc, 'xyz', { 'foo' => 'bar', :baz => :qux } ]
7
- array_new = [ :abc, 'xyz', { :foo => 'bar', :baz => :qux } ]
6
+ array_old = [:abc, 'xyz', { 'foo' => 'bar', :baz => :qux }]
7
+ array_new = [:abc, 'xyz', { :foo => 'bar', :baz => :qux }]
8
8
  array_old.symbolize_keys_recursively.must_equal array_new
9
9
  end
10
10
 
@@ -13,8 +13,8 @@ end
13
13
  describe 'Array#stringify_keys_recursively' do
14
14
 
15
15
  it 'should convert keys to strings' do
16
- array_old = [ :abc, 'xyz', { :foo => 'bar', 'baz' => :qux } ]
17
- array_new = [ :abc, 'xyz', { 'foo' => 'bar', 'baz' => :qux } ]
16
+ array_old = [:abc, 'xyz', { :foo => 'bar', 'baz' => :qux }]
17
+ array_new = [:abc, 'xyz', { 'foo' => 'bar', 'baz' => :qux }]
18
18
  array_old.stringify_keys_recursively.must_equal array_new
19
19
  end
20
20
 
@@ -25,7 +25,7 @@ describe 'Array#freeze_recursively' do
25
25
  include Nanoc::TestHelpers
26
26
 
27
27
  it 'should prevent first-level elements from being modified' do
28
- array = [ :a, [ :b, :c ], :d ]
28
+ array = [:a, [:b, :c], :d]
29
29
  array.freeze_recursively
30
30
 
31
31
  assert_raises_frozen_error do
@@ -34,7 +34,7 @@ describe 'Array#freeze_recursively' do
34
34
  end
35
35
 
36
36
  it 'should prevent second-level elements from being modified' do
37
- array = [ :a, [ :b, :c ], :d ]
37
+ array = [:a, [:b, :c], :d]
38
38
  array.freeze_recursively
39
39
 
40
40
  assert_raises_frozen_error do
@@ -59,7 +59,7 @@ describe 'Array#checksum' do
59
59
 
60
60
  it 'should work' do
61
61
  expectation = 'CEUlNvu/3DUmlbtpFRiLHU8oHA0='
62
- [ [ :foo, 123 ] ].checksum.must_equal expectation
62
+ [[:foo, 123]].checksum.must_equal expectation
63
63
  end
64
64
 
65
65
  end
@@ -88,7 +88,7 @@ describe 'Hash#checksum' do
88
88
 
89
89
  it 'should not sort keys' do
90
90
  if RUBY_VERSION =~ /\A1\.8./
91
- skip "Ruby 1.8.x does not have ordered hashes"
91
+ skip 'Ruby 1.8.x does not have ordered hashes'
92
92
  end
93
93
 
94
94
  a = { :a => 1, :c => 2, :b => 3 }.checksum
@@ -9,7 +9,7 @@ class Nanoc::ChecksumStoreTest < Nanoc::TestCase
9
9
  FileUtils.mkdir_p('tmp')
10
10
  pstore = PStore.new('tmp/checksums')
11
11
  pstore.transaction do
12
- pstore[:data] = { [ :item, '/moo/' ] => 'zomg' }
12
+ pstore[:data] = { [:item, '/moo/'] => 'zomg' }
13
13
  pstore[:version] = 1
14
14
  end
15
15
 
@@ -4,7 +4,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
4
4
 
5
5
  def test_compilation_rule_for
6
6
  # Mock rules
7
- rules = [ mock, mock, mock ]
7
+ rules = [mock, mock, mock]
8
8
  rules[0].expects(:applicable_to?).returns(false)
9
9
  rules[1].expects(:applicable_to?).returns(true)
10
10
  rules[1].expects(:rep_name).returns('wrong')
@@ -27,7 +27,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
27
27
 
28
28
  def test_routing_rule_for
29
29
  # Mock rules
30
- rules = [ mock, mock, mock ]
30
+ rules = [mock, mock, mock]
31
31
  rules[0].expects(:applicable_to?).returns(false)
32
32
  rules[1].expects(:applicable_to?).returns(true)
33
33
  rules[1].expects(:rep_name).returns('wrong')
@@ -54,14 +54,14 @@ class Nanoc::CompilerTest < Nanoc::TestCase
54
54
 
55
55
  # Create compiler
56
56
  compiler = Nanoc::Compiler.new(site)
57
- compiler.rules_collection.layout_filter_mapping[/.*/] = [ :erb, { :foo => 'bar' } ]
57
+ compiler.rules_collection.layout_filter_mapping[/.*/] = [:erb, { :foo => 'bar' }]
58
58
 
59
59
  # Mock layout
60
60
  layout = MiniTest::Mock.new
61
61
  layout.expect(:identifier, '/some_layout/')
62
62
 
63
63
  # Check
64
- assert_equal([ :erb, { :foo => 'bar' } ], compiler.rules_collection.filter_for_layout(layout))
64
+ assert_equal([:erb, { :foo => 'bar' }], compiler.rules_collection.filter_for_layout(layout))
65
65
  end
66
66
 
67
67
  def test_filter_for_layout_with_existant_layout_and_unknown_filter
@@ -70,14 +70,14 @@ class Nanoc::CompilerTest < Nanoc::TestCase
70
70
 
71
71
  # Create compiler
72
72
  compiler = Nanoc::Compiler.new(site)
73
- compiler.rules_collection.layout_filter_mapping[/.*/] = [ :some_unknown_filter, { :foo => 'bar' } ]
73
+ compiler.rules_collection.layout_filter_mapping[/.*/] = [:some_unknown_filter, { :foo => 'bar' }]
74
74
 
75
75
  # Mock layout
76
76
  layout = MiniTest::Mock.new
77
77
  layout.expect(:identifier, '/some_layout/')
78
78
 
79
79
  # Check
80
- assert_equal([ :some_unknown_filter, { :foo => 'bar' } ], compiler.rules_collection.filter_for_layout(layout))
80
+ assert_equal([:some_unknown_filter, { :foo => 'bar' }], compiler.rules_collection.filter_for_layout(layout))
81
81
  end
82
82
 
83
83
  def test_filter_for_layout_with_nonexistant_layout
@@ -86,7 +86,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
86
86
 
87
87
  # Create compiler
88
88
  compiler = Nanoc::Compiler.new(site)
89
- compiler.rules_collection.layout_filter_mapping[%r{^/foo/$}] = [ :erb, { :foo => 'bar' } ]
89
+ compiler.rules_collection.layout_filter_mapping[%r{^/foo/$}] = [:erb, { :foo => 'bar' }]
90
90
 
91
91
  # Mock layout
92
92
  layout = MiniTest::Mock.new
@@ -102,13 +102,13 @@ class Nanoc::CompilerTest < Nanoc::TestCase
102
102
 
103
103
  # Create compiler
104
104
  compiler = Nanoc::Compiler.new(site)
105
- compiler.rules_collection.layout_filter_mapping[%r{^/a/b/c/.*/$}] = [ :erb, { :char => 'd' } ]
106
- compiler.rules_collection.layout_filter_mapping[%r{^/a/.*/$}] = [ :erb, { :char => 'b' } ]
107
- compiler.rules_collection.layout_filter_mapping[%r{^/a/b/.*/$}] = [ :erb, { :char => 'c' } ] # never used!
108
- compiler.rules_collection.layout_filter_mapping[%r{^/.*/$}] = [ :erb, { :char => 'a' } ]
105
+ compiler.rules_collection.layout_filter_mapping[%r{^/a/b/c/.*/$}] = [:erb, { :char => 'd' }]
106
+ compiler.rules_collection.layout_filter_mapping[%r{^/a/.*/$}] = [:erb, { :char => 'b' }]
107
+ compiler.rules_collection.layout_filter_mapping[%r{^/a/b/.*/$}] = [:erb, { :char => 'c' }] # never used!
108
+ compiler.rules_collection.layout_filter_mapping[%r{^/.*/$}] = [:erb, { :char => 'a' }]
109
109
 
110
110
  # Mock layout
111
- layouts = [ mock, mock, mock, mock ]
111
+ layouts = [mock, mock, mock, mock]
112
112
  layouts[0].stubs(:identifier).returns('/a/b/c/d/')
113
113
  layouts[1].stubs(:identifier).returns('/a/b/c/')
114
114
  layouts[2].stubs(:identifier).returns('/a/b/')
@@ -159,12 +159,12 @@ class Nanoc::CompilerTest < Nanoc::TestCase
159
159
  site = mock
160
160
  site.stubs(:config).returns({})
161
161
  site.stubs(:items).returns([])
162
- site.stubs(:layouts).returns([ layout ])
162
+ site.stubs(:layouts).returns([layout])
163
163
 
164
164
  # Create compiler
165
165
  compiler = Nanoc::Compiler.new(site)
166
166
  compiler.rules_collection.expects(:compilation_rule_for).times(2).with(rep).returns(rule)
167
- compiler.rules_collection.layout_filter_mapping[%r{^/blah/$}] = [ :erb, {} ]
167
+ compiler.rules_collection.layout_filter_mapping[%r{^/blah/$}] = [:erb, {}]
168
168
  site.stubs(:compiler).returns(compiler)
169
169
 
170
170
  # Compile
@@ -106,7 +106,7 @@ EOS
106
106
  # Create items
107
107
  assert Dir['content/*'].empty?
108
108
  File.open('content/robots.txt', 'w') do |io|
109
- io.write "Hello I am robots"
109
+ io.write 'Hello I am robots'
110
110
  end
111
111
 
112
112
  # Compile
@@ -114,7 +114,7 @@ EOS
114
114
  site.compile
115
115
 
116
116
  # Check paths
117
- assert_equal [ 'output/robots.txt' ], Dir['output/*']
117
+ assert_equal ['output/robots.txt'], Dir['output/*']
118
118
  end
119
119
  end
120
120
 
@@ -130,7 +130,7 @@ EOS
130
130
  # Create items
131
131
  assert Dir['content/*'].empty?
132
132
  File.open('content/foo', 'w') do |io|
133
- io.write "Hello I am foo"
133
+ io.write 'Hello I am foo'
134
134
  end
135
135
 
136
136
  # Compile
@@ -138,7 +138,7 @@ EOS
138
138
  site.compile
139
139
 
140
140
  # Check paths
141
- assert_equal [ 'output/foo' ], Dir['output/*']
141
+ assert_equal ['output/foo'], Dir['output/*']
142
142
  end
143
143
  end
144
144
 
@@ -160,7 +160,7 @@ EOS
160
160
  # Create items
161
161
  FileUtils.mkdir_p('static')
162
162
  File.open('static/foo.txt', 'w') do |io|
163
- io.write "Hello I am foo"
163
+ io.write 'Hello I am foo'
164
164
  end
165
165
 
166
166
  # Compile
@@ -168,7 +168,7 @@ EOS
168
168
  site.compile
169
169
 
170
170
  # Check paths
171
- assert_equal [ 'output/foo.txt' ], Dir['output/*']
171
+ assert_equal ['output/foo.txt'], Dir['output/*']
172
172
  end
173
173
  end
174
174
 
@@ -200,8 +200,8 @@ EOS
200
200
  site.compile
201
201
 
202
202
  # Check paths
203
- assert_equal [ 'output/foo' ], Dir['output/*']
204
- assert_equal [ 'output/foo/index.html' ], Dir['output/foo/*']
203
+ assert_equal ['output/foo'], Dir['output/*']
204
+ assert_equal ['output/foo/index.html'], Dir['output/foo/*']
205
205
  end
206
206
  end
207
207
 
@@ -219,11 +219,11 @@ EOS
219
219
  # Create items
220
220
  assert Dir['content/*'].empty?
221
221
  File.open('content/lame.txt', 'w') do |io|
222
- io.write "Hello I am lame"
222
+ io.write 'Hello I am lame'
223
223
  end
224
224
 
225
225
  File.open('content/notlame.txt', 'w') do |io|
226
- io.write "Hello I am not lame"
226
+ io.write 'Hello I am not lame'
227
227
  end
228
228
 
229
229
  # Compile
@@ -231,7 +231,7 @@ EOS
231
231
  site.compile
232
232
 
233
233
  # Check paths
234
- assert_equal [ 'output/notlame.txt'], Dir['output/*']
234
+ assert_equal ['output/notlame.txt'], Dir['output/*']
235
235
  end
236
236
  end
237
237
 
@@ -263,8 +263,8 @@ EOS
263
263
  site.compile
264
264
 
265
265
  # Check paths
266
- assert_equal [ 'output/foo' ], Dir['output/*']
267
- assert_equal [ 'output/foo/index.html' ], Dir['output/foo/*']
266
+ assert_equal ['output/foo'], Dir['output/*']
267
+ assert_equal ['output/foo/index.html'], Dir['output/foo/*']
268
268
  end
269
269
  end
270
270
 
@@ -7,7 +7,7 @@ class Nanoc::ContextTest < Nanoc::TestCase
7
7
  context = Nanoc::Context.new({ :foo => 'bar', :baz => 'quux' })
8
8
 
9
9
  # Ensure correct evaluation
10
- assert_equal('bar', eval("@foo", context.get_binding))
10
+ assert_equal('bar', eval('@foo', context.get_binding))
11
11
  end
12
12
 
13
13
  def test_context_with_instance_method
@@ -15,7 +15,7 @@ class Nanoc::ContextTest < Nanoc::TestCase
15
15
  context = Nanoc::Context.new({ :foo => 'bar', :baz => 'quux' })
16
16
 
17
17
  # Ensure correct evaluation
18
- assert_equal('bar', eval("foo", context.get_binding))
18
+ assert_equal('bar', eval('foo', context.get_binding))
19
19
  end
20
20
 
21
21
  def test_example
@@ -4,7 +4,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
4
4
 
5
5
  def test_initialize
6
6
  # Mock items
7
- items = [ mock, mock ]
7
+ items = [mock, mock]
8
8
 
9
9
  # Create
10
10
  tracker = Nanoc::DependencyTracker.new(items)
@@ -16,7 +16,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
16
16
 
17
17
  def test_record_dependency
18
18
  # Mock items
19
- items = [ mock, mock ]
19
+ items = [mock, mock]
20
20
 
21
21
  # Create
22
22
  tracker = Nanoc::DependencyTracker.new(items)
@@ -25,12 +25,12 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
25
25
  tracker.record_dependency(items[0], items[1])
26
26
 
27
27
  # Verify dependencies
28
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
28
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
29
29
  end
30
30
 
31
31
  def test_record_dependency_no_self
32
32
  # Mock items
33
- items = [ mock, mock ]
33
+ items = [mock, mock]
34
34
 
35
35
  # Create
36
36
  tracker = Nanoc::DependencyTracker.new(items)
@@ -40,12 +40,12 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
40
40
  tracker.record_dependency(items[0], items[1])
41
41
 
42
42
  # Verify dependencies
43
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
43
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
44
44
  end
45
45
 
46
46
  def test_record_dependency_no_doubles
47
47
  # Mock items
48
- items = [ mock, mock ]
48
+ items = [mock, mock]
49
49
 
50
50
  # Create
51
51
  tracker = Nanoc::DependencyTracker.new(items)
@@ -56,12 +56,12 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
56
56
  tracker.record_dependency(items[0], items[1])
57
57
 
58
58
  # Verify dependencies
59
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
59
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
60
60
  end
61
61
 
62
62
  def test_objects_causing_outdatedness_of
63
63
  # Mock items
64
- items = [ mock, mock, mock ]
64
+ items = [mock, mock, mock]
65
65
 
66
66
  # Create
67
67
  tracker = Nanoc::DependencyTracker.new(items)
@@ -71,12 +71,12 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
71
71
  tracker.record_dependency(items[1], items[2])
72
72
 
73
73
  # Verify dependencies
74
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
74
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
75
75
  end
76
76
 
77
77
  def test_objects_outdated_due_to
78
78
  # Mock items
79
- items = [ mock, mock, mock ]
79
+ items = [mock, mock, mock]
80
80
 
81
81
  # Create
82
82
  tracker = Nanoc::DependencyTracker.new(items)
@@ -86,12 +86,12 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
86
86
  tracker.record_dependency(items[1], items[2])
87
87
 
88
88
  # Verify dependencies
89
- assert_contains_exactly [ items[0] ], tracker.objects_outdated_due_to(items[1])
89
+ assert_contains_exactly [items[0]], tracker.objects_outdated_due_to(items[1])
90
90
  end
91
91
 
92
92
  def test_start_and_stop
93
93
  # Mock items
94
- items = [ mock, mock ]
94
+ items = [mock, mock]
95
95
 
96
96
  # Create
97
97
  tracker = Nanoc::DependencyTracker.new(items)
@@ -105,18 +105,18 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
105
105
  tracker.stop
106
106
 
107
107
  # Verify dependencies
108
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
108
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
109
109
  assert_empty tracker.objects_causing_outdatedness_of(items[1])
110
110
  end
111
111
 
112
112
  def test_store_graph_and_load_graph_simple
113
113
  # Mock items
114
- items = [ mock('0'), mock('1'), mock('2'), mock('3') ]
114
+ items = [mock('0'), mock('1'), mock('2'), mock('3')]
115
115
  items.each { |i| i.stubs(:type).returns(:item) }
116
- items[0].stubs(:reference).returns([ :item, '/aaa/' ])
117
- items[1].stubs(:reference).returns([ :item, '/bbb/' ])
118
- items[2].stubs(:reference).returns([ :item, '/ccc/' ])
119
- items[3].stubs(:reference).returns([ :item, '/ddd/' ])
116
+ items[0].stubs(:reference).returns([:item, '/aaa/'])
117
+ items[1].stubs(:reference).returns([:item, '/bbb/'])
118
+ items[2].stubs(:reference).returns([:item, '/ccc/'])
119
+ items[3].stubs(:reference).returns([:item, '/ddd/'])
120
120
 
121
121
  # Create
122
122
  tracker = Nanoc::DependencyTracker.new(items)
@@ -137,24 +137,24 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
137
137
  tracker.load_graph
138
138
 
139
139
  # Check loaded graph
140
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
141
- assert_contains_exactly [ items[2], items[3] ], tracker.objects_causing_outdatedness_of(items[1])
140
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
141
+ assert_contains_exactly [items[2], items[3]], tracker.objects_causing_outdatedness_of(items[1])
142
142
  assert_empty tracker.objects_causing_outdatedness_of(items[2])
143
143
  assert_empty tracker.objects_causing_outdatedness_of(items[3])
144
144
  end
145
145
 
146
146
  def test_store_graph_and_load_graph_with_removed_items
147
147
  # Mock items
148
- items = [ mock('0'), mock('1'), mock('2'), mock('3') ]
148
+ items = [mock('0'), mock('1'), mock('2'), mock('3')]
149
149
  items.each { |i| i.stubs(:type).returns(:item) }
150
- items[0].stubs(:reference).returns([ :item, '/aaa/' ])
151
- items[1].stubs(:reference).returns([ :item, '/bbb/' ])
152
- items[2].stubs(:reference).returns([ :item, '/ccc/' ])
153
- items[3].stubs(:reference).returns([ :item, '/ddd/' ])
150
+ items[0].stubs(:reference).returns([:item, '/aaa/'])
151
+ items[1].stubs(:reference).returns([:item, '/bbb/'])
152
+ items[2].stubs(:reference).returns([:item, '/ccc/'])
153
+ items[3].stubs(:reference).returns([:item, '/ddd/'])
154
154
 
155
155
  # Create new and old lists
156
- old_items = [ items[0], items[1], items[2], items[3] ]
157
- new_items = [ items[0], items[1], items[2] ]
156
+ old_items = [items[0], items[1], items[2], items[3]]
157
+ new_items = [items[0], items[1], items[2]]
158
158
 
159
159
  # Create
160
160
  tracker = Nanoc::DependencyTracker.new(old_items)
@@ -175,18 +175,18 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
175
175
  tracker.load_graph
176
176
 
177
177
  # Check loaded graph
178
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
179
- assert_contains_exactly [ items[2], nil ], tracker.objects_causing_outdatedness_of(items[1])
178
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
179
+ assert_contains_exactly [items[2], nil], tracker.objects_causing_outdatedness_of(items[1])
180
180
  assert_empty tracker.objects_causing_outdatedness_of(items[2])
181
181
  end
182
182
 
183
183
  def test_store_graph_with_nils_in_dst
184
184
  # Mock items
185
- items = [ mock('0'), mock('1'), mock('2') ]
185
+ items = [mock('0'), mock('1'), mock('2')]
186
186
  items.each { |i| i.stubs(:type).returns(:item) }
187
- items[0].stubs(:reference).returns([ :item, '/aaa/' ])
188
- items[1].stubs(:reference).returns([ :item, '/bbb/' ])
189
- items[2].stubs(:reference).returns([ :item, '/ccc/' ])
187
+ items[0].stubs(:reference).returns([:item, '/aaa/'])
188
+ items[1].stubs(:reference).returns([:item, '/bbb/'])
189
+ items[2].stubs(:reference).returns([:item, '/ccc/'])
190
190
 
191
191
  # Create
192
192
  tracker = Nanoc::DependencyTracker.new(items)
@@ -206,17 +206,17 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
206
206
  tracker.load_graph
207
207
 
208
208
  # Check loaded graph
209
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
210
- assert_contains_exactly [ nil ], tracker.objects_causing_outdatedness_of(items[1])
209
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
210
+ assert_contains_exactly [nil], tracker.objects_causing_outdatedness_of(items[1])
211
211
  end
212
212
 
213
213
  def test_store_graph_with_nils_in_src
214
214
  # Mock items
215
- items = [ mock('0'), mock('1'), mock('2') ]
215
+ items = [mock('0'), mock('1'), mock('2')]
216
216
  items.each { |i| i.stubs(:type).returns(:item) }
217
- items[0].stubs(:reference).returns([ :item, '/aaa/' ])
218
- items[1].stubs(:reference).returns([ :item, '/bbb/' ])
219
- items[2].stubs(:reference).returns([ :item, '/ccc/' ])
217
+ items[0].stubs(:reference).returns([:item, '/aaa/'])
218
+ items[1].stubs(:reference).returns([:item, '/bbb/'])
219
+ items[2].stubs(:reference).returns([:item, '/ccc/'])
220
220
 
221
221
  # Create
222
222
  tracker = Nanoc::DependencyTracker.new(items)
@@ -236,13 +236,13 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
236
236
  tracker.load_graph
237
237
 
238
238
  # Check loaded graph
239
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
239
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
240
240
  assert_empty tracker.objects_causing_outdatedness_of(items[1])
241
241
  end
242
242
 
243
243
  def test_forget_dependencies_for
244
244
  # Mock items
245
- items = [ mock, mock, mock ]
245
+ items = [mock, mock, mock]
246
246
 
247
247
  # Create
248
248
  tracker = Nanoc::DependencyTracker.new(items)
@@ -250,7 +250,7 @@ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
250
250
  # Record some dependencies
251
251
  tracker.record_dependency(items[0], items[1])
252
252
  tracker.record_dependency(items[1], items[2])
253
- assert_contains_exactly [ items[1] ], tracker.objects_causing_outdatedness_of(items[0])
253
+ assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
254
254
 
255
255
  # Forget dependencies
256
256
  tracker.forget_dependencies_for(items[0])