nanoc 3.7.3 → 3.7.4

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -3,78 +3,78 @@
3
3
  class Nanoc::DirectedGraphTest < Nanoc::TestCase
4
4
 
5
5
  def test_direct_predecessors
6
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
6
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
7
7
  graph.add_edge(1, 2)
8
8
  graph.add_edge(2, 3)
9
9
 
10
10
  assert_equal [], graph.direct_predecessors_of(1)
11
- assert_equal [ 1 ], graph.direct_predecessors_of(2)
12
- assert_equal [ 2 ], graph.direct_predecessors_of(3)
11
+ assert_equal [1], graph.direct_predecessors_of(2)
12
+ assert_equal [2], graph.direct_predecessors_of(3)
13
13
  end
14
14
 
15
15
  def test_predecessors
16
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
16
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
17
17
  graph.add_edge(1, 2)
18
18
  graph.add_edge(2, 3)
19
19
 
20
20
  assert_equal [], graph.predecessors_of(1).sort
21
- assert_equal [ 1 ], graph.predecessors_of(2).sort
22
- assert_equal [ 1, 2 ], graph.predecessors_of(3).sort
21
+ assert_equal [1], graph.predecessors_of(2).sort
22
+ assert_equal [1, 2], graph.predecessors_of(3).sort
23
23
  end
24
24
 
25
25
  def test_direct_successors
26
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
26
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
27
27
  graph.add_edge(1, 2)
28
28
  graph.add_edge(2, 3)
29
29
 
30
- assert_equal [ 2 ], graph.direct_successors_of(1)
31
- assert_equal [ 3 ], graph.direct_successors_of(2)
30
+ assert_equal [2], graph.direct_successors_of(1)
31
+ assert_equal [3], graph.direct_successors_of(2)
32
32
  assert_equal [], graph.direct_successors_of(3)
33
33
  end
34
34
 
35
35
  def test_successors
36
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
36
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
37
37
  graph.add_edge(1, 2)
38
38
  graph.add_edge(2, 3)
39
39
 
40
- assert_equal [ 2, 3 ], graph.successors_of(1).sort
41
- assert_equal [ 3 ], graph.successors_of(2).sort
40
+ assert_equal [2, 3], graph.successors_of(1).sort
41
+ assert_equal [3], graph.successors_of(2).sort
42
42
  assert_equal [], graph.successors_of(3).sort
43
43
  end
44
44
 
45
45
  def test_edges
46
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
46
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
47
47
  graph.add_edge(1, 2)
48
48
  graph.add_edge(2, 3)
49
49
 
50
- assert_equal [ [ 0, 1 ], [ 1, 2 ] ], graph.edges.sort
50
+ assert_equal [[0, 1], [1, 2]], graph.edges.sort
51
51
  end
52
52
 
53
53
  def test_edges_with_new_vertices
54
- graph = Nanoc::DirectedGraph.new([ 1 ])
55
- assert_equal [ 1 ], graph.vertices
54
+ graph = Nanoc::DirectedGraph.new([1])
55
+ assert_equal [1], graph.vertices
56
56
  graph.add_edge(1, 2)
57
- assert_equal [ 1, 2 ], graph.vertices
57
+ assert_equal [1, 2], graph.vertices
58
58
  graph.add_edge(3, 2)
59
- assert_equal [ 1, 2, 3 ], graph.vertices
59
+ assert_equal [1, 2, 3], graph.vertices
60
60
 
61
- assert_equal [ [ 0, 1 ], [ 2, 1 ] ], graph.edges.sort
61
+ assert_equal [[0, 1], [2, 1]], graph.edges.sort
62
62
  end
63
63
 
64
64
  def test_add_edge
65
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
65
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
66
66
 
67
67
  assert_equal [], graph.successors_of(1)
68
68
  assert_equal [], graph.predecessors_of(2)
69
69
 
70
70
  graph.add_edge(1, 2)
71
71
 
72
- assert_equal [ 2 ], graph.successors_of(1)
73
- assert_equal [ 1 ], graph.predecessors_of(2)
72
+ assert_equal [2], graph.successors_of(1)
73
+ assert_equal [1], graph.predecessors_of(2)
74
74
  end
