nanoc 4.0.0b2 → 4.0.0b3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -22
- data/NEWS.md +20 -0
- data/Rakefile +0 -2
- data/bin/nanoc +0 -2
- data/lib/nanoc.rb +0 -2
- data/lib/nanoc/base.rb +1 -2
- data/lib/nanoc/base/checksummer.rb +0 -2
- data/lib/nanoc/base/compilation/checksum_store.rb +0 -2
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -2
- data/lib/nanoc/base/compilation/compiler.rb +0 -2
- data/lib/nanoc/base/compilation/compiler_dsl.rb +0 -2
- data/lib/nanoc/base/compilation/dependency_tracker.rb +0 -2
- data/lib/nanoc/base/compilation/filter.rb +0 -2
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -2
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -2
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -2
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -2
- data/lib/nanoc/base/compilation/rule.rb +0 -2
- data/lib/nanoc/base/compilation/rule_context.rb +0 -2
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -2
- data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -2
- data/lib/nanoc/base/compilation/rules_collection.rb +0 -2
- data/lib/nanoc/base/context.rb +0 -2
- data/lib/nanoc/base/core_ext.rb +0 -2
- data/lib/nanoc/base/core_ext/array.rb +0 -2
- data/lib/nanoc/base/core_ext/hash.rb +0 -2
- data/lib/nanoc/base/core_ext/pathname.rb +0 -2
- data/lib/nanoc/base/core_ext/string.rb +0 -2
- data/lib/nanoc/base/directed_graph.rb +0 -2
- data/lib/nanoc/base/error.rb +0 -2
- data/lib/nanoc/base/errors.rb +0 -2
- data/lib/nanoc/base/identifiable_collection.rb +0 -2
- data/lib/nanoc/base/memoization.rb +0 -2
- data/lib/nanoc/base/notification_center.rb +0 -2
- data/lib/nanoc/base/pattern.rb +0 -2
- data/lib/nanoc/base/plugin_registry.rb +0 -2
- data/lib/nanoc/base/result_data/item_rep.rb +0 -2
- data/lib/nanoc/base/source_data/code_snippet.rb +0 -2
- data/lib/nanoc/base/source_data/configuration.rb +0 -2
- data/lib/nanoc/base/source_data/data_source.rb +0 -2
- data/lib/nanoc/base/source_data/identifier.rb +0 -2
- data/lib/nanoc/base/source_data/item.rb +0 -2
- data/lib/nanoc/base/source_data/layout.rb +0 -2
- data/lib/nanoc/base/source_data/site.rb +1 -3
- data/lib/nanoc/base/store.rb +0 -2
- data/lib/nanoc/base/temp_filename_factory.rb +0 -2
- data/lib/nanoc/base/views/config.rb +0 -2
- data/lib/nanoc/base/views/identifiable_collection.rb +0 -2
- data/lib/nanoc/base/views/item.rb +3 -5
- data/lib/nanoc/base/views/item_collection.rb +0 -2
- data/lib/nanoc/base/views/item_rep.rb +0 -2
- data/lib/nanoc/base/views/item_rep_collection.rb +48 -0
- data/lib/nanoc/base/views/layout.rb +0 -2
- data/lib/nanoc/base/views/layout_collection.rb +0 -2
- data/lib/nanoc/base/views/mutable_config.rb +0 -2
- data/lib/nanoc/base/views/mutable_identifiable_collection.rb +0 -2
- data/lib/nanoc/base/views/mutable_item.rb +0 -2
- data/lib/nanoc/base/views/mutable_item_collection.rb +0 -2
- data/lib/nanoc/base/views/mutable_layout.rb +0 -2
- data/lib/nanoc/base/views/mutable_layout_collection.rb +0 -2
- data/lib/nanoc/base/views/site.rb +0 -2
- data/lib/nanoc/cli.rb +0 -2
- data/lib/nanoc/cli/ansi_string_colorizer.rb +0 -2
- data/lib/nanoc/cli/cleaning_stream.rb +0 -2
- data/lib/nanoc/cli/command_runner.rb +0 -2
- data/lib/nanoc/cli/commands/check.rb +0 -2
- data/lib/nanoc/cli/commands/compile.rb +0 -2
- data/lib/nanoc/cli/commands/create-site.rb +7 -25
- data/lib/nanoc/cli/commands/deploy.rb +0 -2
- data/lib/nanoc/cli/commands/nanoc.rb +0 -2
- data/lib/nanoc/cli/commands/prune.rb +0 -2
- data/lib/nanoc/cli/commands/shell.rb +0 -2
- data/lib/nanoc/cli/commands/show-data.rb +0 -2
- data/lib/nanoc/cli/commands/show-plugins.rb +0 -2
- data/lib/nanoc/cli/commands/show-rules.rb +0 -2
- data/lib/nanoc/cli/commands/view.rb +0 -2
- data/lib/nanoc/cli/error_handler.rb +0 -2
- data/lib/nanoc/cli/logger.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -2
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +0 -2
- data/lib/nanoc/data_sources.rb +1 -5
- data/lib/nanoc/data_sources/filesystem.rb +2 -2
- data/lib/nanoc/data_sources/filesystem_unified.rb +0 -2
- data/lib/nanoc/extra.rb +0 -2
- data/lib/nanoc/extra/checking.rb +0 -2
- data/lib/nanoc/extra/checking/check.rb +23 -15
- data/lib/nanoc/extra/checking/checks.rb +0 -2
- data/lib/nanoc/extra/checking/checks/css.rb +1 -3
- data/lib/nanoc/extra/checking/checks/external_links.rb +0 -2
- data/lib/nanoc/extra/checking/checks/html.rb +1 -3
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -5
- data/lib/nanoc/extra/checking/checks/mixed_content.rb +0 -2
- data/lib/nanoc/extra/checking/checks/stale.rb +2 -4
- data/lib/nanoc/extra/checking/dsl.rb +0 -2
- data/lib/nanoc/extra/checking/issue.rb +0 -2
- data/lib/nanoc/extra/checking/runner.rb +1 -3
- data/lib/nanoc/extra/core_ext.rb +0 -2
- data/lib/nanoc/extra/core_ext/pathname.rb +0 -2
- data/lib/nanoc/extra/core_ext/time.rb +0 -2
- data/lib/nanoc/extra/deployer.rb +0 -2
- data/lib/nanoc/extra/deployers.rb +0 -2
- data/lib/nanoc/extra/deployers/fog.rb +40 -8
- data/lib/nanoc/extra/deployers/rsync.rb +0 -2
- data/lib/nanoc/extra/filesystem_tools.rb +0 -2
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -2
- data/lib/nanoc/extra/link_collector.rb +0 -2
- data/lib/nanoc/extra/piper.rb +0 -2
- data/lib/nanoc/extra/pruner.rb +0 -2
- data/lib/nanoc/filters.rb +0 -2
- data/lib/nanoc/filters/asciidoc.rb +0 -2
- data/lib/nanoc/filters/bluecloth.rb +0 -2
- data/lib/nanoc/filters/coffeescript.rb +0 -2
- data/lib/nanoc/filters/colorize_syntax.rb +0 -2
- data/lib/nanoc/filters/erb.rb +0 -2
- data/lib/nanoc/filters/erubis.rb +0 -2
- data/lib/nanoc/filters/haml.rb +0 -2
- data/lib/nanoc/filters/handlebars.rb +0 -2
- data/lib/nanoc/filters/kramdown.rb +0 -2
- data/lib/nanoc/filters/less.rb +0 -2
- data/lib/nanoc/filters/markaby.rb +0 -2
- data/lib/nanoc/filters/maruku.rb +0 -2
- data/lib/nanoc/filters/mustache.rb +0 -2
- data/lib/nanoc/filters/pandoc.rb +0 -2
- data/lib/nanoc/filters/rainpress.rb +0 -2
- data/lib/nanoc/filters/rdiscount.rb +0 -2
- data/lib/nanoc/filters/rdoc.rb +0 -2
- data/lib/nanoc/filters/redcarpet.rb +0 -2
- data/lib/nanoc/filters/redcloth.rb +0 -2
- data/lib/nanoc/filters/relativize_paths.rb +0 -2
- data/lib/nanoc/filters/rubypants.rb +0 -2
- data/lib/nanoc/filters/sass.rb +0 -2
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
- data/lib/nanoc/filters/slim.rb +0 -2
- data/lib/nanoc/filters/typogruby.rb +0 -2
- data/lib/nanoc/filters/uglify_js.rb +0 -2
- data/lib/nanoc/filters/xsl.rb +0 -2
- data/lib/nanoc/filters/yui_compressor.rb +0 -2
- data/lib/nanoc/helpers.rb +0 -2
- data/lib/nanoc/helpers/blogging.rb +0 -2
- data/lib/nanoc/helpers/breadcrumbs.rb +0 -2
- data/lib/nanoc/helpers/capturing.rb +0 -2
- data/lib/nanoc/helpers/filtering.rb +0 -2
- data/lib/nanoc/helpers/html_escape.rb +0 -2
- data/lib/nanoc/helpers/link_to.rb +0 -2
- data/lib/nanoc/helpers/rendering.rb +0 -2
- data/lib/nanoc/helpers/tagging.rb +0 -2
- data/lib/nanoc/helpers/text.rb +0 -2
- data/lib/nanoc/helpers/xml_sitemap.rb +0 -2
- data/lib/nanoc/version.rb +1 -3
- data/nanoc.gemspec +1 -3
- data/tasks/doc.rake +0 -2
- data/tasks/test.rake +0 -2
- data/test/base/checksummer_spec.rb +0 -2
- data/test/base/core_ext/array_spec.rb +0 -2
- data/test/base/core_ext/hash_spec.rb +0 -2
- data/test/base/core_ext/pathname_spec.rb +0 -2
- data/test/base/core_ext/string_spec.rb +0 -2
- data/test/base/temp_filename_factory_spec.rb +0 -2
- data/test/base/test_checksum_store.rb +0 -2
- data/test/base/test_code_snippet.rb +0 -2
- data/test/base/test_compiler.rb +0 -2
- data/test/base/test_compiler_dsl.rb +1 -3
- data/test/base/test_context.rb +0 -2
- data/test/base/test_data_source.rb +0 -2
- data/test/base/test_dependency_tracker.rb +0 -2
- data/test/base/test_directed_graph.rb +0 -2
- data/test/base/test_filter.rb +0 -2
- data/test/base/test_item.rb +0 -2
- data/test/base/test_item_array.rb +0 -2
- data/test/base/test_item_rep.rb +0 -2
- data/test/base/test_item_rep_recorder_proxy.rb +0 -2
- data/test/base/test_layout.rb +0 -2
- data/test/base/test_memoization.rb +0 -2
- data/test/base/test_notification_center.rb +0 -2
- data/test/base/test_outdatedness_checker.rb +1 -3
- data/test/base/test_plugin.rb +0 -2
- data/test/base/test_rule.rb +0 -2
- data/test/base/test_rule_context.rb +0 -2
- data/test/base/test_site.rb +1 -3
- data/test/base/test_store.rb +0 -2
- data/test/cli/commands/test_check.rb +0 -2
- data/test/cli/commands/test_compile.rb +0 -2
- data/test/cli/commands/test_create_site.rb +1 -3
- data/test/cli/commands/test_deploy.rb +0 -2
- data/test/cli/commands/test_help.rb +0 -2
- data/test/cli/commands/test_info.rb +0 -2
- data/test/cli/commands/test_prune.rb +2 -4
- data/test/cli/test_cleaning_stream.rb +0 -2
- data/test/cli/test_cli.rb +0 -6
- data/test/cli/test_error_handler.rb +0 -2
- data/test/cli/test_logger.rb +0 -2
- data/test/data_sources/test_filesystem.rb +0 -2
- data/test/data_sources/test_filesystem_unified.rb +15 -2
- data/test/extra/checking/checks/test_css.rb +3 -5
- data/test/extra/checking/checks/test_external_links.rb +5 -7
- data/test/extra/checking/checks/test_html.rb +2 -4
- data/test/extra/checking/checks/test_internal_links.rb +5 -7
- data/test/extra/checking/checks/test_mixed_content.rb +8 -10
- data/test/extra/checking/checks/test_stale.rb +1 -3
- data/test/extra/checking/test_check.rb +2 -6
- data/test/extra/checking/test_dsl.rb +0 -2
- data/test/extra/checking/test_runner.rb +0 -2
- data/test/extra/core_ext/test_pathname.rb +0 -2
- data/test/extra/core_ext/test_time.rb +0 -2
- data/test/extra/deployers/test_fog.rb +147 -2
- data/test/extra/deployers/test_rsync.rb +0 -2
- data/test/extra/test_filesystem_tools.rb +0 -2
- data/test/extra/test_link_collector.rb +0 -2
- data/test/extra/test_piper.rb +0 -2
- data/test/filters/test_asciidoc.rb +0 -2
- data/test/filters/test_bluecloth.rb +0 -2
- data/test/filters/test_coffeescript.rb +0 -2
- data/test/filters/test_colorize_syntax.rb +0 -2
- data/test/filters/test_erb.rb +0 -2
- data/test/filters/test_erubis.rb +0 -2
- data/test/filters/test_haml.rb +0 -2
- data/test/filters/test_handlebars.rb +0 -2
- data/test/filters/test_kramdown.rb +0 -2
- data/test/filters/test_less.rb +0 -2
- data/test/filters/test_markaby.rb +0 -2
- data/test/filters/test_maruku.rb +0 -2
- data/test/filters/test_mustache.rb +0 -2
- data/test/filters/test_pandoc.rb +0 -2
- data/test/filters/test_rainpress.rb +0 -2
- data/test/filters/test_rdiscount.rb +0 -2
- data/test/filters/test_rdoc.rb +0 -2
- data/test/filters/test_redcarpet.rb +0 -2
- data/test/filters/test_redcloth.rb +0 -2
- data/test/filters/test_relativize_paths.rb +0 -2
- data/test/filters/test_rubypants.rb +0 -2
- data/test/filters/test_sass.rb +0 -2
- data/test/filters/test_slim.rb +0 -2
- data/test/filters/test_typogruby.rb +0 -2
- data/test/filters/test_uglify_js.rb +0 -2
- data/test/filters/test_xsl.rb +0 -2
- data/test/filters/test_yui_compressor.rb +0 -2
- data/test/gem_loader.rb +0 -2
- data/test/helper.rb +1 -3
- data/test/helpers/test_blogging.rb +0 -2
- data/test/helpers/test_breadcrumbs.rb +0 -2
- data/test/helpers/test_capturing.rb +0 -2
- data/test/helpers/test_filtering.rb +0 -2
- data/test/helpers/test_html_escape.rb +0 -2
- data/test/helpers/test_link_to.rb +0 -2
- data/test/helpers/test_rendering.rb +0 -2
- data/test/helpers/test_tagging.rb +0 -2
- data/test/helpers/test_text.rb +0 -2
- data/test/helpers/test_xml_sitemap.rb +0 -2
- data/test/test_gem.rb +0 -5
- metadata +5 -6
- data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -71
- data/test/data_sources/test_filesystem_verbose.rb +0 -308
data/test/helpers/test_text.rb
CHANGED
data/test/test_gem.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
class Nanoc::GemTest < Nanoc::TestCase
|
4
2
|
def setup
|
5
3
|
super
|
@@ -22,9 +20,6 @@ class Nanoc::GemTest < Nanoc::TestCase
|
|
22
20
|
diff = files_after - files_before
|
23
21
|
assert_equal 1, diff.size
|
24
22
|
assert_match(/^nanoc-.*\.gem$/, diff.to_a[0])
|
25
|
-
|
26
|
-
# Check output
|
27
|
-
assert_match(/Successfully built RubyGem\s+Name: nanoc\s+Version: .*\s+File: nanoc-.*\.gem\s+/, stdout.string)
|
28
23
|
ensure
|
29
24
|
Dir['nanoc-*.gem'].each { |f| FileUtils.rm(f) }
|
30
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.0b3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/nanoc/base/views/item.rb
|
117
117
|
- lib/nanoc/base/views/item_collection.rb
|
118
118
|
- lib/nanoc/base/views/item_rep.rb
|
119
|
+
- lib/nanoc/base/views/item_rep_collection.rb
|
119
120
|
- lib/nanoc/base/views/layout.rb
|
120
121
|
- lib/nanoc/base/views/layout_collection.rb
|
121
122
|
- lib/nanoc/base/views/mutable_config.rb
|
@@ -149,7 +150,6 @@ files:
|
|
149
150
|
- lib/nanoc/data_sources.rb
|
150
151
|
- lib/nanoc/data_sources/filesystem.rb
|
151
152
|
- lib/nanoc/data_sources/filesystem_unified.rb
|
152
|
-
- lib/nanoc/data_sources/filesystem_verbose.rb
|
153
153
|
- lib/nanoc/extra.rb
|
154
154
|
- lib/nanoc/extra/checking.rb
|
155
155
|
- lib/nanoc/extra/checking/check.rb
|
@@ -261,7 +261,6 @@ files:
|
|
261
261
|
- test/cli/test_logger.rb
|
262
262
|
- test/data_sources/test_filesystem.rb
|
263
263
|
- test/data_sources/test_filesystem_unified.rb
|
264
|
-
- test/data_sources/test_filesystem_verbose.rb
|
265
264
|
- test/extra/checking/checks/test_css.rb
|
266
265
|
- test/extra/checking/checks/test_external_links.rb
|
267
266
|
- test/extra/checking/checks/test_html.rb
|
@@ -337,7 +336,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
337
336
|
requirements:
|
338
337
|
- - ">="
|
339
338
|
- !ruby/object:Gem::Version
|
340
|
-
version: 2.
|
339
|
+
version: 2.2.0
|
341
340
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
342
341
|
requirements:
|
343
342
|
- - ">"
|
@@ -345,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
344
|
version: 1.3.1
|
346
345
|
requirements: []
|
347
346
|
rubyforge_project:
|
348
|
-
rubygems_version: 2.4.
|
347
|
+
rubygems_version: 2.4.7
|
349
348
|
signing_key:
|
350
349
|
specification_version: 4
|
351
350
|
summary: a web publishing system written in Ruby for building small to medium-sized
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Nanoc::DataSources
|
4
|
-
# The filesystem_verbose data source is the old data source for a new nanoc
|
5
|
-
# site. It stores all data as files on the hard disk.
|
6
|
-
#
|
7
|
-
# None of the methods are documented in this file. See {Nanoc::DataSource}
|
8
|
-
# for documentation on the overridden methods instead.
|
9
|
-
#
|
10
|
-
# The filesystem_verbose data source stores its items and layouts in nested
|
11
|
-
# directories. Each directory represents a single item or layout. The root
|
12
|
-
# directory for items is the `content` directory; for layouts it is the
|
13
|
-
# `layouts` directory.
|
14
|
-
#
|
15
|
-
# Every directory has a content file and a meta file. The content file
|
16
|
-
# contains the actual item content, while the meta file contains the item’s
|
17
|
-
# or the layout’s metadata, formatted as YAML.
|
18
|
-
#
|
19
|
-
# Both content files and meta files are named after its parent directory
|
20
|
-
# (i.e. item). For example, an item/layout named `foo` will have a directory
|
21
|
-
# named `foo`, with e.g. a `foo.markdown` content file and a `foo.yaml` meta
|
22
|
-
# file.
|
23
|
-
#
|
24
|
-
# Content file extensions are not used for determining the filter that
|
25
|
-
# should be run; the meta file defines the list of filters. The meta file
|
26
|
-
# extension must always be `.yaml`, though.
|
27
|
-
#
|
28
|
-
# For backwards compatibility, content files can also have the `index`
|
29
|
-
# basename. Similarly, meta files can have the `meta` basename. For example,
|
30
|
-
# a parent directory named `foo` can have an `index.txt` content file and a
|
31
|
-
# `meta.yaml` meta file.
|
32
|
-
#
|
33
|
-
# The identifier is calculated by stripping the extension; if there is more
|
34
|
-
# than one extension, only the last extension is stripped and the previous
|
35
|
-
# extensions will be part of the identifier.
|
36
|
-
#
|
37
|
-
# It is possible to set an explicit encoding that should be used when reading
|
38
|
-
# files. In the data source configuration, set `encoding` to an encoding
|
39
|
-
# understood by Ruby’s `Encoding`. If no encoding is set in the configuration,
|
40
|
-
# one will be inferred from the environment.
|
41
|
-
#
|
42
|
-
# @api private
|
43
|
-
class FilesystemVerbose < Nanoc::DataSource
|
44
|
-
include Nanoc::DataSources::Filesystem
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# See {Nanoc::DataSources::Filesystem#filename_for}.
|
49
|
-
def filename_for(base_filename, ext)
|
50
|
-
return nil if ext.nil?
|
51
|
-
|
52
|
-
last_component = base_filename[%r{[^/]+$}]
|
53
|
-
possibilities = [
|
54
|
-
base_filename + (ext.empty? ? '' : '.' + ext), # foo/bar.html
|
55
|
-
base_filename + '/' + last_component + (ext.empty? ? '' : '.' + ext), # foo/bar/bar.html
|
56
|
-
base_filename + '/' + 'index' + (ext.empty? ? '' : '.' + ext) # foo/bar/index.html
|
57
|
-
]
|
58
|
-
|
59
|
-
possibilities.find { |p| File.file?(p) }
|
60
|
-
end
|
61
|
-
|
62
|
-
# See {Nanoc::DataSources::Filesystem#identifier_for_filename}.
|
63
|
-
def identifier_for_filename(filename)
|
64
|
-
if config[:identifier_type] == 'full'
|
65
|
-
return Nanoc::Identifier.new(filename)
|
66
|
-
end
|
67
|
-
|
68
|
-
Nanoc::Identifier.new(filename.sub(/[^\/]+\.yaml$/, ''), type: :legacy)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,308 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
class Nanoc::DataSources::FilesystemVerboseTest < Nanoc::TestCase
|
4
|
-
def new_data_source(params = nil)
|
5
|
-
# Mock site
|
6
|
-
site = Nanoc::Int::Site.new({})
|
7
|
-
|
8
|
-
# Create data source
|
9
|
-
data_source = Nanoc::DataSources::FilesystemVerbose.new(site, nil, nil, params)
|
10
|
-
|
11
|
-
# Done
|
12
|
-
data_source
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_items
|
16
|
-
# Create data source
|
17
|
-
data_source = new_data_source
|
18
|
-
|
19
|
-
# Create foo item
|
20
|
-
FileUtils.mkdir_p('content/foo')
|
21
|
-
File.open('content/foo/foo.yaml', 'w') do |io|
|
22
|
-
io.write("---\n")
|
23
|
-
io.write("title: Foo\n")
|
24
|
-
end
|
25
|
-
File.open('content/foo/foo.html', 'w') do |io|
|
26
|
-
io.write('Lorem ipsum dolor sit amet...')
|
27
|
-
end
|
28
|
-
|
29
|
-
# Create bar item
|
30
|
-
FileUtils.mkdir_p('content/bar')
|
31
|
-
File.open('content/bar/bar.yaml', 'w') do |io|
|
32
|
-
io.write("---\n")
|
33
|
-
io.write("title: Bar\n")
|
34
|
-
end
|
35
|
-
File.open('content/bar/bar.xml', 'w') do |io|
|
36
|
-
io.write('Lorem ipsum dolor sit amet...')
|
37
|
-
end
|
38
|
-
|
39
|
-
# Load items
|
40
|
-
items = data_source.items
|
41
|
-
|
42
|
-
# Check items
|
43
|
-
assert_equal(2, items.size)
|
44
|
-
assert(items.any? do |a|
|
45
|
-
a[:title] == 'Foo' &&
|
46
|
-
a[:extension] == 'html' &&
|
47
|
-
a[:content_filename] == 'content/foo/foo.html' &&
|
48
|
-
a[:meta_filename] == 'content/foo/foo.yaml'
|
49
|
-
end)
|
50
|
-
assert(items.any? do |a|
|
51
|
-
a[:title] == 'Bar' &&
|
52
|
-
a[:extension] == 'xml' &&
|
53
|
-
a[:content_filename] == 'content/bar/bar.xml' &&
|
54
|
-
a[:meta_filename] == 'content/bar/bar.yaml'
|
55
|
-
end)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_items_with_period_in_name
|
59
|
-
data_source = new_data_source(allow_periods_in_identifiers: true)
|
60
|
-
|
61
|
-
# Create foo.css
|
62
|
-
FileUtils.mkdir_p('content/foo')
|
63
|
-
File.open('content/foo/foo.yaml', 'w') do |io|
|
64
|
-
io.write(YAML.dump({ 'title' => 'Foo' }))
|
65
|
-
end
|
66
|
-
File.open('content/foo/foo.css', 'w') do |io|
|
67
|
-
io.write('body.foo {}')
|
68
|
-
end
|
69
|
-
|
70
|
-
# Create foo.bar.css
|
71
|
-
FileUtils.mkdir_p('content/foo.bar')
|
72
|
-
File.open('content/foo.bar/foo.bar.yaml', 'w') do |io|
|
73
|
-
io.write(YAML.dump({ 'title' => 'Foo Bar' }))
|
74
|
-
end
|
75
|
-
File.open('content/foo.bar/foo.bar.css', 'w') do |io|
|
76
|
-
io.write('body.foobar {}')
|
77
|
-
end
|
78
|
-
|
79
|
-
# Load
|
80
|
-
items = data_source.items.sort_by { |i| i[:title] }
|
81
|
-
|
82
|
-
# Check
|
83
|
-
assert_equal 2, items.size
|
84
|
-
assert_equal '/foo/', items[0].identifier.to_s
|
85
|
-
assert_equal 'Foo', items[0][:title]
|
86
|
-
assert_equal 'content/foo/foo.css', items[0][:content_filename]
|
87
|
-
assert_equal 'content/foo/foo.yaml', items[0][:meta_filename]
|
88
|
-
assert_equal '/foo.bar/', items[1].identifier.to_s
|
89
|
-
assert_equal 'Foo Bar', items[1][:title]
|
90
|
-
assert_equal 'content/foo.bar/foo.bar.css', items[1][:content_filename]
|
91
|
-
assert_equal 'content/foo.bar/foo.bar.yaml', items[1][:meta_filename]
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_items_with_optional_meta_file
|
95
|
-
# Create data source
|
96
|
-
data_source = new_data_source
|
97
|
-
|
98
|
-
# Create foo item
|
99
|
-
FileUtils.mkdir_p('content/foo')
|
100
|
-
File.open('content/foo/foo.html', 'w') do |io|
|
101
|
-
io.write('Lorem ipsum dolor sit amet...')
|
102
|
-
end
|
103
|
-
|
104
|
-
# Create bar item
|
105
|
-
FileUtils.mkdir_p('content/bar')
|
106
|
-
File.open('content/bar/bar.yaml', 'w') do |io|
|
107
|
-
io.write("---\n")
|
108
|
-
io.write("title: Bar\n")
|
109
|
-
end
|
110
|
-
|
111
|
-
# Load items
|
112
|
-
items = data_source.items
|
113
|
-
|
114
|
-
# Check items
|
115
|
-
assert_equal(2, items.size)
|
116
|
-
assert(items.any? do |a|
|
117
|
-
a[:title].nil? &&
|
118
|
-
a[:extension] == 'html' &&
|
119
|
-
a[:content_filename] == 'content/foo/foo.html' &&
|
120
|
-
a[:meta_filename].nil?
|
121
|
-
end)
|
122
|
-
assert(items.any? do |a|
|
123
|
-
a[:title] == 'Bar' &&
|
124
|
-
a[:extension].nil? &&
|
125
|
-
a[:content_filename].nil? &&
|
126
|
-
a[:meta_filename] == 'content/bar/bar.yaml'
|
127
|
-
end)
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_layouts
|
131
|
-
# Create data source
|
132
|
-
data_source = new_data_source
|
133
|
-
|
134
|
-
# Create layout
|
135
|
-
FileUtils.mkdir_p('layouts/foo')
|
136
|
-
File.open('layouts/foo/foo.yaml', 'w') do |io|
|
137
|
-
io.write("---\n")
|
138
|
-
io.write("filter: erb\n")
|
139
|
-
end
|
140
|
-
File.open('layouts/foo/foo.html', 'w') do |io|
|
141
|
-
io.write('Lorem ipsum dolor sit amet...')
|
142
|
-
end
|
143
|
-
|
144
|
-
# Load layouts
|
145
|
-
layouts = data_source.layouts
|
146
|
-
|
147
|
-
# Check layouts
|
148
|
-
assert_equal(1, layouts.size)
|
149
|
-
assert_equal('erb', layouts[0][:filter])
|
150
|
-
assert_equal('html', layouts[0][:extension])
|
151
|
-
assert_equal('layouts/foo/foo.html', layouts[0][:content_filename])
|
152
|
-
assert_equal('layouts/foo/foo.yaml', layouts[0][:meta_filename])
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_layouts_with_period_in_name_disallowing_periods_in_identifiers
|
156
|
-
data_source = new_data_source
|
157
|
-
|
158
|
-
# Create foo.html
|
159
|
-
FileUtils.mkdir_p('layouts/foo')
|
160
|
-
File.open('layouts/foo/foo.yaml', 'w') do |io|
|
161
|
-
io.write(YAML.dump({ 'dog' => 'woof' }))
|
162
|
-
end
|
163
|
-
File.open('layouts/foo/foo.html', 'w') do |io|
|
164
|
-
io.write('body.foo {}')
|
165
|
-
end
|
166
|
-
|
167
|
-
# Create bar.html.erb
|
168
|
-
FileUtils.mkdir_p('layouts/bar')
|
169
|
-
File.open('layouts/bar/bar.yaml', 'w') do |io|
|
170
|
-
io.write(YAML.dump({ 'cat' => 'meow' }))
|
171
|
-
end
|
172
|
-
File.open('layouts/bar/bar.html.erb', 'w') do |io|
|
173
|
-
io.write('body.foobar {}')
|
174
|
-
end
|
175
|
-
|
176
|
-
# Load
|
177
|
-
layouts = data_source.layouts.sort_by(&:identifier)
|
178
|
-
|
179
|
-
# Check
|
180
|
-
assert_equal 2, layouts.size
|
181
|
-
assert_equal '/bar/', layouts[0].identifier.to_s
|
182
|
-
assert_equal 'meow', layouts[0][:cat]
|
183
|
-
assert_equal '/foo/', layouts[1].identifier.to_s
|
184
|
-
assert_equal 'woof', layouts[1][:dog]
|
185
|
-
end
|
186
|
-
|
187
|
-
def test_layouts_with_period_in_name_allowing_periods_in_identifiers
|
188
|
-
data_source = new_data_source(allow_periods_in_identifiers: true)
|
189
|
-
|
190
|
-
# Create foo.html
|
191
|
-
FileUtils.mkdir_p('layouts/foo')
|
192
|
-
File.open('layouts/foo/foo.yaml', 'w') do |io|
|
193
|
-
io.write(YAML.dump({ 'dog' => 'woof' }))
|
194
|
-
end
|
195
|
-
File.open('layouts/foo/foo.html', 'w') do |io|
|
196
|
-
io.write('body.foo {}')
|
197
|
-
end
|
198
|
-
|
199
|
-
# Create bar.html.erb
|
200
|
-
FileUtils.mkdir_p('layouts/bar.xyz')
|
201
|
-
File.open('layouts/bar.xyz/bar.xyz.yaml', 'w') do |io|
|
202
|
-
io.write(YAML.dump({ 'cat' => 'meow' }))
|
203
|
-
end
|
204
|
-
File.open('layouts/bar.xyz/bar.xyz.html', 'w') do |io|
|
205
|
-
io.write('body.foobar {}')
|
206
|
-
end
|
207
|
-
|
208
|
-
# Load
|
209
|
-
layouts = data_source.layouts.sort_by(&:identifier)
|
210
|
-
|
211
|
-
# Check
|
212
|
-
assert_equal 2, layouts.size
|
213
|
-
assert_equal '/bar.xyz/', layouts[0].identifier.to_s
|
214
|
-
assert_equal 'meow', layouts[0][:cat]
|
215
|
-
assert_equal '/foo/', layouts[1].identifier.to_s
|
216
|
-
assert_equal 'woof', layouts[1][:dog]
|
217
|
-
end
|
218
|
-
|
219
|
-
def test_load_binary_objects
|
220
|
-
# Create data source
|
221
|
-
data_source = new_data_source
|
222
|
-
|
223
|
-
# Create sample files
|
224
|
-
FileUtils.mkdir_p('foo')
|
225
|
-
File.open('foo/stuff.dat', 'w') { |io| io.write('random binary data') }
|
226
|
-
|
227
|
-
# Load
|
228
|
-
items = data_source.send(:load_objects, 'foo', 'item', Nanoc::Int::Item)
|
229
|
-
|
230
|
-
# Check
|
231
|
-
assert_equal 1, items.size
|
232
|
-
assert items[0].binary?
|
233
|
-
assert_equal 'foo/stuff.dat', items[0].raw_filename
|
234
|
-
assert_nil items[0].raw_content
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_filename_for_with_single
|
238
|
-
data_source = new_data_source
|
239
|
-
|
240
|
-
FileUtils.mkdir_p('foo/bar')
|
241
|
-
File.open('foo/bar.ext', 'w') { |io| io.write('o hai') }
|
242
|
-
assert_equal 'foo/bar.ext', data_source.send(:filename_for, 'foo/bar', 'ext')
|
243
|
-
end
|
244
|
-
|
245
|
-
def test_filename_for_with_double
|
246
|
-
data_source = new_data_source
|
247
|
-
|
248
|
-
FileUtils.mkdir_p('foo/bar')
|
249
|
-
File.open('foo/bar/bar.ext', 'w') { |io| io.write('o hai') }
|
250
|
-
assert_equal 'foo/bar/bar.ext', data_source.send(:filename_for, 'foo/bar', 'ext')
|
251
|
-
end
|
252
|
-
|
253
|
-
def test_filename_for_with_index
|
254
|
-
data_source = new_data_source
|
255
|
-
|
256
|
-
FileUtils.mkdir_p('foo/bar')
|
257
|
-
File.open('foo/bar/index.ext', 'w') { |io| io.write('o hai') }
|
258
|
-
assert_equal 'foo/bar/index.ext', data_source.send(:filename_for, 'foo/bar', 'ext')
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_filename_for_with_nil
|
262
|
-
data_source = new_data_source
|
263
|
-
|
264
|
-
assert_equal nil, data_source.send(:filename_for, 'foo/bar', nil)
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_filename_for_with_single_and_empty_ext
|
268
|
-
data_source = new_data_source
|
269
|
-
|
270
|
-
FileUtils.mkdir_p('foo')
|
271
|
-
File.open('foo/bar', 'w') { |io| io.write('o hai') }
|
272
|
-
assert_equal 'foo/bar', data_source.send(:filename_for, 'foo/bar', '')
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_filename_for_with_double_and_empty_ext
|
276
|
-
data_source = new_data_source
|
277
|
-
|
278
|
-
FileUtils.mkdir_p('foo/bar')
|
279
|
-
File.open('foo/bar/bar', 'w') { |io| io.write('o hai') }
|
280
|
-
assert_equal 'foo/bar/bar', data_source.send(:filename_for, 'foo/bar', '')
|
281
|
-
end
|
282
|
-
|
283
|
-
def test_filename_for_with_index_and_empty_ext
|
284
|
-
data_source = new_data_source
|
285
|
-
|
286
|
-
FileUtils.mkdir_p('foo/bar')
|
287
|
-
File.open('foo/bar/index', 'w') { |io| io.write('o hai') }
|
288
|
-
assert_equal 'foo/bar/index', data_source.send(:filename_for, 'foo/bar', '')
|
289
|
-
end
|
290
|
-
|
291
|
-
def test_compile_huge_site
|
292
|
-
if_implemented do
|
293
|
-
# Create data source
|
294
|
-
data_source = new_data_source
|
295
|
-
|
296
|
-
# Create a lot of items
|
297
|
-
count = Process.getrlimit(Process::RLIMIT_NOFILE)[0] + 5
|
298
|
-
count.times do |i|
|
299
|
-
FileUtils.mkdir_p("content/#{i}")
|
300
|
-
File.open("content/#{i}/#{i}.html", 'w') { |io| io << "This is item #{i}." }
|
301
|
-
File.open("content/#{i}/#{i}.yaml", 'w') { |io| io << "title: Item #{i}" }
|
302
|
-
end
|
303
|
-
|
304
|
-
# Read all items
|
305
|
-
data_source.items
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|