nanoc-live 1.0.0b2 → 1.0.0b7

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: 7eeecefd3484786adc38e4655092c9443c33a5d438b21f10e19f7e51fd0d0b94
4
- data.tar.gz: 6a922e2bb7a34253643cca1467a47e0c0852d39cda2c6727cbad55ba5cb4e529
3
+ metadata.gz: ed39aa6d7d31ffd01171db4357222032d8fb161758aece71e8bfacae6e6ad63a
4
+ data.tar.gz: 30ce1774af9d2089e1d76ffa0eca24bfb0012e62a74ac6d42e08b95f4cb8452f
5
5
  SHA512:
6
- metadata.gz: c373b0886e76fe4a1a9ecb1272bdfce89b53316750b211bf92381f5dab64fe819b6d85766c6f89cd70622f4b2954833f49a62573b5c4a0d1c5f04b27fb959c6e
7
- data.tar.gz: 799a48f914e42d48259f319e83c35485abc16e8bfa6c08d5edfddb202edd21812406e37df327e72a6b3ee8bc2bb5715691cfa5d82f0d63b7b6152a9baa76fb04
6
+ metadata.gz: 46fdb4f00d54e38e55c7fe07eeb309eaba6c8cc76789acab42cd51d7f58666d1d71c6391999fae820f4f5ef50a0feb5974483e826273f51cb3b8b75490ae70dd
7
+ data.tar.gz: 44e28065b1338e10e73c00697e05978bd1a49d7b59a5b15a32f728a8e877d6d91c6b140c7e4c9dfd432e9dba0ab2e3185510625d5084b075b8c6dc086fa50054
data/NEWS.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Release notes for nanoc-live
2
2
 
3
+ ## 1.0.0b7 (2021-01-01)
4
+
5
+ Enhancements:
6
+
7
+ - Added support for Ruby 3.x
8
+
9
+ ## 1.0.0b6 (2020-03-07)
10
+
11
+ Fixes:
12
+
13
+ * Restored compatibility with Nanoc 4.11.14.
14
+
15
+ ## 1.0.0b5 (2019-11-16)
16
+
17
+ Fixes:
18
+
19
+ * Restored compatibility with Nanoc 4.11.13.
20
+
21
+ ## 1.0.0b4 (2019-04-30)
22
+
23
+ Fixes:
24
+
25
+ * Restored compatibility with most recent version of Nanoc.
26
+
27
+ ## 1.0.0b3 (2018-08-31)
28
+
29
+ Fixes:
30
+
31
+ * Fixed issue which required all command-line options to be specified
32
+
3
33
  ## 1.0.0b2 (2018-06-10)
4
34
 
5
35
  Fixes:
@@ -3,7 +3,7 @@
3
3
  require 'adsf/live'
4
4
  require 'listen'
5
5
  require 'nanoc'
6
- require 'nanoc/cli'
6
+ require 'nanoc/orig_cli'
7
7
 
8
8
  module Nanoc
9
9
  module Live
@@ -12,9 +12,12 @@ end
12
12
 
13
13
  require_relative 'live/version'
14
14
  require_relative 'live/live_recompiler'
15
+ require_relative 'live/command_runners/live'
16
+
17
+ root = File.dirname(__FILE__)
18
+ live_command_path = File.join(root, 'live', 'commands', 'live.rb')
19
+ command = Cri::Command.load_file(live_command_path, infer_name: true)
15
20
 
16
21
  Nanoc::CLI.after_setup do
