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
@@ -1,16 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
- describe Nanoc::TempFilenameFactory do
3
+ describe Nanoc::Int::TempFilenameFactory do
4
4
  subject do
5
- Nanoc::TempFilenameFactory.instance
5
+ Nanoc::Int::TempFilenameFactory.new
6
6
  end
7
7
 
8
8
  let(:prefix) { 'foo' }
9
9
 
10
- before do
11
- subject.cleanup(prefix)
12
- end
13
-
14
10
  describe '#create' do
15
11
  it 'should create unique paths' do
16
12
  path_a = subject.create(prefix)
@@ -60,7 +56,7 @@ describe Nanoc::TempFilenameFactory do
60
56
 
61
57
  describe 'other instance' do
62
58
  let(:other_instance) do
63
- Nanoc::TempFilenameFactory.new
59
+ Nanoc::Int::TempFilenameFactory.new
64
60
  end
65
61
 
66
62
  it 'should create unique paths across instances' do
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::ChecksumStoreTest < Nanoc::TestCase
3
+ class Nanoc::Int::ChecksumStoreTest < Nanoc::TestCase
4
4
  def test_get_with_existing_object
5
5
  require 'pstore'
6
6
 
@@ -13,18 +13,18 @@ class Nanoc::ChecksumStoreTest < Nanoc::TestCase
13
13
  end
14
14
 
15
15
  # Check
16
- store = Nanoc::ChecksumStore.new
16
+ store = Nanoc::Int::ChecksumStore.new
17
17
  store.load
18
- obj = Nanoc::Item.new('Moo?', {}, '/moo/')
18
+ obj = Nanoc::Int::Item.new('Moo?', {}, '/moo/')
19
19
  assert_equal 'zomg', store[obj]
20
20
  end
21
21
 
22
22
  def test_get_with_nonexistant_object
23
- store = Nanoc::ChecksumStore.new
23
+ store = Nanoc::Int::ChecksumStore.new
24
24
  store.load
25
25
 
26
26
  # Check
27
- obj = Nanoc::Item.new('Moo?', {}, '/animals/cow/')
27
+ obj = Nanoc::Int::Item.new('Moo?', {}, '/animals/cow/')
28
28
  assert_equal nil, store[obj]
29
29
  end
30
30
  end
@@ -1,12 +1,12 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CodeSnippetTest < Nanoc::TestCase
3
+ class Nanoc::Int::CodeSnippetTest < Nanoc::TestCase
4
4
  def test_load
5
5
  # Initialize
6
6
  $complete_insane_parrot = 'meow'
7
7
 
8
8
  # Create code and load it
9
- code_snippet = Nanoc::CodeSnippet.new("$complete_insane_parrot = 'woof'", 'parrot.rb')
9
+ code_snippet = Nanoc::Int::CodeSnippet.new("$complete_insane_parrot = 'woof'", 'parrot.rb')
10
10
  code_snippet.load
11
11
 
12
12
  # Ensure code is loaded
@@ -18,7 +18,7 @@ class Nanoc::CodeSnippetTest < Nanoc::TestCase
18
18
  @foo = 'meow'
19
19
 
20
20
  # Create code and load it
21
- code_snippet = Nanoc::CodeSnippet.new("@foo = 'woof'", 'dog.rb')
21
+ code_snippet = Nanoc::Int::CodeSnippet.new("@foo = 'woof'", 'dog.rb')
22
22
  code_snippet.load
23
23
 
24
24
  # Ensure binding is correct
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CompilerTest < Nanoc::TestCase
3
+ class Nanoc::Int::CompilerTest < Nanoc::TestCase
4
4
  def test_compilation_rule_for
5
5
  # Mock rules
6
6
  rules = [mock, mock, mock]
@@ -11,7 +11,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
11
11
  rules[2].expects(:rep_name).returns('right')
12
12
 
13
13
  # Create compiler
14
- compiler = Nanoc::Compiler.new(nil)
14
+ compiler = Nanoc::Int::Compiler.new(nil)
15
15
  compiler.rules_collection.instance_eval { @item_compilation_rules = rules }
16
16
 
17
17
  # Mock rep
@@ -34,7 +34,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
34
34
  rules[2].expects(:rep_name).returns('right')
35
35
 
36
36
  # Create compiler
