nanoc 4.11.12 → 4.11.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.md +7 -1
  3. data/bin/nanoc +1 -1
  4. data/lib/nanoc.rb +2 -27
  5. data/lib/nanoc/base.rb +3 -6
  6. data/lib/nanoc/base/errors.rb +6 -104
  7. data/lib/nanoc/checking/check.rb +4 -4
  8. data/lib/nanoc/checking/checks/external_links.rb +1 -1
  9. data/lib/nanoc/checking/checks/stale.rb +1 -1
  10. data/lib/nanoc/checking/runner.rb +2 -2
  11. data/lib/nanoc/data_sources/filesystem/tools.rb +4 -4
  12. data/lib/nanoc/extra.rb +1 -1
  13. data/lib/nanoc/helpers/blogging.rb +8 -8
  14. data/lib/nanoc/helpers/capturing.rb +1 -1
  15. data/lib/nanoc/helpers/link_to.rb +1 -1
  16. data/lib/nanoc/orig_cli.rb +20 -0
  17. data/lib/nanoc/{cli → orig_cli}/commands/check.rb +3 -3
  18. data/lib/nanoc/{cli → orig_cli}/commands/deploy.rb +8 -8
  19. data/lib/nanoc/{cli → orig_cli}/commands/show-rules.rb +3 -3
  20. data/lib/nanoc/rule_dsl/action_provider.rb +5 -5
  21. data/lib/nanoc/rule_dsl/action_recorder.rb +4 -4
  22. data/lib/nanoc/rule_dsl/compilation_rule_context.rb +1 -1
  23. data/lib/nanoc/rule_dsl/compiler_dsl.rb +1 -1
  24. data/lib/nanoc/rule_dsl/rule_context.rb +6 -6
  25. data/lib/nanoc/version.rb +1 -1
  26. metadata +13 -152
  27. data/lib/nanoc/base/error.rb +0 -7
  28. data/lib/nanoc/base/feature.rb +0 -104
  29. data/lib/nanoc/base/repos.rb +0 -4
  30. data/lib/nanoc/base/repos/config_loader.rb +0 -95
  31. data/lib/nanoc/base/repos/site_loader.rb +0 -102
  32. data/lib/nanoc/base/services.rb +0 -23
  33. data/lib/nanoc/base/services/compiler.rb +0 -214
  34. data/lib/nanoc/base/services/compiler/phases.rb +0 -19
  35. data/lib/nanoc/base/services/compiler/phases/abstract.rb +0 -50
  36. data/lib/nanoc/base/services/compiler/phases/cache.rb +0 -45
  37. data/lib/nanoc/base/services/compiler/phases/mark_done.rb +0 -25
  38. data/lib/nanoc/base/services/compiler/phases/notify.rb +0 -21
  39. data/lib/nanoc/base/services/compiler/phases/recalculate.rb +0 -51
  40. data/lib/nanoc/base/services/compiler/phases/resume.rb +0 -54
  41. data/lib/nanoc/base/services/compiler/phases/write.rb +0 -86
  42. data/lib/nanoc/base/services/compiler/stages.rb +0 -23
  43. data/lib/nanoc/base/services/compiler/stages/build_reps.rb +0 -38
  44. data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +0 -44
  45. data/lib/nanoc/base/services/compiler/stages/cleanup.rb +0 -45
  46. data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +0 -98
  47. data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +0 -51
  48. data/lib/nanoc/base/services/compiler/stages/forget_outdated_dependencies.rb +0 -22
  49. data/lib/nanoc/base/services/compiler/stages/load_stores.rb +0 -37
  50. data/lib/nanoc/base/services/compiler/stages/postprocess.rb +0 -23
  51. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +0 -34
  52. data/lib/nanoc/base/services/compiler/stages/prune.rb +0 -32
  53. data/lib/nanoc/base/services/compiler/stages/store_post_compilation_state.rb +0 -22
  54. data/lib/nanoc/base/services/compiler/stages/store_pre_compilation_state.rb +0 -34
  55. data/lib/nanoc/base/services/compiler_loader.rb +0 -48
  56. data/lib/nanoc/base/services/executor.rb +0 -134
  57. data/lib/nanoc/base/services/filter.rb +0 -267
  58. data/lib/nanoc/base/services/item_rep_builder.rb +0 -54
  59. data/lib/nanoc/base/services/item_rep_selector.rb +0 -69
  60. data/lib/nanoc/base/services/item_rep_writer.rb +0 -86
  61. data/lib/nanoc/base/services/outdatedness_checker.rb +0 -222
  62. data/lib/nanoc/base/services/outdatedness_rules.rb +0 -18
  63. data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +0 -41
  64. data/lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb +0 -31
  65. data/lib/nanoc/base/services/outdatedness_rules/content_modified.rb +0 -21
  66. data/lib/nanoc/base/services/outdatedness_rules/item_collection_extended.rb +0 -20
  67. data/lib/nanoc/base/services/outdatedness_rules/layout_collection_extended.rb +0 -20
  68. data/lib/nanoc/base/services/outdatedness_rules/not_written.rb +0 -17
  69. data/lib/nanoc/base/services/outdatedness_rules/rules_modified.rb +0 -45
  70. data/lib/nanoc/base/services/outdatedness_rules/uses_always_outdated_filter.rb +0 -26
  71. data/lib/nanoc/base/services/pruner.rb +0 -123
  72. data/lib/nanoc/base/views.rb +0 -40
  73. data/lib/nanoc/base/views/basic_item_rep_collection_view.rb +0 -86
  74. data/lib/nanoc/base/views/basic_item_rep_view.rb +0 -81
  75. data/lib/nanoc/base/views/basic_item_view.rb +0 -52
  76. data/lib/nanoc/base/views/compilation_item_rep_collection_view.rb +0 -10
  77. data/lib/nanoc/base/views/compilation_item_rep_view.rb +0 -49
  78. data/lib/nanoc/base/views/compilation_item_view.rb +0 -45
  79. data/lib/nanoc/base/views/config_view.rb +0 -68
  80. data/lib/nanoc/base/views/identifiable_collection_view.rb +0 -109
  81. data/lib/nanoc/base/views/item_collection_with_reps_view.rb +0 -10
  82. data/lib/nanoc/base/views/item_collection_without_reps_view.rb +0 -10
  83. data/lib/nanoc/base/views/layout_collection_view.rb +0 -10
  84. data/lib/nanoc/base/views/layout_view.rb +0 -7
  85. data/lib/nanoc/base/views/mixins/document_view_mixin.rb +0 -88
  86. data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +0 -58
  87. data/lib/nanoc/base/views/mutable_config_view.rb +0 -14
  88. data/lib/nanoc/base/views/mutable_identifiable_collection_view.rb +0 -17
  89. data/lib/nanoc/base/views/mutable_item_collection_view.rb +0 -32
  90. data/lib/nanoc/base/views/mutable_item_view.rb +0 -7
  91. data/lib/nanoc/base/views/mutable_layout_collection_view.rb +0 -24
  92. data/lib/nanoc/base/views/mutable_layout_view.rb +0 -7
  93. data/lib/nanoc/base/views/post_compile_item_collection_view.rb +0 -10
  94. data/lib/nanoc/base/views/post_compile_item_rep_collection_view.rb +0 -10
  95. data/lib/nanoc/base/views/post_compile_item_rep_view.rb +0 -31
  96. data/lib/nanoc/base/views/post_compile_item_view.rb +0 -18
  97. data/lib/nanoc/base/views/view.rb +0 -41
  98. data/lib/nanoc/cli.rb +0 -241
  99. data/lib/nanoc/cli/ansi_string_colorizer.rb +0 -28
  100. data/lib/nanoc/cli/cleaning_stream.rb +0 -160
  101. data/lib/nanoc/cli/command_runner.rb +0 -72
  102. data/lib/nanoc/cli/commands/compile.rb +0 -57
  103. data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +0 -58
  104. data/lib/nanoc/cli/commands/compile_listeners/aggregate.rb +0 -50
  105. data/lib/nanoc/cli/commands/compile_listeners/debug_printer.rb +0 -100
  106. data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +0 -101
  107. data/lib/nanoc/cli/commands/compile_listeners/file_action_printer.rb +0 -76
  108. data/lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb +0 -170
  109. data/lib/nanoc/cli/commands/create-site.rb +0 -257
  110. data/lib/nanoc/cli/commands/nanoc.rb +0 -42
  111. data/lib/nanoc/cli/commands/prune.rb +0 -49
  112. data/lib/nanoc/cli/commands/shell.rb +0 -57
  113. data/lib/nanoc/cli/commands/show-data.rb +0 -185
  114. data/lib/nanoc/cli/commands/show-plugins.rb +0 -89
  115. data/lib/nanoc/cli/commands/view.rb +0 -68
  116. data/lib/nanoc/cli/error_handler.rb +0 -365
  117. data/lib/nanoc/cli/logger.rb +0 -75
  118. data/lib/nanoc/cli/stack_trace_writer.rb +0 -50
  119. data/lib/nanoc/cli/stream_cleaners.rb +0 -10
  120. data/lib/nanoc/cli/stream_cleaners/abstract.rb +0 -21
  121. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -13
  122. data/lib/nanoc/cli/stream_cleaners/utf8.rb +0 -17
  123. data/lib/nanoc/cli/transform.rb +0 -16
  124. data/lib/nanoc/spec.rb +0 -240
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::CLI
4
- # A simple ANSI colorizer for strings. When given a string and a list of
5
- # attributes, it returns a colorized string.
6
- #
7
- # @api private
8
- module ANSIStringColorizer
9
- # TODO: complete mapping
10
- MAPPING = {
11
- bold: "\e[1m",
12
- red: "\e[31m",
13
- green: "\e[32m",
14
- yellow: "\e[33m",
15
- blue: "\e[34m",
16
- }.freeze
17
-
18
- # @param [String] str The string to colorize
19
- #
20
- # @param [Array] attrs An array of attributes from `MAPPING` to colorize the
21
- # string with
22
- #
23
- # @return [String] A string colorized using the given attributes
24
- def self.c(str, *attrs)
25
- attrs.map { |a| MAPPING[a] }.join('') + str + "\e[0m"
26
- end
27
- end
28
- end
@@ -1,160 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::CLI
4
- # An output stream that passes output through stream cleaners. This can be
5
- # used to strip ANSI color sequences, for instance.
6
- #
7
- # @api private
8
- class CleaningStream
9
- # @param [IO, StringIO] stream The stream to wrap
10
- def initialize(stream)
11
- @stream = stream
12
- @stream_cleaners = []
13
- end
14
-
15
- # Adds a stream cleaner for the given class to this cleaning stream. If the
16
- # cleaning stream already has the given stream cleaner, nothing happens.
17
- #
18
- # @param [Nanoc::CLI::StreamCleaners::Abstract] klass The class of the
19
- # stream cleaner to add
20
- #
21
- # @return [void]
22
- def add_stream_cleaner(klass)
23
- unless @stream_cleaners.map(&:class).include?(klass)
24
- @stream_cleaners << klass.new
25
- end
26
- end
27
-
28
- # Removes the stream cleaner for the given class from this cleaning stream.
29
- # If the cleaning stream does not have the given stream cleaner, nothing
30
- # happens.
31
- #
32
- # @param [Nanoc::CLI::StreamCleaners::Abstract] klass The class of the
33
- # stream cleaner to add
34
- #
35
- # @return [void]
36
- def remove_stream_cleaner(klass)
37
- @stream_cleaners.delete_if { |c| c.class == klass }
38
- end
39
-
40
- # @group IO proxy methods
41
-
42
- # @see IO#write
43
- def write(str)
44
- _nanoc_swallow_broken_pipe_errors_while do
45
- @stream.write(_nanoc_clean(str))
46
- end
47
- end
48
-
49
- # @see IO#<<
50
- def <<(str)
51
- _nanoc_swallow_broken_pipe_errors_while do
52
- @stream.<<(_nanoc_clean(str))
53
- end
54
- end
55
-
56
- # @see IO#tty?
57
- def tty?
58
- @cached_is_tty ||= @stream.tty?
59
- end
60
-
61
- # @see IO#isatty
62
- def isatty
63
- tty?
64
- end
65
-
66
- # @see IO#flush
67
- def flush
68
- _nanoc_swallow_broken_pipe_errors_while do
69
- @stream.flush
70
- end
71
- end
72
-
73
- # @see IO#tell
74
- def tell
75
- @stream.tell
76
- end
77
-
78
- # @see IO#print
79
- def print(str)
80
- _nanoc_swallow_broken_pipe_errors_while do
81
- @stream.print(_nanoc_clean(str))
82
- end
83
- end
84
-
85
- # @see IO#puts
86
- def puts(*str)
87
- _nanoc_swallow_broken_pipe_errors_while do
88
- @stream.puts(*str.map { |ss| _nanoc_clean(ss) })
89
- end
90
- end
91
-
92
- # @see StringIO#string
93
- def string
94
- @stream.string
95
- end
96
-
97
- # @see IO#reopen
98
- def reopen(*args)
99
- @stream.reopen(*args)
100
- end
101
-
102
- # @see IO#close
103
- def close
104
- @stream.close
105
- end
106
-
107
- # @see File#exist?
108
- def exist?
109
- @stream.exist?
110
- end
111
-
112
- # @see File.exists?
113
- def exists?
114
- @stream.exists?
115
- end
116
-
117
- # @see IO.winsize
118
- def winsize
119
- @stream.winsize
120
- end
121
-
122
- # @see IO.winsize=
123
- def winsize=(arg)
124
- @stream.winsize = arg
125
- end
126
-
127
- # @see IO.sync
128
- def sync
129
- @stream.sync
130
- end
131
-
132
- # @see IO.sync=
133
- def sync=(arg)
134
- @stream.sync = arg
135
- end
136
-
137
- # @see IO.sync=
138
- def external_encoding
139
- @stream.external_encoding
140
- end
141
-
142
- # @see ARGF.set_encoding
143
- # rubocop:disable Naming/AccessorMethodName
144
- def set_encoding(*args)
145
- @stream.set_encoding(*args)
146
- end
147
- # rubocop:enable Naming/AccessorMethodName
148
-
149
- protected
150
-
151
- def _nanoc_clean(str)
152
- @stream_cleaners.reduce(str.to_s.scrub) { |acc, elem| elem.clean(acc) }
153
- end
154
-
155
- def _nanoc_swallow_broken_pipe_errors_while
156
- yield
157
- rescue Errno::EPIPE
158
- end
159
- end
160
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::CLI
4
- # A command runner subclass for Nanoc commands that adds Nanoc-specific
5
- # convenience methods and error handling.
6
- #
7
- # @api private
8
- class CommandRunner < ::Cri::CommandRunner
9
- # @see http://rubydoc.info/gems/cri/Cri/CommandRunner#call-instance_method
10
- #
11
- # @return [void]
12
- def call
13
- Nanoc::CLI::ErrorHandler.handle_while do
14
- run
15
- end
16
- end
17
-
18
- # @return [Boolean] true if the current working directory is a Nanoc site
19
- # directory, false otherwise
20
- def in_site_dir?
21
- Nanoc::Int::SiteLoader.cwd_is_nanoc_site?
22
- end
23
-
24
- def self.find_site_dir
25
- start_here = Dir.pwd
26
-
27
- here = start_here
28
- until Nanoc::Int::SiteLoader.cwd_is_nanoc_site?
29
- Dir.chdir('..')
30
- return nil if Dir.pwd == here
31
-
32
- here = Dir.pwd
33
- end
34
- here
35
- ensure
36
- Dir.chdir(start_here)
37
- end
38
-
39
- def self.enter_site_dir
40
- dir = find_site_dir
41
- if dir.nil?
42
- raise ::Nanoc::Int::Errors::GenericTrivial, 'The current working directory, nor any of its parents, seems to be a Nanoc site.'
43
- end
44
-
45
- return if Dir.getwd == dir
46
-
47
- $stderr.puts "Using Nanoc site in #{dir}"
48
- Dir.chdir(dir)
49
- end
50
-
51
- # Asserts that the current working directory contains a site and loads the site into memory.
52
- #
53
- # @return [void]
54
- def load_site
55
- self.class.enter_site_dir
56
-
57
- $stderr.print 'Loading site… '
58
- $stderr.flush
59
- site = Nanoc::Int::SiteLoader.new.new_from_cwd
60
-
61
- $stderr.puts 'done'
62
- site
63
- end
64
-
65
- # @return [Boolean] true if debug output is enabled, false if not
66
- #
67
- # @see Nanoc::CLI.debug?
68
- def debug?
69
- Nanoc::CLI.debug?
70
- end
71
- end
72
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- usage 'compile [options]'
4
- summary 'compile items of this site'
5
- description <<~EOS
6
- Compile all items of the current site.
7
- EOS
8
- no_params
9
-
10
- flag nil, :diff, 'generate diff'
11
- if Nanoc::Feature.enabled?(Nanoc::Feature::LIVE_CMD)
12
- flag :w, :watch, 'watch for changes and recompile when needed'
13
- end
14
-
15
- module Nanoc::CLI::Commands
16
- class Compile < ::Nanoc::CLI::CommandRunner
17
- attr_accessor :listener_classes
18
-
19
- def run
20
- self.class.enter_site_dir
21
-
22
- if options[:watch]
23
- run_repeat
24
- else
25
- run_once
26
- end
27
- end
28
-
29
- def run_repeat
30
- require 'nanoc/live'
31
- Nanoc::Live::LiveRecompiler.new(command_runner: self).run
32
- end
33
-
34
- def run_once
35
- time_before = Time.now
36
-
37
- @site = load_site
38
-
39
- puts 'Compiling site…'
40
- compiler = Nanoc::Int::Compiler.new_for(@site)
41
- listener = Nanoc::CLI::Commands::CompileListeners::Aggregate.new(
42
- command_runner: self,
43
- site: @site,
44
- compiler: compiler,
45
- )
46
- listener.run_while do
47
- compiler.run_until_end
48
- end
49
-
50
- time_after = Time.now
51
- puts
52
- puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
53
- end
54
- end
55
- end
56
-
57
- runner Nanoc::CLI::Commands::Compile
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::CLI::Commands::CompileListeners
4
- class Abstract
5
- def initialize(*)
6
- super()
7
- end
8
-
9
- def self.enable_for?(command_runner, site) # rubocop:disable Lint/UnusedMethodArgument
10
- true
11
- end
12
-
13
- # @abstract
14
- def start
15
- raise NotImplementedError, "Subclasses of #{self.class} must implement #start"
16
- end
17
-
18
- # @abstract
19
- def stop; end
20
-
21
- def wrapped_start
22
- @_notification_names = []
23
- start
24
- end
25
-
26
- def wrapped_stop
27
- stop
28
-
29
- Nanoc::Core::NotificationCenter.sync
30
-
31
- @_notification_names.each do |name|
32
- Nanoc::Core::NotificationCenter.remove(name, self)
33
- end
34
- end
35
-
36
- def run_while
37
- wrapped_start
38
- yield
39
- ensure
40
- wrapped_stop
41
- end
42
-
43
- def start_safely
44
- wrapped_start
45
- @_started = true
46
- end
47
-
48
- def stop_safely
49
- wrapped_stop if @_started
50
- @_started = false
51
- end
52
-
53
- def on(sym)
54
- @_notification_names << sym
55
- Nanoc::Core::NotificationCenter.on(sym, self) { |*args| yield(*args) }
56
- end
57
- end
58
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::CLI::Commands::CompileListeners
4
- class Aggregate < Abstract
5
- def initialize(command_runner:, site:, compiler:)
6
- @site = site
7
- @compiler = compiler
8
- @command_runner = command_runner
9
-
10
- @listener_classes = self.class.default_listener_classes
11
- end
12
-
13
- def start
14
- setup_listeners
15
- end
16
-
17
- def stop
18
- teardown_listeners
19
- end
20
-
21
- def self.default_listener_classes
22
- [
23
- Nanoc::CLI::Commands::CompileListeners::DiffGenerator,
24
- Nanoc::CLI::Commands::CompileListeners::DebugPrinter,
25
- Nanoc::CLI::Commands::CompileListeners::TimingRecorder,
26
- Nanoc::CLI::Commands::CompileListeners::FileActionPrinter,
27
- ]
28
- end
29
-
30
- protected
31
-
32
- def setup_listeners
33
- res = @compiler.run_until_reps_built
34
- reps = res.fetch(:reps)
35
-
36
- @listeners =
37
- @listener_classes
38
- .select { |klass| klass.enable_for?(@command_runner, @site) }
39
- .map { |klass| klass.new(reps: reps) }
40
-
41
- @listeners.each(&:start_safely)
42
- end
43
-
44
- def teardown_listeners
45
- return unless @listeners
46
-
47
- @listeners.reverse_each(&:stop_safely)
48
- end
49
- end
50
- end
@@ -1,100 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::CLI::Commands::CompileListeners
4
- class DebugPrinter < Abstract
5
- # @see Listener#enable_for?
6
- def self.enable_for?(command_runner, _site)
7
- command_runner.debug?
8
- end
9
-
10
- COLOR_MAP = {
11
- 'compilation' => "\e[31m",
12
- 'content' => "\e[32m",
13
- 'filtering' => "\e[33m",
14
- 'dependency_tracking' => "\e[34m",
15
- 'phase' => "\e[35m",
16
- 'stage' => "\e[36m",
17
- }.freeze
18
-
19
- # @see Listener#start
20
- def start
21
- on(:compilation_started) do |rep|
22
- log('compilation', "Started compilation of #{rep}")
23
- end
24
-
25
- on(:compilation_ended) do |rep|
26
- log('compilation', "Ended compilation of #{rep}")
27
- log('compilation', '')
28
- end
29
-
30
- on(:compilation_suspended) do |rep, target_rep, snapshot_name|
31
- log('compilation', "Suspended compilation of #{rep}: depends on #{target_rep}, snapshot #{snapshot_name}")
32
- end
33
-
34
- on(:cached_content_used) do |rep|
35
- log('content', "Used cached compiled content for #{rep} instead of recompiling")
36
- end
37
-
38
- on(:snapshot_created) do |rep, snapshot_name|
39
- log('content', "Snapshot #{snapshot_name} created for #{rep}")
40
- end
41
-
42
- on(:filtering_started) do |rep, filter_name|
43
- log('filtering', "Started filtering #{rep} with #{filter_name}")
44
- end
45
-
46
- on(:filtering_ended) do |rep, filter_name|
47
- log('filtering', "Ended filtering #{rep} with #{filter_name}")
48
- end
49
-
50
- on(:dependency_created) do |src, dst|
51
- log('dependency_tracking', "Dependency created from #{src.inspect} onto #{dst.inspect}")
52
- end
53
-
54
- on(:phase_started) do |phase_name, rep|
55
- log('phase', "Phase started: #{phase_name} (rep: #{rep})")
56
- end
57
-
58
- on(:phase_yielded) do |phase_name, rep|
59
- log('phase', "Phase yielded: #{phase_name} (rep: #{rep})")
60
- end
61
-
62
- on(:phase_resumed) do |phase_name, rep|
63
- log('phase', "Phase resumed: #{phase_name} (rep: #{rep})")
64
- end
65
-
66
- on(:phase_ended) do |phase_name, rep|
67
- log('phase', "Phase ended: #{phase_name} (rep: #{rep})")
68
- end
69
-
70
- on(:phase_aborted) do |phase_name, rep|
71
- log('phase', "Phase aborted: #{phase_name} (rep: #{rep})")
72
- end
73
-
74
- on(:stage_started) do |stage_name|
75
- log('stage', "Stage started: #{stage_name}")
76
- end
77
-
78
- on(:stage_ended) do |stage_name|
79
- log('stage', "Stage ended: #{stage_name}")
80
- end
81
-
82
- on(:stage_aborted) do |stage_name|
83
- log('stage', "Stage aborted: #{stage_name}")
84
- end
85
- end
86
-
87
- def log(progname, msg)
88
- logger.info(progname) { msg }
89
- end
90
-
91
- def logger
92
- @_logger ||=
93
- Logger.new($stdout).tap do |l|
94
- l.formatter = proc do |_severity, _datetime, progname, msg|
95
- "*** #{COLOR_MAP[progname]}#{msg}\e[0m\n"
96
- end
97
- end
98
- end
99
- end
100
- end