17
- root = File.dirname(__FILE__)
18
- live_command_path = File.join(root, 'live', 'commands', 'live.rb')
19
- Nanoc::CLI.add_command(Nanoc::CLI.load_command_at(live_command_path))
22
+ Nanoc::CLI.add_command(command)
20
23
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Live
5
+ module CommandRunners
6
+ class Live < ::Nanoc::CLI::CommandRunner
7
+ def run
8
+ if defined?(Guard::Nanoc)
9
+ $stderr.puts '-' * 40
10
+ $stderr.puts 'NOTE:'
11
+ $stderr.puts 'You are using the `nanoc live` command provided by `nanoc-live`, but the `guard-nanoc` gem is also installed, which also provides a `nanoc live` command.'
12
+ if defined?(Bundler)
13
+ $stderr.puts 'Recommendation: Remove `guard-nanoc` from your Gemfile.'
14
+ else
15
+ $stderr.puts 'Recommendation: Uninstall `guard-nanoc`.'
16
+ end
17
+ $stderr.puts '-' * 40
18
+ end
19
+
20
+ self.class.enter_site_dir
21
+
22
+ Thread.new do
23
+ Thread.current.abort_on_exception = true
24
+ if Thread.current.respond_to?(:report_on_exception)
25
+ Thread.current.report_on_exception = false
26
+ end
27
+
28
+ view_options = options.merge('live-reload': true)
29
+ Nanoc::CLI::Commands::View.new(view_options, [], self).run
30
+ end
31
+
32
+ Nanoc::Live::LiveRecompiler.new(command_runner: self).run
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -9,27 +9,8 @@ description <<~EOS
9
9
  EOS
10
10
 
11
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)'
13
- required :p, :port, 'specify the port to listen on (default: 3000)'
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
14
+ no_params
14
15
 
15
- module Nanoc::Live::Commands
16
- class Live < ::Nanoc::CLI::CommandRunner
17
- def run
18
- self.class.enter_site_dir
19
-
20
- Thread.new do
21
- Thread.current.abort_on_exception = true
22
- if Thread.current.respond_to?(:report_on_exception)
23
- Thread.current.report_on_exception = false
24
- end
25
-
26
- view_options = options.merge('live-reload': true)
27
- Nanoc::CLI::Commands::View.new(view_options, [], self).run
28
- end
29
-
30
- Nanoc::Live::LiveRecompiler.new(command_runner: self).run
31
- end
32
- end
33
- end
34
-
35
- runner Nanoc::Live::Commands::Live
16
+ runner Nanoc::Live::CommandRunners::Live
@@ -1,135 +1,137 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Nanoc::Live
4
- class LiveRecompiler
5
- def initialize(command_runner:)
6
- @command_runner = command_runner
7
- end
8
-
9
- def run
10
- run_parent do |site|
11
- handle_changes(site, @command_runner)
3
+ module Nanoc
4
+ module Live
5
+ class LiveRecompiler
6
+ def initialize(command_runner:)
7
+ @command_runner = command_runner
12
8
  end
13
- end
14
9
 
15
- private
16
-
17
- def gen_changes_for_child(site)
18
- changes = [
19
- site.data_source.item_changes,
20
- site.data_source.layout_changes,
21
- gen_config_and_rules_changes,
22
- ]
23
-
24
- SlowEnumeratorTools.batch(SlowEnumeratorTools.merge(changes))
25
- end
10
+ def run
11
+ run_parent do |site|
12
+ handle_changes(site, @command_runner)
13
+ end
14
+ end
26
15
 
27
- def run_child(pipe_write, pipe_read)
28
- pipe_write.close
16
+ private
29
17
 
30
- site = Nanoc::Int::SiteLoader.new.new_from_cwd
31
- changes_enum = gen_changes_for_child(site)
32
- yield(site)
18
+ def gen_changes_for_child(site)
19
+ changes = [
20
+ site.data_source.item_changes,
21
+ site.data_source.layout_changes,
22
+ gen_config_and_rules_changes,
23
+ ]
33
24
 
34
- quit = Object.new
35
- parent_enum = Enumerator.new do |y|
36
- pipe_read.read
37
- y << quit
25
+ SlowEnumeratorTools.batch(SlowEnumeratorTools.merge(changes))
38
26
  end
39
27
 
40
- puts 'Listening for site changes…'
41
- SlowEnumeratorTools.merge([parent_enum, changes_enum]).each do |e|
42
- break if quit.equal?(e)
43
-
44
- $stderr.print 'Reloading site… '
45
- $stderr.flush
46
- site_loader = Nanoc::Int::SiteLoader.new
47
- site = Nanoc::Int::Site.new(
48
- config: Nanoc::Int::ConfigLoader.new.new_from_cwd,
49
- data_source: site_loader.gen_data_source_for_config(site.config),
50
- code_snippets: site.code_snippets,
51
- )
52
- $stderr.puts 'done'
28
+ def run_child(pipe_write, pipe_read)
29
+ pipe_write.close
53
30
 