37
- compiler = Nanoc::Compiler.new(nil)
37
+ compiler = Nanoc::Int::Compiler.new(nil)
38
38
  compiler.rules_collection.instance_eval { @item_routing_rules = rules }
39
39
 
40
40
  # Mock rep
@@ -52,7 +52,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
52
52
  site = mock
53
53
 
54
54
  # Create compiler
55
- compiler = Nanoc::Compiler.new(site)
55
+ compiler = Nanoc::Int::Compiler.new(site)
56
56
  compiler.rules_collection.layout_filter_mapping[/.*/] = [:erb, { foo: 'bar' }]
57
57
 
58
58
  # Mock layout
@@ -68,7 +68,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
68
68
  site = mock
69
69
 
70
70
  # Create compiler
71
- compiler = Nanoc::Compiler.new(site)
71
+ compiler = Nanoc::Int::Compiler.new(site)
72
72
  compiler.rules_collection.layout_filter_mapping[/.*/] = [:some_unknown_filter, { foo: 'bar' }]
73
73
 
74
74
  # Mock layout
@@ -84,7 +84,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
84
84
  site = mock
85
85
 
86
86
  # Create compiler
87
- compiler = Nanoc::Compiler.new(site)
87
+ compiler = Nanoc::Int::Compiler.new(site)
88
88
  compiler.rules_collection.layout_filter_mapping[%r{^/foo/$}] = [:erb, { foo: 'bar' }]
89
89
 
90
90
  # Mock layout
@@ -100,7 +100,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
100
100
  site = mock
101
101
 
102
102
  # Create compiler
103
- compiler = Nanoc::Compiler.new(site)
103
+ compiler = Nanoc::Int::Compiler.new(site)
104
104
  compiler.rules_collection.layout_filter_mapping[%r{^/a/b/c/.*/$}] = [:erb, { char: 'd' }]
105
105
  compiler.rules_collection.layout_filter_mapping[%r{^/a/.*/$}] = [:erb, { char: 'b' }]
106
106
  compiler.rules_collection.layout_filter_mapping[%r{^/a/b/.*/$}] = [:erb, { char: 'c' }] # never used!
@@ -131,8 +131,8 @@ class Nanoc::CompilerTest < Nanoc::TestCase
131
131
 
132
132
  def test_compile_rep_should_write_proper_snapshots
133
133
  # Mock rep
134
- item = Nanoc::Item.new('<%= 1 %> <%%= 2 %> <%%%= 3 %>', {}, '/moo/')
135
- rep = Nanoc::ItemRep.new(item, :blah)
134
+ item = Nanoc::Int::Item.new('<%= 1 %> <%%= 2 %> <%%%= 3 %>', {}, '/moo/')
135
+ rep = Nanoc::Int::ItemRep.new(item, :blah)
136
136
 
137
137
  # Set snapshot filenames
