nanoc 4.3.6 → 4.3.7

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
  SHA1:
3
- metadata.gz: 33272b9e2fbec854248b3d0bd0abbcb714f3e1eb
4
- data.tar.gz: 5f4d064d412bb748a9103454243c06bd851e9f6a
3
+ metadata.gz: 6d052e7d5720a345ca133515b628b273f7ab649f
4
+ data.tar.gz: aeba9202e6a052fc7f43743a95bd5d624cbd3da8
5
5
  SHA512:
6
- metadata.gz: 2f32329a10aac398a06ca5974db441a3b685fc27e8db011a87f4e8e8937bcb371495e822a4ba6fe3c6bd4391f823cbc946a38cc77fba0d388671d2629358ac6c
7
- data.tar.gz: 4b32d6d3c48b88ad8f996c53278f759073a17844d729c532991f5da01e8c7923d3851e653cf8cb31a0de877140ef15bbbad40d30977cacab7af9a1217869d70a
6
+ metadata.gz: 873ae8427b92df4ca6e3cdffd6636ecb860ecfd092085f9a657725cce83e9cc839287b9860b76100c083cba1bd831eddc50f7e6bbe9bcc77d3290d5dee060607
7
+ data.tar.gz: '094be294404797042fb05beb21497887b828aa6ad58b37d76b29e110d90ecf60685394aee6a5d03d3debc119f69f928faf955ee6e5ec05323737c78466bd17ef'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (4.3.6)
4
+ nanoc (4.3.7)
5
5
  cri (~> 2.3)
6
6
  hamster (~> 3.0)
7
7
  parallel (~> 1.9)
@@ -127,7 +127,7 @@ GEM
127
127
  fog-json (1.0.2)
128
128
  fog-core (~> 1.0)
129
129
  multi_json (~> 1.10)
130
- fog-local (0.3.0)
130
+ fog-local (0.3.1)
131
131
  fog-core (~> 1.27)
132
132
  fog-openstack (0.1.15)
133
133
  fog-core (>= 1.40)
@@ -174,7 +174,7 @@ GEM
174
174
  fog-voxel (0.1.0)
175
175
  fog-core
176
176
  fog-xml
177
- fog-vsphere (1.4.0)
177
+ fog-vsphere (1.5.0)
178
178
  fog-core
179
179
  rbvmomi (~> 1.9)
180
180
  fog-xenserver (0.2.3)
@@ -257,7 +257,7 @@ GEM
257
257
  rainbow (2.1.0)
258
258
  rainpress (1.0)
259
259
  rake (11.3.0)
260
- rb-fsevent (0.9.7)
260
+ rb-fsevent (0.9.8)
261
261
  rb-inotify (0.9.7)
262
262
  ffi (>= 0.5.0)
263
263
  rbvmomi (1.9.4)
@@ -316,7 +316,7 @@ GEM
316
316
  trollop (2.1.2)
317
317
  typogruby (1.0.18)
318
318
  rubypants
319
- uglifier (3.0.2)
319
+ uglifier (3.0.3)
320
320
  execjs (>= 0.3.0, < 3)
321
321
  unicode-display_width (1.1.1)
322
322
  vcr (3.0.3)
