nanoc-cli 4.12.21 → 4.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 366aa05b913d64bfe79f952f484bccb1c06a44eb47de3a29abd1dcd783f3ec39
4
- data.tar.gz: 02d1df2a1bd90a9e65a7d486d7f57e8835f583c33123d3d228dc372a16eaa038
3
+ metadata.gz: bb024e5460202d0a214dfe26b930a6b063d40f23092894f74a0ff574c2788c56
4
+ data.tar.gz: d1955b167ee63dfe43c1ae14109a8cec43c9835165468d45bf13f3439f6b302d
5
5
  SHA512:
6
- metadata.gz: 226319413dfa995a0ffc0471b104f7f091f9221bc83bfe488a018875f2077b0cb45506b03e11bd78d41ced6ab50a9e9680efd800c7dd93277783c1b204af5f48
7
- data.tar.gz: d686d8841b35cad504c44053696ccff591779d06eb0620893dc533b57b1f42771d7fe69afe1b7e2f8df2645c1ed409e78c9bacd1980d370df8f41ce5eb6d9981
6
+ metadata.gz: 3cf6033f3d61d63b2338a6352912dd90c0dfa69cf1d59a8b893c46d590bc245b882a3502ff09a92460cc468fb15c7f36b77c5af0560db675a80171de069a5db0
7
+ data.tar.gz: 76c24eecf8c51a700f5b1ebb9c1983ecb2977cbcfbe19d40390c26dab7d807ab24ecc263686fbe1976d9cfa3ad22f5794d7ccc9c0ed1b985f2f2a99c66e7913d
@@ -54,7 +54,7 @@ module Nanoc
54
54
 
55
55
  # @see IO#tty?
56
56
  def tty?
57
- @cached_is_tty ||= @stream.tty?
57
+ @_tty_eh ||= @stream.tty? # rubocop:disable Naming/MemoizedInstanceVariableName
58
58
  end
59
59
 
60
60
  # @see IO#isatty
@@ -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: 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: 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
- required :H, :handler, 'specify the handler to use (webrick/puma/...)'
12
- required :o, :host, 'specify the host to listen on', default: '127.0.0.1'
13
- required :p, :port, 'specify the port to listen on', transform: Nanoc::CLI::Transform::Port, default: 3000
14
- flag :L, :'live-reload', 'reload on changes'
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: 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: exit_on_error, &block)
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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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
@@ -5,7 +5,7 @@ module Nanoc
5
5
  # @api private
6
6
  module Transform
7
7
  module Port
8
- RANGE = (0x0001..0xffff).freeze
8
+ RANGE = (0x0001..0xffff)
9
9
 
10
10
  def self.call(data)
11
11
  Integer(data).tap do |int|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module CLI
5
- VERSION = '4.12.21'
5
+ VERSION = '4.13.1'
6
6
  end
7
7
  end
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.12.21
4
+ version: 4.13.1
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-04-27 00:00:00.000000000 Z
11
+ date: 2024-11-04 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.12.21
47
+ version: 4.13.1
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.12.21
54
+ version: 4.13.1
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.12.21/nanoc-cli
123
+ source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-cli-v4.13.1/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: '2.7'
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.9
139
+ rubygems_version: 3.5.21
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: CLI for Nanoc