138
138
  rep.raw_paths = {
@@ -149,10 +149,10 @@ class Nanoc::CompilerTest < Nanoc::TestCase
149
149
  layout '/blah/'
150
150
  filter :erb
151
151
  end
152
- rule = Nanoc::Rule.new(/blah/, :meh, rule_block)
152
+ rule = Nanoc::Int::Rule.new(/blah/, :meh, rule_block)
153
153
 
154
154
  # Create layout
155
- layout = Nanoc::Layout.new('head <%= yield %> foot', {}, '/blah/')
155
+ layout = Nanoc::Int::Layout.new('head <%= yield %> foot', {}, '/blah/')
156
156
 
157
157
  # Create site
158
158
  site = mock
@@ -161,7 +161,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
161
161
  site.stubs(:layouts).returns([layout])
162
162
 
163
163
  # Create compiler
164
- compiler = Nanoc::Compiler.new(site)
164
+ compiler = Nanoc::Int::Compiler.new(site)
165
165
  compiler.rules_collection.expects(:compilation_rule_for).times(2).with(rep).returns(rule)
166
166
  compiler.rules_collection.layout_filter_mapping[%r{^/blah/$}] = [:erb, {}]
167
167
  site.stubs(:compiler).returns(compiler)
@@ -243,7 +243,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
243
243
  io.write('<%= @items.find { |i| i.identifier == "/foo/" }.compiled_content %>')
244
244
  end
245
245
 
246
- assert_raises Nanoc::Errors::RecursiveCompilation do
246
+ assert_raises Nanoc::Int::Errors::RecursiveCompilation do
247
247
  site.compile
248
248
  end
249
249
  end
@@ -268,7 +268,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
268
268
  end
269
269
 
270
270
  # Create site
271
- site = Nanoc::Site.new('.')
271
+ site = Nanoc::Int::Site.new('.')
272
272
  error = assert_raises(RuntimeError) do
273
273
  site.compile
274
274
  end
@@ -281,9 +281,9 @@ class Nanoc::CompilerTest < Nanoc::TestCase
281
281
  Nanoc::CLI.run %w( create_site bar)
282
282
 
283
283
  FileUtils.cd('bar') do
284
- site = Nanoc::Site.new('.')
284
+ site = Nanoc::Int::Site.new('.')
285
285
 
286
- compiler = Nanoc::Compiler.new(site)
286
+ compiler = Nanoc::Int::Compiler.new(site)
287
287
  def compiler.route_reps
288
288
  raise 'oh my gosh it is borken'
289
289
  end
@@ -301,7 +301,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
301
301
  FileUtils.cd('bar') do
302
302
  Nanoc::CLI.run %w( compile )
303
303
 
304
- site = Nanoc::Site.new('.')
304
+ site = Nanoc::Int::Site.new('.')
305
305
  site.compile
306
306
 
307
307
  # At this point, even the already compiled items in the previous pass
@@ -330,8 +330,8 @@ class Nanoc::CompilerTest < Nanoc::TestCase
330
330
  end
331
331
 
332
332
  # Compile
333
- site = Nanoc::Site.new('.')
334
- assert_raises Nanoc::Errors::CannotCreateMultipleSnapshotsWithSameName do
333
+ site = Nanoc::Int::Site.new('.')
334
+ assert_raises Nanoc::Int::Errors::CannotCreateMultipleSnapshotsWithSameName do
335
335
  site.compile
336
336
  end
337
337
  end
@@ -360,7 +360,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
360
360
  end
361
361
 
362
362
  # Compile
363
- site = Nanoc::Site.new('.')
363
+ site = Nanoc::Int::Site.new('.')
364
364
  site.compile
365
365
 
366
366
  # Check
@@ -393,7 +393,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
393
393
  end
394
394
 
395
395
  # Compile
396
- site = Nanoc::Site.new('.')
396
+ site = Nanoc::Int::Site.new('.')
397
397
  site.compile
398
398
 
399
399
  # Check
@@ -423,7 +423,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
423
423
  end
424
424
 
425
425
  # Compile
426
- site = Nanoc::Site.new('.')
426
+ site = Nanoc::Int::Site.new('.')
427
427
  site.compile
428
428
 
429
429
  # Check
@@ -456,7 +456,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
456
456
  end
457
457
 
458
458
  # Compile
459
- site = Nanoc::Site.new('.')
459
+ site = Nanoc::Int::Site.new('.')
460
460
  site.compile
461
461
 
462
462
  # Check
@@ -477,7 +477,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
477
477
  end
478
478
 
479
479
  # Compile
480
- site = Nanoc::Site.new('.')
480
+ site = Nanoc::Int::Site.new('.')
481
481
  site.compile
482
482
 
483
483
  # Check
@@ -508,7 +508,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
508
508
  end
509
509
 
510
510
  # Compile
511
- site = Nanoc::Site.new('.')
511
+ site = Nanoc::Int::Site.new('.')
512
512
  site.compile
513
513
 
514
514
  # Check
@@ -531,7 +531,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
531
531
  io.write "layout '*', :erb\n"
532
532
  end
533
533
 
534
- site = Nanoc::Site.new('.')
534
+ site = Nanoc::Int::Site.new('.')
535
535
  site.compile
536
536
 
537
537
  assert_equal Set.new(%w( content/blah.dat )), Set.new(Dir['content/*'])
@@ -547,7 +547,7 @@ class Nanoc::CompilerTest < Nanoc::TestCase
547
547
  end
548
548
 
549
549
  # Compile
550
- site = Nanoc::Site.new('.')
550
+ site = Nanoc::Int::Site.new('.')
551
551
  site.compile
552
552
 
553
553
  # Check
@@ -575,11 +575,11 @@ class Nanoc::CompilerTest < Nanoc::TestCase
575
575
  io.write "layout '*', :erb\n"
576
576
  end
577
577
 
578
- site = Nanoc::Site.new('.')
578
+ site = Nanoc::Int::Site.new('.')
579
579
  rep = site.items['/a/'].reps[0]
580
580
  dt = site.compiler.dependency_tracker
581
581
  dt.start
582
- assert_raises Nanoc::Errors::UnmetDependency do
582
+ assert_raises Nanoc::Int::Errors::UnmetDependency do
583
583
  site.compiler.send :compile_rep, rep
584
584
  end
585
585
  dt.stop
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CompilerDSLTest < Nanoc::TestCase
3
+ class Nanoc::Int::CompilerDSLTest < Nanoc::TestCase
4
4
  def test_compile
5
5
  # TODO: implement
6
6
  end
@@ -14,8 +14,8 @@ class Nanoc::CompilerDSLTest < Nanoc::TestCase
14
14
  end
15
15
 
16
16
  def test_preprocess_twice
17
- rules_collection = Nanoc::RulesCollection.new(nil)
18
- compiler_dsl = Nanoc::CompilerDSL.new(rules_collection, {})
17
+ rules_collection = Nanoc::Int::RulesCollection.new(nil)
18
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(rules_collection, {})
19
19
 
20
20
  # first time
21
21
  io = capturing_stdio do
@@ -37,13 +37,13 @@ class Nanoc::CompilerDSLTest < Nanoc::TestCase
37
37
  Nanoc::CLI.run %w( create_site per-rules-file-preprocessor )
38
38
  FileUtils.cd('per-rules-file-preprocessor') do
39
39
  # Create rep
40
- item = Nanoc::Item.new('foo', { extension: 'bar' }, '/foo/')
40
+ item = Nanoc::Int::Item.new('foo', { extension: 'bar' }, '/foo/')
41
41
 
42
42
  # Create a bonus rules file
43
43
  File.open('more_rules.rb', 'w') { |io| io.write "preprocess { @items['/foo/'][:preprocessed] = true }" }
44
44
 
45
45
  # Create other necessary stuff
46
- site = Nanoc::Site.new('.')
46
+ site = Nanoc::Int::Site.new('.')
47
47
  site.items << item
48
48
  dsl = site.compiler.rules_collection.dsl
49
49
  io = capturing_stdio do
@@ -71,14 +71,14 @@ class Nanoc::CompilerDSLTest < Nanoc::TestCase
71
71
  Nanoc::CLI.run %w( create_site with_bonus_rules )
72
72
  FileUtils.cd('with_bonus_rules') do
73
73
  # Create rep
74
- item = Nanoc::Item.new('foo', { extension: 'bar' }, '/foo/')
75
- rep = Nanoc::ItemRep.new(item, :default)
74
+ item = Nanoc::Int::Item.new('foo', { extension: 'bar' }, '/foo/')
75
+ rep = Nanoc::Int::ItemRep.new(item, :default)
76
76
 
77
77
  # Create a bonus rules file
78
78
  File.open('more_rules.rb', 'w') { |io| io.write "passthrough '/foo/'" }
79
79
 
80
80
  # Create other necessary stuff
81
- site = Nanoc::Site.new('.')
81
+ site = Nanoc::Int::Site.new('.')
82
82
  site.items << item
83
83
  dsl = site.compiler.rules_collection.dsl
84
84
 
@@ -109,7 +109,7 @@ EOS
109
109
  end
110
110
 
111
111
  # Compile
112
- site = Nanoc::Site.new('.')
112
+ site = Nanoc::Int::Site.new('.')
113
113
  site.compile
114
114
 
115
115
  # Check paths
@@ -133,7 +133,7 @@ EOS
133
133
  end
134
134
 
135
135
  # Compile
136
- site = Nanoc::Site.new('.')
136
+ site = Nanoc::Int::Site.new('.')
137
137
  site.compile
138
138
 
139
139
  # Check paths
@@ -163,7 +163,7 @@ EOS
163
163
  end
164
164
 
165
165
  # Compile
166
- site = Nanoc::Site.new('.')
166
+ site = Nanoc::Int::Site.new('.')
167
167
  site.compile
168
168
 
169
169
  # Check paths
@@ -195,7 +195,7 @@ EOS
195
195
  end
196
196
 
197
197
  # Compile
198
- site = Nanoc::Site.new('.')
198
+ site = Nanoc::Int::Site.new('.')
199
199
  site.compile
200
200
 
201
201
  # Check paths
@@ -226,7 +226,7 @@ EOS
226
226
  end
227
227
 
228
228
  # Compile
229
- site = Nanoc::Site.new('.')
229
+ site = Nanoc::Int::Site.new('.')
230
230
  site.compile
231
231
 
232
232
  # Check paths
@@ -258,7 +258,7 @@ EOS
258
258
  end
259
259
 
260
260
  # Compile
261
- site = Nanoc::Site.new('.')
261
+ site = Nanoc::Int::Site.new('.')
262
262
  site.compile
263
263
 
264
264
  # Check paths
@@ -269,7 +269,7 @@ EOS
269
269
 
270
270
  def test_identifier_to_regex_without_wildcards
271
271
  # Create compiler DSL
272
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
272
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
273
273
 
274
274
  actual = compiler_dsl.instance_eval { identifier_to_regex('foo') }
275
275
  expected = %r{^/foo/$}
@@ -283,7 +283,7 @@ EOS
283
283
 
284
284
  def test_identifier_to_regex_with_one_wildcard
285
285
  # Create compiler DSL
286
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
286
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
287
287
 
288
288
  actual = compiler_dsl.instance_eval { identifier_to_regex('foo/*/bar') }
289
289
  expected = %r{^/foo/(.*?)/bar/$}
@@ -297,7 +297,7 @@ EOS
297
297
 
298
298
  def test_identifier_to_regex_with_two_wildcards
299
299
  # Create compiler DSL
300
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
300
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
301
301
 
302
302
  actual = compiler_dsl.instance_eval { identifier_to_regex('foo/*/bar/*/qux') }
303
303
  expected = %r{^/foo/(.*?)/bar/(.*?)/qux/$}
@@ -311,7 +311,7 @@ EOS
311
311
 
312
312
  def test_identifier_to_regex_with_just_one_wildcard
313
313
  # Create compiler DSL
314
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
314
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
315
315
 
316
316
  actual = compiler_dsl.instance_eval { identifier_to_regex('*') }
317
317
  expected = %r{^/(.*?)$}
@@ -325,7 +325,7 @@ EOS
325
325
 
326
326
  def test_identifier_to_regex_with_root
327
327
  # Create compiler DSL
328
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
328
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
329
329
 
330
330
  actual = compiler_dsl.instance_eval { identifier_to_regex('/') }
331
331
  expected = %r{^/$}
@@ -339,7 +339,7 @@ EOS
339
339
 
340
340
  def test_identifier_to_regex_with_only_children
341
341
  # Create compiler DSL
342
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
342
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
343
343
 
344
344
  actual = compiler_dsl.instance_eval { identifier_to_regex('/foo/*/') }
345
345
  expected = %r{^/foo/(.*?)/$}
@@ -353,7 +353,7 @@ EOS
353
353
 
354
354
  def test_identifier_to_regex_with_plus_wildcard
355
355
  # Create compiler DSL
356
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
356
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
357
357
 
358
358
  actual = compiler_dsl.instance_eval { identifier_to_regex('/foo/+') }
359
359
  expected = %r{^/foo/(.+?)/$}
@@ -368,7 +368,7 @@ EOS
368
368
  end
369
369
 
370
370
  def test_dsl_has_no_access_to_compiler
371
- compiler_dsl = Nanoc::CompilerDSL.new(nil, {})
371
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
372
372
  assert_raises(NameError) do
373
373
  compiler_dsl.instance_eval { compiler }
374
374
  end
@@ -376,7 +376,7 @@ EOS
376
376
 
377
377
  def test_config
378
378
  $venetian = 'unsnares'
379
- compiler_dsl = Nanoc::CompilerDSL.new(nil, { venetian: 'snares' })
379
+ compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { venetian: 'snares' })
380
380
  compiler_dsl.instance_eval { $venetian = @config[:venetian] }
381
381
  assert_equal 'snares', $venetian
382
382
  end