nanoc 3.8.0 → 4.0.0a1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +322 -0
- data/NEWS.md +6 -0
- data/bin/nanoc +0 -18
- data/lib/nanoc.rb +5 -3
- data/lib/nanoc/base.rb +24 -6
- data/lib/nanoc/base/checksummer.rb +6 -4
- data/lib/nanoc/base/compilation/checksum_store.rb +4 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +5 -5
- data/lib/nanoc/base/compilation/compiler.rb +60 -65
- data/lib/nanoc/base/compilation/compiler_dsl.rb +11 -9
- data/lib/nanoc/base/compilation/dependency_tracker.rb +24 -38
- data/lib/nanoc/base/compilation/filter.rb +22 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +14 -12
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -8
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +32 -32
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +3 -1
- data/lib/nanoc/base/compilation/rule.rb +9 -7
- data/lib/nanoc/base/compilation/rule_context.rb +15 -15
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
- data/lib/nanoc/base/compilation/rule_memory_store.rb +7 -7
- data/lib/nanoc/base/compilation/rules_collection.rb +28 -30
- data/lib/nanoc/base/context.rb +2 -2
- data/lib/nanoc/base/core_ext/array.rb +17 -25
- data/lib/nanoc/base/core_ext/hash.rb +17 -25
- data/lib/nanoc/base/core_ext/pathname.rb +4 -2
- data/lib/nanoc/base/core_ext/string.rb +5 -3
- data/lib/nanoc/base/directed_graph.rb +4 -9
- data/lib/nanoc/base/error.rb +7 -0
- data/lib/nanoc/base/errors.rb +16 -23
- data/lib/nanoc/base/memoization.rb +4 -2
- data/lib/nanoc/base/notification_center.rb +3 -1
- data/lib/nanoc/base/plugin_registry.rb +14 -21
- data/lib/nanoc/base/result_data/item_rep.rb +43 -88
- data/lib/nanoc/base/source_data/code_snippet.rb +6 -4
- data/lib/nanoc/base/source_data/configuration.rb +3 -1
- data/lib/nanoc/base/source_data/data_source.rb +12 -94
- data/lib/nanoc/base/source_data/identifier.rb +50 -0
- data/lib/nanoc/base/source_data/item.rb +24 -67
- data/lib/nanoc/base/source_data/item_array.rb +6 -4
- data/lib/nanoc/base/source_data/layout.rb +17 -28
- data/lib/nanoc/base/source_data/site.rb +33 -44
- data/lib/nanoc/base/store.rb +3 -5
- data/lib/nanoc/base/temp_filename_factory.rb +3 -2
- data/lib/nanoc/base/views/config.rb +19 -0
- data/lib/nanoc/base/views/item.rb +77 -0
- data/lib/nanoc/base/views/item_collection.rb +43 -0
- data/lib/nanoc/base/views/item_rep.rb +125 -0
- data/lib/nanoc/base/views/layout.rb +42 -0
- data/lib/nanoc/base/views/layout_collection.rb +26 -0
- data/lib/nanoc/base/views/mutable_config.rb +9 -0
- data/lib/nanoc/base/views/mutable_item.rb +9 -0
- data/lib/nanoc/base/views/mutable_item_collection.rb +18 -0
- data/lib/nanoc/base/views/mutable_layout.rb +9 -0
- data/lib/nanoc/base/views/mutable_layout_collection.rb +18 -0
- data/lib/nanoc/base/views/site.rb +35 -0
- data/lib/nanoc/cli.rb +3 -6
- data/lib/nanoc/cli/ansi_string_colorizer.rb +2 -0
- data/lib/nanoc/cli/cleaning_stream.rb +2 -0
- data/lib/nanoc/cli/command_runner.rb +8 -42
- data/lib/nanoc/cli/commands/check.rb +2 -2
- data/lib/nanoc/cli/commands/compile.rb +19 -34
- data/lib/nanoc/cli/commands/create-site.rb +46 -83
- data/lib/nanoc/cli/commands/deploy.rb +4 -4
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/commands/show-plugins.rb +4 -6
- data/lib/nanoc/cli/error_handler.rb +4 -14
- data/lib/nanoc/cli/logger.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners.rb +1 -0
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -0
- data/lib/nanoc/data_sources.rb +1 -17
- data/lib/nanoc/data_sources/filesystem.rb +6 -37
- data/lib/nanoc/data_sources/filesystem_unified.rb +5 -3
- data/lib/nanoc/data_sources/filesystem_verbose.rb +5 -3
- data/lib/nanoc/data_sources/static.rb +4 -2
- data/lib/nanoc/extra.rb +1 -13
- data/lib/nanoc/extra/checking.rb +1 -0
- data/lib/nanoc/extra/checking/check.rb +4 -2
- data/lib/nanoc/extra/checking/checks.rb +1 -0
- data/lib/nanoc/extra/checking/checks/css.rb +1 -0
- data/lib/nanoc/extra/checking/checks/external_links.rb +2 -0
- data/lib/nanoc/extra/checking/checks/html.rb +1 -0
- data/lib/nanoc/extra/checking/checks/internal_links.rb +2 -0
- data/lib/nanoc/extra/checking/checks/mixed_content.rb +2 -0
- data/lib/nanoc/extra/checking/checks/stale.rb +1 -0
- data/lib/nanoc/extra/checking/dsl.rb +1 -0
- data/lib/nanoc/extra/checking/issue.rb +1 -0
- data/lib/nanoc/extra/checking/runner.rb +3 -3
- data/lib/nanoc/extra/core_ext/pathname.rb +5 -3
- data/lib/nanoc/extra/core_ext/time.rb +4 -2
- data/lib/nanoc/extra/deployer.rb +3 -1
- data/lib/nanoc/extra/deployers.rb +1 -0
- data/lib/nanoc/extra/deployers/fog.rb +2 -0
- data/lib/nanoc/extra/deployers/rsync.rb +2 -0
- data/lib/nanoc/extra/filesystem_tools.rb +3 -7
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -0
- data/lib/nanoc/extra/link_collector.rb +1 -0
- data/lib/nanoc/extra/piper.rb +2 -1
- data/lib/nanoc/extra/pruner.rb +5 -3
- data/lib/nanoc/filters.rb +1 -2
- data/lib/nanoc/filters/asciidoc.rb +2 -0
- data/lib/nanoc/filters/bluecloth.rb +1 -0
- data/lib/nanoc/filters/coffeescript.rb +2 -0
- data/lib/nanoc/filters/colorize_syntax.rb +1 -12
- data/lib/nanoc/filters/erb.rb +2 -1
- data/lib/nanoc/filters/erubis.rb +2 -1
- data/lib/nanoc/filters/haml.rb +2 -1
- data/lib/nanoc/filters/handlebars.rb +2 -0
- data/lib/nanoc/filters/kramdown.rb +1 -0
- data/lib/nanoc/filters/less.rb +1 -0
- data/lib/nanoc/filters/markaby.rb +1 -0
- data/lib/nanoc/filters/maruku.rb +1 -0
- data/lib/nanoc/filters/mustache.rb +2 -0
- data/lib/nanoc/filters/pandoc.rb +1 -0
- data/lib/nanoc/filters/rainpress.rb +1 -0
- data/lib/nanoc/filters/rdiscount.rb +1 -0
- data/lib/nanoc/filters/rdoc.rb +1 -0
- data/lib/nanoc/filters/redcarpet.rb +2 -0
- data/lib/nanoc/filters/redcloth.rb +1 -0
- data/lib/nanoc/filters/relativize_paths.rb +1 -0
- data/lib/nanoc/filters/rubypants.rb +1 -0
- data/lib/nanoc/filters/sass.rb +1 -0
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +2 -0
- data/lib/nanoc/filters/slim.rb +3 -1
- data/lib/nanoc/filters/typogruby.rb +2 -0
- data/lib/nanoc/filters/uglify_js.rb +1 -0
- data/lib/nanoc/filters/xsl.rb +2 -0
- data/lib/nanoc/filters/yui_compressor.rb +2 -0
- data/lib/nanoc/helpers/blogging.rb +30 -30
- data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
- data/lib/nanoc/helpers/capturing.rb +6 -17
- data/lib/nanoc/helpers/filtering.rb +3 -3
- data/lib/nanoc/helpers/link_to.rb +3 -3
- data/lib/nanoc/helpers/rendering.rb +11 -11
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -3
- data/lib/nanoc/tasks.rb +1 -0
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/tasks/doc.rake +2 -1
- data/tasks/test.rake +7 -1
- data/test/base/checksummer_spec.rb +15 -15
- data/test/base/core_ext/array_spec.rb +10 -10
- data/test/base/core_ext/hash_spec.rb +16 -16
- data/test/base/core_ext/pathname_spec.rb +2 -2
- data/test/base/core_ext/string_spec.rb +9 -9
- data/test/base/temp_filename_factory_spec.rb +3 -7
- data/test/base/test_checksum_store.rb +5 -5
- data/test/base/test_code_snippet.rb +3 -3
- data/test/base/test_compiler.rb +29 -29
- data/test/base/test_compiler_dsl.rb +23 -23
- data/test/base/test_context.rb +4 -4
- data/test/base/test_data_source.rb +17 -7
- data/test/base/test_dependency_tracker.rb +29 -29
- data/test/base/test_directed_graph.rb +27 -27
- data/test/base/test_item.rb +23 -21
- data/test/base/test_item_array.rb +18 -18
- data/test/base/test_item_rep.rb +76 -76
- data/test/base/test_item_rep_recorder_proxy.rb +4 -4
- data/test/base/test_layout.rb +8 -16
- data/test/base/test_memoization.rb +4 -4
- data/test/base/test_notification_center.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +18 -18
- data/test/base/test_plugin.rb +1 -1
- data/test/base/test_rule.rb +2 -2
- data/test/base/test_rule_context.rb +5 -5
- data/test/base/test_site.rb +62 -38
- data/test/base/test_store.rb +2 -2
- data/test/cli/commands/test_check.rb +1 -1
- data/test/cli/commands/test_compile.rb +24 -18
- data/test/cli/commands/test_create_site.rb +5 -7
- data/test/cli/commands/test_deploy.rb +1 -1
- data/test/data_sources/test_filesystem.rb +22 -67
- data/test/data_sources/test_filesystem_unified.rb +10 -23
- data/test/data_sources/test_filesystem_verbose.rb +8 -53
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +1 -1
- data/test/extra/core_ext/test_pathname.rb +3 -3
- data/test/extra/core_ext/test_time.rb +4 -4
- data/test/extra/test_filesystem_tools.rb +1 -1
- data/test/filters/test_handlebars.rb +3 -3
- data/test/filters/test_less.rb +6 -6
- data/test/filters/test_mustache.rb +2 -2
- data/test/filters/test_relativize_paths.rb +81 -81
- data/test/filters/test_sass.rb +7 -7
- data/test/filters/test_xsl.rb +6 -6
- data/test/helper.rb +1 -1
- data/test/helpers/test_blogging.rb +78 -99
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +10 -11
- data/test/helpers/test_filtering.rb +6 -6
- data/test/helpers/test_rendering.rb +3 -3
- data/test/helpers/test_tagging.rb +7 -7
- data/test/helpers/test_xml_sitemap.rb +34 -33
- metadata +19 -43
- data/lib/nanoc/cli/commands/autocompile.rb +0 -69
- data/lib/nanoc/cli/commands/create-item.rb +0 -55
- data/lib/nanoc/cli/commands/create-layout.rb +0 -68
- data/lib/nanoc/cli/commands/sync.rb +0 -32
- data/lib/nanoc/cli/commands/update.rb +0 -63
- data/lib/nanoc/cli/commands/validate-css.rb +0 -20
- data/lib/nanoc/cli/commands/validate-html.rb +0 -20
- data/lib/nanoc/cli/commands/validate-links.rb +0 -27
- data/lib/nanoc/cli/commands/watch.rb +0 -176
- data/lib/nanoc/data_sources/deprecated/delicious.rb +0 -38
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +0 -85
- data/lib/nanoc/data_sources/deprecated/twitter.rb +0 -34
- data/lib/nanoc/extra/auto_compiler.rb +0 -99
- data/lib/nanoc/extra/chick.rb +0 -117
- data/lib/nanoc/extra/file_proxy.rb +0 -36
- data/lib/nanoc/extra/validators.rb +0 -8
- data/lib/nanoc/extra/validators/links.rb +0 -18
- data/lib/nanoc/extra/validators/w3c.rb +0 -23
- data/lib/nanoc/extra/vcs.rb +0 -62
- data/lib/nanoc/extra/vcses.rb +0 -15
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -21
- data/lib/nanoc/extra/vcses/dummy.rb +0 -20
- data/lib/nanoc/extra/vcses/git.rb +0 -21
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -21
- data/lib/nanoc/extra/vcses/subversion.rb +0 -21
- data/lib/nanoc/filters/coderay.rb +0 -19
- data/lib/nanoc3.rb +0 -3
- data/lib/nanoc3/cli.rb +0 -3
- data/lib/nanoc3/tasks.rb +0 -3
- data/test/cli/commands/test_create_item.rb +0 -10
- data/test/cli/commands/test_create_layout.rb +0 -24
- data/test/cli/commands/test_sync.rb +0 -27
- data/test/cli/commands/test_update.rb +0 -6
- data/test/cli/commands/test_watch.rb +0 -74
- data/test/extra/test_auto_compiler.rb +0 -437
- data/test/extra/test_vcs.rb +0 -18
- data/test/extra/validators/test_links.rb +0 -4
- data/test/extra/validators/test_w3c.rb +0 -37
- data/test/filters/test_coderay.rb +0 -40
@@ -14,7 +14,7 @@ module Nanoc::Helpers
|
|
14
14
|
#
|
15
15
|
# @param [String] text The visible link text
|
16
16
|
#
|
17
|
-
# @param [String, Nanoc::Item, Nanoc::ItemRep] target The path/URL,
|
17
|
+
# @param [String, Nanoc::Int::Item, Nanoc::Int::ItemRep] target The path/URL,
|
18
18
|
# item or item representation that should be linked to
|
19
19
|
#
|
20
20
|
# @param [Hash] attributes A hash containing HTML attributes (e.g.
|
@@ -68,7 +68,7 @@ module Nanoc::Helpers
|
|
68
68
|
#
|
69
69
|
# @param [String] text The visible link text
|
70
70
|
#
|
71
|
-
# @param [String, Nanoc::Item, Nanoc::ItemRep] target The path/URL,
|
71
|
+
# @param [String, Nanoc::Int::Item, Nanoc::Int::ItemRep] target The path/URL,
|
72
72
|
# item or item representation that should be linked to
|
73
73
|
#
|
74
74
|
# @param [Hash] attributes A hash containing HTML attributes (e.g.
|
@@ -100,7 +100,7 @@ module Nanoc::Helpers
|
|
100
100
|
# Returns the relative path from the current item to the given path or
|
101
101
|
# item representation. The returned path will not be HTML-escaped.
|
102
102
|
#
|
103
|
-
# @param [String, Nanoc::Item, Nanoc::ItemRep] target The path/URL,
|
103
|
+
# @param [String, Nanoc::Int::Item, Nanoc::Int::ItemRep] target The path/URL,
|
104
104
|
# item or item representation to which the relative path should be
|
105
105
|
# generated
|
106
106
|
#
|
@@ -64,25 +64,25 @@ module Nanoc::Helpers
|
|
64
64
|
# I'm boxy! Luvz!
|
65
65
|
# </div>
|
66
66
|
#
|
67
|
-
# @raise [Nanoc::Errors::UnknownLayout] if the given layout does not
|
67
|
+
# @raise [Nanoc::Int::Errors::UnknownLayout] if the given layout does not
|
68
68
|
# exist
|
69
69
|
#
|
70
|
-
# @raise [Nanoc::Errors::CannotDetermineFilter] if there is no layout
|
70
|
+
# @raise [Nanoc::Int::Errors::CannotDetermineFilter] if there is no layout
|
71
71
|
# rule for the given layout
|
72
72
|
#
|
73
|
-
# @raise [Nanoc::Errors::UnknownFilter] if the layout rule for the given
|
73
|
+
# @raise [Nanoc::Int::Errors::UnknownFilter] if the layout rule for the given
|
74
74
|
# layout specifies an unknown filter
|
75
75
|
#
|
76
76
|
# @return [String, nil] The rendered partial, or nil if this method was
|
77
77
|
# invoked with a block
|
78
78
|
def render(identifier, other_assigns = {}, &block)
|
79
79
|
# Find layout
|
80
|
-
layout = @site.layouts.find { |l| l.identifier == identifier.
|
81
|
-
raise Nanoc::Errors::UnknownLayout.new(identifier.
|
80
|
+
layout = @site.layouts.find { |l| l.identifier == identifier.__nanoc_cleaned_identifier }
|
81
|
+
raise Nanoc::Int::Errors::UnknownLayout.new(identifier.__nanoc_cleaned_identifier) if layout.nil?
|
82
82
|
|
83
83
|
# Visit
|
84
|
-
Nanoc::NotificationCenter.post(:visit_started, layout)
|
85
|
-
Nanoc::NotificationCenter.post(:visit_ended, layout)
|
84
|
+
Nanoc::Int::NotificationCenter.post(:visit_started, layout)
|
85
|
+
Nanoc::Int::NotificationCenter.post(:visit_ended, layout)
|
86
86
|
|
87
87
|
# Capture content, if any
|
88
88
|
captured_content = block_given? ? capture(&block) : nil
|
@@ -101,18 +101,18 @@ module Nanoc::Helpers
|
|
101
101
|
|
102
102
|
# Get filter name
|
103
103
|
filter_name, filter_args = @site.compiler.rules_collection.filter_for_layout(layout)
|
104
|
-
raise Nanoc::Errors::CannotDetermineFilter.new(layout.identifier) if filter_name.nil?
|
104
|
+
raise Nanoc::Int::Errors::CannotDetermineFilter.new(layout.identifier) if filter_name.nil?
|
105
105
|
|
106
106
|
# Get filter class
|
107
107
|
filter_class = Nanoc::Filter.named(filter_name)
|
108
|
-
raise Nanoc::Errors::UnknownFilter.new(filter_name) if filter_class.nil?
|
108
|
+
raise Nanoc::Int::Errors::UnknownFilter.new(filter_name) if filter_class.nil?
|
109
109
|
|
110
110
|
# Create filter
|
111
111
|
filter = filter_class.new(assigns)
|
112
112
|
|
113
113
|
begin
|
114
114
|
# Notify start
|
115
|
-
Nanoc::NotificationCenter.post(:processing_started, layout)
|
115
|
+
Nanoc::Int::NotificationCenter.post(:processing_started, layout)
|
116
116
|
|
117
117
|
# Layout
|
118
118
|
result = filter.setup_and_run(layout.raw_content, filter_args)
|
@@ -129,7 +129,7 @@ module Nanoc::Helpers
|
|
129
129
|
end
|
130
130
|
ensure
|
131
131
|
# Notify end
|
132
|
-
Nanoc::NotificationCenter.post(:processing_ended, layout)
|
132
|
+
Nanoc::Int::NotificationCenter.post(:processing_ended, layout)
|
133
133
|
end
|
134
134
|
end
|
135
135
|
end
|
@@ -49,7 +49,7 @@ module Nanoc::Helpers
|
|
49
49
|
xml = Builder::XmlMarkup.new(target: buffer, indent: 2)
|
50
50
|
|
51
51
|
# Check for required attributes
|
52
|
-
if @
|
52
|
+
if @config[:base_url].nil?
|
53
53
|
raise RuntimeError.new('The Nanoc::Helpers::XMLSitemap helper requires the site configuration to specify the base URL for the site.')
|
54
54
|
end
|
55
55
|
|
@@ -62,8 +62,8 @@ module Nanoc::Helpers
|
|
62
62
|
reps.reject! { |r| !select_proc[r] } if select_proc
|
63
63
|
reps.sort_by { |r| r.name.to_s }.each do |rep|
|
64
64
|
xml.url do
|
65
|
-
xml.loc @
|
66
|
-
xml.lastmod item[:mtime].
|
65
|
+
xml.loc @config[:base_url] + rep.path
|
66
|
+
xml.lastmod item[:mtime].__nanoc_to_iso8601_date unless item[:mtime].nil?
|
67
67
|
xml.changefreq item[:changefreq] unless item[:changefreq].nil?
|
68
68
|
xml.priority item[:priority] unless item[:priority].nil?
|
69
69
|
end
|
data/lib/nanoc/tasks.rb
CHANGED
data/lib/nanoc/tasks/clean.rake
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
desc 'Remove output files generated by nanoc'
|
4
4
|
task :clean do
|
5
5
|
# Load site
|
6
|
-
site = Nanoc::Site.new('.')
|
6
|
+
site = Nanoc::Int::Site.new('.')
|
7
7
|
if site.nil?
|
8
8
|
$stderr.puts 'The current working directory does not seem to be a ' \
|
9
9
|
'valid/complete nanoc site directory; aborting.'
|
data/lib/nanoc/version.rb
CHANGED
data/tasks/doc.rake
CHANGED
@@ -12,6 +12,7 @@ YARD::Rake::YardocTask.new(:doc) do |yard|
|
|
12
12
|
'--files', 'NEWS.md,LICENSE',
|
13
13
|
'--output-dir', 'doc/yardoc',
|
14
14
|
'--template-path', 'doc/yardoc_templates',
|
15
|
-
'--load', 'doc/yardoc_handlers/identifier.rb'
|
15
|
+
'--load', 'doc/yardoc_handlers/identifier.rb',
|
16
|
+
'--query', '@api.text != "private"',
|
16
17
|
]
|
17
18
|
end
|
data/tasks/test.rake
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
3
5
|
def run_tests(dir_glob)
|
4
6
|
ENV['ARGS'] ||= ''
|
5
7
|
ENV['QUIET'] ||= 'true'
|
@@ -32,5 +34,9 @@ namespace :test do
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
37
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
38
|
+
t.rspec_opts = '-r ./spec/spec_helper.rb --color'
|
39
|
+
end
|
40
|
+
|
35
41
|
desc 'Alias for test:all + rubocop'
|
36
|
-
task test: [:'test:all', :rubocop]
|
42
|
+
task test: [:spec, :'test:all', :rubocop]
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'tempfile'
|
4
4
|
|
5
|
-
describe Nanoc::Checksummer do
|
6
|
-
subject { Nanoc::Checksummer }
|
5
|
+
describe Nanoc::Int::Checksummer do
|
6
|
+
subject { Nanoc::Int::Checksummer }
|
7
7
|
|
8
8
|
CHECKSUM_REGEX = /\A[0-9a-zA-Z\/+]+=*\Z/
|
9
9
|
|
@@ -130,12 +130,12 @@ describe Nanoc::Checksummer do
|
|
130
130
|
|
131
131
|
it 'should not have the same checksum for same content but different class'
|
132
132
|
|
133
|
-
describe 'for Nanoc::RulesCollection' do
|
133
|
+
describe 'for Nanoc::Int::RulesCollection' do
|
134
134
|
let(:data) { 'STUFF!' }
|
135
|
-
let(:normal_checksum) { '
|
135
|
+
let(:normal_checksum) { 'Y6mX13i8ZEd4a11xRPc2yNQSRDs=' }
|
136
136
|
|
137
137
|
let(:rules_collection) do
|
138
|
-
coll = Nanoc::RulesCollection.new(nil)
|
138
|
+
coll = Nanoc::Int::RulesCollection.new(nil)
|
139
139
|
coll.data = data
|
140
140
|
coll
|
141
141
|
end
|
@@ -154,11 +154,11 @@ describe Nanoc::Checksummer do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
describe 'for Nanoc::CodeSnippet' do
|
157
|
+
describe 'for Nanoc::Int::CodeSnippet' do
|
158
158
|
let(:data) { 'asdf' }
|
159
159
|
let(:filename) { File.expand_path('bob.txt') }
|
160
|
-
let(:code_snippet) { Nanoc::CodeSnippet.new(data, filename) }
|
161
|
-
let(:normal_checksum) { '
|
160
|
+
let(:code_snippet) { Nanoc::Int::CodeSnippet.new(data, filename) }
|
161
|
+
let(:normal_checksum) { 's6oZ1xLVekKDVhYrXsJuHChFjek=' }
|
162
162
|
|
163
163
|
it 'should checksum the data' do
|
164
164
|
subject.calc(code_snippet).must_equal(normal_checksum)
|
@@ -182,13 +182,13 @@ describe Nanoc::Checksummer do
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
-
describe 'for Nanoc::Configuration' do
|
185
|
+
describe 'for Nanoc::Int::Configuration' do
|
186
186
|
let(:wrapped) { { a: 1, b: 2 } }
|
187
|
-
let(:configuration) { Nanoc::Configuration.new(wrapped) }
|
188
|
-
let(:normal_checksum) { '
|
187
|
+
let(:configuration) { Nanoc::Int::Configuration.new(wrapped) }
|
188
|
+
let(:normal_checksum) { 'xwbPeftLbSXYx0OJbKCqrPHctPU=' }
|
189
189
|
|
190
190
|
it 'should checksum the hash' do
|
191
|
-
subject.calc(configuration).must_equal(
|
191
|
+
subject.calc(configuration).must_equal(normal_checksum)
|
192
192
|
end
|
193
193
|
|
194
194
|
describe 'if the content changes' do
|
@@ -201,13 +201,13 @@ describe Nanoc::Checksummer do
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
-
describe 'for Nanoc::Item' do
|
204
|
+
describe 'for Nanoc::Int::Item' do
|
205
205
|
let(:content) { 'asdf' }
|
206
206
|
let(:filename) { File.expand_path('bob.txt') }
|
207
207
|
let(:attributes) { { a: 1, b: 2 } }
|
208
208
|
let(:identifier) { '/foo/' }
|
209
|
-
let(:item) { Nanoc::Item.new(content, attributes, identifier) }
|
210
|
-
let(:normal_checksum) { '
|
209
|
+
let(:item) { Nanoc::Int::Item.new(content, attributes, identifier) }
|
210
|
+
let(:normal_checksum) { '6VtlVLx1JE69erzfDczZW7HSWeY=' }
|
211
211
|
|
212
212
|
it 'should checksum item' do
|
213
213
|
subject.calc(item).must_equal(normal_checksum)
|
@@ -1,27 +1,27 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
describe 'Array#
|
3
|
+
describe 'Array#__nanoc_symbolize_keys_recursively' do
|
4
4
|
it 'should convert keys to symbols' do
|
5
5
|
array_old = [:abc, 'xyz', { 'foo' => 'bar', :baz => :qux }]
|
6
6
|
array_new = [:abc, 'xyz', { foo: 'bar', baz: :qux }]
|
7
|
-
array_old.
|
7
|
+
array_old.__nanoc_symbolize_keys_recursively.must_equal array_new
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe 'Array#
|
11
|
+
describe 'Array#__nanoc_stringify_keys_recursively' do
|
12
12
|
it 'should convert keys to strings' do
|
13
13
|
array_old = [:abc, 'xyz', { :foo => 'bar', 'baz' => :qux }]
|
14
14
|
array_new = [:abc, 'xyz', { 'foo' => 'bar', 'baz' => :qux }]
|
15
|
-
array_old.
|
15
|
+
array_old.__nanoc_stringify_keys_recursively.must_equal array_new
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe 'Array#
|
19
|
+
describe 'Array#__nanoc_freeze_recursively' do
|
20
20
|
include Nanoc::TestHelpers
|
21
21
|
|
22
22
|
it 'should prevent first-level elements from being modified' do
|
23
23
|
array = [:a, [:b, :c], :d]
|
24
|
-
array.
|
24
|
+
array.__nanoc_freeze_recursively
|
25
25
|
|
26
26
|
assert_raises_frozen_error do
|
27
27
|
array[0] = 123
|
@@ -30,7 +30,7 @@ describe 'Array#freeze_recursively' do
|
|
30
30
|
|
31
31
|
it 'should prevent second-level elements from being modified' do
|
32
32
|
array = [:a, [:b, :c], :d]
|
33
|
-
array.
|
33
|
+
array.__nanoc_freeze_recursively
|
34
34
|
|
35
35
|
assert_raises_frozen_error do
|
36
36
|
array[1][0] = 123
|
@@ -41,7 +41,7 @@ describe 'Array#freeze_recursively' do
|
|
41
41
|
a = []
|
42
42
|
a << a
|
43
43
|
|
44
|
-
a.
|
44
|
+
a.__nanoc_freeze_recursively
|
45
45
|
|
46
46
|
assert a.frozen?
|
47
47
|
assert a[0].frozen?
|
@@ -49,9 +49,9 @@ describe 'Array#freeze_recursively' do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe 'Array#
|
52
|
+
describe 'Array#__nanoc_checksum' do
|
53
53
|
it 'should work' do
|
54
54
|
expectation = 'CEUlNvu/3DUmlbtpFRiLHU8oHA0='
|
55
|
-
[[:foo, 123]].
|
55
|
+
[[:foo, 123]].__nanoc_checksum.must_equal expectation
|
56
56
|
end
|
57
57
|
end
|
@@ -1,51 +1,51 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
describe 'Hash#
|
3
|
+
describe 'Hash#__nanoc_symbolize_keys_recursively' do
|
4
4
|
it 'should convert keys to symbols' do
|
5
5
|
hash_old = { 'foo' => 'bar' }
|
6
6
|
hash_new = { foo: 'bar' }
|
7
|
-
hash_old.
|
7
|
+
hash_old.__nanoc_symbolize_keys_recursively.must_equal hash_new
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should not require string keys' do
|
11
11
|
hash_old = { Time.now => 'abc' }
|
12
12
|
hash_new = hash_old
|
13
|
-
hash_old.
|
13
|
+
hash_old.__nanoc_symbolize_keys_recursively.must_equal hash_new
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe 'Hash#
|
17
|
+
describe 'Hash#__nanoc_stringify_keys_recursively' do
|
18
18
|
it 'should leave strings as strings' do
|
19
19
|
hash_old = { 'foo' => 'bar' }
|
20
20
|
hash_new = { 'foo' => 'bar' }
|
21
|
-
hash_old.
|
21
|
+
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should convert symbols to strings' do
|
25
25
|
hash_old = { foo: 'bar' }
|
26
26
|
hash_new = { 'foo' => 'bar' }
|
27
|
-
hash_old.
|
27
|
+
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should convert integers to strings' do
|
31
31
|
hash_old = { 123 => 'bar' }
|
32
32
|
hash_new = { '123' => 'bar' }
|
33
|
-
hash_old.
|
33
|
+
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should convert nil to an empty string' do
|
37
37
|
hash_old = { nil => 'bar' }
|
38
38
|
hash_new = { '' => 'bar' }
|
39
|
-
hash_old.
|
39
|
+
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
describe 'Hash#
|
43
|
+
describe 'Hash#__nanoc_freeze_recursively' do
|
44
44
|
include Nanoc::TestHelpers
|
45
45
|
|
46
46
|
it 'should prevent first-level elements from being modified' do
|
47
47
|
hash = { a: { b: :c } }
|
48
|
-
hash.
|
48
|
+
hash.__nanoc_freeze_recursively
|
49
49
|
|
50
50
|
assert_raises_frozen_error do
|
51
51
|
hash[:a] = 123
|
@@ -54,7 +54,7 @@ describe 'Hash#freeze_recursively' do
|
|
54
54
|
|
55
55
|
it 'should prevent second-level elements from being modified' do
|
56
56
|
hash = { a: { b: :c } }
|
57
|
-
hash.
|
57
|
+
hash.__nanoc_freeze_recursively
|
58
58
|
|
59
59
|
assert_raises_frozen_error do
|
60
60
|
hash[:a][:b] = 123
|
@@ -65,7 +65,7 @@ describe 'Hash#freeze_recursively' do
|
|
65
65
|
a = {}
|
66
66
|
a[:x] = a
|
67
67
|
|
68
|
-
a.
|
68
|
+
a.__nanoc_freeze_recursively
|
69
69
|
|
70
70
|
assert a.frozen?
|
71
71
|
assert a[:x].frozen?
|
@@ -73,15 +73,15 @@ describe 'Hash#freeze_recursively' do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
describe 'Hash#
|
76
|
+
describe 'Hash#__nanoc_checksum' do
|
77
77
|
it 'should work' do
|
78
78
|
expectation = 'wy7gHokc700tqJ/BmJ+EK6/F0bc='
|
79
|
-
{ foo: 123 }.
|
79
|
+
{ foo: 123 }.__nanoc_checksum.must_equal expectation
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'should not sort keys' do
|
83
|
-
a = { a: 1, c: 2, b: 3 }.
|
84
|
-
b = { a: 1, b: 3, c: 2 }.
|
83
|
+
a = { a: 1, c: 2, b: 3 }.__nanoc_checksum
|
84
|
+
b = { a: 1, b: 3, c: 2 }.__nanoc_checksum
|
85
85
|
a.wont_equal b
|
86
86
|
end
|
87
87
|
end
|
@@ -11,7 +11,7 @@ describe 'Pathname#checksum' do
|
|
11
11
|
|
12
12
|
# Create checksum
|
13
13
|
pathname = Pathname.new('tmp/myfile')
|
14
|
-
pathname.
|
14
|
+
pathname.__nanoc_checksum.must_equal 'oU+0fYgGm4EDTl+uErBv8rB9YhU='
|
15
15
|
ensure
|
16
16
|
FileUtils.rm_rf('tmp')
|
17
17
|
end
|
@@ -27,7 +27,7 @@ describe 'Pathname#checksum' do
|
|
27
27
|
|
28
28
|
# Create checksum
|
29
29
|
pathname = Pathname.new('tmp/myfile')
|
30
|
-
pathname.
|
30
|
+
pathname.__nanoc_checksum.must_equal 'IAoqYXvcDheQjaYmZ8waPtEO8zU='
|
31
31
|
ensure
|
32
32
|
FileUtils.rm_rf('tmp')
|
33
33
|
end
|
@@ -1,33 +1,33 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
describe 'String#
|
3
|
+
describe 'String#__nanoc_cleaned_identifier' do
|
4
4
|
it 'should not convert already clean paths' do
|
5
|
-
'/foo/bar/'.
|
5
|
+
'/foo/bar/'.__nanoc_cleaned_identifier.must_equal '/foo/bar/'
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should prepend slash if necessary' do
|
9
|
-
'foo/bar/'.
|
9
|
+
'foo/bar/'.__nanoc_cleaned_identifier.must_equal '/foo/bar/'
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should append slash if necessary' do
|
13
|
-
'/foo/bar'.
|
13
|
+
'/foo/bar'.__nanoc_cleaned_identifier.must_equal '/foo/bar/'
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should remove double slashes at start' do
|
17
|
-
'//foo/bar/'.
|
17
|
+
'//foo/bar/'.__nanoc_cleaned_identifier.must_equal '/foo/bar/'
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should remove double slashes at end' do
|
21
|
-
'/foo/bar//'.
|
21
|
+
'/foo/bar//'.__nanoc_cleaned_identifier.must_equal '/foo/bar/'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe 'String#
|
25
|
+
describe 'String#__nanoc_checksum' do
|
26
26
|
it 'should work on empty strings' do
|
27
|
-
''.
|
27
|
+
''.__nanoc_checksum.must_equal 'PfY7essFItpoXa1f6EuB/deyUmQ='
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should work on all strings' do
|
31
|
-
'abc'.
|
31
|
+
'abc'.__nanoc_checksum.must_equal 'NkkYRO+25f6psNSeCYykXKCg3C0='
|
32
32
|
end
|
33
33
|
end
|