nanoc-live 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b877d4835b41771c810a276ffe99a7ae88780680520ee25e2a8e6f0590119d6
4
- data.tar.gz: 6bd35d4f74a14fb778064b54cd9e8757b91caf14ba8ab8881f521d8ffd69ed77
3
+ metadata.gz: cdd06ace4f84418061436ecd4cb14108e8c8417acabcb1bd7a3b2dafcc9f072e
4
+ data.tar.gz: 5428c0a98895092725ee6a4e8112f27a47c36b84a9fba38a46f108e05789659a
5
5
  SHA512:
6
- metadata.gz: 4118180a0c80513acaff000d66fb1618dfcc81629fd4bd4c72ab117b6acea0ade8d9bc9f4089ef47f00783e895a4fcafde43e7ba2f4f4a63d89affde7903015b
7
- data.tar.gz: 5fd19a25aa6eabbf8a84e3201887be88f3cc3da631ce3d070537472994e24db7b92eb962a1e8ae4466f792ba353ce9f8f4b4f0bca5c508a00c995217f8b9d790
6
+ metadata.gz: 19ea055dd88b544fd175f19284845e7d01f3099c806eaf2ce2d446e7f6cfafa6025e80228fcdba65811c8ffff1cdb4ceb0e1e617b27e85a6ac0256a442c559db
7
+ data.tar.gz: 67e3a25c8c4ede6e8317f24c8cf4e3e2047206f4f920d748e7163dadbe0f31119ec06bdd3bc3e224fb7d7b6990e6d01fc3359b47e8378afcbeff211bf6c318f3
data/NEWS.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Release notes for nanoc-live
2
2
 
