This repository has been archived by the owner on Nov 1, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Move static resources around, adding new datasource to handle them
- Loading branch information
Showing
38 changed files
with
317 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| *.svg eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| require 'digest/sha1' | ||
|
|
||
| module Nanoc3::DataSources | ||
|
|
||
| class Static < Nanoc3::DataSource | ||
|
|
||
| identifier :static | ||
|
|
||
| def items | ||
| # Get prefix | ||
| prefix = config[:prefix] || 'static' | ||
|
|
||
| # Get all files under prefix dir | ||
| filenames = Dir[prefix + '/**/*'].select { |f| File.file?(f) } | ||
|
|
||
| # Convert filenames to items | ||
| filenames.map do |filename| | ||
| attributes = { | ||
| :extension => File.extname(filename)[1..-1], | ||
| :filename => filename, | ||
| } | ||
| identifier = filename[(prefix.length+1)..-1] + '/' | ||
|
|
||
| mtime = File.mtime(filename) | ||
| checksum = checksum_for(filename) | ||
|
|
||
| Nanoc3::Item.new( | ||
| filename, | ||
| attributes, | ||
| identifier, | ||
| :binary => true, :mtime => mtime, :checksum => checksum | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
| # Returns a checksum of the given filenames | ||
| # TODO un-duplicate this somewhere | ||
| def checksum_for(*filenames) | ||
| filenames.flatten.map do |filename| | ||
| digest = Digest::SHA1.new | ||
| File.open(filename, 'r') do |io| | ||
| until io.eof | ||
| data = io.readpartial(2**10) | ||
| digest.update(data) | ||
| end | ||
| end | ||
| digest.hexdigest | ||
| end.join('-') | ||
| end | ||
|
|
||
| end | ||
|
|
||
| end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
312 changes: 156 additions & 156 deletions
312
content/shared/images/blacktocat.svg → static/shared/images/blacktocat.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
186 changes: 93 additions & 93 deletions
186
content/shared/images/footer-logo.svg → static/shared/images/footer-logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.

