nanoc 3.6.1 → 3.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile.lock +4 -4
  3. data/LICENSE +1 -1
  4. data/NEWS.md +17 -0
  5. data/lib/nanoc.rb +1 -1
  6. data/lib/nanoc/base/result_data/item_rep.rb +20 -12
  7. data/lib/nanoc/base/source_data/item_array.rb +1 -1
  8. data/lib/nanoc/cli/commands/check.rb +1 -1
  9. data/lib/nanoc/cli/commands/deploy.rb +32 -23
  10. data/lib/nanoc/cli/commands/prune.rb +2 -2
  11. data/lib/nanoc/cli/commands/validate-css.rb +1 -0
  12. data/lib/nanoc/cli/commands/validate-html.rb +1 -0
  13. data/lib/nanoc/cli/commands/validate-links.rb +2 -0
  14. data/lib/nanoc/cli/commands/watch.rb +1 -1
  15. data/lib/nanoc/extra/checking/checks/external_links.rb +5 -2
  16. data/lib/nanoc/extra/checking/runner.rb +9 -4
  17. data/lib/nanoc/filters/rdoc.rb +9 -2
  18. data/lib/nanoc/helpers/breadcrumbs.rb +10 -15
  19. data/nanoc.gemspec +3 -2
  20. data/test/base/test_checksum_store.rb +1 -3
  21. data/test/base/test_code_snippet.rb +1 -3
  22. data/test/base/test_compiler.rb +24 -3
  23. data/test/base/test_compiler_dsl.rb +1 -3
  24. data/test/base/test_context.rb +1 -3
  25. data/test/base/test_data_source.rb +1 -3
  26. data/test/base/test_dependency_tracker.rb +1 -3
  27. data/test/base/test_directed_graph.rb +1 -3
  28. data/test/base/test_filter.rb +1 -3
  29. data/test/base/test_item.rb +1 -3
  30. data/test/base/test_item_array.rb +1 -3
  31. data/test/base/test_item_rep.rb +1 -3
  32. data/test/base/test_layout.rb +1 -3
  33. data/test/base/test_memoization.rb +1 -3
  34. data/test/base/test_notification_center.rb +1 -3
  35. data/test/base/test_outdatedness_checker.rb +1 -3
  36. data/test/base/test_plugin.rb +1 -3
  37. data/test/base/test_rule.rb +1 -3
  38. data/test/base/test_rule_context.rb +1 -3
  39. data/test/base/test_site.rb +1 -3
  40. data/test/cli/commands/test_check.rb +1 -3
  41. data/test/cli/commands/test_compile.rb +1 -3
  42. data/test/cli/commands/test_create_item.rb +1 -3
  43. data/test/cli/commands/test_create_layout.rb +1 -3
  44. data/test/cli/commands/test_create_site.rb +1 -3
  45. data/test/cli/commands/test_deploy.rb +45 -4
  46. data/test/cli/commands/test_help.rb +1 -3
  47. data/test/cli/commands/test_info.rb +1 -3
  48. data/test/cli/commands/test_prune.rb +1 -3
  49. data/test/cli/commands/test_sync.rb +1 -3
  50. data/test/cli/commands/test_update.rb +1 -3
  51. data/test/cli/commands/test_watch.rb +1 -3
  52. data/test/cli/test_cleaning_stream.rb +1 -3
  53. data/test/cli/test_cli.rb +1 -3
  54. data/test/cli/test_error_handler.rb +1 -3
  55. data/test/cli/test_logger.rb +1 -3
  56. data/test/data_sources/test_filesystem.rb +1 -3
  57. data/test/data_sources/test_filesystem_unified.rb +1 -3
  58. data/test/data_sources/test_filesystem_verbose.rb +1 -3
  59. data/test/data_sources/test_static.rb +1 -3
  60. data/test/extra/checking/checks/test_css.rb +1 -3
  61. data/test/extra/checking/checks/test_external_links.rb +20 -43
  62. data/test/extra/checking/checks/test_html.rb +1 -3
  63. data/test/extra/checking/checks/test_internal_links.rb +1 -3
  64. data/test/extra/checking/checks/test_stale.rb +1 -3
  65. data/test/extra/checking/test_check.rb +1 -3
  66. data/test/extra/checking/test_dsl.rb +1 -3
  67. data/test/extra/checking/test_runner.rb +1 -3
  68. data/test/extra/core_ext/test_enumerable.rb +1 -3
  69. data/test/extra/core_ext/test_pathname.rb +1 -3
  70. data/test/extra/core_ext/test_time.rb +1 -3
  71. data/test/extra/deployers/test_fog.rb +1 -3
  72. data/test/extra/deployers/test_rsync.rb +1 -3
  73. data/test/extra/test_auto_compiler.rb +1 -3
  74. data/test/extra/test_file_proxy.rb +1 -3
  75. data/test/extra/test_link_collector.rb +1 -3
  76. data/test/extra/test_vcs.rb +1 -3
  77. data/test/extra/validators/test_links.rb +1 -3
  78. data/test/extra/validators/test_w3c.rb +1 -3
  79. data/test/filters/test_asciidoc.rb +1 -3
  80. data/test/filters/test_bluecloth.rb +1 -3
  81. data/test/filters/test_coderay.rb +1 -3
  82. data/test/filters/test_coffeescript.rb +1 -3
  83. data/test/filters/test_colorize_syntax.rb +3 -16
  84. data/test/filters/test_erb.rb +1 -3
  85. data/test/filters/test_erubis.rb +1 -3
  86. data/test/filters/test_haml.rb +1 -3
  87. data/test/filters/test_handlebars.rb +1 -3
  88. data/test/filters/test_kramdown.rb +1 -3
  89. data/test/filters/test_less.rb +1 -3
  90. data/test/filters/test_markaby.rb +1 -3
  91. data/test/filters/test_maruku.rb +1 -3
  92. data/test/filters/test_mustache.rb +1 -3
  93. data/test/filters/test_pandoc.rb +1 -3
  94. data/test/filters/test_rainpress.rb +1 -3
  95. data/test/filters/test_rdiscount.rb +1 -3
  96. data/test/filters/test_rdoc.rb +6 -10
  97. data/test/filters/test_redcarpet.rb +1 -3
  98. data/test/filters/test_redcloth.rb +1 -3
  99. data/test/filters/test_relativize_paths.rb +2 -9
  100. data/test/filters/test_rubypants.rb +1 -3
  101. data/test/filters/test_sass.rb +1 -3
  102. data/test/filters/test_slim.rb +1 -3
  103. data/test/filters/test_typogruby.rb +1 -3
  104. data/test/filters/test_uglify_js.rb +1 -3
  105. data/test/filters/test_xsl.rb +1 -3
  106. data/test/filters/test_yui_compressor.rb +1 -3
  107. data/test/helper.rb +6 -0
  108. data/test/helpers/test_blogging.rb +1 -3
  109. data/test/helpers/test_breadcrumbs.rb +21 -59
  110. data/test/helpers/test_capturing.rb +1 -3
  111. data/test/helpers/test_filtering.rb +1 -3
  112. data/test/helpers/test_html_escape.rb +1 -3
  113. data/test/helpers/test_link_to.rb +1 -3
  114. data/test/helpers/test_rendering.rb +1 -3
  115. data/test/helpers/test_tagging.rb +1 -3
  116. data/test/helpers/test_text.rb +1 -3
  117. data/test/helpers/test_xml_sitemap.rb +1 -3
  118. data/test/tasks/test_clean.rb +1 -3
  119. data/test/test_gem.rb +1 -3
  120. metadata +7 -20
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CompilerTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CompilerTest < Nanoc::TestCase
6
4
 