data/NEWS.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.3.7 (2016-10-29)
4
+
5
+ Fixes:
6
+
7
+ * Fixed issue with `show-data` and `show-rules` commands not showing all data (#970) [Chris Chapman]
8
+
9
+ Enhancements:
10
+
11
+ * Improved speed of `compile` command (#968)
12
+ * Improved speed of `prune` command (#969)
13
+ * Made kramdown warnings include affected item rep (#967) [Gregory Pakosz]
14
+ * Made kramdown warnings configurable (#967) [Gregory Pakosz]
15
+
3
16
  ## 4.3.6 (2016-10-23)
4
17
 
5
18
  Fixes:
data/README.md CHANGED
@@ -19,4 +19,4 @@ Contributions are greatly appreciated! Consult the [Development guidelines](http
19
19
 
20
20
  Many thanks to everyone who has contributed to Nanoc in one way or another:
21
21
 
22
- Ale Muñoz, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, 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, Jack Chu, Jake Benilov, 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, Š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
22
+ Ale Muñoz, Alexander Mankuta, Andy Drop, Arnau Siches, Ben Armston, Bil Bas, Brian Candler, Bruno Dufour, 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, Jack Chu, Jake Benilov, 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, Š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
@@ -206,7 +206,8 @@ module Nanoc::Int
206
206
  end
207
207
 
208
208
  # Find item reps to compile and compile them
209
- selector = Nanoc::Int::ItemRepSelector.new(@reps)
209
+ outdated_reps = @reps.select { |r| outdatedness_checker.outdated?(r) }
210
+ selector = Nanoc::Int::ItemRepSelector.new(outdated_reps)
210
211
  selector.each do |rep|
211
212
  @stack = []
212
213
  compile_rep(rep)
@@ -24,3 +24,5 @@ require_relative 'views/mutable_layout_collection_view'
24
24
 
25
25
  require_relative 'views/post_compile_item_view'
26
26
  require_relative 'views/post_compile_item_collection_view'
27
+ require_relative 'views/post_compile_item_rep_view'
28
+ require_relative 'views/post_compile_item_rep_collection_view'
@@ -19,19 +19,24 @@ module Nanoc
19
19
  @item_reps
20
20
  end
21
21
 
22
+ # @api private
23
+ def view_class
24
+ Nanoc::ItemRepView
25
+ end
26
+
22
27
  def to_ary
23
- @item_reps.map { |ir| Nanoc::ItemRepView.new(ir, @context) }
28
+ @item_reps.map { |ir| view_class.new(ir, @context) }
24
29
  end
25
30
 
26
31
  # Calls the given block once for each item rep, passing that item rep as a parameter.
27
32
  #
28
- # @yieldparam [Nanoc::ItemRepView] item rep
33
+ # @yieldparam [Object] item rep view
29
34
  #
30
35
  # @yieldreturn [void]
31
36
  #
32
37
  # @return [self]
33
38
  def each
34
- @item_reps.each { |ir| yield Nanoc::ItemRepView.new(ir, @context) }
39
+ @item_reps.each { |ir| yield view_class.new(ir, @context) }
35
40
  self
36
41
  end
37
42
 
@@ -51,7 +56,7 @@ module Nanoc
51
56
  case rep_name
52
57
  when Symbol
53
58
  res = @item_reps.find { |ir| ir.name == rep_name }
54
- res && Nanoc::ItemRepView.new(res, @context)
59
+ res && view_class.new(res, @context)
55
60
  when Fixnum
56
61
  raise ArgumentError, "expected ItemRepCollectionView#[] to be called with a symbol (you likely want `.reps[:default]` rather than `.reps[#{rep_name}]`)"
57
62
  else
@@ -70,7 +75,7 @@ module Nanoc
70
75
  def fetch(rep_name)
71
76
  res = @item_reps.find { |ir| ir.name == rep_name }
72
77
  if res
73
- Nanoc::ItemRepView.new(res, @context)
78
+ view_class.new(res, @context)
74
79
  else
75
80
  raise NoSuchItemRepError.new(rep_name)
76
81
  end
@@ -0,0 +1,8 @@
1
+ module Nanoc
2
+ class PostCompileItemRepCollectionView < Nanoc::ItemRepCollectionView
3
+ # @api private
4
+ def view_class
5
+ Nanoc::PostCompileItemRepView
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ module Nanoc
2
+ class PostCompileItemRepView < ::Nanoc::ItemRepView
3
+ def compiled_content(snapshot: nil)
4
+ if unwrap.binary?
5
+ raise Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem.new(unwrap)
6
+ end
7
+
8
+ snapshot_contents = @context.compiler.compiled_content_cache[unwrap]
9
+ snapshot_name = snapshot || (snapshot_contents[:pre] ? :pre : :last)
10
+
11
+ if snapshot_contents[snapshot_name]
12
+ snapshot_contents[snapshot_name].string
13
+ else
14
+ raise Nanoc::Int::Errors::NoSuchSnapshot.new(unwrap, snapshot_name)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,9 @@
1
1
  module Nanoc
2
2
  class PostCompileItemView < Nanoc::ItemWithRepsView
3
+ def reps
4
+ Nanoc::PostCompileItemRepCollectionView.new(@context.reps[unwrap], @context)
5
+ end
6
+
3
7
  # @deprecated Use {#modified_reps} instead
4
8
  def modified
5
9
  modified_reps
@@ -20,6 +20,9 @@ module Nanoc::CLI::Commands
20
20
  compiler.load_stores
21
21
  dependency_store = compiler.dependency_store
22
22
 
23
+ # Build reps
24
+ compiler.build_reps
25
+
23
26
  # Print data
24
27
  print_item_dependencies(items, dependency_store)
25
28
  print_item_rep_paths(items)
@@ -11,7 +11,10 @@ module Nanoc::CLI::Commands
11
11
  load_site
12
12
 
13
13
  @c = Nanoc::CLI::ANSIStringColorizer
14
- @reps = site.compiler.reps
14
+
15
+ compiler = site.compiler
16
+ compiler.build_reps
17
+ @reps = compiler.reps
15
18
 
16
19
  action_provider = site.compiler.action_provider
17
20
  unless action_provider.respond_to?(:rules_collection)
@@ -17,7 +17,7 @@ module Nanoc::Extra
17
17
  def initialize(site, dry_run: false, exclude: [])
18
18
  @site = site
19
19
  @dry_run = dry_run
20
- @exclude = exclude
20
+ @exclude = Set.new(exclude)
21
21
  end
22
22
 
23
23
  # Prunes all output files not managed by Nanoc.
@@ -37,25 +37,40 @@ module Nanoc::Extra
37
37
  present_files = []
38
38
  present_dirs = []
39
39
  Find.find(site.config[:output_dir] + '/') do |f|
40
- present_files << f if File.file?(f)
41
- present_dirs << f if File.directory?(f)
40
+ basename = File.basename(f)
41
+
42
+ case File.ftype(f)
43
+ when 'file'.freeze
44
+ unless exclude?(basename)
45
+ present_files << f
46
+ end
47
+ when 'directory'.freeze
48
+ if exclude?(basename)
49
+ Find.prune
50
+ else
51
+ present_dirs << f
52
+ end
53
+ end
42
54
  end
43
55
 
44
56
  # Remove stray files
45
57
  stray_files = (present_files - compiled_files)
46
58
  stray_files.each do |f|
47
- next if filename_excluded?(f)
48
- delete_file(f)
59
+ delete_file(f) unless exclude?(f)
49
60
  end
50
61
 
51
62
  # Remove empty directories
52
63
  present_dirs.reverse_each do |dir|
53
64
  next if Dir.foreach(dir) { |n| break true if n !~ /\A\.\.?\z/ }
54
- next if filename_excluded?(dir)
65
+ next if exclude?(dir)
55
66
  delete_dir(dir)
56
67
  end
57
68
  end
58
69
 
70
+ def exclude?(component)
71
+ @exclude.include?(component)
72
+ end
73
+
59
74
  # @param [String] filename The filename to check
60
75
  #
61
76
  # @return [Boolean] true if the given file is excluded, false otherwise
@@ -10,10 +10,22 @@ module Nanoc::Filters
10
10
  #
11
11
  # @return [String] The filtered content
12
12
  def run(content, params = {})
13
+ params = params.dup
14
+ warning_filters = params.delete(:warning_filters)
13
15
  document = ::Kramdown::Document.new(content, params)
14
16
 
15
- document.warnings.each do |warning|
16
- $stderr.puts "kramdown warning: #{warning}"
17
+ if warning_filters
18
+ r = Regexp.union(warning_filters)
19
+ warnings = document.warnings.reject { |warning| r =~ warning }
20
+ else
21
+ warnings = document.warnings
22
+ end
23
+
24
+ if warnings.any?
25
+ $stderr.puts "kramdown warning(s) for #{@item_rep.inspect}"
26
+ warnings.each do |warning|
27
+ $stderr.puts " #{warning}"
28
+ end
17
29
  end
18
30
 
19
31
  document.to_html
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.3.6'.freeze
3
+ VERSION = '4.3.7'.freeze
4
4
  end
@@ -208,21 +208,6 @@ class Nanoc::Int::CompilerTest < Nanoc::TestCase
208
208
  end
209
209
  end
210
210
 
211
- def test_compile_should_recompile_all_reps
212
- Nanoc::CLI.run %w(create_site bar)
213
-
214
- FileUtils.cd('bar') do
215
- Nanoc::CLI.run %w(compile)
216
-
217
- site = Nanoc::Int::SiteLoader.new.new_from_cwd
218
- site.compile
219
-
220
- # At this point, even the already compiled items in the previous pass
221
- # should have their compiled content assigned, so this should work:
222
- site.compiler.reps[site.items['/index.*']][0].compiled_content
223
- end
224
- end
225
-
226
211
  def test_disallow_multiple_snapshots_with_the_same_name
227
212
  # Create site
228
213
  Nanoc::CLI.run %w(create_site bar)
@@ -12,15 +12,41 @@ class Nanoc::Filters::KramdownTest < Nanoc::TestCase
12
12
 
13
13
  def test_warnings
14
14
  if_have 'kramdown' do
15
+ # Create item
16
+ item = Nanoc::Int::Item.new('foo', {}, '/foo.md')
17
+ item_view = Nanoc::ItemWithRepsView.new(item, nil)
18
+ item_rep = Nanoc::Int::ItemRep.new(item, :default)
19
+ item_rep_view = Nanoc::ItemRepView.new(item_rep, nil)
20
+
15
21
  # Create filter
16
- filter = ::Nanoc::Filters::Kramdown.new
22
+ filter = ::Nanoc::Filters::Kramdown.new(item: item_view, item_rep: item_rep_view)
17
23
 
18
24
  # Run filter
19
25
  io = capturing_stdio do
20
26
  filter.setup_and_run('{:foo}this is bogus')
21
27
  end
22
28
  assert_empty io[:stdout]
23
- assert_equal "kramdown warning: Found span IAL after text - ignoring it\n", io[:stderr]
29
+ assert_equal "kramdown warning(s) for #{item_rep_view.inspect}\n Found span IAL after text - ignoring it\n", io[:stderr]
30
+ end
31
+ end
32
+
33
+ def test_warning_filters
34
+ if_have 'kramdown' do
35
+ # Create item
36
+ item = Nanoc::Int::Item.new('foo', {}, '/foo.md')
37
+ item_view = Nanoc::ItemWithRepsView.new(item, nil)
38
+ item_rep = Nanoc::Int::ItemRep.new(item, :default)
39
+ item_rep_view = Nanoc::ItemRepView.new(item_rep, nil)
40
+
41
+ # Create filter
42
+ filter = ::Nanoc::Filters::Kramdown.new(item: item_view, item_rep: item_rep_view)
43
+
44
+ # Run filter
45
+ io = capturing_stdio do
46
+ filter.setup_and_run("{:foo}this is bogus\n[foo]: http://foo.com\n", warning_filters: 'No link definition')
47
+ end
48
+ assert_empty io[:stdout]
49
+ assert_equal "kramdown warning(s) for #{item_rep_view.inspect}\n Found span IAL after text - ignoring it\n", io[:stderr]
24
50
  end
25
51
  end
26
52
  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.3.6
4
+ version: 4.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-23 00:00:00.000000000 Z
11
+ date: 2016-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -193,6 +193,8 @@ files:
193
193
  - lib/nanoc/base/views/mutable_layout_collection_view.rb
194
194
  - lib/nanoc/base/views/mutable_layout_view.rb
195
195
  - lib/nanoc/base/views/post_compile_item_collection_view.rb
196
+ - lib/nanoc/base/views/post_compile_item_rep_collection_view.rb
197
+ - lib/nanoc/base/views/post_compile_item_rep_view.rb
196
198
  - lib/nanoc/base/views/post_compile_item_view.rb
197
199
  - lib/nanoc/base/views/view.rb
198
200
  - lib/nanoc/base/views/view_context.rb