nanoc-cli 4.12.20 → 4.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nanoc/cli/cleaning_stream.rb +5 -0
- data/lib/nanoc/cli/commands/compile.rb +9 -3
- data/lib/nanoc/cli/commands/prune.rb +1 -1
- data/lib/nanoc/cli/commands/view.rb +4 -4
- data/lib/nanoc/cli/compile_listeners/aggregate.rb +1 -1
- data/lib/nanoc/cli/compile_listeners/file_action_printer.rb +13 -0
- data/lib/nanoc/cli/error_handler.rb +11 -11
- data/lib/nanoc/cli/transform.rb +1 -1
- data/lib/nanoc/cli/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f128a32f18562448ea9aa76e5f9ec8c123753d72868a99e928d1f0c3ce39782
|
4
|
+
data.tar.gz: 7b7385b30702c3b5e6062ab5aadd9d84eaffa6f3de52d282892e51df01a1f13f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4038d82337732797ab3de5045f4016e73836fb9b5a688120275a526100c1f49bca732a3d3647e953142890f731547953b44f5fc1735bf9fb7ed738a5187b50
|
7
|
+
data.tar.gz: 4c7696dbf5772faa47a079cca94092f2395ceba6a9e5b95dfa4743fcbe6e9adced430d8de086c8470a9b971dbc76471ed5457734e8b76f807fb435424194dd85
|
@@ -9,6 +9,7 @@ no_params
|
|
9
9
|
|
10
10
|
flag nil, :diff, 'generate diff'
|
11
11
|
flag :W, :watch, 'watch for changes and recompile when needed'
|
12
|
+
option nil, :focus, 'compile only items matching the given pattern', argument: :required, multiple: true
|
12
13
|
|
13
14
|
module Nanoc::CLI::Commands
|
14
15
|
class Compile < ::Nanoc::CLI::CommandRunner
|
@@ -26,7 +27,7 @@ module Nanoc::CLI::Commands
|
|
26
27
|
|
27
28
|
def run_repeat
|
28
29
|
require 'nanoc/live'
|
29
|
-
Nanoc::Live::LiveRecompiler.new(command_runner: self).run
|
30
|
+
Nanoc::Live::LiveRecompiler.new(command_runner: self, focus: options[:focus]).run
|
30
31
|
end
|
31
32
|
|
32
33
|
def run_once
|
@@ -35,11 +36,11 @@ module Nanoc::CLI::Commands
|
|
35
36
|
@site = load_site
|
36
37
|
|
37
38
|
puts 'Compiling site…'
|
38
|
-
compiler = Nanoc::Core::Compiler.new_for(@site)
|
39
|
+
compiler = Nanoc::Core::Compiler.new_for(@site, focus: options[:focus])
|
39
40
|
listener = Nanoc::CLI::CompileListeners::Aggregate.new(
|
40
41
|
command_runner: self,
|
41
42
|
site: @site,
|
42
|
-
compiler
|
43
|
+
compiler:,
|
43
44
|
)
|
44
45
|
listener.run_while do
|
45
46
|
compiler.run_until_end
|
@@ -48,6 +49,11 @@ module Nanoc::CLI::Commands
|
|
48
49
|
time_after = Time.now
|
49
50
|
puts
|
50
51
|
puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
|
52
|
+
|
53
|
+
if options[:focus]
|
54
|
+
warn 'CAUTION: A --focus option is specified. Not the entire site has been compiled.'
|
55
|
+
warn 'Re-run without --focus to compile the entire site.'
|
56
|
+
end
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
@@ -23,7 +23,7 @@ module Nanoc::CLI::Commands
|
|
23
23
|
reps = res.fetch(:reps)
|
24
24
|
|
25
25
|
listener_class = Nanoc::CLI::CompileListeners::FileActionPrinter
|
26
|
-
listener = listener_class.new(reps:
|
26
|
+
listener = listener_class.new(reps:)
|
27
27
|
listener.start_safely
|
28
28
|
|
29
29
|
if options.key?(:yes)
|
@@ -8,10 +8,10 @@ description <<~EOS
|
|
8
8
|
`adsf` (not `asdf`!).
|
9
9
|
EOS
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
flag
|
11
|
+
option :H, :handler, 'specify the handler to use (webrick/puma/...)', argument: :required
|
12
|
+
option :o, :host, 'specify the host to listen on', default: '127.0.0.1', argument: :required
|
13
|
+
option :p, :port, 'specify the port to listen on', transform: Nanoc::CLI::Transform::Port, default: 3000, argument: :required
|
14
|
+
flag :L, :'live-reload', 'reload on changes'
|
15
15
|
no_params
|
16
16
|
|
17
17
|
module Nanoc::CLI::Commands
|
@@ -36,7 +36,7 @@ module Nanoc::CLI::CompileListeners
|
|
36
36
|
@listeners =
|
37
37
|
@listener_classes
|
38
38
|
.select { |klass| klass.enable_for?(@command_runner, @site) }
|
39
|
-
.map { |klass| klass.new(reps:
|
39
|
+
.map { |klass| klass.new(reps:) }
|
40
40
|
|
41
41
|
@listeners.each(&:start_safely)
|
42
42
|
end
|
@@ -55,6 +55,7 @@ module Nanoc::CLI::CompileListeners
|
|
55
55
|
:low
|
56
56
|
end
|
57
57
|
|
58
|
+
# Make path relative (to current working directory)
|
58
59
|
# FIXME: do not depend on working directory
|
59
60
|
if path.start_with?(Dir.getwd)
|
60
61
|
path = path[(Dir.getwd.size + 1)..path.size]
|
@@ -64,10 +65,22 @@ module Nanoc::CLI::CompileListeners
|
|
64
65
|
end
|
65
66
|
|
66
67
|
on(:file_pruned) do |path|
|
68
|
+
# Make path relative (to current working directory)
|
69
|
+
# FIXME: do not depend on working directory
|
70
|
+
if path.start_with?(Dir.getwd)
|
71
|
+
path = path[(Dir.getwd.size + 1)..path.size]
|
72
|
+
end
|
73
|
+
|
67
74
|
Nanoc::CLI::Logger.instance.file(:high, :delete, path)
|
68
75
|
end
|
69
76
|
|
70
77
|
on(:file_listed_for_pruning) do |path|
|
78
|
+
# Make path relative (to current working directory)
|
79
|
+
# FIXME: do not depend on working directory
|
80
|
+
if path.start_with?(Dir.getwd)
|
81
|
+
path = path[(Dir.getwd.size + 1)..path.size]
|
82
|
+
end
|
83
|
+
|
71
84
|
Nanoc::CLI::Logger.instance.file(:high, :delete, '(dry run) ' + path)
|
72
85
|
end
|
73
86
|
end
|
@@ -12,7 +12,7 @@ module Nanoc::CLI
|
|
12
12
|
if @disabled
|
13
13
|
yield
|
14
14
|
else
|
15
|
-
new.handle_while(exit_on_error
|
15
|
+
new.handle_while(exit_on_error:, &block)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -66,7 +66,7 @@ module Nanoc::CLI
|
|
66
66
|
puts
|
67
67
|
exit(1)
|
68
68
|
when StandardError, ScriptError
|
69
|
-
handle_error(e, exit_on_error:
|
69
|
+
handle_error(e, exit_on_error:)
|
70
70
|
else
|
71
71
|
raise e
|
72
72
|
end
|
@@ -283,7 +283,7 @@ module Nanoc::CLI
|
|
283
283
|
end
|
284
284
|
|
285
285
|
def write_error_message(stream, error, verbose: false)
|
286
|
-
write_section_header(stream, 'Message', verbose:
|
286
|
+
write_section_header(stream, 'Message', verbose:)
|
287
287
|
|
288
288
|
error = unwrap_error(error)
|
289
289
|
|
@@ -317,33 +317,33 @@ module Nanoc::CLI
|
|
317
317
|
def write_item_rep(stream, error, verbose: false)
|
318
318
|
return unless error.is_a?(Nanoc::Core::Errors::CompilationError)
|
319
319
|
|
320
|
-
write_section_header(stream, 'Item being compiled', verbose:
|
320
|
+
write_section_header(stream, 'Item being compiled', verbose:)
|
321
321
|
|
322
322
|
item_rep = error.item_rep
|
323
323
|
stream.puts "Current item: #{item_rep.item.identifier} (#{item_rep.name.inspect} representation)"
|
324
324
|
end
|
325
325
|
|
326
326
|
def write_stack_trace(stream, error, verbose: false)
|
327
|
-
write_section_header(stream, 'Stack trace', verbose:
|
327
|
+
write_section_header(stream, 'Stack trace', verbose:)
|
328
328
|
|
329
329
|
writer = Nanoc::CLI::StackTraceWriter.new(stream)
|
330
|
-
writer.write(unwrap_error(error), verbose:
|
330
|
+
writer.write(unwrap_error(error), verbose:)
|
331
331
|
end
|
332
332
|
|
333
333
|
def write_version_information(stream, verbose: false)
|
334
|
-
write_section_header(stream, 'Version information', verbose:
|
334
|
+
write_section_header(stream, 'Version information', verbose:)
|
335
335
|
stream.puts Nanoc::Core.version_information
|
336
336
|
end
|
337
337
|
|
338
338
|
def write_system_information(stream, verbose: false)
|
339
339
|
uname = `uname -a`
|
340
|
-
write_section_header(stream, 'System information', verbose:
|
340
|
+
write_section_header(stream, 'System information', verbose:)
|
341
341
|
stream.puts uname
|
342
342
|
rescue Errno::ENOENT
|
343
343
|
end
|
344
344
|
|
345
345
|
def write_installed_gems(stream, verbose: false)
|
346
|
-
write_section_header(stream, 'Installed gems', verbose:
|
346
|
+
write_section_header(stream, 'Installed gems', verbose:)
|
347
347
|
gems_and_versions.each do |g|
|
348
348
|
stream.puts " #{g.first} #{g.last.join(', ')}"
|
349
349
|
end
|
@@ -351,13 +351,13 @@ module Nanoc::CLI
|
|
351
351
|
|
352
352
|
def write_gemfile_lock(stream, verbose: false)
|
353
353
|
if File.exist?('Gemfile.lock')
|
354
|
-
write_section_header(stream, 'Gemfile.lock', verbose:
|
354
|
+
write_section_header(stream, 'Gemfile.lock', verbose:)
|
355
355
|
stream.puts File.read('Gemfile.lock')
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
359
359
|
def write_load_paths(stream, verbose: false)
|
360
|
-
write_section_header(stream, 'Load paths', verbose:
|
360
|
+
write_section_header(stream, 'Load paths', verbose:)
|
361
361
|
$LOAD_PATH.each_with_index do |i, index|
|
362
362
|
stream.puts " #{index}. #{i}"
|
363
363
|
end
|
data/lib/nanoc/cli/transform.rb
CHANGED
data/lib/nanoc/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: 4.13.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: 4.13.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: pry
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,7 +120,7 @@ licenses:
|
|
120
120
|
- MIT
|
121
121
|
metadata:
|
122
122
|
rubygems_mfa_required: 'true'
|
123
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-cli-v4.
|
123
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-cli-v4.13.0/nanoc-cli
|
124
124
|
post_install_message:
|
125
125
|
rdoc_options: []
|
126
126
|
require_paths:
|
@@ -129,14 +129,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
132
|
+
version: '3.1'
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.5.
|
139
|
+
rubygems_version: 3.5.11
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: CLI for Nanoc
|