7
5
  def test_compilation_rule_for
8
6
  # Mock rules
@@ -519,4 +517,27 @@ class Nanoc::CompilerTest < MiniTest::Unit::TestCase
519
517
  end
520
518
  end
521
519
 
520
+ def test_unfiltered_binary_item_should_not_be_moved_outside_content
521
+ with_site do
522
+ File.open('content/blah.dat', 'w') { |io| io.write('o hello') }
523
+
524
+ File.open('Rules', 'w') do |io|
525
+ io.write "compile '*' do\n"
526
+ io.write "end\n"
527
+ io.write "\n"
528
+ io.write "route '*' do\n"
529
+ io.write " item.identifier.chop + '.' + item[:extension]\n"
530
+ io.write "end\n"
531
+ io.write "\n"
532
+ io.write "layout '*', :erb\n"
533
+ end
534
+
535
+ site = Nanoc::Site.new('.')
536
+ site.compile
537
+
538
+ assert_equal Set.new(%w( content/blah.dat )), Set.new(Dir['content/*'])
539
+ assert_equal Set.new(%w( output/blah.dat )), Set.new(Dir['output/*'])
540
+ end
541
+ end
542
+
522
543
  end
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CompilerDSLTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CompilerDSLTest < Nanoc::TestCase
6
4
 