75
75
 
76
76
  def test_add_edge_with_new_vertices
77
- graph = Nanoc::DirectedGraph.new([ 1 ])
77
+ graph = Nanoc::DirectedGraph.new([1])
78
78
  graph.add_edge(1, 2)
79
79
  graph.add_edge(3, 2)
80
80
 
@@ -83,11 +83,11 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
83
83
  end
84
84
 
85
85
  def test_delete_edge
86
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
86
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
87
87
  graph.add_edge(1,2)
88
88
 
89
- assert_equal [ 2 ], graph.successors_of(1)
90
- assert_equal [ 1 ], graph.predecessors_of(2)
89
+ assert_equal [2], graph.successors_of(1)
90
+ assert_equal [1], graph.predecessors_of(2)
91
91
 
92
92
  graph.delete_edge(1, 2)
93
93
 
@@ -96,7 +96,7 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
96
96
  end
97
97
 
98
98
  def test_delete_edges_from
99
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
99
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
100
100
 
101
101
  graph.add_edge(1, 2)
102
102
  graph.add_edge(2, 1)
@@ -105,37 +105,37 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
105
105
  graph.add_edge(1, 3)
106
106
  graph.add_edge(3, 1)
107
107
 
108
- assert_equal [ 2, 3 ], graph.direct_predecessors_of(1).sort
109
- assert_equal [ 2, 3 ], graph.direct_successors_of(1).sort
110
- assert_equal [ 1, 3 ], graph.direct_predecessors_of(2).sort
111
- assert_equal [ 1, 3 ], graph.direct_successors_of(2).sort
112
- assert_equal [ 1, 2 ], graph.direct_predecessors_of(3).sort
113
- assert_equal [ 1, 2 ], graph.direct_successors_of(3).sort
108
+ assert_equal [2, 3], graph.direct_predecessors_of(1).sort
109
+ assert_equal [2, 3], graph.direct_successors_of(1).sort
110
+ assert_equal [1, 3], graph.direct_predecessors_of(2).sort
111
+ assert_equal [1, 3], graph.direct_successors_of(2).sort
112
+ assert_equal [1, 2], graph.direct_predecessors_of(3).sort
113
+ assert_equal [1, 2], graph.direct_successors_of(3).sort
114
114
  assert_equal Set.new([]), graph.roots
115
115
 
116
116
  graph.delete_edges_from(1)
117
117
 
118
- assert_equal [ 2, 3 ], graph.direct_predecessors_of(1).sort
119
- assert_equal [ ], graph.direct_successors_of(1).sort
120
- assert_equal [ 3 ], graph.direct_predecessors_of(2).sort
121
- assert_equal [ 1, 3 ], graph.direct_successors_of(2).sort
122
- assert_equal [ 2 ], graph.direct_predecessors_of(3).sort
123
- assert_equal [ 1, 2 ], graph.direct_successors_of(3).sort
118
+ assert_equal [2, 3], graph.direct_predecessors_of(1).sort
119
+ assert_equal [], graph.direct_successors_of(1).sort
120
+ assert_equal [3], graph.direct_predecessors_of(2).sort
121
+ assert_equal [1, 3], graph.direct_successors_of(2).sort
122
+ assert_equal [2], graph.direct_predecessors_of(3).sort
123
+ assert_equal [1, 2], graph.direct_successors_of(3).sort
124
124
  assert_equal Set.new([]), graph.roots
125
125
 
126
126
  graph.delete_edges_from(2)
127
127
 
128
- assert_equal [ 3 ], graph.direct_predecessors_of(1).sort
129
- assert_equal [ ], graph.direct_successors_of(1).sort
130
- assert_equal [ 3 ], graph.direct_predecessors_of(2).sort
131
- assert_equal [ ], graph.direct_successors_of(2).sort
132
- assert_equal [ ], graph.direct_predecessors_of(3).sort
133
- assert_equal [ 1, 2 ], graph.direct_successors_of(3).sort
134
- assert_equal Set.new([ 3 ]), graph.roots
128
+ assert_equal [3], graph.direct_predecessors_of(1).sort
129
+ assert_equal [], graph.direct_successors_of(1).sort
130
+ assert_equal [3], graph.direct_predecessors_of(2).sort
131
+ assert_equal [], graph.direct_successors_of(2).sort
132
+ assert_equal [], graph.direct_predecessors_of(3).sort
133
+ assert_equal [1, 2], graph.direct_successors_of(3).sort
134
+ assert_equal Set.new([3]), graph.roots
135
135
  end
