nanoc 4.8.15 → 4.8.16

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: 72454ce3213cfb07daf01923f88260c8e1c3e439e163a1b38ecd603cb74794a2
4
- data.tar.gz: fd783734d7a4fd46fe5b391f8ef0a3373bb51ad0e6300e356af66d03478e8b7b
3
+ metadata.gz: cfa738915a0c601d828aa97183ebbfee9613ee9e2b955ad0f52e6a3dbea6545e
4
+ data.tar.gz: 6f0989008933306c049073a1b384c9715969116dafb8fc0279390b1b4ec003dd
5
5
  SHA512:
6
- metadata.gz: 33d234ba1e4646f801f273b26d43b5993cbe4f06f306d58139b8a9f2f6af01007b319dc3f47bf5b0ffa059c836cb3356b6d329a95901445382dc40eaec57dd2e
7
- data.tar.gz: cefdbfa34c2f66ea3fe70fc42f6496b2fa4d607361ff7c5fb8065503f508b0e5786063679e350b996d581ed848860a68cf56055355796db8ddc3f8beb9eca226
6
+ metadata.gz: 8d7af61ff23c5a1f80e2d1b4e80bdb22f684ddca32391e9f19bb3fc44630a675d4cb29f7fbe9e1764f899e691dff0fad7d252e59e34bca86544edf397a07e0a5
7
+ data.tar.gz: 58286c12cf1b0037db772e116c456f4d851d53c64d7ede2a151b9c30611f71b4a9e35cd5b5f7f3609b2b1323b2aa2eec82540393b5d4b6ba9c47f97fb709b81e
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.8.16 (2017-12-09)
4
+
5
+ Fixes:
6
+
7
+ * Made `adsf-live` not be required for `nanoc view`, unless running with `--live-reload`
8
+
3
9
  ## 4.8.15 (2017-12-02)
4
10
 
5
11
  Fixes:
