nanoc 3.7.3 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +71 -46
- data/NEWS.md +14 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +11 -10
- data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
- data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
- data/lib/nanoc/base/compilation/rule.rb +1 -1
- data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
- data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
- data/lib/nanoc/base/context.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/date.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -1
- data/lib/nanoc/base/directed_graph.rb +3 -3
- data/lib/nanoc/base/memoization.rb +1 -1
- data/lib/nanoc/base/notification_center.rb +1 -1
- data/lib/nanoc/base/ordered_hash.rb +1 -1
- data/lib/nanoc/base/plugin_registry.rb +3 -3
- data/lib/nanoc/base/result_data/item_rep.rb +13 -11
- data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
- data/lib/nanoc/base/source_data/data_source.rb +3 -3
- data/lib/nanoc/base/source_data/item.rb +8 -8
- data/lib/nanoc/base/source_data/item_array.rb +1 -1
- data/lib/nanoc/base/source_data/layout.rb +1 -1
- data/lib/nanoc/base/source_data/site.rb +27 -18
- data/lib/nanoc/base/store.rb +3 -3
- data/lib/nanoc/base/temp_filename_factory.rb +2 -2
- data/lib/nanoc/cli.rb +6 -6
- data/lib/nanoc/cli/cleaning_stream.rb +1 -1
- data/lib/nanoc/cli/command_runner.rb +4 -3
- data/lib/nanoc/cli/commands/autocompile.rb +3 -3
- data/lib/nanoc/cli/commands/check.rb +3 -3
- data/lib/nanoc/cli/commands/compile.rb +23 -23
- data/lib/nanoc/cli/commands/create-item.rb +5 -5
- data/lib/nanoc/cli/commands/create-layout.rb +14 -14
- data/lib/nanoc/cli/commands/create-site.rb +6 -6
- data/lib/nanoc/cli/commands/deploy.rb +8 -8
- data/lib/nanoc/cli/commands/nanoc.rb +3 -3
- data/lib/nanoc/cli/commands/prune.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +4 -4
- data/lib/nanoc/cli/commands/show-data.rb +5 -5
- data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
- data/lib/nanoc/cli/commands/show-rules.rb +4 -4
- data/lib/nanoc/cli/commands/sync.rb +1 -1
- data/lib/nanoc/cli/commands/update.rb +13 -13
- data/lib/nanoc/cli/commands/validate-css.rb +3 -3
- data/lib/nanoc/cli/commands/validate-html.rb +3 -3
- data/lib/nanoc/cli/commands/validate-links.rb +6 -6
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/commands/watch.rb +11 -11
- data/lib/nanoc/cli/error_handler.rb +10 -10
- data/lib/nanoc/cli/logger.rb +1 -1
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
- data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +16 -16
- data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
- data/lib/nanoc/data_sources/static.rb +1 -1
- data/lib/nanoc/extra/auto_compiler.rb +2 -2
- data/lib/nanoc/extra/checking/check.rb +11 -1
- data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
- data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
- data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
- data/lib/nanoc/extra/checking/runner.rb +10 -9
- data/lib/nanoc/extra/chick.rb +2 -2
- data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
- data/lib/nanoc/extra/deployers/fog.rb +2 -2
- data/lib/nanoc/extra/deployers/rsync.rb +3 -3
- data/lib/nanoc/extra/file_proxy.rb +3 -3
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
- data/lib/nanoc/extra/link_collector.rb +3 -3
- data/lib/nanoc/extra/piper.rb +2 -2
- data/lib/nanoc/extra/pruner.rb +4 -3
- data/lib/nanoc/extra/validators/links.rb +2 -2
- data/lib/nanoc/extra/validators/w3c.rb +1 -1
- data/lib/nanoc/extra/vcs.rb +5 -5
- data/lib/nanoc/extra/vcses/dummy.rb +1 -1
- data/lib/nanoc/filters/asciidoc.rb +1 -1
- data/lib/nanoc/filters/bluecloth.rb +1 -1
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +19 -21
- data/lib/nanoc/filters/erubis.rb +1 -1
- data/lib/nanoc/filters/handlebars.rb +1 -1
- data/lib/nanoc/filters/less.rb +2 -2
- data/lib/nanoc/filters/markaby.rb +1 -1
- data/lib/nanoc/filters/mustache.rb +1 -1
- data/lib/nanoc/filters/rdoc.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +5 -5
- data/lib/nanoc/filters/rubypants.rb +1 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/filters/typogruby.rb +1 -1
- data/lib/nanoc/filters/xsl.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +12 -12
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/helpers/html_escape.rb +6 -6
- data/lib/nanoc/helpers/tagging.rb +1 -1
- data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/tasks/clean.rb +1 -1
- data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +1 -0
- data/test/base/core_ext/array_spec.rb +7 -7
- data/test/base/core_ext/hash_spec.rb +1 -1
- data/test/base/test_checksum_store.rb +1 -1
- data/test/base/test_compiler.rb +14 -14
- data/test/base/test_compiler_dsl.rb +13 -13
- data/test/base/test_context.rb +2 -2
- data/test/base/test_dependency_tracker.rb +42 -42
- data/test/base/test_directed_graph.rb +102 -102
- data/test/base/test_item.rb +21 -21
- data/test/base/test_item_array.rb +19 -19
- data/test/base/test_item_rep.rb +50 -50
- data/test/base/test_layout.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +2 -2
- data/test/base/test_rule_context.rb +2 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +7 -7
- data/test/cli/commands/test_create_site.rb +2 -2
- data/test/cli/commands/test_deploy.rb +10 -10
- data/test/cli/commands/test_prune.rb +2 -2
- data/test/cli/commands/test_sync.rb +1 -1
- data/test/cli/commands/test_watch.rb +7 -7
- data/test/cli/test_cleaning_stream.rb +4 -4
- data/test/cli/test_cli.rb +3 -3
- data/test/cli/test_error_handler.rb +3 -3
- data/test/data_sources/test_filesystem.rb +19 -19
- data/test/data_sources/test_filesystem_unified.rb +30 -30
- data/test/data_sources/test_filesystem_verbose.rb +3 -3
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +8 -8
- data/test/extra/checking/test_check.rb +11 -1
- data/test/extra/checking/test_dsl.rb +1 -1
- data/test/extra/core_ext/test_enumerable.rb +2 -2
- data/test/extra/deployers/test_fog.rb +10 -10
- data/test/extra/deployers/test_rsync.rb +2 -2
- data/test/extra/test_auto_compiler.rb +28 -28
- data/test/extra/test_filesystem_tools.rb +3 -3
- data/test/extra/test_link_collector.rb +39 -20
- data/test/extra/validators/test_w3c.rb +5 -5
- data/test/filters/test_asciidoc.rb +2 -2
- data/test/filters/test_bluecloth.rb +1 -1
- data/test/filters/test_coffeescript.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +20 -13
- data/test/filters/test_erb.rb +1 -1
- data/test/filters/test_kramdown.rb +1 -1
- data/test/filters/test_less.rb +10 -10
- data/test/filters/test_markaby.rb +2 -2
- data/test/filters/test_maruku.rb +2 -2
- data/test/filters/test_pandoc.rb +3 -3
- data/test/filters/test_rainpress.rb +4 -4
- data/test/filters/test_rdiscount.rb +2 -2
- data/test/filters/test_rdoc.rb +1 -1
- data/test/filters/test_redcarpet.rb +5 -5
- data/test/filters/test_redcloth.rb +5 -5
- data/test/filters/test_relativize_paths.rb +33 -31
- data/test/filters/test_rubypants.rb +2 -2
- data/test/filters/test_sass.rb +8 -8
- data/test/filters/test_slim.rb +3 -3
- data/test/filters/test_uglify_js.rb +1 -1
- data/test/filters/test_yui_compressor.rb +3 -3
- data/test/gem_loader.rb +1 -1
- data/test/helper.rb +14 -16
- data/test/helpers/test_blogging.rb +28 -28
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +7 -7
- data/test/helpers/test_filtering.rb +16 -16
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +1 -1
- data/test/helpers/test_tagging.rb +11 -11
- data/test/helpers/test_xml_sitemap.rb +18 -18
- data/test/tasks/test_clean.rb +8 -8
- metadata +2 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
aliases
|
5
|
-
summary
|
3
|
+
usage 'create-site [options] path'
|
4
|
+
aliases :create_site, :cs
|
5
|
+
summary 'create a site'
|
6
6
|
description "
|
7
7
|
Create a new site at the given path. The site will use the `filesystem_unified` data source by default, but this can be changed using the `--datasource` commandline option.
|
8
8
|
"
|
@@ -15,7 +15,7 @@ module Nanoc::CLI::Commands
|
|
15
15
|
|
16
16
|
class << self
|
17
17
|
|
18
|
-
|
18
|
+
protected
|
19
19
|
|
20
20
|
# Converts the given array to YAML format
|
21
21
|
def array_to_yaml(array)
|
@@ -329,11 +329,11 @@ EOS
|
|
329
329
|
puts "Created a blank nanoc site at '#{path}'. Enjoy!"
|
330
330
|
end
|
331
331
|
|
332
|
-
|
332
|
+
protected
|
333
333
|
|
334
334
|
# Creates a configuration file and a output directory for this site, as
|
335
335
|
# well as a rakefile that loads the standard nanoc tasks.
|
336
|
-
def site_create_minimal(
|
336
|
+
def site_create_minimal(_data_source)
|
337
337
|
# Create output
|
338
338
|
FileUtils.mkdir_p('output')
|
339
339
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
summary
|
3
|
+
usage 'deploy [options]'
|
4
|
+
summary 'deploy the compiled site'
|
5
5
|
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
9
|
option :t, :target, 'specify the location to deploy to (default: `default`)', :argument => :required
|
10
|
-
flag
|
11
|
-
flag
|
12
|
-
flag
|
10
|
+
flag :C, :'no-check', 'do not run the issue checks marked for deployment'
|
11
|
+
flag :L, :list, 'list available locations to deploy to'
|
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
|
@@ -35,7 +35,7 @@ module Nanoc::CLI::Commands
|
|
35
35
|
|
36
36
|
if options[:list]
|
37
37
|
if deploy_configs.empty?
|
38
|
-
puts
|
38
|
+
puts 'No deployment configurations.'
|
39
39
|
else
|
40
40
|
puts 'Available deployment configurations:'
|
41
41
|
deploy_configs.keys.each do |name|
|
@@ -70,10 +70,10 @@ module Nanoc::CLI::Commands
|
|
70
70
|
# Check
|
71
71
|
unless options[:'no-check']
|
72
72
|
runner = Nanoc::Extra::Checking::Runner.new(site)
|
73
|
-
if runner.
|
73
|
+
if runner.dsl_present?
|
74
74
|
puts 'Running issue checks…'
|
75
75
|
ok = runner.run_for_deploy
|
76
|
-
|
76
|
+
unless ok
|
77
77
|
puts 'Issues found, deploy aborted.'
|
78
78
|
return
|
79
79
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
3
|
+
usage 'nanoc command [options] [arguments]'
|
4
4
|
summary 'nanoc, a static site compiler written in Ruby'
|
5
5
|
|
6
6
|
opt :l, :color, 'enable color' do
|
@@ -12,7 +12,7 @@ opt :d, :debug, 'enable debugging' do
|
|
12
12
|
Nanoc::CLI.debug = true
|
13
13
|
end
|
14
14
|
|
15
|
-
opt :h, :help, 'show the help message and quit' do |
|
15
|
+
opt :h, :help, 'show the help message and quit' do |_value, cmd|
|
16
16
|
puts cmd.help
|
17
17
|
exit 0
|
18
18
|
end
|
@@ -35,6 +35,6 @@ opt :w, :warn, 'enable warnings' do
|
|
35
35
|
$-w = true
|
36
36
|
end
|
37
37
|
|
38
|
-
run do |
|
38
|
+
run do |_opts, _args, cmd|
|
39
39
|
cmd.command_named('compile').run([])
|
40
40
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
summary
|
3
|
+
usage 'prune'
|
4
|
+
summary 'remove files not managed by nanoc from the output directory'
|
5
5
|
description <<-EOS
|
6
6
|
Find all files in the output directory that do not correspond to an item
|
7
7
|
managed by nanoc and remove them. Since this is a hazardous operation, an
|
@@ -33,7 +33,7 @@ module Nanoc::CLI::Commands
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
protected
|
37
37
|
|
38
38
|
def prune_config
|
39
39
|
site.config[:prune] || {}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
summary
|
5
|
-
aliases
|
3
|
+
usage 'shell'
|
4
|
+
summary 'open a shell on the nanoc environment'
|
5
|
+
aliases 'console'
|
6
6
|
description "
|
7
7
|
Open an IRB shell on a context that contains @items, @layouts, @config and @site.
|
8
8
|
"
|
@@ -19,7 +19,7 @@ module Nanoc::CLI::Commands
|
|
19
19
|
Nanoc::Context.new(env).pry
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
protected
|
23
23
|
|
24
24
|
def env
|
25
25
|
{
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
aliases
|
5
|
-
summary
|
3
|
+
usage 'show-data'
|
4
|
+
aliases :debug
|
5
|
+
summary 'show data in this site'
|
6
6
|
description <<-EOS
|
7
7
|
Show information about all items, item representations and layouts in the
|
8
8
|
current site, along with dependency information.
|
@@ -31,7 +31,7 @@ module Nanoc::CLI::Commands
|
|
31
31
|
print_layouts(layouts, compiler)
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
protected
|
35
35
|
|
36
36
|
def sorted_with_prev(objects)
|
37
37
|
prev = nil
|
@@ -89,7 +89,7 @@ module Nanoc::CLI::Commands
|
|
89
89
|
end
|
90
90
|
length = rep.raw_paths.keys.map { |s| s.to_s.length }.max
|
91
91
|
rep.raw_paths.each do |snapshot_name, raw_path|
|
92
|
-
puts " [ %-#{length}s ] %s" % [
|
92
|
+
puts " [ %-#{length}s ] %s" % [snapshot_name, raw_path]
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
summary
|
4
|
-
aliases
|
5
|
-
usage
|
3
|
+
summary 'show all available plugins'
|
4
|
+
aliases :info
|
5
|
+
usage 'show-plugins [options]'
|
6
6
|
description <<-EOS
|
7
7
|
Show a list of available plugins, including filters, data sources and VCSes.
|
8
8
|
If the current directory contains a nanoc web site, the plugins defined in this site will be shown as well.
|
@@ -45,7 +45,7 @@ module Nanoc::CLI::Commands
|
|
45
45
|
puts
|
46
46
|
|
47
47
|
# Print plugins organised by subtype
|
48
|
-
[
|
48
|
+
[:builtin, :custom].each do |type|
|
49
49
|
# Find relevant plugins
|
50
50
|
relevant_plugins = plugins_with_this_superclass[type]
|
51
51
|
|
@@ -71,7 +71,7 @@ module Nanoc::CLI::Commands
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
|
74
|
+
private
|
75
75
|
|
76
76
|
PLUGIN_CLASS_ORDER = [
|
77
77
|
Nanoc::Filter,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
aliases
|
5
|
-
summary
|
3
|
+
usage 'show-rules [thing]'
|
4
|
+
aliases :explain
|
5
|
+
summary 'describe the rules for each item'
|
6
6
|
description "
|
7
7
|
Prints the rules used for all items and layouts in the current site.
|
8
8
|
"
|
@@ -25,7 +25,7 @@ module Nanoc::CLI::Commands
|
|
25
25
|
site.layouts.each { |l| explain_layout(l) }
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
protected
|
29
29
|
|
30
30
|
def explain_item(item)
|
31
31
|
puts "#{@c.c('Item ' + item.identifier, :bold, :yellow)}:"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
3
|
+
usage 'update [options]'
|
4
4
|
summary 'update the data stored by the data source to a newer version'
|
5
5
|
description <<-EOS
|
6
6
|
Update the data stored by the data source to a newer format. The format in
|
@@ -13,7 +13,7 @@ backup in case something goes wrong.
|
|
13
13
|
EOS
|
14
14
|
|
15
15
|
required :c, :vcs, 'select the VCS to use'
|
16
|
-
flag
|
16
|
+
flag :y, :yes, 'update the data without warning'
|
17
17
|
|
18
18
|
module Nanoc::CLI::Commands
|
19
19
|
|
@@ -37,21 +37,21 @@ module Nanoc::CLI::Commands
|
|
37
37
|
$stderr.puts '** WARNING **'
|
38
38
|
$stderr.puts '*************'
|
39
39
|
$stderr.puts
|
40
|
-
$stderr.puts 'Are you absolutely sure you want to update the '
|
41
|
-
'content for this site? Updating the site content '
|
42
|
-
'will change the structure of existing data. This '
|
43
|
-
'operation is destructive and cannot be reverted. '
|
44
|
-
'Please do not interrupt this operation; doing so can '
|
45
|
-
'result in data loss. As always, consider making a '
|
40
|
+
$stderr.puts 'Are you absolutely sure you want to update the ' \
|
41
|
+
'content for this site? Updating the site content ' \
|
42
|
+
'will change the structure of existing data. This ' \
|
43
|
+
'operation is destructive and cannot be reverted. ' \
|
44
|
+
'Please do not interrupt this operation; doing so can ' \
|
45
|
+
'result in data loss. As always, consider making a ' \
|
46
46
|
'backup copy.'
|
47
47
|
$stderr.puts
|
48
|
-
$stderr.puts 'If this nanoc site is versioned using a VCS '
|
49
|
-
'supported by nanoc, consider using the --vcs option '
|
50
|
-
'to have nanoc perform add/delete/move operations '
|
51
|
-
'using the specified VCS. To get a list of VCSes '
|
48
|
+
$stderr.puts 'If this nanoc site is versioned using a VCS ' \
|
49
|
+
'supported by nanoc, consider using the --vcs option ' \
|
50
|
+
'to have nanoc perform add/delete/move operations ' \
|
51
|
+
'using the specified VCS. To get a list of VCSes ' \
|
52
52
|
'supported by nanoc, issue the "info" command.'
|
53
53
|
$stderr.puts
|
54
|
-
$stderr.puts 'To continue, use the -y/--yes option, like "nanoc '
|
54
|
+
$stderr.puts 'To continue, use the -y/--yes option, like "nanoc ' \
|
55
55
|
'update -y".'
|
56
56
|
exit 1
|
57
57
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
aliases
|
5
|
-
summary
|
3
|
+
usage 'validate-css [options]'
|
4
|
+
aliases :validate_css, :vcss
|
5
|
+
summary 'validate the site’s CSS'
|
6
6
|
be_hidden
|
7
7
|
description "
|
8
8
|
Validates the site’s CSS files.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
aliases
|
5
|
-
summary
|
3
|
+
usage 'validate-html [options]'
|
4
|
+
aliases :validate_html, :vhtml
|
5
|
+
summary 'validate the site’s HTML'
|
6
6
|
be_hidden
|
7
7
|
description "
|
8
8
|
Validates the site’s HTML files.
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
aliases
|
5
|
-
summary
|
3
|
+
usage 'validate-links [options]'
|
4
|
+
aliases :validate_links, :vlink
|
5
|
+
summary 'validate links in site'
|
6
6
|
be_hidden
|
7
7
|
description "
|
8
8
|
Validates the site’s links. By default, both internal and external links will be checked.
|
9
9
|
"
|
10
10
|
|
11
|
-
flag
|
12
|
-
flag
|
11
|
+
flag :i, :internal, 'validate internal links only'
|
12
|
+
flag :e, :external, 'validate external links only'
|
13
13
|
|
14
14
|
module Nanoc::CLI::Commands
|
15
15
|
|
@@ -21,7 +21,7 @@ module Nanoc::CLI::Commands
|
|
21
21
|
checks = []
|
22
22
|
checks << 'ilinks' if options[:internal]
|
23
23
|
checks << 'elinks' if options[:external]
|
24
|
-
Nanoc::CLI.run [
|
24
|
+
Nanoc::CLI.run ['check', checks].flatten
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
summary
|
3
|
+
usage 'view [options]'
|
4
|
+
summary 'start the web server that serves static files'
|
5
5
|
description <<-EOS
|
6
6
|
Start the static web server. Unless specified, the web server will run on port
|
7
7
|
3000 and listen on all IP addresses. Running this static web server requires
|
@@ -57,7 +57,7 @@ module Nanoc::CLI::Commands
|
|
57
57
|
handler.run(app, options_for_rack)
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
protected
|
61
61
|
|
62
62
|
def load_adsf
|
63
63
|
# Load adsf
|
@@ -66,7 +66,7 @@ module Nanoc::CLI::Commands
|
|
66
66
|
return
|
67
67
|
rescue LoadError
|
68
68
|
$stderr.puts "Could not find the required 'adsf' gem, " \
|
69
|
-
|
69
|
+
'which is necessary for the view command.'
|
70
70
|
end
|
71
71
|
|
72
72
|
# Check asdf
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
usage
|
4
|
-
summary
|
3
|
+
usage 'watch [options]'
|
4
|
+
summary 'start the watcher'
|
5
5
|
be_hidden
|
6
6
|
description <<-EOS
|
7
7
|
Start the watcher. When a change is detected, the site will be recompiled.
|
@@ -114,25 +114,25 @@ module Nanoc::CLI::Commands
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
|
117
|
+
protected
|
118
118
|
|
119
|
-
def
|
119
|
+
def nix_tool_present?(tool)
|
120
120
|
!`which #{tool}`.empty?
|
121
121
|
rescue Errno::ENOENT
|
122
122
|
false
|
123
123
|
end
|
124
124
|
|
125
|
-
def
|
125
|
+
def windows_tool_present?(tool)
|
126
126
|
!`where #{tool} 2> nul`.empty?
|
127
127
|
rescue Errno::ENOENT
|
128
128
|
false
|
129
129
|
end
|
130
130
|
|
131
|
-
def
|
131
|
+
def tool_present?(tool)
|
132
132
|
if self.on_windows?
|
133
|
-
self.
|
133
|
+
self.windows_tool_present?(tool)
|
134
134
|
else
|
135
|
-
self.
|
135
|
+
self.nix_tool_present?(tool)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -141,7 +141,7 @@ module Nanoc::CLI::Commands
|
|
141
141
|
require 'terminal-notifier'
|
142
142
|
'terminal-notify'
|
143
143
|
rescue LoadError
|
144
|
-
TOOLS.find { |t|
|
144
|
+
TOOLS.find { |t| tool_present?(t) }
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
@@ -150,7 +150,7 @@ module Nanoc::CLI::Commands
|
|
150
150
|
end
|
151
151
|
|
152
152
|
def growlnotify_cmd_for(message)
|
153
|
-
[
|
153
|
+
['growlnotify', '-m', message]
|
154
154
|
end
|
155
155
|
|
156
156
|
def growlnotify(message)
|
@@ -158,7 +158,7 @@ module Nanoc::CLI::Commands
|
|
158
158
|
end
|
159
159
|
|
160
160
|
def growlnotify_windows_cmd_for(message)
|
161
|
-
[
|
161
|
+
['growlnotify', '/t:nanoc', message]
|
162
162
|
end
|
163
163
|
|
164
164
|
def growlnotify_windows(message)
|
@@ -50,7 +50,7 @@ module Nanoc::CLI
|
|
50
50
|
# @return [void]
|
51
51
|
#
|
52
52
|
# @api private
|
53
|
-
def handle_while(&
|
53
|
+
def handle_while(&_block)
|
54
54
|
# Set exit handler
|
55
55
|
%w( INT TERM ).each do |signal|
|
56
56
|
Signal.trap(signal) do
|
@@ -157,7 +157,7 @@ module Nanoc::CLI
|
|
157
157
|
write_load_paths(stream, :verbose => true)
|
158
158
|
end
|
159
159
|
|
160
|
-
|
160
|
+
protected
|
161
161
|
|
162
162
|
# @return [Boolean] true if debug output is enabled, false if not
|
163
163
|
#
|
@@ -184,7 +184,7 @@ module Nanoc::CLI
|
|
184
184
|
# @return [Hash<String, Array>] A hash containing the gem names as keys and gem versions as value
|
185
185
|
def gems_and_versions
|
186
186
|
gems = {}
|
187
|
-
Gem::Specification.find_all.sort_by { |s| [
|
187
|
+
Gem::Specification.find_all.sort_by { |s| [s.name, s.version] }.each do |spec|
|
188
188
|
gems[spec.name] ||= []
|
189
189
|
gems[spec.name] << spec.version.to_s
|
190
190
|
end
|
@@ -248,11 +248,11 @@ module Nanoc::CLI
|
|
248
248
|
end
|
249
249
|
when RuntimeError
|
250
250
|
if error.message =~ /^can't modify frozen/
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
251
|
+
'You attempted to modify immutable data. Some data, such as ' \
|
252
|
+
'item/layout attributes and raw item/layout content, can not ' \
|
253
|
+
'be modified once compilation has started. (This was ' \
|
254
|
+
'unintentionally possible in 3.1.x and before, but has been ' \
|
255
|
+
'disabled in 3.2.x in order to allow compiler optimisations.)'
|
256
256
|
end
|
257
257
|
end
|
258
258
|
end
|
@@ -279,7 +279,7 @@ module Nanoc::CLI
|
|
279
279
|
stream.puts "#{resolution}" if resolution
|
280
280
|
end
|
281
281
|
|
282
|
-
def write_compilation_stack(stream,
|
282
|
+
def write_compilation_stack(stream, _error, params = {})
|
283
283
|
write_section_header(stream, 'Compilation stack', params)
|
284
284
|
|
285
285
|
if stack.empty?
|
@@ -309,7 +309,7 @@ module Nanoc::CLI
|
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
-
def write_issue_link(stream,
|
312
|
+
def write_issue_link(stream, _params = {})
|
313
313
|
stream.puts
|
314
314
|
stream.puts 'If you believe this is a bug in nanoc, please do report it at'
|
315
315
|
stream.puts '-> https://github.com/nanoc/nanoc/issues/new <-'
|