136
136
 
137
137
  def test_delete_edges_to
138
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
138
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
139
139
 
140
140
  graph.add_edge(1, 2)
141
141
  graph.add_edge(2, 1)
@@ -144,37 +144,37 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
144
144
  graph.add_edge(1, 3)
145
145
  graph.add_edge(3, 1)
146
146
 
147
- assert_equal [ 2, 3 ], graph.direct_predecessors_of(1).sort
148
- assert_equal [ 2, 3 ], graph.direct_successors_of(1).sort
149
- assert_equal [ 1, 3 ], graph.direct_predecessors_of(2).sort
150
- assert_equal [ 1, 3 ], graph.direct_successors_of(2).sort
151
- assert_equal [ 1, 2 ], graph.direct_predecessors_of(3).sort
152
- assert_equal [ 1, 2 ], graph.direct_successors_of(3).sort
147
+ assert_equal [2, 3], graph.direct_predecessors_of(1).sort
148
+ assert_equal [2, 3], graph.direct_successors_of(1).sort
149
+ assert_equal [1, 3], graph.direct_predecessors_of(2).sort
150
+ assert_equal [1, 3], graph.direct_successors_of(2).sort
151
+ assert_equal [1, 2], graph.direct_predecessors_of(3).sort
152
+ assert_equal [1, 2], graph.direct_successors_of(3).sort
153
153
  assert_equal Set.new([]), graph.roots
154
154
 
155
155
  graph.delete_edges_to(1)
156
156
 
157
- assert_equal [ ], graph.direct_predecessors_of(1).sort
158
- assert_equal [ 2, 3 ], graph.direct_successors_of(1).sort
159
- assert_equal [ 1, 3 ], graph.direct_predecessors_of(2).sort
160
- assert_equal [ 3 ], graph.direct_successors_of(2).sort
161
- assert_equal [ 1, 2 ], graph.direct_predecessors_of(3).sort
162
- assert_equal [ 2 ], graph.direct_successors_of(3).sort
163
- assert_equal Set.new([ 1 ]), graph.roots
157
+ assert_equal [], graph.direct_predecessors_of(1).sort
158
+ assert_equal [2, 3], graph.direct_successors_of(1).sort
159
+ assert_equal [1, 3], graph.direct_predecessors_of(2).sort
160
+ assert_equal [3], graph.direct_successors_of(2).sort
161
+ assert_equal [1, 2], graph.direct_predecessors_of(3).sort
162
+ assert_equal [2], graph.direct_successors_of(3).sort
163
+ assert_equal Set.new([1]), graph.roots
164
164
 
165
165
  graph.delete_edges_to(2)
166
166
 
167
- assert_equal [ ], graph.direct_predecessors_of(1).sort
168
- assert_equal [ 3 ], graph.direct_successors_of(1).sort
169
- assert_equal [ ], graph.direct_predecessors_of(2).sort
170
- assert_equal [ 3 ], graph.direct_successors_of(2).sort
171
- assert_equal [ 1, 2 ], graph.direct_predecessors_of(3).sort
172
- assert_equal [ ], graph.direct_successors_of(3).sort
173
- assert_equal Set.new([ 1, 2 ]), graph.roots
167
+ assert_equal [], graph.direct_predecessors_of(1).sort
168
+ assert_equal [3], graph.direct_successors_of(1).sort
169
+ assert_equal [], graph.direct_predecessors_of(2).sort
170
+ assert_equal [3], graph.direct_successors_of(2).sort
171
+ assert_equal [1, 2], graph.direct_predecessors_of(3).sort
172
+ assert_equal [], graph.direct_successors_of(3).sort
173
+ assert_equal Set.new([1, 2]), graph.roots
174
174
  end
175
175
 
176
176
  def test_delete_vertex
