Guest User

Untitled

a guest
Jun 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1.  
  2. preprocess do
  3. # Find items to put in archives
  4. items_to_archive = items.select { |i| i.identifier =~ /^\/files/ }
  5.  
  6. # Group them by extension
  7. item_groups = items_to_archive.group_by { |i| i[:extension] }
  8.  
  9. # For each extension (and their items)...
  10. item_groups.each_pair do |extension, items|
  11. # ... create a new item
  12. items << Nanoc3::Item.new(
  13. '',
  14. { :identifiers => items.map { |i| i.identifier } },
  15. "/archives/#{extension}.tar.bz2"
  16. )
  17. end
  18.  
  19. compile '/archives/*/' do
  20. filter :tar
  21. end
  22.  
  23. route '/archives/*/' do
  24. item.identifier.chop + '.tar.b2'
  25. end
Add Comment
Please, Sign In to add comment