3
+ ## 1.1.0 (2024-06-26)
4
+
5
+ Enhancements:
6
+
7
+ - Added `--focus` option to the `compile` and `live` commands (#1707)
8
+
9
+ Fixes:
10
+
11
+ - Fixed wrong documentation regarding listening IP addresses (#1584) [Jan M. Faber]
12
+
13
+ Changes:
14
+
15
+ - Dropped support for Ruby 3.0 (EOL) (#1704)
16
+
3
17
  ## 1.0.0 (2021-02-20)
4
18
 
5
19
  Idential to 1.0.0b8.
@@ -29,7 +29,7 @@ module Nanoc
29
29
  Nanoc::CLI::Commands::View.new(view_options, [], self).run
30
30
  end
31
31
 
32
- Nanoc::Live::LiveRecompiler.new(command_runner: self).run
32
+ Nanoc::Live::LiveRecompiler.new(command_runner: self, focus: options[:focus]).run
33
33
  end
34
34
  end
35
35
  end
@@ -4,13 +4,14 @@ usage 'live'
4
4
  summary 'auto-recompile and serve'
5
5
  description <<~EOS
6
6
  Starts the live recompiler along with the static web server. Unless specified,
7
- the web server will run on port 3000 and listen on all IP addresses. Running
8
- this static web server requires `adsf` (not `asdf`!).
7
+ the web server will run on port 3000 and listen on 127.0.0.1. Running this
8
+ static web server requires `adsf` (not `asdf`!).
9
9
  EOS
10
10
 
11
- required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
12
- required :o, :host, 'specify the host to listen on (default: 127.0.0.1)', default: '127.0.0.1'
13
- required :p, :port, 'specify the port to listen on (default: 3000)', transform: Nanoc::CLI::Transform::Port, default: 3000
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
+ option nil, :focus, 'compile only items matching the given pattern', argument: :required, multiple: true
14
15
  no_params
15
16
 
16
17
  runner Nanoc::Live::CommandRunners::Live
@@ -3,13 +3,14 @@
3
3
  module Nanoc
4
4
  module Live
5
5
  class LiveRecompiler
6
- def initialize(command_runner:)
6
+ def initialize(command_runner:, focus:)
7
7
  @command_runner = command_runner
8
+ @focus = focus
8
9
  end
9
10
 
10
11
  def run
11
12
  run_parent do |site|
12
- handle_changes(site, @command_runner)
13
+ handle_changes(site, @command_runner, focus: @focus)
13
14
  end
14
15
  end
15
16
 
@@ -60,10 +61,10 @@ module Nanoc
60
61
  exit 0
61
62
  end
62
63
 
63
- def run_parent
64
+ def run_parent(&block)
64
65
  # create initial child
65
66
  pipe_read, pipe_write = IO.pipe
66
- fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
67
+ fork { run_child(pipe_write, pipe_read, &block) }
67
68
  pipe_read.close
68
69
 
69
70
  changes = gen_lib_changes
@@ -76,27 +77,27 @@ module Nanoc
76
77
 
77
78
  # create new child
78
79
  pipe_read, pipe_write = IO.pipe
79
- fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
80
+ fork { run_child(pipe_write, pipe_read, &block) }
80
81
  pipe_read.close
81
82
  end
82
83
  rescue Interrupt
83
84
  end
84
85
 
85
- def handle_changes(site, command_runner)
86
+ def handle_changes(site, command_runner, focus:)
86
87
  Nanoc::CLI::ErrorHandler.handle_while(exit_on_error: false) do
87
- unsafe_handle_changes(site, command_runner)
88
+ unsafe_handle_changes(site, command_runner, focus:)
88
89
  end
89
90
  end
90
91
 
91
- def unsafe_handle_changes(site, command_runner)
92
+ def unsafe_handle_changes(site, command_runner, focus:)
92
93
  time_before = Time.now
93
94
 
94
95
  puts 'Compiling site…'
95
- compiler = Nanoc::Core::Compiler.new_for(site)
96
+ compiler = Nanoc::Core::Compiler.new_for(site, focus:)
96
97
  listener = Nanoc::CLI::CompileListeners::Aggregate.new(
97
- command_runner: command_runner,
98
- site: site,
99
- compiler: compiler,
98
+ command_runner:,
99
+ site:,
100
+ compiler:,
100
101
  )
101
102
  listener.run_while do
102
103
  compiler.run_until_end
@@ -104,6 +105,10 @@ module Nanoc
104
105
 
105
106
  time_after = Time.now
106
107
  puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
108
+ if focus
109
+ warn 'CAUTION: A --focus option is specified. Not the entire site has been compiled.'
110
+ warn 'Re-run without --focus to compile the entire site.'
111
+ end
107
112
  puts
108
113
  end
109
114
 
@@ -119,7 +124,7 @@ module Nanoc
119
124
  Nanoc::Core::ChangesStream.new do |cl|
120
125
  only = /(\/|\A)(nanoc\.yaml|config\.yaml|rules|Rules|rules\.rb|Rules\.rb)\z/
121
126
 
122
- listener = Listen.to('.', only: only) { |*| cl.unknown }
127
+ listener = Listen.to('.', only:) { |*| cl.unknown }
123
128
  listener.start
124
129
  sleep
125
130
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Live
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-live
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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: 2021-02-20 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adsf-live
@@ -91,10 +91,12 @@ files:
91
91
  - lib/nanoc/live/commands/live.rb
92
92
  - lib/nanoc/live/live_recompiler.rb
93
93
  - lib/nanoc/live/version.rb
94
- homepage: https://nanoc.ws/
94
+ homepage: https://nanoc.app/
95
95
  licenses:
96
96
  - MIT
97
- metadata: {}
97
+ metadata:
98
+ rubygems_mfa_required: 'true'
99
+ source_code_uri: https://github.com/nanoc/nanoc/tree/nanoc-live-v1.1.0/nanoc-live
98
100
  post_install_message:
99
101
  rdoc_options: []
100
102
  require_paths:
@@ -103,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
105
  requirements:
104
106
  - - ">="
105
107
  - !ruby/object:Gem::Version
106
- version: '2.5'
108
+ version: '3.1'
107
109
  required_rubygems_version: !ruby/object:Gem::Requirement
108
110
  requirements:
109
111
  - - ">="
110
112
  - !ruby/object:Gem::Version
111
113
  version: '0'
112
114
  requirements: []
113
- rubygems_version: 3.2.11
115
+ rubygems_version: 3.5.11
114
116
  signing_key:
115
117
  specification_version: 4
116
118
  summary: Live recompilation support for Nanoc