7
5
  def test_compile
8
6
  # TODO implement
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::ContextTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::ContextTest < Nanoc::TestCase
6
4
 
7
5
  def test_context_with_instance_variable
8
6
  # Create context
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::DataSourceTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::DataSourceTest < Nanoc::TestCase
6
4
 
7
5
  def test_loading
8
6
  # Create data source
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::DependencyTrackerTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::DependencyTrackerTest < Nanoc::TestCase
6
4
 
7
5
  def test_initialize
8
6
  # Mock items
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::DirectedGraphTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::DirectedGraphTest < Nanoc::TestCase
6
4
 
7
5
  def test_direct_predecessors
8
6
  graph = Nanoc::DirectedGraph.new([ 1, 2, 3 ])
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::FilterTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::FilterTest < Nanoc::TestCase
6
4
 
7
5
  def test_initialize
8
6
  # Create filter
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::ItemTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::ItemTest < Nanoc::TestCase
6
4
 
7
5
  def test_initialize_with_attributes_with_string_keys
8
6
  item = Nanoc::Item.new("foo", { 'abc' => 'xyz' }, '/foo/')
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::ItemArrayTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::ItemArrayTest < Nanoc::TestCase
6
4
 
7
5
  def setup
8
6
  super
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::ItemRepTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::ItemRepTest < Nanoc::TestCase
6
4
 
7
5
  def test_created_modified_compiled
8
6
  # TODO implement
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::LayoutTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::LayoutTest < Nanoc::TestCase
6
4
 
7
5
  def test_initialize
8
6
  # Make sure attributes are cleaned
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::MemoizationTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::MemoizationTest < Nanoc::TestCase
6
4
 
7
5
  class Sample1
8
6
 
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::NotificationCenterTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::NotificationCenterTest < Nanoc::TestCase
6
4
 
7
5
  def test_post
8
6
  # Set up notification
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::OutdatednessCheckerTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::OutdatednessCheckerTest < Nanoc::TestCase
6
4
 
7
5
  def test_not_outdated
8
6
  # Compile once
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::PluginTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::PluginTest < Nanoc::TestCase
6
4
 
7
5
  class SampleFilter < Nanoc::Filter
8
6
  identifier :_plugin_test_sample_filter
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::RuleTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::RuleTest < Nanoc::TestCase
6
4
 
7
5
  def test_initialize
8
6
  # TODO implement
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::RuleContextTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::RuleContextTest < Nanoc::TestCase
6
4
 
7
5
  def test_objects
8
6
  # Mock everything
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::SiteTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::SiteTest < Nanoc::TestCase
6
4
 
7
5
  def test_initialize_with_dir_without_config_yaml
8
6
  assert_raises(Nanoc::Errors::GenericTrivial) do
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::CheckTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::CheckTest < Nanoc::TestCase
6
4
 
7
5
  def test_check_stale
8
6
  with_site do |site|
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::CompileTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::CompileTest < Nanoc::TestCase
6
4
 
7
5
  def test_profiling_information
8
6
  with_site do |site|
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::CreateItemTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::CreateItemTest < Nanoc::TestCase
6
4
 
7
5
  def test_run
8
6
  with_site do |site|
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::CreateLayoutTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::CreateLayoutTest < Nanoc::TestCase
6
4
 
7
5
  def test_can_compile_new_layout
8
6
  require 'nanoc/cli'
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::CreateSiteTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::CreateSiteTest < Nanoc::TestCase
6
4
 
7
5
  def test_create_site_with_existing_name
8
6
  Nanoc::CLI.run %w( create_site foo )
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::DeployTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::DeployTest < Nanoc::TestCase
6
4
 