31
+ site = Nanoc::Core::SiteLoader.new.new_from_cwd
32
+ changes_enum = gen_changes_for_child(site)
54
33
  yield(site)
55
- end
56
-
57
- exit 0
58
- rescue Interrupt
59
- exit 0
60
- end
61
34
 
62
- def run_parent
63
- # create initial child
64
- pipe_read, pipe_write = IO.pipe
65
- fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
66
- pipe_read.close
67
-
68
- changes = gen_lib_changes
69
- puts 'Listening for lib/ changes…'
70
- changes.each do |_e|
71
- # stop child
72
- pipe_write.write('q')
73
- pipe_write.close
74
- Process.wait
35
+ quit = Object.new
36
+ parent_enum = Enumerator.new do |y|
37
+ pipe_read.read
38
+ y << quit
39
+ end
40
+
41
+ puts 'Listening for site changes…'
42
+ SlowEnumeratorTools.merge([parent_enum, changes_enum]).each do |e|
43
+ break if quit.equal?(e)
44
+
45
+ $stderr.print 'Reloading site… '
46
+ $stderr.flush
47
+ site_loader = Nanoc::Core::SiteLoader.new
48
+ site = Nanoc::Core::Site.new(
49
+ config: Nanoc::Core::ConfigLoader.new.new_from_cwd,
50
+ data_source: site_loader.gen_data_source_for_config(site.config),
51
+ code_snippets: site.code_snippets,
52
+ )
53
+ $stderr.puts 'done'
54
+
55
+ yield(site)
56
+ end
57
+
58
+ exit 0
59
+ rescue Interrupt
60
+ exit 0
61
+ end
75
62
 
76
- # create new child
63
+ def run_parent
64
+ # create initial child
77
65
  pipe_read, pipe_write = IO.pipe
78
66
  fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
79
67
  pipe_read.close
80
- end
81
- rescue Interrupt
82
- end
83
68
 
84
- def handle_changes(site, command_runner)
85
- Nanoc::CLI::ErrorHandler.handle_while(exit_on_error: false) do
86
- unsafe_handle_changes(site, command_runner)
69
+ changes = gen_lib_changes
70
+ puts 'Listening for lib/ changes…'
71
+ changes.each do |_e|
72
+ # stop child
73
+ pipe_write.write('q')
74
+ pipe_write.close
75
+ Process.wait
76
+
77
+ # create new child
78
+ pipe_read, pipe_write = IO.pipe
79
+ fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
80
+ pipe_read.close
81
+ end
82
+ rescue Interrupt
87
83
  end
88
- end
89
84
 
90
- def unsafe_handle_changes(site, command_runner)
91
- time_before = Time.now
92
-
93
- puts 'Compiling site…'
94
- compiler = Nanoc::Int::Compiler.new_for(site)
95
- listener = Nanoc::CLI::Commands::CompileListeners::Aggregate.new(
96
- command_runner: command_runner,
97
- site: site,
98
- compiler: compiler,
99
- )
100
- listener.run_while do
101
- compiler.run_until_end
85
+ def handle_changes(site, command_runner)
86
+ Nanoc::CLI::ErrorHandler.handle_while(exit_on_error: false) do
87
+ unsafe_handle_changes(site, command_runner)
88
+ end
102
89
  end
103
90
 
104
- time_after = Time.now
105
- puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
106
- puts
107
- end
91
+ def unsafe_handle_changes(site, command_runner)
92
+ time_before = Time.now
108
93
 
109
- def gen_lib_changes
110
- Nanoc::ChangesStream.new do |cl|
111
- opts = {
112
- latency: 0.0,
113
- wait_for_delay: 0.0,
114
- }
94
+ puts 'Compiling site…'
95
+ compiler = Nanoc::Core::Compiler.new_for(site)
96
+ listener = Nanoc::CLI::CompileListeners::Aggregate.new(
97
+ command_runner: command_runner,
98
+ site: site,
99
+ compiler: compiler,
100
+ )
101
+ listener.run_while do
102
+ compiler.run_until_end
103
+ end
115
104
 