data/README.md CHANGED
@@ -1,24 +1,5 @@
1
- [![Gem version](http://img.shields.io/gem/v/nanoc.svg)](http://rubygems.org/gems/nanoc)
2
- [![Gem downloads](https://img.shields.io/gem/dt/nanoc.svg)](http://rubygems.org/gems/nanoc)
3
- [![Build status](http://img.shields.io/travis/nanoc/nanoc.svg)](https://travis-ci.org/nanoc/nanoc)
4
- [![Code Climate](http://img.shields.io/codeclimate/github/nanoc/nanoc.svg)](https://codeclimate.com/github/nanoc/nanoc)
5
- [![Code Coverage](https://img.shields.io/codecov/c/github/nanoc/nanoc.svg)](https://codecov.io/gh/nanoc/nanoc)
6
- [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnanoc%2Fnanoc.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnanoc%2Fnanoc?ref=badge_shield)
7
-
8
1
  ![Nanoc logo](https://avatars1.githubusercontent.com/u/3260163?s=140)
9
2
 
10
3
  # Nanoc
11
4
 
12
5
  Nanoc is a flexible static-site generator written in Ruby. See the [Nanoc web site](http://nanoc.ws) for more information.
13
-
14
- **Please take a moment and [donate](http://pledgie.com/campaigns/9282) to Nanoc. A lot of time has gone into developing Nanoc, and I would like to keep it going. Your support will ensure that Nanoc will continue to improve.**
15
-
16
- ## Contributing
17
-
18
- Contributions are greatly appreciated! Consult the [Development guidelines](http://nanoc.ws/development/) for information on how you can contribute.
19
-
20
- ### Contributors
21
-
22
- Many thanks to everyone who has contributed to Nanoc in one way or another:
23
-
24
- Abubakar Ango, Ale Muñoz, Alexander Groß, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, Cédric Boutillier, Chris Burkhardt, Chris Chapman, Chris Eppstein, Christian Plessl, Colin Barrett, Colin Seymour, Croath Liu, Damien Pollet, Dan Callahan, Daniel Hofstetter, Daniel Mendler, Daniel Wollschlaeger, David Alexander, David Everitt, Denis Defreyne, Dennis Sutch, Devon Luke Buchanan, Dmitry Bilunov, Eric Sunshine, Erik Hollensbe, Fabian Buch, Felix Hanley, Garen Torikian, Go Maeda, Grégory Karékinian, Gregory Pakosz, Guilherme Garnier, Hugo Peixoto, Jack Chu, Jake Benilov, Jan M. Faber, Jasper Van der Jeugt, Jeff Forcier, Jim Mendenhall, John Nishinaga, Justin Clift, Justin Hileman, Kevin Lynagh, Lorin Werthen, Louis T., Lucas Vuotto, Mathias Bynens, Matt Keveney, Matthew Frazier, Matthias Beyer, Matthias Reitinger, Matthias Vallentin, Micha Rosenbaum, Michal Cichra, Michal Papis, Mike Pennisi, Nelson Chen, Nicky Peeters, Nikhil Marathe, Oliver Byford, Paul Boone, Peter Aronoff, Raphael von der Grün, Rémi Barraquand, Remko Tronçon, Riley Goodside, Ruben Verborgh, Scott Vokes, Seiichi Yonezawa, Šime Ramov, Simon South, Spencer Whitt, Stanley Rost, Starr Horne, Stefan Bühler, Stuart Montgomery, Takashi Uchibe, Toon Willems, Tuomas Kareinen, Ursula Kallio, Vincent Driessen, Vlatko Kosturjak, whitequark, Xavier Shay, Yannick Ihmels, Zaiste de Grengolada
@@ -49,6 +49,16 @@ module Nanoc::Int
49
49
  end
50
50
  end
51
51
 
52
+ contract C::None => String
53
+ def to_s
54
+ (+'').tap do |s|
55
+ s << (raw_content? ? 'r' : '_')
56
+ s << (attributes? ? 'a' : '_')
57
+ s << (compiled_content? ? 'c' : '_')
58
+ s << (path? ? 'p' : '_')
59
+ end
60
+ end
61
+
52
62
  contract C::None => C::Bool
53
63
  def raw_content?
54
64
  case @raw_content
@@ -118,8 +118,6 @@ module Nanoc::CLI
118
118
 
119
119
  next if basename == 'nanoc'
120
120
 
121
- next if basename == 'live' && !Nanoc::Feature.enabled?(Nanoc::Feature::LIVE_CMD)
122
-
123
121
  cmd = load_command_at(cmd_filename)
124
122
  add_command(cmd)
125
123
  end
@@ -10,7 +10,7 @@ module Nanoc::CLI
10
10
  #
11
11
  # @return [void]
12
12
  def call
13
- Nanoc::CLI::ErrorHandler.handle_while(command: self) do
13
+ Nanoc::CLI::ErrorHandler.handle_while do
14
14
  run
15
15
  end
16
16
  end
@@ -26,7 +26,8 @@ module Nanoc::CLI::Commands
26
26
  end
27
27
 
28
28
  def run_repeat
29
- Nanoc::Extra::LiveRecompiler.new(command_runner: self).run
29
+ require 'nanoc/live'
30
+ Nanoc::Live::LiveRecompiler.new(command_runner: self).run
30
31
  end
31
32
 
32
33
  def run_once
@@ -108,16 +108,19 @@ module Nanoc::CLI::Commands
108
108
  pred.identifier.to_s
109
109
  when Nanoc::Int::Configuration
110
110
  nil
111
+ when Nanoc::Int::IdentifiableCollection
112
+ case dep.props.raw_content
113
+ when true
114
+ 'matching any'
115
+ else
116
+ "matching any of #{dep.props.raw_content.sort.join(', ')}"
117
+ end
118
+ else
119
+ raise Nanoc::Int::Errors::InternalInconsistency, "unexpected pred type #{pred}"
111
120
  end
112
121
 
113
- props = +''
114
- props << (dep.props.raw_content? ? 'r' : '_')
115
- props << (dep.props.attributes? ? 'a' : '_')
116
- props << (dep.props.compiled_content? ? 'c' : '_')
117
- props << (dep.props.path? ? 'p' : '_')
118
-
119
122
  if pred
120
- puts " [ #{format '%6s', type} ] (#{props}) #{pred_identifier}"
123
+ puts " [ #{format '%6s', type} ] (#{dep.props}) #{pred_identifier}"
121
124
  else
122
125
  puts ' ( removed item )'
123
126
  end
@@ -19,7 +19,6 @@ module Nanoc::CLI::Commands
19
19
 
20
20
  def run
21
21
  load_adsf
22
- require 'adsf/live'
23
22
 
24
23
  config = Nanoc::Int::ConfigLoader.new.new_from_cwd
25
24
 
@@ -5,23 +5,14 @@ module Nanoc::CLI
5
5
  #
6
6
  # @api private
7
7
  class ErrorHandler
8
- # @param [Nanoc::CLI::Command, nil] command The command that is
9
- # currently being executed, or nil if there is none
10
- def initialize(command: nil)
11
- @command = command
12
- end
13
-
14
8
  # Enables error handling in the given block.
15
9
  #
16
- # @param [Nanoc::CLI::Command, nil] command The command that is
17
- # currently being executed, or nil if there is none
18
- #
19
10
  # @return [void]
20
- def self.handle_while(command: nil, &block)
11
+ def self.handle_while(exit_on_error: true)
21
12
  if @disabled
22
13
  yield
23
14
  else
24
- new(command: command).handle_while(&block)
15
+ new.handle_while(exit_on_error: exit_on_error) { yield }
25
16
  end
26
17
  end
27
18
 
@@ -42,7 +33,7 @@ module Nanoc::CLI
42
33
  # called directly; use {Nanoc::CLI::ErrorHandler.handle_while} instead.
43
34
  #
44
35
  # @return [void]
45
- def handle_while(&_block)
36
+ def handle_while(exit_on_error:)
46
37
  # Set exit handler
47
38
  %w[INT TERM].each do |signal|
48
39
  Signal.trap(signal) do
@@ -74,7 +65,7 @@ module Nanoc::CLI
74
65
  else
75
66
  print_error(e)
76
67
  end
77
- exit(1)
68
+ exit(1) if exit_on_error
78
69
  end
79
70
 
80
71
  # Prints the given error to stderr. Includes message, possible resolution
@@ -190,6 +181,7 @@ module Nanoc::CLI
190
181
  'markaby' => 'markaby',
191
182
  'maruku' => 'maruku',
192
183
  'mime/types' => 'mime-types',
184
+ 'nanoc/live' => 'nanoc-live',
193
185
  'nokogiri' => 'nokogiri',
194
186
  'nokogumbo' => 'nokogumbo',
195
187
  'pry' => 'pry',
@@ -16,7 +16,6 @@ module Nanoc::Extra
16
16
  end
17
17
 
18
18
  require_relative 'extra/link_collector.rb'
19
- require_relative 'extra/live_recompiler'
20
19
  require_relative 'extra/piper'
21
20
  require_relative 'extra/jruby_nokogiri_warner'
22
21
  require_relative 'extra/core_ext'
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.8.15'
5
+ VERSION = '4.8.16'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.15
4
+ version: 4.8.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-02 00:00:00.000000000 Z
11
+ date: 2017-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -112,16 +112,12 @@ description: Nanoc is a static-site generator focused on flexibility. It transfo
112
112
  content from a format such as Markdown or AsciiDoc into another format, usually
113
113
  HTML, and lays out pages consistently to retain the site’s look and feel throughout.
114
114
  Static sites built with Nanoc can be deployed to any web server.
115
- email: denis@stoneship.org
115
+ email: denis+rubygems@denis.ws
116
116
  executables:
117
117
  - nanoc
118
118
  extensions: []
119
- extra_rdoc_files:
120
- - LICENSE
121
- - README.md
122
- - NEWS.md
119
+ extra_rdoc_files: []
123
120
  files:
124
- - CODE_OF_CONDUCT.md
125
121
  - LICENSE
126
122
  - NEWS.md
127
123
  - README.md
@@ -286,7 +282,6 @@ files:
286
282
  - lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb
287
283
  - lib/nanoc/cli/commands/create-site.rb
288
284
  - lib/nanoc/cli/commands/deploy.rb
289
- - lib/nanoc/cli/commands/live.rb
290
285
  - lib/nanoc/cli/commands/nanoc.rb
291
286
  - lib/nanoc/cli/commands/prune.rb
292
287
  - lib/nanoc/cli/commands/shell.rb
@@ -317,7 +312,6 @@ files:
317
312
  - lib/nanoc/extra/core_ext/time.rb
318
313
  - lib/nanoc/extra/jruby_nokogiri_warner.rb
319
314
  - lib/nanoc/extra/link_collector.rb
320
- - lib/nanoc/extra/live_recompiler.rb
321
315
  - lib/nanoc/extra/parallel_collection.rb
322
316
  - lib/nanoc/extra/piper.rb
323
317
  - lib/nanoc/filters.rb
@@ -380,16 +374,14 @@ licenses:
380
374
  - MIT
381
375
  metadata: {}
382
376
  post_install_message:
383
- rdoc_options:
384
- - "--main"
385
- - README.md
377
+ rdoc_options: []
386
378
  require_paths:
387
379
  - lib
388
380
  required_ruby_version: !ruby/object:Gem::Requirement
389
381
  requirements:
390
- - - ">="
382
+ - - "~>"
391
383
  - !ruby/object:Gem::Version
392
- version: 2.3.0
384
+ version: '2.3'
393
385
  required_rubygems_version: !ruby/object:Gem::Requirement
394
386
  requirements:
395
387
  - - ">="
@@ -1,46 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- ## Our Standards
8
-
9
- Examples of behavior that contributes to creating a positive environment include:
10
-
11
- * Using welcoming and inclusive language
12
- * Being respectful of differing viewpoints and experiences
13
- * Gracefully accepting constructive criticism
14
- * Focusing on what is best for the community
15
- * Showing empathy towards other community members
16
-
17
- Examples of unacceptable behavior by participants include:
18
-
19
- * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
- * Trolling, insulting/derogatory comments, and personal or political attacks
21
- * Public or private harassment
22
- * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
- * Other conduct which could reasonably be considered inappropriate in a professional setting
24
-
25
- ## Our Responsibilities
26
-
27
- Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
-
29
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
-
31
- ## Scope
32
-
33
- This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
-
35
- ## Enforcement
36
-
37
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at denis+nanoc-coc@stoneship.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
-
39
- Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
-
41
- ## Attribution
42
-
43
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
-
45
- [homepage]: http://contributor-covenant.org
46
- [version]: http://contributor-covenant.org/version/1/4/
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- usage 'live'
4
- summary 'auto-recompile and serve'
5
- description <<~EOS
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`!).
9
- EOS
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)'
13
- required :p, :port, 'specify the port to listen on (default: 3000)'
14
- flag :L, :'live-reload', 'reload on changes'
15
-
16
- module Nanoc::CLI::Commands
17
- class Live < ::Nanoc::CLI::CommandRunner
18
- def run
19
- self.class.enter_site_dir
20
-
21
- Thread.new do
22
- Thread.current.abort_on_exception = true
23
- Nanoc::CLI::Commands::View.new(options, [], self).run
24
- end
25
-
26
- Nanoc::Extra::LiveRecompiler.new(command_runner: self).run
27
- end
28
- end
29
- end
30
-
31
- runner Nanoc::CLI::Commands::Live
@@ -1,131 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::Extra
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)
12
- end
13
- end
14
-
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
26
-
27
- def run_child(pipe_write, pipe_read)
28
- pipe_write.close
29
-
30
- site = Nanoc::Int::SiteLoader.new.new_from_cwd
31
- changes_enum = gen_changes_for_child(site)
32
- yield(site)
33
-
34
- quit = Object.new
35
- parent_enum = Enumerator.new do |y|
36
- pipe_read.read
37
- y << quit
38
- end
39
-
40
- SlowEnumeratorTools.merge([parent_enum, changes_enum]).each do |e|
41
- break if quit.equal?(e)
42
-
43
- $stderr.print 'Reloading site… '
44
- $stderr.flush
45
- site_loader = Nanoc::Int::SiteLoader.new
46
- site = Nanoc::Int::Site.new(
47
- config: Nanoc::Int::ConfigLoader.new.new_from_cwd,
48
- data_source: site_loader.gen_data_source_for_config(site.config),
49
- code_snippets: site.code_snippets,
50
- )
51
- $stderr.puts 'done'
52
-
53
- yield(site)
54
- end
55
-
56
- exit 0
57
- rescue Interrupt
58
- exit 0
59
- end
60
-
61
- def run_parent
62
- # create initial child
63
- pipe_read, pipe_write = IO.pipe
64
- fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
65
- pipe_read.close
66
-
67
- gen_lib_changes.each do |_e|
68
- # stop child
69
- pipe_write.write('q')
70
- pipe_write.close
71
- Process.wait
72
-
73
- # create new child
74
- pipe_read, pipe_write = IO.pipe
75
- fork { run_child(pipe_write, pipe_read) { |s| yield(s) } }
76
- pipe_read.close
77
- end
78
- rescue Interrupt
79
- end
80
-
81
- def handle_changes(site, command_runner)
82
- time_before = Time.now
83
-
84
- puts 'Compiling site…'
85
- compiler = Nanoc::Int::Compiler.new_for(site)
86
- listener = Nanoc::CLI::Commands::CompileListeners::Aggregate.new(
87
- command_runner: command_runner,
88
- site: site,
89
- compiler: compiler,
90
- )
91
- listener.run_while do
92
- compiler.run_until_end
93
- end
94
-
95
- time_after = Time.now
96
- puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
97
- puts
98
- end
99
-
100
- def gen_lib_changes
101
- require 'listen'
102
-
103
- Nanoc::ChangesStream.new do |cl|
104
- opts = {
105
- latency: 0.0,
106
- wait_for_delay: 0.0,
107
- }
108
-
109
- listener = Listen.to('lib', opts) { |*| cl.lib }
110
- listener.start
111
- sleep
112
- end
113
- end
114
-
115
- def gen_config_and_rules_changes
116
- require 'listen'
117
-
118
- Nanoc::ChangesStream.new do |cl|
119
- opts = {
120
- only: /(\/|\A)(nanoc\.yaml|config\.yaml|rules|Rules|rules\.rb|Rules\.rb)\z/,
121
- latency: 0.0,
122
- wait_for_delay: 0.0,
123
- }
124
-
125
- listener = Listen.to('.', opts) { |*| cl.unknown }
126
- listener.start
127
- sleep
128
- end
129
- end
130
- end
131
- end