nanoc 3.8.0 → 4.0.0a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +322 -0
  4. data/NEWS.md +6 -0
  5. data/bin/nanoc +0 -18
  6. data/lib/nanoc.rb +5 -3
  7. data/lib/nanoc/base.rb +24 -6
  8. data/lib/nanoc/base/checksummer.rb +6 -4
  9. data/lib/nanoc/base/compilation/checksum_store.rb +4 -4
  10. data/lib/nanoc/base/compilation/compiled_content_cache.rb +5 -5
  11. data/lib/nanoc/base/compilation/compiler.rb +60 -65
  12. data/lib/nanoc/base/compilation/compiler_dsl.rb +11 -9
  13. data/lib/nanoc/base/compilation/dependency_tracker.rb +24 -38
  14. data/lib/nanoc/base/compilation/filter.rb +22 -7
  15. data/lib/nanoc/base/compilation/item_rep_proxy.rb +14 -12
  16. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -8
  17. data/lib/nanoc/base/compilation/outdatedness_checker.rb +32 -32
  18. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +3 -1
  19. data/lib/nanoc/base/compilation/rule.rb +9 -7
  20. data/lib/nanoc/base/compilation/rule_context.rb +15 -15
  21. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
  22. data/lib/nanoc/base/compilation/rule_memory_store.rb +7 -7
  23. data/lib/nanoc/base/compilation/rules_collection.rb +28 -30
  24. data/lib/nanoc/base/context.rb +2 -2
  25. data/lib/nanoc/base/core_ext/array.rb +17 -25
  26. data/lib/nanoc/base/core_ext/hash.rb +17 -25
  27. data/lib/nanoc/base/core_ext/pathname.rb +4 -2
  28. data/lib/nanoc/base/core_ext/string.rb +5 -3
  29. data/lib/nanoc/base/directed_graph.rb +4 -9
  30. data/lib/nanoc/base/error.rb +7 -0
  31. data/lib/nanoc/base/errors.rb +16 -23
  32. data/lib/nanoc/base/memoization.rb +4 -2
  33. data/lib/nanoc/base/notification_center.rb +3 -1
  34. data/lib/nanoc/base/plugin_registry.rb +14 -21
  35. data/lib/nanoc/base/result_data/item_rep.rb +43 -88
  36. data/lib/nanoc/base/source_data/code_snippet.rb +6 -4
  37. data/lib/nanoc/base/source_data/configuration.rb +3 -1
  38. data/lib/nanoc/base/source_data/data_source.rb +12 -94
  39. data/lib/nanoc/base/source_data/identifier.rb +50 -0
  40. data/lib/nanoc/base/source_data/item.rb +24 -67
  41. data/lib/nanoc/base/source_data/item_array.rb +6 -4
  42. data/lib/nanoc/base/source_data/layout.rb +17 -28
  43. data/lib/nanoc/base/source_data/site.rb +33 -44
  44. data/lib/nanoc/base/store.rb +3 -5
  45. data/lib/nanoc/base/temp_filename_factory.rb +3 -2
  46. data/lib/nanoc/base/views/config.rb +19 -0
  47. data/lib/nanoc/base/views/item.rb +77 -0
  48. data/lib/nanoc/base/views/item_collection.rb +43 -0
  49. data/lib/nanoc/base/views/item_rep.rb +125 -0
  50. data/lib/nanoc/base/views/layout.rb +42 -0
  51. data/lib/nanoc/base/views/layout_collection.rb +26 -0
  52. data/lib/nanoc/base/views/mutable_config.rb +9 -0
  53. data/lib/nanoc/base/views/mutable_item.rb +9 -0
  54. data/lib/nanoc/base/views/mutable_item_collection.rb +18 -0
  55. data/lib/nanoc/base/views/mutable_layout.rb +9 -0
  56. data/lib/nanoc/base/views/mutable_layout_collection.rb +18 -0
  57. data/lib/nanoc/base/views/site.rb +35 -0
  58. data/lib/nanoc/cli.rb +3 -6
  59. data/lib/nanoc/cli/ansi_string_colorizer.rb +2 -0
  60. data/lib/nanoc/cli/cleaning_stream.rb +2 -0
  61. data/lib/nanoc/cli/command_runner.rb +8 -42
  62. data/lib/nanoc/cli/commands/check.rb +2 -2
  63. data/lib/nanoc/cli/commands/compile.rb +19 -34
  64. data/lib/nanoc/cli/commands/create-site.rb +46 -83
  65. data/lib/nanoc/cli/commands/deploy.rb +4 -4
  66. data/lib/nanoc/cli/commands/shell.rb +1 -1
  67. data/lib/nanoc/cli/commands/show-plugins.rb +4 -6
  68. data/lib/nanoc/cli/error_handler.rb +4 -14
  69. data/lib/nanoc/cli/logger.rb +2 -0
  70. data/lib/nanoc/cli/stream_cleaners.rb +1 -0
  71. data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -0
  72. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -0
  73. data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -0
  74. data/lib/nanoc/data_sources.rb +1 -17
  75. data/lib/nanoc/data_sources/filesystem.rb +6 -37
  76. data/lib/nanoc/data_sources/filesystem_unified.rb +5 -3
  77. data/lib/nanoc/data_sources/filesystem_verbose.rb +5 -3
  78. data/lib/nanoc/data_sources/static.rb +4 -2
  79. data/lib/nanoc/extra.rb +1 -13
  80. data/lib/nanoc/extra/checking.rb +1 -0
  81. data/lib/nanoc/extra/checking/check.rb +4 -2
  82. data/lib/nanoc/extra/checking/checks.rb +1 -0
  83. data/lib/nanoc/extra/checking/checks/css.rb +1 -0
  84. data/lib/nanoc/extra/checking/checks/external_links.rb +2 -0
  85. data/lib/nanoc/extra/checking/checks/html.rb +1 -0
  86. data/lib/nanoc/extra/checking/checks/internal_links.rb +2 -0
  87. data/lib/nanoc/extra/checking/checks/mixed_content.rb +2 -0
  88. data/lib/nanoc/extra/checking/checks/stale.rb +1 -0
  89. data/lib/nanoc/extra/checking/dsl.rb +1 -0
  90. data/lib/nanoc/extra/checking/issue.rb +1 -0
  91. data/lib/nanoc/extra/checking/runner.rb +3 -3
  92. data/lib/nanoc/extra/core_ext/pathname.rb +5 -3
  93. data/lib/nanoc/extra/core_ext/time.rb +4 -2
  94. data/lib/nanoc/extra/deployer.rb +3 -1
  95. data/lib/nanoc/extra/deployers.rb +1 -0
  96. data/lib/nanoc/extra/deployers/fog.rb +2 -0
  97. data/lib/nanoc/extra/deployers/rsync.rb +2 -0
  98. data/lib/nanoc/extra/filesystem_tools.rb +3 -7
  99. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -0
  100. data/lib/nanoc/extra/link_collector.rb +1 -0
  101. data/lib/nanoc/extra/piper.rb +2 -1
  102. data/lib/nanoc/extra/pruner.rb +5 -3
  103. data/lib/nanoc/filters.rb +1 -2
  104. data/lib/nanoc/filters/asciidoc.rb +2 -0
  105. data/lib/nanoc/filters/bluecloth.rb +1 -0
  106. data/lib/nanoc/filters/coffeescript.rb +2 -0
  107. data/lib/nanoc/filters/colorize_syntax.rb +1 -12
  108. data/lib/nanoc/filters/erb.rb +2 -1
  109. data/lib/nanoc/filters/erubis.rb +2 -1
  110. data/lib/nanoc/filters/haml.rb +2 -1
  111. data/lib/nanoc/filters/handlebars.rb +2 -0
  112. data/lib/nanoc/filters/kramdown.rb +1 -0
  113. data/lib/nanoc/filters/less.rb +1 -0
  114. data/lib/nanoc/filters/markaby.rb +1 -0
  115. data/lib/nanoc/filters/maruku.rb +1 -0
  116. data/lib/nanoc/filters/mustache.rb +2 -0
  117. data/lib/nanoc/filters/pandoc.rb +1 -0
  118. data/lib/nanoc/filters/rainpress.rb +1 -0
  119. data/lib/nanoc/filters/rdiscount.rb +1 -0
  120. data/lib/nanoc/filters/rdoc.rb +1 -0
  121. data/lib/nanoc/filters/redcarpet.rb +2 -0
  122. data/lib/nanoc/filters/redcloth.rb +1 -0
  123. data/lib/nanoc/filters/relativize_paths.rb +1 -0
  124. data/lib/nanoc/filters/rubypants.rb +1 -0
  125. data/lib/nanoc/filters/sass.rb +1 -0
  126. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +2 -0
  127. data/lib/nanoc/filters/slim.rb +3 -1
  128. data/lib/nanoc/filters/typogruby.rb +2 -0
  129. data/lib/nanoc/filters/uglify_js.rb +1 -0
  130. data/lib/nanoc/filters/xsl.rb +2 -0
  131. data/lib/nanoc/filters/yui_compressor.rb +2 -0
  132. data/lib/nanoc/helpers/blogging.rb +30 -30
  133. data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
  134. data/lib/nanoc/helpers/capturing.rb +6 -17
  135. data/lib/nanoc/helpers/filtering.rb +3 -3
  136. data/lib/nanoc/helpers/link_to.rb +3 -3
  137. data/lib/nanoc/helpers/rendering.rb +11 -11
  138. data/lib/nanoc/helpers/xml_sitemap.rb +3 -3
  139. data/lib/nanoc/tasks.rb +1 -0
  140. data/lib/nanoc/tasks/clean.rake +1 -1
  141. data/lib/nanoc/version.rb +1 -1
  142. data/tasks/doc.rake +2 -1
  143. data/tasks/test.rake +7 -1
  144. data/test/base/checksummer_spec.rb +15 -15
  145. data/test/base/core_ext/array_spec.rb +10 -10
  146. data/test/base/core_ext/hash_spec.rb +16 -16
  147. data/test/base/core_ext/pathname_spec.rb +2 -2
  148. data/test/base/core_ext/string_spec.rb +9 -9
  149. data/test/base/temp_filename_factory_spec.rb +3 -7
  150. data/test/base/test_checksum_store.rb +5 -5
  151. data/test/base/test_code_snippet.rb +3 -3
  152. data/test/base/test_compiler.rb +29 -29
  153. data/test/base/test_compiler_dsl.rb +23 -23
  154. data/test/base/test_context.rb +4 -4
  155. data/test/base/test_data_source.rb +17 -7
  156. data/test/base/test_dependency_tracker.rb +29 -29
  157. data/test/base/test_directed_graph.rb +27 -27
  158. data/test/base/test_item.rb +23 -21
  159. data/test/base/test_item_array.rb +18 -18
  160. data/test/base/test_item_rep.rb +76 -76
  161. data/test/base/test_item_rep_recorder_proxy.rb +4 -4
  162. data/test/base/test_layout.rb +8 -16
  163. data/test/base/test_memoization.rb +4 -4
  164. data/test/base/test_notification_center.rb +6 -6
  165. data/test/base/test_outdatedness_checker.rb +18 -18
  166. data/test/base/test_plugin.rb +1 -1
  167. data/test/base/test_rule.rb +2 -2
  168. data/test/base/test_rule_context.rb +5 -5
  169. data/test/base/test_site.rb +62 -38
  170. data/test/base/test_store.rb +2 -2
  171. data/test/cli/commands/test_check.rb +1 -1
  172. data/test/cli/commands/test_compile.rb +24 -18
  173. data/test/cli/commands/test_create_site.rb +5 -7
  174. data/test/cli/commands/test_deploy.rb +1 -1
  175. data/test/data_sources/test_filesystem.rb +22 -67
  176. data/test/data_sources/test_filesystem_unified.rb +10 -23
  177. data/test/data_sources/test_filesystem_verbose.rb +8 -53
  178. data/test/data_sources/test_static.rb +9 -9
  179. data/test/extra/checking/checks/test_stale.rb +1 -1
  180. data/test/extra/core_ext/test_pathname.rb +3 -3
  181. data/test/extra/core_ext/test_time.rb +4 -4
  182. data/test/extra/test_filesystem_tools.rb +1 -1
  183. data/test/filters/test_handlebars.rb +3 -3
  184. data/test/filters/test_less.rb +6 -6
  185. data/test/filters/test_mustache.rb +2 -2
  186. data/test/filters/test_relativize_paths.rb +81 -81
  187. data/test/filters/test_sass.rb +7 -7
  188. data/test/filters/test_xsl.rb +6 -6
  189. data/test/helper.rb +1 -1
  190. data/test/helpers/test_blogging.rb +78 -99
  191. data/test/helpers/test_breadcrumbs.rb +12 -12
  192. data/test/helpers/test_capturing.rb +10 -11
  193. data/test/helpers/test_filtering.rb +6 -6
  194. data/test/helpers/test_rendering.rb +3 -3
  195. data/test/helpers/test_tagging.rb +7 -7
  196. data/test/helpers/test_xml_sitemap.rb +34 -33
  197. metadata +19 -43
  198. data/lib/nanoc/cli/commands/autocompile.rb +0 -69
  199. data/lib/nanoc/cli/commands/create-item.rb +0 -55
  200. data/lib/nanoc/cli/commands/create-layout.rb +0 -68
  201. data/lib/nanoc/cli/commands/sync.rb +0 -32
  202. data/lib/nanoc/cli/commands/update.rb +0 -63
  203. data/lib/nanoc/cli/commands/validate-css.rb +0 -20
  204. data/lib/nanoc/cli/commands/validate-html.rb +0 -20
  205. data/lib/nanoc/cli/commands/validate-links.rb +0 -27
  206. data/lib/nanoc/cli/commands/watch.rb +0 -176
  207. data/lib/nanoc/data_sources/deprecated/delicious.rb +0 -38
  208. data/lib/nanoc/data_sources/deprecated/last_fm.rb +0 -85
  209. data/lib/nanoc/data_sources/deprecated/twitter.rb +0 -34
  210. data/lib/nanoc/extra/auto_compiler.rb +0 -99
  211. data/lib/nanoc/extra/chick.rb +0 -117
  212. data/lib/nanoc/extra/file_proxy.rb +0 -36
  213. data/lib/nanoc/extra/validators.rb +0 -8
  214. data/lib/nanoc/extra/validators/links.rb +0 -18
  215. data/lib/nanoc/extra/validators/w3c.rb +0 -23
  216. data/lib/nanoc/extra/vcs.rb +0 -62
  217. data/lib/nanoc/extra/vcses.rb +0 -15
  218. data/lib/nanoc/extra/vcses/bazaar.rb +0 -21
  219. data/lib/nanoc/extra/vcses/dummy.rb +0 -20
  220. data/lib/nanoc/extra/vcses/git.rb +0 -21
  221. data/lib/nanoc/extra/vcses/mercurial.rb +0 -21
  222. data/lib/nanoc/extra/vcses/subversion.rb +0 -21
  223. data/lib/nanoc/filters/coderay.rb +0 -19
  224. data/lib/nanoc3.rb +0 -3
  225. data/lib/nanoc3/cli.rb +0 -3
  226. data/lib/nanoc3/tasks.rb +0 -3
  227. data/test/cli/commands/test_create_item.rb +0 -10
  228. data/test/cli/commands/test_create_layout.rb +0 -24
  229. data/test/cli/commands/test_sync.rb +0 -27
  230. data/test/cli/commands/test_update.rb +0 -6
  231. data/test/cli/commands/test_watch.rb +0 -74
  232. data/test/extra/test_auto_compiler.rb +0 -437
  233. data/test/extra/test_vcs.rb +0 -18
  234. data/test/extra/validators/test_links.rb +0 -4
  235. data/test/extra/validators/test_w3c.rb +0 -37
  236. data/test/filters/test_coderay.rb +0 -40