177
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
177
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
178
178
 
179
179
  graph.add_edge(1, 2)
180
180
  graph.add_edge(2, 1)
@@ -185,27 +185,27 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
185
185
 
186
186
  graph.delete_vertex(2)
187
187
 
188
- assert_equal [ 3 ], graph.direct_predecessors_of(1).sort
189
- assert_equal [ 3 ], graph.direct_successors_of(1).sort
190
- assert_equal [ 1 ], graph.direct_predecessors_of(3).sort
191
- assert_equal [ 1 ], graph.direct_successors_of(3).sort
188
+ assert_equal [3], graph.direct_predecessors_of(1).sort
189
+ assert_equal [3], graph.direct_successors_of(1).sort
190
+ assert_equal [1], graph.direct_predecessors_of(3).sort
191
+ assert_equal [1], graph.direct_successors_of(3).sort
192
192
  assert_equal Set.new([]), graph.roots
193
193
  end
194
194
 
195
195
  def test_delete_vertex_resulting_roots
196
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
197
- assert_equal Set.new([ 1, 2, 3 ]), graph.roots
196
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
197
+ assert_equal Set.new([1, 2, 3]), graph.roots
198
198
 
199
199
  graph.add_edge(1, 2)
200
200
  graph.add_edge(2, 3)
201
- assert_equal Set.new([ 1 ]), graph.roots
201
+ assert_equal Set.new([1]), graph.roots
202
202
 
203
203
  graph.delete_vertex(2)
204
- assert_equal Set.new([ 1, 3 ]), graph.roots
204
+ assert_equal Set.new([1, 3]), graph.roots
205
205
  end
206
206
 
207
207
  def test_should_return_empty_array_for_nonexistant_vertices
208
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
208
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
209
209
 
210
210
  assert_equal [], graph.direct_predecessors_of(4)
211
211
  assert_equal [], graph.predecessors_of(4)
@@ -214,30 +214,30 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
214
214
  end
215
215
 
216
216
  def test_roots_after_init
217
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
217
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
218
218
 
219
- assert_equal Set.new([ 1, 2, 3 ]), graph.roots
219
+ assert_equal Set.new([1, 2, 3]), graph.roots
220
220
  end
221
221
 
222
222
  def test_roots_after_adding_edge
223
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
223
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
224
224
  graph.add_edge(1, 2)
225
- assert_equal Set.new([ 1, 3 ]), graph.roots
225
+ assert_equal Set.new([1, 3]), graph.roots
226
226
 
227
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
227
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
228
228
  graph.add_edge(1, 3)
229
- assert_equal Set.new([ 1, 2 ]), graph.roots
229
+ assert_equal Set.new([1, 2]), graph.roots
230
230
 
231
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
231
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
232
232
  graph.add_edge(2, 1)
233
- assert_equal Set.new([ 2, 3 ]), graph.roots
233
+ assert_equal Set.new([2, 3]), graph.roots
234
234
 
235
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
235
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
236
236
  graph.add_edge(1, 2)
237
237
  graph.add_edge(2, 3)
238
- assert_equal Set.new([ 1 ]), graph.roots
238
+ assert_equal Set.new([1]), graph.roots
239
239
 
240
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
240
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
241
241
  graph.add_edge(1, 2)
242
242
  graph.add_edge(2, 3)
243
243
  graph.add_edge(3, 1)
@@ -245,40 +245,40 @@ class Nanoc::DirectedGraphTest < Nanoc::TestCase
245
245
  end
246
246
 
247
247
  def test_roots_after_removing_edge
248
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
248
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
249
249
  graph.add_edge(1, 2)
250
250
  graph.delete_edge(1, 2)
251
- assert_equal Set.new([ 1, 2, 3 ]), graph.roots
251
+ assert_equal Set.new([1, 2, 3]), graph.roots
252
252
 
253
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
253
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
254
254
  graph.add_edge(1, 3)
255
- assert_equal Set.new([ 1, 2 ]), graph.roots
255
+ assert_equal Set.new([1, 2]), graph.roots
256
256
  graph.delete_edge(1, 2) # no such edge
