nanoc 4.11.14 → 4.11.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +16 -0
  3. data/lib/nanoc.rb +4 -2
  4. data/lib/nanoc/data_sources/filesystem.rb +9 -3
  5. data/lib/nanoc/extra.rb +1 -0
  6. data/lib/nanoc/extra/core_ext.rb +0 -1
  7. data/lib/nanoc/extra/srcset_parser.rb +79 -0
  8. data/lib/nanoc/filters/erb.rb +1 -5
  9. data/lib/nanoc/filters/relativize_paths.rb +62 -10
  10. data/lib/nanoc/helpers/rendering.rb +5 -4
  11. data/lib/nanoc/orig_cli.rb +0 -5
  12. data/lib/nanoc/rule_dsl.rb +1 -0
  13. data/lib/nanoc/rule_dsl/action_provider.rb +1 -1
  14. data/lib/nanoc/rule_dsl/compiler_dsl.rb +1 -1
  15. data/lib/nanoc/rule_dsl/errors.rb +25 -0
  16. data/lib/nanoc/rule_dsl/rules_loader.rb +1 -1
  17. data/lib/nanoc/version.rb +1 -1
  18. metadata +37 -33
  19. data/lib/nanoc/base.rb +0 -13
  20. data/lib/nanoc/base/changes_stream.rb +0 -53
  21. data/lib/nanoc/base/errors.rb +0 -65
  22. data/lib/nanoc/checking.rb +0 -14
  23. data/lib/nanoc/checking/check.rb +0 -93
  24. data/lib/nanoc/checking/checks.rb +0 -14
  25. data/lib/nanoc/checking/checks/css.rb +0 -16
  26. data/lib/nanoc/checking/checks/external_links.rb +0 -151
  27. data/lib/nanoc/checking/checks/html.rb +0 -16
  28. data/lib/nanoc/checking/checks/internal_links.rb +0 -95
  29. data/lib/nanoc/checking/checks/mixed_content.rb +0 -37
  30. data/lib/nanoc/checking/checks/stale.rb +0 -41
  31. data/lib/nanoc/checking/checks/w3c_validator.rb +0 -31
  32. data/lib/nanoc/checking/dsl.rb +0 -27
  33. data/lib/nanoc/checking/issue.rb +0 -16
  34. data/lib/nanoc/checking/loader.rb +0 -50
  35. data/lib/nanoc/checking/runner.rb +0 -136
  36. data/lib/nanoc/deploying.rb +0 -10
  37. data/lib/nanoc/deploying/deployer.rb +0 -45
  38. data/lib/nanoc/deploying/deployers.rb +0 -11
  39. data/lib/nanoc/deploying/deployers/fog.rb +0 -220
  40. data/lib/nanoc/deploying/deployers/git.rb +0 -112
  41. data/lib/nanoc/deploying/deployers/rsync.rb +0 -68
  42. data/lib/nanoc/extra/core_ext/pathname.rb +0 -27
  43. data/lib/nanoc/orig_cli/commands/check.rb +0 -43
  44. data/lib/nanoc/orig_cli/commands/deploy.rb +0 -126
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::Extra
4
- # @api private
5
- module PathnameExtensions
6
- def __nanoc_components
7
- components = []
8
- tmp = self
9
- loop do
10
- old = tmp
11
- components << File.basename(tmp)
12
- tmp = File.dirname(tmp)
13
- break if old == tmp
14
- end
15
- components.reverse
16
- end
17
-
18
- def __nanoc_include_component?(component)
19
- __nanoc_components.include?(component)
20
- end
21
- end
22
- end
23
-
24
- # @api private
25
- class ::Pathname
26
- include ::Nanoc::Extra::PathnameExtensions
27
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- usage 'check [options] [names]'
4
- summary 'run issue checks'
5
- description "
6
- Run issue checks on the current site. If the `--all` option is passed, all available issue checks will be run. By default, the issue checks marked for deployment will be run.
7
- "
8
-
9
- flag :a, :all, 'run all checks'
10
- flag :L, :list, 'list all checks'
11
- flag :d, :deploy, '(deprecated)'
12
-
13
- module Nanoc::OrigCLI::Commands
14
- class Check < ::Nanoc::CLI::CommandRunner
15
- def run
16
- site = load_site
17
-
18
- runner = Nanoc::Checking::Runner.new(site)
19
-
20
- if options[:list]
21
- runner.list_checks
22
- return
23
- end
24
-
25
- success =
26
- if options[:all]
27
- runner.run_all
28
- elsif options[:deploy]
29
- runner.run_for_deploy
30
- elsif arguments.any?
31
- runner.run_specific(arguments)
32
- else
33
- runner.run_for_deploy
34
- end
35
-
36
- unless success
37
- raise Nanoc::Core::TrivialError, 'One or more checks failed'
38
- end
39
- end
40
- end
41
- end
42
-
43
- runner Nanoc::OrigCLI::Commands::Check
@@ -1,126 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- usage 'deploy [target] [options]'
4
- summary 'deploy the compiled site'
5
- description "
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
- "
8
-
9
- option :t, :target, 'specify the location to deploy to (default: `default`)', argument: :required
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
- option :n, :'dry-run', 'show what would be deployed'
14
-
15
- module Nanoc::OrigCLI::Commands
16
- class Deploy < ::Nanoc::CLI::CommandRunner
17
- def run
18
- @site = load_site
19
- Nanoc::Core::Compiler.new_for(@site).run_until_preprocessed
20
-
21
- if options[:'list-deployers']
22
- list_deployers
23
- elsif options[:list]
24
- list_deploy_configs
25
- else
26
- deploy
27
- end
28
- end
29
-
30
- private
31
-
32
- def list_deployers
33
- deployers = Nanoc::Deploying::Deployer.all
34
- deployer_names = deployers.map(&:identifier).sort
35
- puts 'Available deployers:'
36
- deployer_names.each do |name|
37
- puts " #{name}"
38
- end
39
- end
40
-
41
- def list_deploy_configs
42
- if deploy_configs.empty?
43
- puts 'No deployment configurations.'
44
- else
45
- puts 'Available deployment configurations:'
46
- deploy_configs.each_key do |name|
47
- puts " #{name}"
48
- end
49
- end
50
- end
51
-
52
- def deploy
53
- deployer = deployer_for(deploy_config)
54
-
55
- checks_successful = options[:'no-check'] ? true : check
56
- return unless checks_successful
57
-
58
- deployer.run
59
- end
60
-
61
- def deploy_config
62
- if deploy_configs.empty?
63
- raise Nanoc::Core::TrivialError, 'The site has no deployment configurations.'
64
- end
65
-
66
- if arguments.length > 1
67
- raise Nanoc::Core::TrivialError, "usage: #{command.usage}"
68
- end
69
-
70
- target_from_arguments = arguments[0]
71
- target_from_options = options.fetch(:target, nil)
72
- if target_from_arguments && target_from_options
73
- raise Nanoc::Core::TrivialError, 'Only one deployment target can be specified on the command line.'
74
- end
75
-
76
- target = target_from_arguments || target_from_options || :default
77
- deploy_configs.fetch(target.to_sym) do
78
- raise Nanoc::Core::TrivialError, "The site has no deployment configuration named `#{target}`."
79
- end
80
- end
81
-
82
- def deployer_for(config)
83
- deployer_class_for_config(config).new(
84
- @site.config.output_dir,
85
- config,
86
- dry_run: options[:'dry-run'],
87
- )
88
- end
89
-
90
- def check
91
- runner = Nanoc::Checking::Runner.new(@site)
92
- if runner.any_enabled_checks?
93
- puts 'Running issue checks…'
94
- is_success = runner.run_for_deploy
95
- if is_success
96
- puts 'No issues found. Deploying!'
97
- else
98
- puts 'Issues found, deploy aborted.'
99
- end
100
- is_success
101
- else
102
- true
103
- end
104
- end
105
-
106
- def deploy_configs
107
- @site.config.fetch(:deploy, {})
108
- end
109
-
110
- def deployer_class_for_config(config)
111
- name = config.fetch(:kind) do
112
- $stderr.puts 'Warning: The specified deploy target does not have a kind attribute. Assuming rsync.'
113
- 'rsync'
114
- end
115
-
116
- deployer_class = Nanoc::Deploying::Deployer.named(name.to_sym)
117
- if deployer_class.nil?
118
- names = Nanoc::Deploying::Deployer.all.map(&:identifier)
119
- raise Nanoc::Core::TrivialError, "The specified deploy target has an unrecognised kind “#{name}” (expected one of #{names.join(', ')})."
120
- end
121
- deployer_class
122
- end
123
- end
124
- end
125
-
126
- runner Nanoc::OrigCLI::Commands::Deploy