@@ -123,7 +123,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
123
123
  end
124
124
 
125
125
  # Compile
126
- site = Nanoc::Site.new('.')
126
+ site = Nanoc::Int::Site.new('.')
127
127
  site.compile
128
128
 
129
129
  # Check
@@ -138,7 +138,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
138
138
  end
139
139
 
140
140
  # Recompile
141
- site = Nanoc::Site.new('.')
141
+ site = Nanoc::Int::Site.new('.')
142
142
  site.compile
143
143
 
144
144
  # Recheck
@@ -178,7 +178,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
178
178
  end
179
179
 
180
180
  # Compile
181
- site = Nanoc::Site.new('.')
181
+ site = Nanoc::Int::Site.new('.')
182
182
  site.compile
183
183
 
184
184
  # Check
@@ -193,7 +193,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
193
193
  end
194
194
 
195
195
  # Recompile
196
- site = Nanoc::Site.new('.')
196
+ site = Nanoc::Int::Site.new('.')
197
197
  site.compile
198
198
 
199
199
  # Recheck
@@ -245,7 +245,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
245
245
  end
246
246
 
247
247
  # Compile
248
- site = Nanoc::Site.new('.')
248
+ site = Nanoc::Int::Site.new('.')
249
249
  site.compile
250
250
 