257
- assert_equal Set.new([ 1, 2 ]), graph.roots
257
+ assert_equal Set.new([1, 2]), graph.roots
258
258
 
259
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
259
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
260
260
  graph.add_edge(2, 1)
261
261
  graph.delete_edge(2, 1)
262
- assert_equal Set.new([ 1, 2, 3 ]), graph.roots
262
+ assert_equal Set.new([1, 2, 3]), graph.roots
263
263
 
264
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
264
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
265
265
  graph.add_edge(1, 2)
266
266
  graph.add_edge(2, 3)
267
267
  graph.delete_edge(1, 2)
268
- assert_equal Set.new([ 1, 2 ]), graph.roots
268
+ assert_equal Set.new([1, 2]), graph.roots
269
269
  graph.delete_edge(2, 3)
270
- assert_equal Set.new([ 1, 2, 3 ]), graph.roots
270
+ assert_equal Set.new([1, 2, 3]), graph.roots
271
271
 
272
- graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
272
+ graph = Nanoc::DirectedGraph.new([1, 2, 3])
273
273
  graph.add_edge(1, 2)
274
274
  graph.add_edge(2, 3)
275
275
  graph.add_edge(3, 1)
276
276
  graph.delete_edge(1, 2)
277
- assert_equal Set.new([ 2 ]), graph.roots
277
+ assert_equal Set.new([2]), graph.roots
278
278
  graph.delete_edge(2, 3)
279
- assert_equal Set.new([ 2, 3 ]), graph.roots
279
+ assert_equal Set.new([2, 3]), graph.roots
280
280
  graph.delete_edge(3, 1)
281
- assert_equal Set.new([ 1, 2, 3 ]), graph.roots
281
+ assert_equal Set.new([1, 2, 3]), graph.roots
282
282
  end
283
283
 
284
284
  def test_example
@@ -3,20 +3,20 @@
3
3
  class Nanoc::ItemTest < Nanoc::TestCase
4
4
 
5
5
  def test_initialize_with_attributes_with_string_keys
6
- item = Nanoc::Item.new("foo", { 'abc' => 'xyz' }, '/foo/')
6
+ item = Nanoc::Item.new('foo', { 'abc' => 'xyz' }, '/foo/')
7
7
 
8
8
  assert_equal nil, item.attributes['abc']
9
9
  assert_equal 'xyz', item.attributes[:abc]
10
10
  end
11
11
 
12
12
  def test_initialize_with_unclean_identifier
13
- item = Nanoc::Item.new("foo", {}, '/foo')
13
+ item = Nanoc::Item.new('foo', {}, '/foo')
14
14
 
15
15
  assert_equal '/foo/', item.identifier
16
16
  end
17
17
 
18
18
  def test_frozen_identifier
19
- item = Nanoc::Item.new("foo", {}, '/foo')
19
+ item = Nanoc::Item.new('foo', {}, '/foo')
20
20
 
21
21
  assert_raises_frozen_error do
22
22
  item.identifier.chop!
@@ -26,7 +26,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
26
26
  def test_lookup
27
27
  # Create item
28
28
  item = Nanoc::Item.new(
29
- "content",
29
+ 'content',
30
30
  { :one => 'one in item' },
31
31
  '/path/'
32
32
  )
@@ -39,7 +39,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
39
39
  end
40
40
 
41
41
  def test_set_attribute
42
- item = Nanoc::Item.new("foo", {}, '/foo')
42
+ item = Nanoc::Item.new('foo', {}, '/foo')
43
43
  assert_equal nil, item[:motto]
44
44
 
45
45
  item[:motto] = 'More human than human'
@@ -49,14 +49,14 @@ class Nanoc::ItemTest < Nanoc::TestCase
49
49
  def test_compiled_content_with_default_rep_and_default_snapshot
50
50
  # Mock rep
51
51
  rep = Object.new
52
- def rep.name ; :default ; end
52
+ def rep.name; :default; end
53
53
  def rep.compiled_content(params)
54
54
  "content at #{params[:snapshot].inspect}"
55
55
  end
56
56
 
57
57
  # Mock item