7
5
  def test_deploy
8
6
  if_have 'systemu' do
@@ -46,6 +44,24 @@ class Nanoc::CLI::Commands::DeployTest < MiniTest::Unit::TestCase
46
44
  end
47
45
  end
48
46
 
47
+ def test_deploy_with_list_without_config
48
+ if_have 'systemu' do
49
+ with_site do |site|
50
+ FileUtils.mkdir_p('output')
51
+ File.open('output/blah.html', 'w') { |io| io.write 'moo' }
52
+
53
+ ios = capturing_stdio do
54
+ Nanoc::CLI.run %w( deploy -L )
55
+ end
56
+
57
+ assert ios[:stdout].include?('No deployment configurations.')
58
+
59
+ refute File.directory?('mydestination')
60
+ refute File.file?('mydestination/blah.html')
61
+ end
62
+ end
63
+ end
64
+
49
65
  def test_deploy_with_list
50
66
  if_have 'systemu' do
51
67
  with_site do |site|
@@ -71,6 +87,31 @@ class Nanoc::CLI::Commands::DeployTest < MiniTest::Unit::TestCase
71
87
  end
72
88
  end
73
89
 
90
+ def test_deploy_with_list_deployers
91
+ if_have 'systemu' do
92
+ with_site do |site|
93
+ File.open('nanoc.yaml', 'w') do |io|
94
+ io.write "deploy:\n"
95
+ io.write " public:\n"
96
+ io.write " kind: rsync\n"
97
+ io.write " dst: mydestination"
98
+ end
99
+
100
+ FileUtils.mkdir_p('output')
101
+ File.open('output/blah.html', 'w') { |io| io.write 'moo' }
102
+
103
+ ios = capturing_stdio do
104
+ Nanoc::CLI.run %w( deploy -D )
105
+ end
106
+
107
+ assert ios[:stdout].include?('Available deployers:')
108
+
109
+ refute File.directory?('mydestination')
110
+ refute File.file?('mydestination/blah.html')
111
+ end
112
+ end
113
+ end
114
+
74
115
  def test_deploy_without_kind
75
116
  if_have 'systemu' do
76
117
  with_site do |site|
@@ -111,7 +152,7 @@ class Nanoc::CLI::Commands::DeployTest < MiniTest::Unit::TestCase
111
152
  err = assert_raises Nanoc::Errors::GenericTrivial do
112
153
  Nanoc::CLI.run %w( deploy )
113
154
  end
114
- assert_equal 'The site configuration has no deploy configuration for default.', err.message
155
+ assert_equal 'The site has no deployment configuration for default.', err.message
115
156
  end
116
157
  end
117
158
  end
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::HelpTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::HelpTest < Nanoc::TestCase
6
4
 
7
5
  def test_run
8
6
  Nanoc::CLI.run %w( help )
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::InfoTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::InfoTest < Nanoc::TestCase
6
4
 
7
5
  def test_run
8
6
  Nanoc::CLI.run %w( info )
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::PruneTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::PruneTest < Nanoc::TestCase
6
4
 
7
5
  def test_run_without_yes
8
6
  with_site do |site|
@@ -1,6 +1,4 @@
1
- class Nanoc::CLI::Commands::SyncTest < MiniTest::Unit::TestCase
2
-
3
- include Nanoc::TestHelpers
1
+ class Nanoc::CLI::Commands::SyncTest < Nanoc::TestCase
4
2
 
5
3
  def test_run
6
4
  with_site do
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::UpdateTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::UpdateTest < Nanoc::TestCase
6
4
 
7
5
  def test_stub
8
6
  end
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::Commands::WatchTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
6
4
 
7
5
  def test_run
8
6
  with_site do |s|
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::CleaningStreamTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
6
4
 
7
5
  class Stream
8
6
 
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLITest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLITest < Nanoc::TestCase
6
4
 
7
5
  COMMAND_CODE = <<EOS
8
6
  # encoding: utf-8
@@ -1,8 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- class Nanoc::CLI::ErrorHandlerTest < MiniTest::Unit::TestCase
4
-
5
- include Nanoc::TestHelpers
3
+ class Nanoc::CLI::ErrorHandlerTest < Nanoc::TestCase
6
4
 
7
5
  def setup
8
6
  super