251
251
  # Check
@@ -259,7 +259,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
259
259
  end
260
260
 
261
261
  # Recompile
262
- site = Nanoc::Site.new('.')
262
+ site = Nanoc::Int::Site.new('.')
263
263
  site.compile
264
264
 
265
265
  # Recheck
@@ -287,7 +287,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
287
287
  FileUtils.mkdir_p('content')
288
288
  File.open('content/xyzzy.sass', 'w') { |io| io.write('p\n color: green') }
289
289
 
290
- items = [Nanoc::Item.new(
290
+ items = [Nanoc::Int::Item.new(
291
291
  'blah',
292
292
  { content_filename: 'content/xyzzy.sass' },
293
293
  '/blah/')]
@@ -86,10 +86,10 @@ EOS
86
86
  def test_filter_as_layout
87
87
  if_have 'nokogiri' do
88
88
  # Create our data objects
89
- item = Nanoc::Item.new(SAMPLE_XML_IN,
89
+ item = Nanoc::Int::Item.new(SAMPLE_XML_IN,
90
90
  {},
91
91
  '/content/')
92
- layout = Nanoc::Layout.new(SAMPLE_XSL,
92
+ layout = Nanoc::Int::Layout.new(SAMPLE_XSL,
93
93
  {},
94
94
  '/layout/')
95
95
 
@@ -110,10 +110,10 @@ EOS
110
110
  def test_filter_with_params
111
111
  if_have 'nokogiri' do
112
112
  # Create our data objects
113
- item = Nanoc::Item.new(SAMPLE_XML_IN_WITH_PARAMS,
113
+ item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_PARAMS,
114
114
  {},
115
115
  '/content/')
116
- layout = Nanoc::Layout.new(SAMPLE_XSL_WITH_PARAMS,
116
+ layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_PARAMS,
117
117
  {},
118
118
  '/layout/')
119
119
 
@@ -135,10 +135,10 @@ EOS
135
135
  def test_filter_with_omit_xml_decl
136
136
  if_have 'nokogiri' do
137
137
  # Create our data objects
138
- item = Nanoc::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL,
138
+ item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL,
139
139
  {},
140
140
  '/content/')
141
- layout = Nanoc::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL,
141
+ layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL,
142
142
  {},
143
143
  '/layout/')
144
144
 
@@ -110,7 +110,7 @@ EOS
110
110
 
111
111
  # Yield site
112
112
  FileUtils.cd(site_name) do
113
- yield Nanoc::Site.new('.')
113
+ yield Nanoc::Int::Site.new('.')
114
114
  end
115
115
  end
116
116
 
@@ -29,17 +29,17 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
29
29
  def test_articles
30
30
  # Create items
31
31
  @items = [
32
- Nanoc::Item.new(
32
+ Nanoc::Int::Item.new(
33
33
  'blah',
34
34
  { kind: 'item' },
35
35
  '/0/'
36
36
  ),
37
- Nanoc::Item.new(
37
+ Nanoc::Int::Item.new(
38
38
  'blah blah',
39
39
  { kind: 'article' },
40
40
  '/1/'
41
41
  ),
42
- Nanoc::Item.new(
42
+ Nanoc::Int::Item.new(
43
43
  'blah blah blah',
44
44
  { kind: 'article' },
45
45
  '/2/'
@@ -58,17 +58,17 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
58
58
  def test_sorted_articles
59
59
  # Create items
60
60
  @items = [
61
- Nanoc::Item.new(
61
+ Nanoc::Int::Item.new(
62
62
  'blah',
63
63
  { kind: 'item' },
64
64
  '/0/'
65
65
  ),
66
- Nanoc::Item.new(
66
+ Nanoc::Int::Item.new(
67
67
  'blah',
68
68
  { kind: 'article', created_at: (Date.today - 1).to_s },
69
69
  '/1/'
70
70
  ),
71
- Nanoc::Item.new(
71
+ Nanoc::Int::Item.new(
72
72
  'blah',
73
73
  { kind: 'article', created_at: (Time.now - 500).to_s },
74
74
  '/2/'
@@ -107,8 +107,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
107
107
  @items[2].expects(:compiled_content).with(snapshot: :pre).returns('item 2 content')
108
108
 
109
109
  # Mock site
110
- @site = mock
111
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
110
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
112
111
 
113
112
  # Create feed item
114
113
  @item = mock
@@ -139,8 +138,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
139
138
  @items[2].expects(:compiled_content).returns('item 2 content')
140
139
 
141
140
  # Mock site
142
- @site = mock
143
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
141
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
144
142
 
145
143
  # Create feed item
146
144
  @item = mock
@@ -161,8 +159,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
161
159
  @items = [mock_item, mock_item]
162
160
 
163
161
  # Mock site
164
- @site = mock
165
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
162
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
166
163
 
167
164
  # Create feed item
168
165
  @item = mock
@@ -171,7 +168,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
171
168
  @item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
172
169
 
173
170
  # Check
174
- error = assert_raises(Nanoc::Errors::GenericTrivial) do
171
+ error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
175
172
  atom_feed
176
173
  end
177
174
  assert_equal(
@@ -187,8 +184,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
187
184
  @items = [mock_item, mock_article]
188
185
 
189
186
  # Mock site
190
- @site = mock
191
- @site.stubs(:config).returns({ base_url: nil })
187
+ @config = Nanoc::ConfigView.new({ base_url: nil })
192
188
 
193
189
  # Create feed item
194
190
  @item = mock
@@ -197,7 +193,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
197
193
  @item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
198
194
 
199
195
  # Check
200
- error = assert_raises(Nanoc::Errors::GenericTrivial) do
196
+ error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
201
197
  atom_feed
202
198
  end
203
199
  assert_equal(
@@ -213,8 +209,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
213
209
  @items = [mock_item, mock_article]
214
210
 
215
211
  # Mock site
216
- @site = mock
217
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
212
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
218
213
 
219
214
  # Create feed item
220
215
  @item = mock
@@ -223,7 +218,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
223
218
  @item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
224
219
 
225
220
  # Check
226
- error = assert_raises(Nanoc::Errors::GenericTrivial) do
221
+ error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
227
222
  atom_feed
228
223
  end
229
224
  assert_equal(
@@ -239,8 +234,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
239
234
  @items = [mock_item, mock_article]
240
235
 
241
236
  # Mock site
242
- @site = mock
243
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
237
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
244
238
 
245
239
  # Create feed item
246
240
  @item = mock
@@ -249,7 +243,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
249
243
  @item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
250
244
 
251
245
  # Check
252
- error = assert_raises(Nanoc::Errors::GenericTrivial) do
246
+ error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
253
247
  atom_feed
254
248
  end
255
249
  assert_equal(
@@ -270,8 +264,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
270
264
  @items[0].expects(:compiled_content).returns('item 1 content')
271
265
 
272
266
  # Mock site
273
- @site = mock
274
- @site.stubs(:config).returns({ base_url: 'http://example.com/' })
267
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com/' })
275
268
 
276
269
  # Create feed item
277
270
  @item = mock
@@ -313,8 +306,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
313
306
  @items = [mock_item, mock_article]
314
307
 
315
308
  # Mock site
316
- @site = mock
317
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
309
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
318
310
 
319
311
  # Create feed item
320
312
  @item = mock
@@ -323,7 +315,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
323
315
  @item.stubs(:[]).with(:author_uri).returns(nil)
324
316
 
325
317
  # Check
326
- error = assert_raises(Nanoc::Errors::GenericTrivial) do
318
+ error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
327
319
  atom_feed
328
320
  end
329
321
  assert_equal(
@@ -341,8 +333,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
341
333
  @items[2].stubs(:[]).with(:created_at).returns(nil)
342
334
 
343
335
  # Mock site
344
- @site = mock
345
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
336
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
346
337
 
347
338
  # Create feed item
348
339
  @item = mock
@@ -351,7 +342,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
351
342
  @item.stubs(:[]).with(:author_uri).returns('http://example.com/~jdoe')
352
343
 
353
344
  # Check
354
- error = assert_raises(Nanoc::Errors::GenericTrivial) do
345
+ error = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
355
346
  atom_feed
356
347
  end
357
348
  assert_equal(
@@ -368,8 +359,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
368
359
  @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
369
360
 
370
361
  # Mock site
371
- @site = mock
372
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
362
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
373
363
 
374
364
  # Create feed item
375
365
  @item = mock
@@ -394,14 +384,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
394
384
  @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
395
385
 
396
386
  # Mock site
397
- @config = {
387
+ @config = Nanoc::ConfigView.new({
398
388
  author_name: 'Bob',
399
389
  author_uri: 'http://example.com/~bob/',
400
390
  title: 'My Blog Or Something',
401
391
  base_url: 'http://example.com'
402
- }
403
- @site = mock
404
- @site.stubs(:config).returns(@config)
392
+ })
405
393
 
406
394
  # Create feed item
407
395
  @item = mock
@@ -425,8 +413,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
425
413
  @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
426
414
 
427
415
  # Mock site
428
- @site = mock
429
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
416
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
430
417
 
431
418
  # Create feed item
432
419
  @item = mock
@@ -450,8 +437,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
450
437
  end
451
438
 
452
439
  # Mock site
453
- @site = mock
454
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
440
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
455
441
 
456
442
  # Create feed item
457
443
  @item = mock
@@ -484,8 +470,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
484
470
  @items[1].stubs(:[]).with(:created_at).returns('22-03-2009')
485
471
 
486
472
  # Mock site
487
- @site = mock
488
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
473
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
489
474
 
490
475
  # Create feed item
491
476
  @item = mock
@@ -514,8 +499,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
514
499
  @items[1].stubs(:[]).with(:created_at).returns('01-01-2014')
515
500
 
516
501
  # Mock site
517
- @site = mock
518
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
502
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
519
503
 
520
504
  # Create feed item
521
505
  @item = mock
@@ -539,8 +523,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
539
523
  @items = [mock_article]
540
524
 
541
525
  # Mock site
542
- @site = mock
543
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
526
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
544
527
 
545
528
  # Create feed item
546
529
  @item = mock
@@ -561,8 +544,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
561
544
  @items = [mock_article]
562
545
 
563
546
  # Mock site
564
- @site = mock
565
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
547
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
566
548
 
567
549
  # Create feed item
568
550
  @item = mock
@@ -583,8 +565,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
583
565
  @items = [mock_article]
584
566
 
585
567
  # Mock site
586
- @site = mock
587
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
568
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
588
569
 
589
570
  # Create feed item
590
571
  @item = mock
@@ -605,8 +586,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
605
586
  @items = [mock_article]
606
587
 
607
588
  # Mock site
608
- @site = mock
609
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
589
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
610
590
 
611
591
  # Create feed item
612
592
  @item = mock
@@ -628,8 +608,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
628
608
  @items[0].stubs(:path).returns(nil)
629
609
 
630
610
  # Mock site
631
- @site = mock
632
- @site.stubs(:config).returns({ base_url: 'http://example.com' })
611
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
633
612
 
634
613
  # Create feed item
635
614
  @item = mock
@@ -647,12 +626,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
647
626
 
648
627
  def test_url_for_without_custom_path_in_feed
649
628
  # Create site
650
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
629
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
651
630
 
652
631
  # Create article
653
- item = Nanoc::Item.new('content', {}, '/foo/')
654
- item.reps << Nanoc::ItemRep.new(item, :default)
655
- item.reps[0].path = '/foo/bar/'
632
+ item = Nanoc::Int::Item.new('content', {}, '/foo/')
633
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
634
+ item.reps[0].paths[:last] = '/foo/bar/'
656
635
 
657
636
  # Check
658
637
  assert_equal('http://example.com/foo/bar/', url_for(item))
@@ -663,12 +642,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
663
642
 
664
643
  def test_url_for_with_custom_path_in_feed
665
644
  # Create site
666
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
645
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
667
646
 
668
647
  # Create article
669
- item = Nanoc::Item.new(
648
+ item = Nanoc::Int::Item.new(
670
649
  'content', { custom_path_in_feed: '/meow/woof/' }, '/foo/')
671
- item.reps << Nanoc::ItemRep.new(item, :default)
650
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
672
651
 
673
652
  # Check
674
653
  assert_equal('http://example.com/meow/woof/', url_for(item))
@@ -679,12 +658,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
679
658
 
680
659
  def test_url_for_with_custom_url_in_feed
681
660
  # Create site
682
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
661
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
683
662
 
684
663
  # Create article
685
- item = Nanoc::Item.new(
664
+ item = Nanoc::Int::Item.new(
686
665
  'content', { custom_url_in_feed: 'http://example.org/x' }, '/foo/')
687
- item.reps << Nanoc::ItemRep.new(item, :default)
666
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
688
667
 
689
668
  # Check
690
669
  assert_equal('http://example.org/x', url_for(item))
@@ -695,22 +674,22 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
695
674
 
696
675
  def test_url_for_without_base_url
697
676
  # Create site
698
- @site = Nanoc::Site.new({})
677
+ @config = Nanoc::ConfigView.new({})
699
678
 
700
679
  # Check
701
- assert_raises(Nanoc::Errors::GenericTrivial) do
680
+ assert_raises(Nanoc::Int::Errors::GenericTrivial) do
702
681
  url_for(nil)
703
682
  end
704
683
  end
705
684
 
706
685
  def test_url_for_without_path
707
686
  # Create site
708
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
687
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
709
688
 
710
689
  # Create article
711
- item = Nanoc::Item.new('content', {}, '/foo/')
712
- item.reps << Nanoc::ItemRep.new(item, :default)
713
- item.reps[0].path = nil
690
+ item = Nanoc::Int::Item.new('content', {}, '/foo/')
691
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
692
+ item.reps[0].paths[:last] = nil
714
693
 
715
694
  # Check
716
695
  assert_equal(nil, url_for(item))
@@ -718,12 +697,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
718
697
 
719
698
  def test_feed_url_without_custom_feed_url
720
699
  # Create site
721
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
700
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
722
701
 
723
702
  # Create article
724
- @item = Nanoc::Item.new('content', {}, '/foo/')
725
- @item.reps << Nanoc::ItemRep.new(@item, :default)
726
- @item.reps[0].path = '/foo/bar/'
703
+ @item = Nanoc::Int::Item.new('content', {}, '/foo/')
704
+ @item.reps << Nanoc::Int::ItemRep.new(@item, :default)
705
+ @item.reps[0].paths[:last] = '/foo/bar/'
727
706
 
728
707
  # Check
729
708
  assert_equal('http://example.com/foo/bar/', feed_url)
@@ -734,12 +713,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
734
713
 
735
714
  def test_feed_url_with_custom_feed_url
736
715
  # Create site
737
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
716
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
738
717
 
739
718
  # Create feed item
740
- @item = Nanoc::Item.new('content', { feed_url: 'http://example.com/feed/' }, '/foo/')
741
- @item.reps << Nanoc::ItemRep.new(@item, :default)
742
- @item.reps[0].path = '/foo/bar/'
719
+ @item = Nanoc::Int::Item.new('content', { feed_url: 'http://example.com/feed/' }, '/foo/')
720
+ @item.reps << Nanoc::Int::ItemRep.new(@item, :default)
721
+ @item.reps[0].paths[:last] = '/foo/bar/'
743
722
 
744
723
  # Check
745
724
  assert_equal('http://example.com/feed/', feed_url)
@@ -750,22 +729,22 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
750
729
 
751
730
  def test_feed_url_without_base_url
752
731
  # Create site
753
- @site = Nanoc::Site.new({})
732
+ @config = Nanoc::ConfigView.new({})
754
733
 
755
734
  # Check
756
- assert_raises(Nanoc::Errors::GenericTrivial) do
735
+ assert_raises(Nanoc::Int::Errors::GenericTrivial) do
757
736
  feed_url
758
737
  end
759
738
  end
760
739
 
761
740
  def test_atom_tag_for_with_path
762
741
  # Create site
763
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
742
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
764
743
 
765
744
  # Create article
766
- item = Nanoc::Item.new('content', { created_at: '2008-05-19' }, '/foo/')
767
- item.reps << Nanoc::ItemRep.new(item, :default)
768
- item.reps[0].path = '/foo/bar/'
745
+ item = Nanoc::Int::Item.new('content', { created_at: '2008-05-19' }, '/foo/')
746
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
747
+ item.reps[0].paths[:last] = '/foo/bar/'
769
748
 
770
749
  # Check
771
750
  assert_equal('tag:example.com,2008-05-19:/foo/bar/', atom_tag_for(item))
@@ -773,11 +752,11 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
773
752
 
774
753
  def test_atom_tag_for_without_path
775
754
  # Create site
776
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
755
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
777
756
 
778
757
  # Create article
779
- item = Nanoc::Item.new('content', { created_at: '2008-05-19' }, '/baz/qux/')
780
- item.reps << Nanoc::ItemRep.new(item, :default)
758
+ item = Nanoc::Int::Item.new('content', { created_at: '2008-05-19' }, '/baz/qux/')
759
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
781
760
 
782
761
  # Check
783
762
  assert_equal('tag:example.com,2008-05-19:/baz/qux/', atom_tag_for(item))
@@ -785,12 +764,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
785
764
 
786
765
  def test_atom_tag_for_with_base_url_in_dir
787
766
  # Create site
788
- @site = Nanoc::Site.new({ base_url: 'http://example.com/somedir' })
767
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com/somedir' })
789
768
 
790
769
  # Create article
791
- item = Nanoc::Item.new('content', { created_at: '2008-05-19' }, '/foo/')
792
- item.reps << Nanoc::ItemRep.new(item, :default)
793
- item.reps[0].path = '/foo/bar/'
770
+ item = Nanoc::Int::Item.new('content', { created_at: '2008-05-19' }, '/foo/')
771
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
772
+ item.reps[0].paths[:last] = '/foo/bar/'
794
773
 
795
774
  # Check
796
775
  assert_equal('tag:example.com,2008-05-19:/somedir/foo/bar/', atom_tag_for(item))
@@ -798,12 +777,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
798
777
 
799
778
  def test_atom_tag_for_with_time
800
779
  # Create site
801
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
780
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
802
781
 
803
782
  # Create article
804
- item = Nanoc::Item.new('content', { created_at: Time.parse('2008-05-19') }, '/foo/')
805
- item.reps << Nanoc::ItemRep.new(item, :default)
806
- item.reps[0].path = '/foo/bar/'
783
+ item = Nanoc::Int::Item.new('content', { created_at: Time.parse('2008-05-19') }, '/foo/')
784
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
785
+ item.reps[0].paths[:last] = '/foo/bar/'
807
786
 
808
787
  # Check
809
788
  assert_equal('tag:example.com,2008-05-19:/foo/bar/', atom_tag_for(item))
@@ -811,12 +790,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
811
790
 
812
791
  def test_atom_tag_for_with_date
813
792
  # Create site
814
- @site = Nanoc::Site.new({ base_url: 'http://example.com' })
793
+ @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' })
815
794
 
816
795
  # Create article
817
- item = Nanoc::Item.new('content', { created_at: Date.parse('2008-05-19') }, '/foo/')
818
- item.reps << Nanoc::ItemRep.new(item, :default)
819
- item.reps[0].path = '/foo/bar/'
796
+ item = Nanoc::Int::Item.new('content', { created_at: Date.parse('2008-05-19') }, '/foo/')
797
+ item.reps << Nanoc::Int::ItemRep.new(item, :default)
798
+ item.reps[0].paths[:last] = '/foo/bar/'
820
799
 
821
800
  # Check
822
801
  assert_equal('tag:example.com,2008-05-19:/foo/bar/', atom_tag_for(item))