58
- item = Nanoc::Item.new("foo", {}, '/foo')
59
- item.expects(:reps).returns([ rep ])
58
+ item = Nanoc::Item.new('foo', {}, '/foo')
59
+ item.expects(:reps).returns([rep])
60
60
 
61
61
  # Check
62
62
  assert_equal 'content at nil', item.compiled_content
@@ -65,14 +65,14 @@ class Nanoc::ItemTest < Nanoc::TestCase
65
65
  def test_compiled_content_with_custom_rep_and_default_snapshot
66
66
  # Mock reps
67
67
  rep = Object.new
68
- def rep.name ; :foo ; end
68
+ def rep.name; :foo; end
69
69
  def rep.compiled_content(params)
70
70
  "content at #{params[:snapshot].inspect}"
71
71
  end
72
72
 
73
73
  # Mock item
74
- item = Nanoc::Item.new("foo", {}, '/foo')
75
- item.expects(:reps).returns([ rep ])
74
+ item = Nanoc::Item.new('foo', {}, '/foo')
75
+ item.expects(:reps).returns([rep])
76
76
 
77
77
  # Check
78
78
  assert_equal 'content at nil', item.compiled_content(:rep => :foo)
@@ -81,14 +81,14 @@ class Nanoc::ItemTest < Nanoc::TestCase
81
81
  def test_compiled_content_with_default_rep_and_custom_snapshot
82
82
  # Mock reps
83
83
  rep = Object.new
84
- def rep.name ; :default ; end
84
+ def rep.name; :default; end
85
85
  def rep.compiled_content(params)
86
86
  "content at #{params[:snapshot].inspect}"
87
87
  end
88
88
 
89
89
  # Mock item
90
- item = Nanoc::Item.new("foo", {}, '/foo')
91
- item.expects(:reps).returns([ rep ])
90
+ item = Nanoc::Item.new('foo', {}, '/foo')
91
+ item.expects(:reps).returns([rep])
92
92
 
93
93
  # Check
94
94
  assert_equal 'content at :blah', item.compiled_content(:snapshot => :blah)
@@ -96,7 +96,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
96
96
 
97
97
  def test_compiled_content_with_custom_nonexistant_rep
98
98
  # Mock item
99
- item = Nanoc::Item.new("foo", {}, '/foo')
99
+ item = Nanoc::Item.new('foo', {}, '/foo')
100
100
  item.expects(:reps).returns([])
101
101
 
102
102
  # Check
@@ -112,8 +112,8 @@ class Nanoc::ItemTest < Nanoc::TestCase
112
112
  rep.expects(:path).returns('the correct path')
113
113
 
114
114
  # Mock item
115
- item = Nanoc::Item.new("foo", {}, '/foo')
116
- item.expects(:reps).returns([ rep ])
115
+ item = Nanoc::Item.new('foo', {}, '/foo')
116
+ item.expects(:reps).returns([rep])
117
117
 
118
118
  # Check
119
119
  assert_equal 'the correct path', item.path
@@ -126,15 +126,15 @@ class Nanoc::ItemTest < Nanoc::TestCase
126
126
  rep.expects(:path).returns('the correct path')
127
127
 
128
128
  # Mock item
129
- item = Nanoc::Item.new("foo", {}, '/foo')
130
- item.expects(:reps).returns([ rep ])
129
+ item = Nanoc::Item.new('foo', {}, '/foo')
130
+ item.expects(:reps).returns([rep])
131
131
 
132
132
  # Check
133
133
  assert_equal 'the correct path', item.path(:rep => :moo)
134
134
  end
135
135
 
136
136
  def test_freeze_should_disallow_changes
137
- item = Nanoc::Item.new("foo", { :a => { :b => 123 }}, '/foo/')
137
+ item = Nanoc::Item.new('foo', { :a => { :b => 123 }}, '/foo/')
138
138
  item.freeze
139
139
 
140
140
  assert_raises_frozen_error do
@@ -148,7 +148,7 @@ class Nanoc::ItemTest < Nanoc::TestCase
148
148
 
149
149
  def test_dump_and_load
150
150
  item = Nanoc::Item.new(
151
- "foobar",
151
+ 'foobar',
152
152
  { :a => { :b => 123 }},
153
153
  '/foo/')
154
154