nanoc 3.7.4 → 3.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +19 -18
- data/LICENSE +1 -1
- data/NEWS.md +14 -0
- data/Rakefile +1 -1
- data/doc/yardoc_handlers/identifier.rb +1 -5
- data/lib/nanoc.rb +1 -3
- data/lib/nanoc/base.rb +1 -4
- data/lib/nanoc/base/checksummer.rb +10 -12
- data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
- data/lib/nanoc/base/compilation/compiler.rb +27 -31
- data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
- data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
- data/lib/nanoc/base/compilation/filter.rb +1 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -5
- data/lib/nanoc/base/compilation/rule_context.rb +7 -11
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
- data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
- data/lib/nanoc/base/context.rb +0 -3
- data/lib/nanoc/base/core_ext.rb +0 -1
- 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 -4
- data/lib/nanoc/base/errors.rb +1 -39
- data/lib/nanoc/base/memoization.rb +0 -4
- data/lib/nanoc/base/notification_center.rb +1 -7
- data/lib/nanoc/base/plugin_registry.rb +4 -10
- data/lib/nanoc/base/result_data/item_rep.rb +8 -16
- data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
- data/lib/nanoc/base/source_data/configuration.rb +0 -4
- data/lib/nanoc/base/source_data/data_source.rb +2 -5
- data/lib/nanoc/base/source_data/item.rb +3 -7
- data/lib/nanoc/base/source_data/item_array.rb +1 -5
- data/lib/nanoc/base/source_data/layout.rb +2 -6
- data/lib/nanoc/base/source_data/site.rb +20 -23
- data/lib/nanoc/base/store.rb +1 -5
- data/lib/nanoc/base/temp_filename_factory.rb +0 -4
- data/lib/nanoc/cli.rb +3 -5
- data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
- data/lib/nanoc/cli/cleaning_stream.rb +2 -6
- data/lib/nanoc/cli/command_runner.rb +1 -5
- data/lib/nanoc/cli/commands/autocompile.rb +2 -6
- data/lib/nanoc/cli/commands/check.rb +0 -4
- data/lib/nanoc/cli/commands/compile.rb +12 -27
- data/lib/nanoc/cli/commands/create-item.rb +1 -5
- data/lib/nanoc/cli/commands/create-layout.rb +0 -4
- data/lib/nanoc/cli/commands/create-site.rb +2 -8
- data/lib/nanoc/cli/commands/deploy.rb +3 -7
- data/lib/nanoc/cli/commands/prune.rb +2 -6
- data/lib/nanoc/cli/commands/shell.rb +4 -8
- data/lib/nanoc/cli/commands/show-data.rb +3 -7
- data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
- data/lib/nanoc/cli/commands/show-rules.rb +11 -15
- data/lib/nanoc/cli/commands/sync.rb +0 -4
- data/lib/nanoc/cli/commands/update.rb +1 -7
- data/lib/nanoc/cli/commands/validate-css.rb +0 -4
- data/lib/nanoc/cli/commands/validate-html.rb +0 -4
- data/lib/nanoc/cli/commands/validate-links.rb +0 -4
- data/lib/nanoc/cli/commands/view.rb +3 -7
- data/lib/nanoc/cli/commands/watch.rb +4 -10
- data/lib/nanoc/cli/error_handler.rb +9 -13
- data/lib/nanoc/cli/logger.rb +8 -12
- data/lib/nanoc/cli/stream_cleaners.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
- data/lib/nanoc/data_sources.rb +2 -4
- data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
- data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
- data/lib/nanoc/data_sources/filesystem.rb +10 -13
- data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
- data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
- data/lib/nanoc/data_sources/static.rb +4 -8
- data/lib/nanoc/extra.rb +2 -4
- data/lib/nanoc/extra/auto_compiler.rb +2 -6
- data/lib/nanoc/extra/checking.rb +0 -4
- data/lib/nanoc/extra/checking/check.rb +0 -4
- data/lib/nanoc/extra/checking/checks.rb +0 -2
- data/lib/nanoc/extra/checking/checks/css.rb +6 -6
- data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
- data/lib/nanoc/extra/checking/checks/html.rb +6 -6
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
- data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
- data/lib/nanoc/extra/checking/dsl.rb +0 -4
- data/lib/nanoc/extra/checking/issue.rb +0 -4
- data/lib/nanoc/extra/checking/runner.rb +4 -7
- data/lib/nanoc/extra/chick.rb +7 -17
- data/lib/nanoc/extra/core_ext.rb +0 -1
- data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
- data/lib/nanoc/extra/core_ext/time.rb +0 -2
- data/lib/nanoc/extra/deployer.rb +0 -4
- data/lib/nanoc/extra/deployers.rb +0 -4
- data/lib/nanoc/extra/deployers/fog.rb +7 -11
- data/lib/nanoc/extra/deployers/rsync.rb +1 -5
- data/lib/nanoc/extra/file_proxy.rb +1 -5
- data/lib/nanoc/extra/filesystem_tools.rb +37 -12
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
- data/lib/nanoc/extra/link_collector.rb +3 -7
- data/lib/nanoc/extra/piper.rb +0 -6
- data/lib/nanoc/extra/pruner.rb +1 -7
- data/lib/nanoc/extra/validators.rb +0 -4
- data/lib/nanoc/extra/validators/links.rb +0 -4
- data/lib/nanoc/extra/validators/w3c.rb +0 -4
- data/lib/nanoc/extra/vcs.rb +3 -7
- data/lib/nanoc/extra/vcses.rb +0 -2
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
- data/lib/nanoc/extra/vcses/dummy.rb +0 -4
- data/lib/nanoc/extra/vcses/git.rb +0 -4
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
- data/lib/nanoc/extra/vcses/subversion.rb +0 -4
- data/lib/nanoc/filters.rb +0 -2
- data/lib/nanoc/filters/asciidoc.rb +1 -5
- data/lib/nanoc/filters/bluecloth.rb +0 -2
- data/lib/nanoc/filters/coderay.rb +0 -2
- data/lib/nanoc/filters/coffeescript.rb +0 -4
- data/lib/nanoc/filters/colorize_syntax.rb +17 -15
- data/lib/nanoc/filters/erb.rb +1 -3
- data/lib/nanoc/filters/erubis.rb +2 -4
- data/lib/nanoc/filters/haml.rb +2 -4
- data/lib/nanoc/filters/handlebars.rb +0 -4
- data/lib/nanoc/filters/kramdown.rb +7 -4
- data/lib/nanoc/filters/less.rb +1 -3
- data/lib/nanoc/filters/markaby.rb +0 -2
- data/lib/nanoc/filters/maruku.rb +0 -2
- data/lib/nanoc/filters/mustache.rb +1 -5
- 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 -4
- data/lib/nanoc/filters/redcloth.rb +0 -2
- data/lib/nanoc/filters/relativize_paths.rb +2 -4
- data/lib/nanoc/filters/rubypants.rb +0 -2
- data/lib/nanoc/filters/sass.rb +2 -4
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
- data/lib/nanoc/filters/slim.rb +2 -6
- data/lib/nanoc/filters/typogruby.rb +0 -4
- data/lib/nanoc/filters/uglify_js.rb +0 -2
- data/lib/nanoc/filters/xsl.rb +1 -5
- data/lib/nanoc/filters/yui_compressor.rb +0 -4
- data/lib/nanoc/helpers.rb +0 -2
- data/lib/nanoc/helpers/blogging.rb +12 -20
- data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
- data/lib/nanoc/helpers/capturing.rb +2 -10
- data/lib/nanoc/helpers/filtering.rb +0 -4
- data/lib/nanoc/helpers/html_escape.rb +3 -7
- data/lib/nanoc/helpers/link_to.rb +0 -4
- data/lib/nanoc/helpers/rendering.rb +8 -12
- data/lib/nanoc/helpers/tagging.rb +0 -4
- data/lib/nanoc/helpers/text.rb +1 -5
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
- data/lib/nanoc/tasks/clean.rb +1 -7
- data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
- data/lib/nanoc/tasks/validate.rake +0 -4
- data/lib/nanoc/version.rb +1 -3
- data/nanoc.gemspec +12 -9
- data/tasks/rubocop.rake +1 -1
- data/tasks/test.rake +6 -7
- data/test/base/checksummer_spec.rb +28 -44
- data/test/base/core_ext/array_spec.rb +1 -9
- data/test/base/core_ext/hash_spec.rb +7 -19
- data/test/base/core_ext/pathname_spec.rb +2 -4
- data/test/base/core_ext/string_spec.rb +0 -4
- data/test/base/temp_filename_factory_spec.rb +0 -8
- data/test/base/test_checksum_store.rb +0 -2
- data/test/base/test_code_snippet.rb +0 -2
- data/test/base/test_compiler.rb +15 -17
- data/test/base/test_compiler_dsl.rb +7 -9
- data/test/base/test_context.rb +2 -4
- 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 +2 -4
- data/test/base/test_filter.rb +5 -7
- data/test/base/test_item.rb +17 -13
- data/test/base/test_item_array.rb +2 -4
- data/test/base/test_item_rep.rb +79 -73
- data/test/base/test_layout.rb +3 -5
- data/test/base/test_memoization.rb +13 -21
- data/test/base/test_notification_center.rb +0 -2
- data/test/base/test_outdatedness_checker.rb +34 -36
- data/test/base/test_plugin.rb +0 -2
- data/test/base/test_rule.rb +3 -5
- data/test/base/test_rule_context.rb +4 -6
- data/test/base/test_site.rb +9 -17
- data/test/base/test_store.rb +2 -6
- data/test/cli/commands/test_check.rb +1 -3
- data/test/cli/commands/test_compile.rb +24 -15
- data/test/cli/commands/test_create_item.rb +1 -3
- data/test/cli/commands/test_create_layout.rb +0 -2
- data/test/cli/commands/test_create_site.rb +0 -3
- data/test/cli/commands/test_deploy.rb +9 -11
- 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 +6 -8
- data/test/cli/commands/test_sync.rb +0 -2
- data/test/cli/commands/test_update.rb +0 -2
- data/test/cli/commands/test_watch.rb +4 -6
- data/test/cli/test_cleaning_stream.rb +4 -6
- data/test/cli/test_cli.rb +9 -5
- data/test/cli/test_error_handler.rb +9 -7
- data/test/cli/test_logger.rb +0 -2
- data/test/data_sources/test_filesystem.rb +8 -10
- data/test/data_sources/test_filesystem_unified.rb +35 -34
- data/test/data_sources/test_filesystem_verbose.rb +31 -33
- data/test/data_sources/test_static.rb +20 -21
- data/test/extra/checking/checks/test_css.rb +23 -2
- data/test/extra/checking/checks/test_external_links.rb +2 -4
- data/test/extra/checking/checks/test_html.rb +4 -3
- data/test/extra/checking/checks/test_internal_links.rb +1 -3
- data/test/extra/checking/checks/test_stale.rb +4 -6
- data/test/extra/checking/test_check.rb +0 -2
- data/test/extra/checking/test_dsl.rb +1 -3
- data/test/extra/checking/test_runner.rb +0 -2
- data/test/extra/core_ext/test_pathname.rb +0 -3
- data/test/extra/core_ext/test_time.rb +0 -2
- data/test/extra/deployers/test_fog.rb +13 -15
- data/test/extra/deployers/test_rsync.rb +4 -6
- data/test/extra/test_auto_compiler.rb +47 -25
- data/test/extra/test_file_proxy.rb +1 -3
- data/test/extra/test_filesystem_tools.rb +47 -7
- data/test/extra/test_link_collector.rb +0 -2
- data/test/extra/test_piper.rb +3 -5
- data/test/extra/test_vcs.rb +0 -2
- data/test/extra/validators/test_links.rb +0 -1
- data/test/extra/validators/test_w3c.rb +2 -4
- data/test/filters/test_asciidoc.rb +0 -2
- data/test/filters/test_bluecloth.rb +0 -2
- data/test/filters/test_coderay.rb +2 -4
- data/test/filters/test_coffeescript.rb +0 -2
- data/test/filters/test_colorize_syntax.rb +16 -18
- data/test/filters/test_erb.rb +12 -14
- data/test/filters/test_erubis.rb +4 -6
- data/test/filters/test_haml.rb +7 -9
- data/test/filters/test_handlebars.rb +10 -12
- data/test/filters/test_kramdown.rb +13 -1
- data/test/filters/test_less.rb +9 -11
- data/test/filters/test_markaby.rb +0 -2
- data/test/filters/test_maruku.rb +0 -2
- data/test/filters/test_mustache.rb +4 -6
- data/test/filters/test_pandoc.rb +1 -3
- data/test/filters/test_rainpress.rb +1 -3
- data/test/filters/test_rdiscount.rb +1 -3
- data/test/filters/test_rdoc.rb +0 -2
- data/test/filters/test_redcarpet.rb +6 -8
- data/test/filters/test_redcloth.rb +1 -3
- data/test/filters/test_relativize_paths.rb +29 -34
- data/test/filters/test_rubypants.rb +0 -2
- data/test/filters/test_sass.rb +8 -10
- data/test/filters/test_slim.rb +2 -4
- data/test/filters/test_typogruby.rb +0 -3
- data/test/filters/test_uglify_js.rb +2 -4
- data/test/filters/test_xsl.rb +16 -18
- data/test/filters/test_yui_compressor.rb +3 -5
- data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +11 -15
- data/test/helpers/test_blogging.rb +61 -63
- data/test/helpers/test_breadcrumbs.rb +0 -2
- data/test/helpers/test_capturing.rb +4 -6
- data/test/helpers/test_filtering.rb +2 -4
- data/test/helpers/test_html_escape.rb +0 -2
- data/test/helpers/test_link_to.rb +5 -6
- data/test/helpers/test_rendering.rb +2 -4
- data/test/helpers/test_tagging.rb +9 -11
- data/test/helpers/test_text.rb +6 -8
- data/test/helpers/test_xml_sitemap.rb +11 -13
- data/test/tasks/test_clean.rb +0 -2
- data/test/test_gem.rb +1 -3
- metadata +15 -14
- data/Gemfile.lock +0 -252
- data/lib/nanoc/base/core_ext/date.rb +0 -29
- data/lib/nanoc/base/ordered_hash.rb +0 -228
- data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
- data/test/base/core_ext/date_spec.rb +0 -15
- data/test/extra/core_ext/test_enumerable.rb +0 -28
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
module Nanoc::CLI
|
|
4
|
-
|
|
5
4
|
# A command runner subclass for nanoc commands that adds nanoc-specific
|
|
6
5
|
# convenience methods and error handling.
|
|
7
6
|
class CommandRunner < ::Cri::CommandRunner
|
|
8
|
-
|
|
9
7
|
# @see http://rubydoc.info/gems/cri/Cri/CommandRunner#call-instance_method
|
|
10
8
|
#
|
|
11
9
|
# @return [void]
|
|
12
10
|
def call
|
|
13
|
-
Nanoc::CLI::ErrorHandler.handle_while(:
|
|
11
|
+
Nanoc::CLI::ErrorHandler.handle_while(command: self) do
|
|
14
12
|
run
|
|
15
13
|
end
|
|
16
14
|
end
|
|
@@ -104,10 +102,8 @@ module Nanoc::CLI
|
|
|
104
102
|
def stack
|
|
105
103
|
(site && site.compiler.stack) || []
|
|
106
104
|
end
|
|
107
|
-
|
|
108
105
|
end
|
|
109
106
|
|
|
110
107
|
# @deprecated Use {Nanoc::CLI::CommandRunner} instead
|
|
111
108
|
Command = CommandRunner
|
|
112
|
-
|
|
113
109
|
end
|
|
@@ -24,9 +24,7 @@ required :o, :host, 'specify the host to listen on (default: 0.0.0.0)'
|
|
|
24
24
|
required :p, :port, 'specify the port to listen on (default: 3000)'
|
|
25
25
|
|
|
26
26
|
module Nanoc::CLI::Commands
|
|
27
|
-
|
|
28
27
|
class AutoCompile < ::Nanoc::CLI::CommandRunner
|
|
29
|
-
|
|
30
28
|
def run
|
|
31
29
|
warn 'WARNING: The `autocompile` command is deprecated. Please consider using `guard-nanoc` instead (see https://github.com/nanoc/guard-nanoc).'
|
|
32
30
|
|
|
@@ -38,8 +36,8 @@ module Nanoc::CLI::Commands
|
|
|
38
36
|
|
|
39
37
|
# Set options
|
|
40
38
|
options_for_rack = {
|
|
41
|
-
:
|
|
42
|
-
:
|
|
39
|
+
Port: (options[:port] || autocompile_config[:port] || 3000).to_i,
|
|
40
|
+
Host: (options[:host] || autocompile_config[:host] || '0.0.0.0')
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
# Guess which handler we should use
|
|
@@ -65,9 +63,7 @@ module Nanoc::CLI::Commands
|
|
|
65
63
|
puts "Running on http://#{options_for_rack[:Host]}:#{options_for_rack[:Port]}/"
|
|
66
64
|
handler.run(app, options_for_rack)
|
|
67
65
|
end
|
|
68
|
-
|
|
69
66
|
end
|
|
70
|
-
|
|
71
67
|
end
|
|
72
68
|
|
|
73
69
|
runner Nanoc::CLI::Commands::AutoCompile
|
|
@@ -11,9 +11,7 @@ flag :L, :list, 'list all checks'
|
|
|
11
11
|
flag :d, :deploy, 'run checks for deployment'
|
|
12
12
|
|
|
13
13
|
module Nanoc::CLI::Commands
|
|
14
|
-
|
|
15
14
|
class Check < ::Nanoc::CLI::CommandRunner
|
|
16
|
-
|
|
17
15
|
def run
|
|
18
16
|
validate_options_and_arguments
|
|
19
17
|
require_site
|
|
@@ -47,9 +45,7 @@ module Nanoc::CLI::Commands
|
|
|
47
45
|
'nothing to do (pass either --all, --deploy or --list or a list of checks)'
|
|
48
46
|
end
|
|
49
47
|
end
|
|
50
|
-
|
|
51
48
|
end
|
|
52
|
-
|
|
53
49
|
end
|
|
54
50
|
|
|
55
51
|
runner Nanoc::CLI::Commands::Check
|
|
@@ -21,9 +21,7 @@ option :a, :all, '(ignored)'
|
|
|
21
21
|
option :f, :force, '(ignored)'
|
|
22
22
|
|
|
23
23
|
module Nanoc::CLI::Commands
|
|
24
|
-
|
|
25
24
|
class Compile < ::Nanoc::CLI::CommandRunner
|
|
26
|
-
|
|
27
25
|
extend Nanoc::Memoization
|
|
28
26
|
|
|
29
27
|
# Listens to compilation events and reacts to them. This abstract class
|
|
@@ -32,7 +30,6 @@ module Nanoc::CLI::Commands
|
|
|
32
30
|
#
|
|
33
31
|
# @abstract Subclasses must override {#start} and may override {#stop}.
|
|
34
32
|
class Listener
|
|
35
|
-
|
|
36
33
|
def initialize(_params = {})
|
|
37
34
|
end
|
|
38
35
|
|
|
@@ -41,7 +38,7 @@ module Nanoc::CLI::Commands
|
|
|
41
38
|
# @return [Boolean] true if this listener should be enabled for the given command runner, false otherwise
|
|
42
39
|
#
|
|
43
40
|
# @abstract Returns `true` by default, but subclasses may override this.
|
|
44
|
-
def self.enable_for?(
|
|
41
|
+
def self.enable_for?(command_runner) # rubocop:disable Lint/UnusedMethodArgument
|
|
45
42
|
true
|
|
46
43
|
end
|
|
47
44
|
|
|
@@ -59,12 +56,10 @@ module Nanoc::CLI::Commands
|
|
|
59
56
|
# @return [void]
|
|
60
57
|
def stop
|
|
61
58
|
end
|
|
62
|
-
|
|
63
59
|
end
|
|
64
60
|
|
|
65
61
|
# Generates diffs for every output file written
|
|
66
62
|
class DiffGenerator < Listener
|
|
67
|
-
|
|
68
63
|
# @see Listener#enable_for?
|
|
69
64
|
def self.enable_for?(command_runner)
|
|
70
65
|
command_runner.site.config[:enable_output_diff]
|
|
@@ -76,7 +71,7 @@ module Nanoc::CLI::Commands
|
|
|
76
71
|
setup_diffs
|
|
77
72
|
old_contents = {}
|
|
78
73
|
Nanoc::NotificationCenter.on(:will_write_rep) do |rep, snapshot|
|
|
79
|
-
path = rep.raw_path(:
|
|
74
|
+
path = rep.raw_path(snapshot: snapshot)
|
|
80
75
|
old_contents[rep] = File.file?(path) ? File.read(path) : nil
|
|
81
76
|
end
|
|
82
77
|
Nanoc::NotificationCenter.on(:rep_written) do |rep, path, _is_created, _is_modified|
|
|
@@ -105,7 +100,7 @@ module Nanoc::CLI::Commands
|
|
|
105
100
|
end
|
|
106
101
|
|
|
107
102
|
def teardown_diffs
|
|
108
|
-
@diff_threads.each
|
|
103
|
+
@diff_threads.each(&:join)
|
|
109
104
|
end
|
|
110
105
|
|
|
111
106
|
def generate_diff_for(rep, old_content, new_content)
|
|
@@ -149,12 +144,10 @@ module Nanoc::CLI::Commands
|
|
|
149
144
|
'content will be available.'
|
|
150
145
|
nil
|
|
151
146
|
end
|
|
152
|
-
|
|
153
147
|
end
|
|
154
148
|
|
|
155
149
|
# Records the time spent per filter and per item representation
|
|
156
150
|
class TimingRecorder < Listener
|
|
157
|
-
|
|
158
151
|
# @see Listener#enable_for?
|
|
159
152
|
def self.enable_for?(command_runner)
|
|
160
153
|
command_runner.options.fetch(:verbose, false)
|
|
@@ -171,7 +164,7 @@ module Nanoc::CLI::Commands
|
|
|
171
164
|
def start
|
|
172
165
|
Nanoc::NotificationCenter.on(:filtering_started) do |_rep, filter_name|
|
|
173
166
|
@times[filter_name] ||= []
|
|
174
|
-
@times[filter_name] << { :
|
|
167
|
+
@times[filter_name] << { start: Time.now }
|
|
175
168
|
end
|
|
176
169
|
Nanoc::NotificationCenter.on(:filtering_ended) do |_rep, filter_name|
|
|
177
170
|
@times[filter_name].last[:stop] = Time.now
|
|
@@ -215,7 +208,7 @@ module Nanoc::CLI::Commands
|
|
|
215
208
|
# Calculate stats
|
|
216
209
|
count = samples.size
|
|
217
210
|
min = samples.min
|
|
218
|
-
tot = samples.reduce(0) { |
|
|
211
|
+
tot = samples.reduce(0) { |a, e| a + e }
|
|
219
212
|
avg = tot / count
|
|
220
213
|
max = samples.max
|
|
221
214
|
|
|
@@ -253,12 +246,10 @@ module Nanoc::CLI::Commands
|
|
|
253
246
|
end
|
|
254
247
|
result
|
|
255
248
|
end
|
|
256
|
-
|
|
257
249
|
end
|
|
258
250
|
|
|
259
251
|
# Controls garbage collection so that it only occurs once every 20 items
|
|
260
252
|
class GCController < Listener
|
|
261
|
-
|
|
262
253
|
# @see Listener#enable_for?
|
|
263
254
|
def self.enable_for?(_command_runner)
|
|
264
255
|
!ENV.key?('TRAVIS')
|
|
@@ -285,12 +276,10 @@ module Nanoc::CLI::Commands
|
|
|
285
276
|
super
|
|
286
277
|
GC.enable
|
|
287
278
|
end
|
|
288
|
-
|
|
289
279
|
end
|
|
290
280
|
|
|
291
281
|
# Prints debug information (compilation started/ended, filtering started/ended, …)
|
|
292
282
|
class DebugPrinter < Listener
|
|
293
|
-
|
|
294
283
|
# @see Listener#enable_for?
|
|
295
284
|
def self.enable_for?(command_runner)
|
|
296
285
|
command_runner.debug?
|
|
@@ -327,12 +316,10 @@ module Nanoc::CLI::Commands
|
|
|
327
316
|
puts "*** Dependency created from #{src.inspect} onto #{dst.inspect}"
|
|
328
317
|
end
|
|
329
318
|
end
|
|
330
|
-
|
|
331
319
|
end
|
|
332
320
|
|
|
333
321
|
# Prints file actions (created, updated, deleted, identical, skipped)
|
|
334
322
|
class FileActionPrinter < Listener
|
|
335
|
-
|
|
336
323
|
# @option params [Array<Nanoc::ItemRep>] :reps The list of item representations in the site
|
|
337
324
|
def initialize(params = {})
|
|
338
325
|
@start_times = {}
|
|
@@ -378,7 +365,6 @@ module Nanoc::CLI::Commands
|
|
|
378
365
|
def log(level, action, path, duration)
|
|
379
366
|
Nanoc::CLI::Logger.instance.file(level, action, path, duration)
|
|
380
367
|
end
|
|
381
|
-
|
|
382
368
|
end
|
|
383
369
|
|
|
384
370
|
def initialize(options, arguments, command, params = {})
|
|
@@ -407,7 +393,7 @@ module Nanoc::CLI::Commands
|
|
|
407
393
|
|
|
408
394
|
def prune
|
|
409
395
|
if site.config[:prune][:auto_prune]
|
|
410
|
-
Nanoc::Extra::Pruner.new(site, :
|
|
396
|
+
Nanoc::Extra::Pruner.new(site, exclude: prune_config_exclude).run
|
|
411
397
|
end
|
|
412
398
|
end
|
|
413
399
|
|
|
@@ -422,11 +408,12 @@ module Nanoc::CLI::Commands
|
|
|
422
408
|
end
|
|
423
409
|
|
|
424
410
|
def setup_listeners
|
|
425
|
-
@listeners =
|
|
411
|
+
@listeners =
|
|
412
|
+
@listener_classes
|
|
426
413
|
.select { |klass| klass.enable_for?(self) }
|
|
427
|
-
.map { |klass| klass.new(:
|
|
414
|
+
.map { |klass| klass.new(reps: reps) }
|
|
428
415
|
|
|
429
|
-
@listeners.each
|
|
416
|
+
@listeners.each(&:start)
|
|
430
417
|
end
|
|
431
418
|
|
|
432
419
|
def listeners
|
|
@@ -441,11 +428,11 @@ module Nanoc::CLI::Commands
|
|
|
441
428
|
end
|
|
442
429
|
|
|
443
430
|
def teardown_listeners
|
|
444
|
-
@listeners.each
|
|
431
|
+
@listeners.each(&:stop)
|
|
445
432
|
end
|
|
446
433
|
|
|
447
434
|
def reps
|
|
448
|
-
site.items.map
|
|
435
|
+
site.items.map(&:reps).flatten
|
|
449
436
|
end
|
|
450
437
|
memoize :reps
|
|
451
438
|
|
|
@@ -470,9 +457,7 @@ module Nanoc::CLI::Commands
|
|
|
470
457
|
def prune_config_exclude
|
|
471
458
|
prune_config[:exclude] || {}
|
|
472
459
|
end
|
|
473
|
-
|
|
474
460
|
end
|
|
475
|
-
|
|
476
461
|
end
|
|
477
462
|
|
|
478
463
|
runner Nanoc::CLI::Commands::Compile
|
|
@@ -11,9 +11,7 @@ EOS
|
|
|
11
11
|
required :c, :vcs, 'specify the VCS to use'
|
|
12
12
|
|
|
13
13
|
module Nanoc::CLI::Commands
|
|
14
|
-
|
|
15
14
|
class CreateItem < ::Nanoc::CLI::CommandRunner
|
|
16
|
-
|
|
17
15
|
def run
|
|
18
16
|
# Check arguments
|
|
19
17
|
if arguments.length != 1
|
|
@@ -45,15 +43,13 @@ module Nanoc::CLI::Commands
|
|
|
45
43
|
data_source = site.data_sources[0]
|
|
46
44
|
data_source.create_item(
|
|
47
45
|
"Hi, I'm a new item!\n",
|
|
48
|
-
{ :
|
|
46
|
+
{ title: 'A New Item' },
|
|
49
47
|
identifier
|
|
50
48
|
)
|
|
51
49
|
|
|
52
50
|
puts "An item has been created at #{identifier}."
|
|
53
51
|
end
|
|
54
|
-
|
|
55
52
|
end
|
|
56
|
-
|
|
57
53
|
end
|
|
58
54
|
|
|
59
55
|
runner Nanoc::CLI::Commands::CreateItem
|
|
@@ -9,9 +9,7 @@ configuration will be used.
|
|
|
9
9
|
EOS
|
|
10
10
|
|
|
11
11
|
module Nanoc::CLI::Commands
|
|
12
|
-
|
|
13
12
|
class CreateLayout < ::Nanoc::CLI::CommandRunner
|
|
14
|
-
|
|
15
13
|
def run
|
|
16
14
|
# Check arguments
|
|
17
15
|
if arguments.length != 1
|
|
@@ -64,9 +62,7 @@ module Nanoc::CLI::Commands
|
|
|
64
62
|
|
|
65
63
|
puts "A layout has been created at #{identifier}."
|
|
66
64
|
end
|
|
67
|
-
|
|
68
65
|
end
|
|
69
|
-
|
|
70
66
|
end
|
|
71
67
|
|
|
72
68
|
runner Nanoc::CLI::Commands::CreateLayout
|
|
@@ -10,18 +10,14 @@ Create a new site at the given path. The site will use the `filesystem_unified`
|
|
|
10
10
|
required :d, :datasource, 'specify the data source for the new site'
|
|
11
11
|
|
|
12
12
|
module Nanoc::CLI::Commands
|
|
13
|
-
|
|
14
13
|
class CreateSite < ::Nanoc::CLI::CommandRunner
|
|
15
|
-
|
|
16
14
|
class << self
|
|
17
|
-
|
|
18
15
|
protected
|
|
19
16
|
|
|
20
17
|
# Converts the given array to YAML format
|
|
21
18
|
def array_to_yaml(array)
|
|
22
19
|
'[ ' + array.map { |s| "'" + s + "'" }.join(', ') + ' ]'
|
|
23
20
|
end
|
|
24
|
-
|
|
25
21
|
end
|
|
26
22
|
|
|
27
23
|
DEFAULT_CONFIG = <<EOS unless defined? DEFAULT_CONFIG
|
|
@@ -370,7 +366,7 @@ EOS
|
|
|
370
366
|
# Create home page
|
|
371
367
|
data_source.create_item(
|
|
372
368
|
DEFAULT_ITEM,
|
|
373
|
-
{ :
|
|
369
|
+
{ title: 'Home' },
|
|
374
370
|
'/'
|
|
375
371
|
)
|
|
376
372
|
|
|
@@ -379,7 +375,7 @@ EOS
|
|
|
379
375
|
DEFAULT_STYLESHEET,
|
|
380
376
|
{},
|
|
381
377
|
'/stylesheet/',
|
|
382
|
-
:
|
|
378
|
+
extension: '.css'
|
|
383
379
|
)
|
|
384
380
|
|
|
385
381
|
# Create layout
|
|
@@ -396,9 +392,7 @@ EOS
|
|
|
396
392
|
io.write "\# before nanoc starts compiling.\n"
|
|
397
393
|
end
|
|
398
394
|
end
|
|
399
|
-
|
|
400
395
|
end
|
|
401
|
-
|
|
402
396
|
end
|
|
403
397
|
|
|
404
398
|
runner Nanoc::CLI::Commands::CreateSite
|
|
@@ -6,23 +6,21 @@ description "
|
|
|
6
6
|
Deploys the compiled site. The compiled site contents in the output directory will be uploaded to the destination, which is specified using the `--target` option.
|
|
7
7
|
"
|
|
8
8
|
|
|
9
|
-
option :t, :target, 'specify the location to deploy to (default: `default`)', :
|
|
9
|
+
option :t, :target, 'specify the location to deploy to (default: `default`)', argument: :required
|
|
10
10
|
flag :C, :'no-check', 'do not run the issue checks marked for deployment'
|
|
11
11
|
flag :L, :list, 'list available locations to deploy to'
|
|
12
12
|
flag :D, :'list-deployers', 'list available deployers'
|
|
13
13
|
option :n, :'dry-run', 'show what would be deployed'
|
|
14
14
|
|
|
15
15
|
module Nanoc::CLI::Commands
|
|
16
|
-
|
|
17
16
|
class Deploy < ::Nanoc::CLI::CommandRunner
|
|
18
|
-
|
|
19
17
|
def run
|
|
20
18
|
load_site
|
|
21
19
|
|
|
22
20
|
# List deployers
|
|
23
21
|
if options[:'list-deployers']
|
|
24
22
|
deployers = Nanoc::PluginRegistry.instance.find_all(Nanoc::Extra::Deployer)
|
|
25
|
-
deployer_names = deployers.keys.sort_by
|
|
23
|
+
deployer_names = deployers.keys.sort_by(&:to_s)
|
|
26
24
|
puts 'Available deployers:'
|
|
27
25
|
deployer_names.each do |name|
|
|
28
26
|
puts " #{name}"
|
|
@@ -85,12 +83,10 @@ module Nanoc::CLI::Commands
|
|
|
85
83
|
deployer = deployer_class.new(
|
|
86
84
|
site.config[:output_dir],
|
|
87
85
|
config,
|
|
88
|
-
:
|
|
86
|
+
dry_run: options[:'dry-run'])
|
|
89
87
|
deployer.run
|
|
90
88
|
end
|
|
91
|
-
|
|
92
89
|
end
|
|
93
|
-
|
|
94
90
|
end
|
|
95
91
|
|
|
96
92
|
runner Nanoc::CLI::Commands::Deploy
|
|
@@ -15,16 +15,14 @@ flag :y, :yes, 'confirm deletion'
|
|
|
15
15
|
flag :n, :'dry-run', 'print files to be deleted instead of actually deleting them'
|
|
16
16
|
|
|
17
17
|
module Nanoc::CLI::Commands
|
|
18
|
-
|
|
19
18
|
class Prune < ::Nanoc::CLI::CommandRunner
|
|
20
|
-
|
|
21
19
|
def run
|
|
22
20
|
load_site
|
|
23
21
|
|
|
24
22
|
if options.key?(:yes)
|
|
25
|
-
Nanoc::Extra::Pruner.new(site, :
|
|
23
|
+
Nanoc::Extra::Pruner.new(site, exclude: prune_config_exclude).run
|
|
26
24
|
elsif options.key?(:'dry-run')
|
|
27
|
-
Nanoc::Extra::Pruner.new(site, :
|
|
25
|
+
Nanoc::Extra::Pruner.new(site, exclude: prune_config_exclude, dry_run: true).run
|
|
28
26
|
else
|
|
29
27
|
$stderr.puts 'WARNING: Since the prune command is a destructive command, it requires an additional --yes flag in order to work.'
|
|
30
28
|
$stderr.puts
|
|
@@ -42,9 +40,7 @@ module Nanoc::CLI::Commands
|
|
|
42
40
|
def prune_config_exclude
|
|
43
41
|
prune_config[:exclude] || {}
|
|
44
42
|
end
|
|
45
|
-
|
|
46
43
|
end
|
|
47
|
-
|
|
48
44
|
end
|
|
49
45
|
|
|
50
46
|
runner Nanoc::CLI::Commands::Prune
|
|
@@ -8,9 +8,7 @@ Open an IRB shell on a context that contains @items, @layouts, @config and @site
|
|
|
8
8
|
"
|
|
9
9
|
|
|
10
10
|
module Nanoc::CLI::Commands
|
|
11
|
-
|
|
12
11
|
class Shell < ::Nanoc::CLI::CommandRunner
|
|
13
|
-
|
|
14
12
|
def run
|
|
15
13
|
require 'pry'
|
|
16
14
|
|
|
@@ -23,15 +21,13 @@ module Nanoc::CLI::Commands
|
|
|
23
21
|
|
|
24
22
|
def env
|
|
25
23
|
{
|
|
26
|
-
:
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
:
|
|
24
|
+
site: site,
|
|
25
|
+
items: site.items,
|
|
26
|
+
layouts: site.layouts,
|
|
27
|
+
config: site.config
|
|
30
28
|
}
|
|
31
29
|
end
|
|
32
|
-
|
|
33
30
|
end
|
|
34
|
-
|
|
35
31
|
end
|
|
36
32
|
|
|
37
33
|
runner Nanoc::CLI::Commands::Shell
|