116
- listener = Listen.to('lib', opts) { |*| cl.lib }
117
- listener.start
118
- sleep
105
+ time_after = Time.now
106
+ puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
107
+ puts
108
+ end
109
+
110
+ def gen_lib_changes
111
+ Nanoc::Core::ChangesStream.new do |cl|
112
+ opts = {
113
+ latency: 0.1,
114
+ wait_for_delay: 0.0,
115
+ }
116
+
117
+ listener = Listen.to('lib', opts) { |*| cl.lib }
118
+ listener.start
119
+ sleep
120
+ end
119
121
  end
120
- end
121
122
 
122
- def gen_config_and_rules_changes
123
- Nanoc::ChangesStream.new do |cl|
124
- opts = {
125
- only: /(\/|\A)(nanoc\.yaml|config\.yaml|rules|Rules|rules\.rb|Rules\.rb)\z/,
126
- latency: 0.0,
127
- wait_for_delay: 0.0,
128
- }
129
-
130
- listener = Listen.to('.', opts) { |*| cl.unknown }
131
- listener.start
132
- sleep
123
+ def gen_config_and_rules_changes
124
+ Nanoc::Core::ChangesStream.new do |cl|
125
+ opts = {
126
+ only: /(\/|\A)(nanoc\.yaml|config\.yaml|rules|Rules|rules\.rb|Rules\.rb)\z/,
127
+ latency: 0.1,
128
+ wait_for_delay: 0.0,
129
+ }
130
+
131
+ listener = Listen.to('.', opts) { |*| cl.unknown }
132
+ listener.start
133
+ sleep
134
+ end
133
135
  end
134
136
  end
135
137
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nanoc
4
4
  module Live
5
- VERSION = '1.0.0b2'
5
+ VERSION = '1.0.0b7'
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.0b2
4
+ version: 1.0.0b7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-10 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adsf-live
@@ -39,25 +39,45 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: nanoc
42
+ name: nanoc-cli
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.8'
47
+ version: '4.11'
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 4.8.16
50
+ version: 4.11.14
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: '4.8'
57
+ version: '4.11'
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 4.8.16
60
+ version: 4.11.14
61
+ - !ruby/object:Gem::Dependency
62
+ name: nanoc-core
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '4.11'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 4.11.14
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '4.11'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 4.11.14
61
81
  description: Provides support for auto-recompiling Nanoc sites.
62
82
  email: denis+rubygems@denis.ws
63
83
  executables: []
@@ -67,31 +87,31 @@ files:
67
87
  - NEWS.md
68
88
  - README.md
69
89
  - lib/nanoc/live.rb
90
+ - lib/nanoc/live/command_runners/live.rb
70
91
  - lib/nanoc/live/commands/live.rb
71
92
  - lib/nanoc/live/live_recompiler.rb
72
93
  - lib/nanoc/live/version.rb
73
- homepage: http://nanoc.ws/
94
+ homepage: https://nanoc.ws/
74
95
  licenses:
75
96
  - MIT
76
97
  metadata: {}
77
- post_install_message:
98
+ post_install_message:
78
99
  rdoc_options: []
79
100
  require_paths:
80
101
  - lib
81
102
  required_ruby_version: !ruby/object:Gem::Requirement
82
103
  requirements:
83
- - - "~>"
104
+ - - ">="
84
105
  - !ruby/object:Gem::Version
85
- version: '2.3'
106
+ version: '2.5'
86
107
  required_rubygems_version: !ruby/object:Gem::Requirement
87
108
  requirements:
88
109
  - - ">"
89
110
  - !ruby/object:Gem::Version
90
111
  version: 1.3.1
91
112
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 2.7.7
94
- signing_key:
113
+ rubygems_version: 3.2.4
114
+ signing_key:
95
115
  specification_version: 4
96
116
  summary: Live recompilation support for Nanoc
97
117
  test_files: []