nanoc3 3.2.0a1 → 3.2.0a2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/ChangeLog +2 -2
  2. data/NEWS.md +14 -0
  3. data/README.md +20 -12
  4. data/doc/yardoc_templates/default/layout/html/footer.erb +10 -0
  5. data/lib/nanoc3/base/compilation/checksum_store.rb +130 -0
  6. data/lib/nanoc3/base/compilation/checksummer.rb +68 -0
  7. data/lib/nanoc3/base/compilation/compiled_content_cache.rb +57 -0
  8. data/lib/nanoc3/base/{compiler.rb → compilation/compiler.rb} +255 -55
  9. data/lib/nanoc3/base/{compiler_dsl.rb → compilation/compiler_dsl.rb} +11 -6
  10. data/lib/nanoc3/base/{dependency_tracker.rb → compilation/dependency_tracker.rb} +62 -92
  11. data/lib/nanoc3/base/{filter.rb → compilation/filter.rb} +0 -0
  12. data/lib/nanoc3/base/compilation/item_rep_proxy.rb +87 -0
  13. data/lib/nanoc3/base/compilation/outdatedness_checker.rb +86 -0
  14. data/lib/nanoc3/base/compilation/outdatedness_reasons.rb +43 -0
  15. data/lib/nanoc3/base/{rule.rb → compilation/rule.rb} +8 -2
  16. data/lib/nanoc3/base/{rule_context.rb → compilation/rule_context.rb} +17 -14
  17. data/lib/nanoc3/base/directed_graph.rb +8 -0
  18. data/lib/nanoc3/base/errors.rb +9 -17
  19. data/lib/nanoc3/base/plugin_registry.rb +1 -1
  20. data/lib/nanoc3/base/result_data/item_rep.rb +447 -0
  21. data/lib/nanoc3/base/{code_snippet.rb → source_data/code_snippet.rb} +7 -22
  22. data/lib/nanoc3/base/{data_source.rb → source_data/data_source.rb} +0 -0
  23. data/lib/nanoc3/base/{item.rb → source_data/item.rb} +20 -30
  24. data/lib/nanoc3/base/{layout.rb → source_data/layout.rb} +7 -26
  25. data/lib/nanoc3/base/source_data/site.rb +314 -0
  26. data/lib/nanoc3/base/store.rb +126 -0
  27. data/lib/nanoc3/base.rb +26 -15
  28. data/lib/nanoc3/cli/base.rb +2 -1
  29. data/lib/nanoc3/cli/commands/compile.rb +116 -48
  30. data/lib/nanoc3/cli/commands/create_item.rb +0 -1
  31. data/lib/nanoc3/cli/commands/create_layout.rb +0 -1
  32. data/lib/nanoc3/cli/commands/create_site.rb +11 -1
  33. data/lib/nanoc3/cli/commands/debug.rb +11 -6
  34. data/lib/nanoc3/cli/commands/info.rb +1 -2
  35. data/lib/nanoc3/cli/commands/update.rb +0 -1
  36. data/lib/nanoc3/cli/commands/watch.rb +27 -32
  37. data/lib/nanoc3/cli/logger.rb +2 -2
  38. data/lib/nanoc3/data_sources/filesystem.rb +1 -6
  39. data/lib/nanoc3/extra/auto_compiler.rb +2 -3
  40. data/lib/nanoc3/extra/deployers/rsync.rb +1 -0
  41. data/lib/nanoc3/extra/validators/links.rb +45 -26
  42. data/lib/nanoc3/filters/asciidoc.rb +58 -0
  43. data/lib/nanoc3/filters/colorize_syntax.rb +47 -9
  44. data/lib/nanoc3/filters/less.rb +6 -0
  45. data/lib/nanoc3/filters/sass.rb +8 -5
  46. data/lib/nanoc3/filters.rb +2 -0
  47. data/lib/nanoc3/helpers/blogging.rb +8 -0
  48. data/lib/nanoc3/helpers/html_escape.rb +37 -7
  49. data/lib/nanoc3/helpers/link_to.rb +15 -4
  50. data/lib/nanoc3/helpers/rendering.rb +6 -2
  51. data/lib/nanoc3/tasks/clean.rb +0 -4
  52. data/lib/nanoc3.rb +1 -1
  53. data/nanoc3.gemspec +42 -0
  54. metadata +35 -19
  55. data/lib/nanoc3/base/checksummer.rb +0 -40
  56. data/lib/nanoc3/base/compiled_content_cache.rb +0 -86
  57. data/lib/nanoc3/base/item_rep.rb +0 -537
  58. data/lib/nanoc3/base/site.rb +0 -490
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+
3
+ module Nanoc3::Filters
4
+ class AsciiDoc < Nanoc3::Filter
5
+
6
+ type :text
7
+ identifier :asciidoc
8
+
9
+ # Runs the content through [AsciiDoc](http://www.methods.co.nz/asciidoc/).
10
+ # This method takes no options.
11
+ #
12
+ # @param [String] content The content to filter
13
+ #
14
+ # @return [String] The filtered content
15
+ def run(content, params={})
16
+ require 'escape'
17
+ require 'tempfile'
18
+
19
+ # Run filter
20
+ output = ''
21
+ errors = ''
22
+ success = true
23
+ Tempfile.open('nanoc-asciidoc-in') do |cmd_in|
24
+ cmd_out = Tempfile.open('nanoc-asciidoc-out')
25
+ cmd_err = Tempfile.open('nanoc-asciidoc-err')
26
+ cmd_out.close
27
+ cmd_err.close
28
+
29
+ # Write input
30
+ cmd_in.write(content)
31
+ cmd_in.close
32
+
33
+ # Run
34
+ # TODO allow customizable options
35
+ fns = {
36
+ :in => Escape.shell_single_word(cmd_in.path),
37
+ :out => Escape.shell_single_word(cmd_out.path),
38
+ :err => Escape.shell_single_word(cmd_err.path),
39
+ }
40
+ command = "asciidoc -o #{fns[:out]} #{fns[:in]} 2>#{fns[:err]}"
41
+ system(command)
42
+ success = $?.success?
43
+
44
+ # Done
45
+ output = File.read(cmd_out.path)
46
+ errors = File.read(cmd_err.path)
47
+ end
48
+
49
+ # Show errors
50
+ puts errors
51
+ raise RuntimeError, errors if !success
52
+
53
+ # Done
54
+ output
55
+ end
56
+
57
+ end
58
+ end
@@ -17,8 +17,11 @@ module Nanoc3::Filters
17
17
  # invoked with a `:coderay => coderay_options_hash` option, the
18
18
  # `coderay_options_hash` hash will be passed to the CodeRay colorizer.
19
19
  #
20
- # Currently, only the `:coderay` and `:pygmentize` colorizers are
21
- # implemented. Additional colorizer implementations are welcome!
20
+ # Currently, only the `:coderay` (http://coderay.rubychan.de/),
21
+ # `:pygmentize` (http://pygments.org/, http://pygments.org/docs/cmdline/),
22
+ # and `:simon_highlight`
23
+ # (http://www.andre-simon.de/doku/highlight/en/highlight.html) colorizers
24
+ # are implemented. Additional colorizer implementations are welcome!
22
25
  #
23
26
  # @example Content that will be highlighted
24
27
  #
@@ -36,7 +39,11 @@ module Nanoc3::Filters
36
39
  #
37
40
  # @param [String] content The content to filter
38
41
  #
39
- # @option params [Hash] :colorizers (DEFAULT_COLORIZER) A hash containing
42
+ # @option params [symbol] :default_colorizer (DEFAULT_COLORIZER) The
43
+ # default colorizer, i.e. the colorizer that will be used when the
44
+ # colorizer is not overriden for a specific language.
45
+ #
46
+ # @option params [Hash] :colorizers ({}) A hash containing
40
47
  # a mapping of programming languages (symbols, not strings) onto
41
48
  # colorizers (symbols).
42
49
  #
@@ -45,7 +52,7 @@ module Nanoc3::Filters
45
52
  require 'nokogiri'
46
53
 
47
54
  # Take colorizers from parameters
48
- @colorizers = Hash.new(DEFAULT_COLORIZER)
55
+ @colorizers = Hash.new(params[:default_colorizer] || DEFAULT_COLORIZER)
49
56
  (params[:colorizers] || {}).each_pair do |language, colorizer|
50
57
  @colorizers[language] = colorizer
51
58
  end
@@ -70,8 +77,8 @@ module Nanoc3::Filters
70
77
  language = match[2]
71
78
 
72
79
  # Highlight
73
- highlighted_code = highlight(element.inner_text, language, params)
74
- element.inner_html = highlighted_code
80
+ highlighted_code = highlight(element.inner_text.strip, language, params)
81
+ element.inner_html = highlighted_code.strip
75
82
  end
76
83
 
77
84
  doc.to_s
@@ -79,10 +86,10 @@ module Nanoc3::Filters
79
86
 
80
87
  private
81
88
 
82
- KNOWN_COLORIZERS = [ :coderay, :dummy, :pygmentize ]
89
+ KNOWN_COLORIZERS = [ :coderay, :dummy, :pygmentize, :simon_highlight ]
83
90
 
84
91
  def highlight(code, language, params={})
85
- colorizer = @colorizers[language]
92
+ colorizer = @colorizers[language.to_sym]
86
93
  if KNOWN_COLORIZERS.include?(colorizer)
87
94
  send(colorizer, code, language, params[colorizer] || {})
88
95
  else
@@ -104,9 +111,40 @@ module Nanoc3::Filters
104
111
  IO.popen("pygmentize -l #{language} -f html", "r+") do |io|
105
112
  io.write(code)
106
113
  io.close_write
107
- return io.read
114
+ highlighted_code = io.read
115
+
116
+ doc = Nokogiri::HTML.fragment(highlighted_code)
117
+ return doc.xpath('./div[@class="highlight"]/pre').inner_html
108
118
  end
109
119
  end
110
120
 
121
+ SIMON_HIGHLIGHT_OPT_MAP = {
122
+ :wrap => '-W',
123
+ :include_style => '-I',
124
+ :line_numbers => '-l',
125
+ }
126
+
127
+ def simon_highlight(code, language, params={})
128
+ opts = []
129
+
130
+ params.each do |key, value|
131
+ if SIMON_HIGHLIGHT_OPT_MAP[key]
132
+ opts << SIMON_HIGHLIGHT_OPT_MAP[key]
133
+ else
134
+ # TODO allow passing other options
135
+ case key
136
+ when :style
137
+ opts << "--style #{params[:style]}"
138
+ end
139
+ end
140
+ end
141
+
142
+ commandline = "highlight --syntax #{language} --fragment #{opts.join(" ")} /dev/stdin"
143
+ IO.popen(commandline, "r+") do |io|
144
+ io.write(code)
145
+ io.close_write
146
+ return io.read
147
+ end
148
+ end
111
149
  end
112
150
  end
@@ -12,7 +12,13 @@ module Nanoc3::Filters
12
12
  def run(content, params={})
13
13
  require 'less'
14
14
 
15
+ # Add filename to load path
16
+ $LESS_LOAD_PATH << File.dirname(@item[:content_filename])
17
+
15
18
  ::Less::Engine.new(content).to_css
19
+ ensure
20
+ # Restore load path
21
+ $LESS_LOAD_PATH.delete_at(-1)
16
22
  end
17
23
 
18
24
  end
@@ -20,7 +20,9 @@ module Nanoc3::Filters
20
20
  end
21
21
 
22
22
  # Get options
23
- options = params.merge(:filename => filename)
23
+ options = params.dup
24
+ sass_filename = options[:filename] || (@item && @item[:content_filename])
25
+ options[:filename] ||= sass_filename
24
26
 
25
27
  # Build engine
26
28
  engine = ::Sass::Engine.new(content, options)
@@ -43,8 +45,7 @@ module Nanoc3::Filters
43
45
 
44
46
  # Get import paths
45
47
  import_paths = (options[:load_paths] || []).dup
46
- import_paths.unshift(File.dirname(options[:filename])) if options[:filename]
47
-
48
+ import_paths.unshift(File.dirname(sass_filename)) if sass_filename
48
49
  # Get imported filenames
49
50
  imported_filenames = imported_nodes.map do |node|
50
51
  ::Sass::Files.find_file_to_import(node.imported_filename, import_paths)
@@ -52,8 +53,10 @@ module Nanoc3::Filters
52
53
 
53
54
  # Convert to items
54
55
  imported_items = imported_filenames.map do |filename|
55
- normalized_filename = Pathname.new(filename).realpath
56
- @items.find { |i| i[:filename] && Pathname.new(i[:filename]).realpath == normalized_filename }
56
+ pathname = Pathname.new(filename)
57
+ next unless pathname.file?
58
+ normalized_filename = pathname.realpath
59
+ @items.find { |i| i[:content_filename] && Pathname.new(i[:content_filename]).realpath == normalized_filename }
57
60
  end.compact
58
61
 
59
62
  # Require compilation of each item
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Nanoc3::Filters
4
4
 
5
+ autoload 'AsciiDoc', 'nanoc3/filters/asciidoc'
5
6
  autoload 'BlueCloth', 'nanoc3/filters/bluecloth'
6
7
  autoload 'CodeRay', 'nanoc3/filters/coderay'
7
8
  autoload 'ColorizeSyntax', 'nanoc3/filters/colorize_syntax'
@@ -21,6 +22,7 @@ module Nanoc3::Filters
21
22
  autoload 'RubyPants', 'nanoc3/filters/rubypants'
22
23
  autoload 'Sass', 'nanoc3/filters/sass'
23
24
 
25
+ Nanoc3::Filter.register '::Nanoc3::Filters::AsciiDoc', :asciidoc
24
26
  Nanoc3::Filter.register '::Nanoc3::Filters::BlueCloth', :bluecloth
25
27
  Nanoc3::Filter.register '::Nanoc3::Filters::CodeRay', :coderay
26
28
  Nanoc3::Filter.register '::Nanoc3::Filters::ColorizeSyntax', :colorize_syntax
@@ -233,6 +233,14 @@ module Nanoc3::Helpers
233
233
  update_time = a[:updated_at] || a[:created_at]
234
234
  xml.published((create_time.is_a?(String) ? Time.parse(create_time) : create_time).to_iso8601_time)
235
235
  xml.updated( (update_time.is_a?(String) ? Time.parse(update_time) : update_time).to_iso8601_time)
236
+
237
+ # Add specific author information
238
+ if a[:author_name] || a[:author_uri]
239
+ xml.author do
240
+ xml.name a[:author_name] || author_name
241
+ xml.uri a[:author_uri] || author_uri
242
+ end
243
+ end
236
244
 
237
245
  # Add link
238
246
  xml.link(:rel => 'alternate', :href => url)
@@ -5,17 +5,47 @@ module Nanoc3::Helpers
5
5
  # Contains functionality for HTML-escaping strings.
6
6
  module HTMLEscape
7
7
 
8
- # Returns the HTML-escaped representation of the given string. Only `&`,
9
- # `<`, `>` and `"` are escaped.
8
+ require 'nanoc3/helpers/capturing'
9
+ include Nanoc3::Helpers::Capturing
10
+
11
+ # Returns the HTML-escaped representation of the given string or the given
12
+ # block. Only `&`, `<`, `>` and `"` are escaped. When given a block, the
13
+ # contents of the block will be escaped and appended to the output buffer,
14
+ # `_erbout`.
15
+ #
16
+ # @example Escaping a string
17
+ #
18
+ # h('<br>')
19
+ # # => '&lt;br&gt;'
20
+ #
21
+ # @example Escaping with a block
22
+ #
23
+ # <% h do %>
24
+ # <h1>Hello <em>world</em>!</h1>
25
+ # <% end %>
26
+ # # The buffer will now contain “&lt;h1&gt;Hello &lt;em&gt;world&lt;/em&gt;!&lt;/h1&gt;”
10
27
  #
11
28
  # @param [String] string The string to escape
12
29
  #
13
30
  # @return [String] The escaped string
14
- def html_escape(string)
15
- string.gsub('&', '&amp;').
16
- gsub('<', '&lt;').
17
- gsub('>', '&gt;').
18
- gsub('"', '&quot;')
31
+ def html_escape(string=nil, &block)
32
+ if block_given?
33
+ # Capture and escape block
34
+ data = capture(&block)
35
+ escaped_data = html_escape(data)
36
+
37
+ # Append filtered data to buffer
38
+ buffer = eval('_erbout', block.binding)
39
+ buffer << escaped_data
40
+ elsif string
41
+ string.gsub('&', '&amp;').
42
+ gsub('<', '&lt;').
43
+ gsub('>', '&gt;').
44
+ gsub('"', '&quot;')
45
+ else
46
+ raise RuntimeError, "The #html_escape or #h function needs either a " \
47
+ "string or a block to HTML-escape, but neither a string nor a block was given"
48
+ end
19
49
  end
20
50
 
21
51
  alias h html_escape
@@ -47,7 +47,12 @@ module Nanoc3::Helpers
47
47
  # # => '<a title="My super cool blog" href="/blog/">Blog</a>'
48
48
  def link_to(text, target, attributes={})
49
49
  # Find path
50
- path = target.is_a?(String) ? target : target.path
50
+ if target.is_a?(String)
51
+ path = target
52
+ else
53
+ path = target.path
54
+ raise RuntimeError, "Cannot create a link to #{target.inspect} because this target is not outputted (its routing rule returns nil)" if path.nil?
55
+ end
51
56
 
52
57
  # Join attributes
53
58
  attributes = attributes.inject('') do |memo, (key, value)|
@@ -112,14 +117,20 @@ module Nanoc3::Helpers
112
117
  require 'pathname'
113
118
 
114
119
  # Find path
115
- path = target.is_a?(String) ? target : target.path
120
+ if target.is_a?(String)
121
+ path = target
122
+ else
123
+ path = target.path
124
+ raise RuntimeError, "Cannot get the relative path to #{target.inspect} because this target is not outputted (its routing rule returns nil)" if path.nil?
125
+ end
116
126
 
117
127
  # Get source and destination paths
118
128
  dst_path = Pathname.new(path)
129
+ raise RuntimeError, "Cannot get the relative path to #{path} because the current item representation, #{@item_rep.inspect}, is not outputted (its routing rule returns nil)" if @item_rep.path.nil?
119
130
  src_path = Pathname.new(@item_rep.path)
120
131
 
121
- # Calculate elative path (method depends on whether destination is a
122
- # directory or not).
132
+ # Calculate the relative path (method depends on whether destination is
133
+ # a directory or not).
123
134
  if src_path.to_s[-1,1] != '/'
124
135
  relative_path = dst_path.relative_path_from(src_path.dirname).to_s
125
136
  else
@@ -68,10 +68,11 @@ module Nanoc3::Helpers
68
68
  # Create filter
69
69
  filter = filter_class.new(assigns)
70
70
 
71
+ # Notify start
72
+ Nanoc3::NotificationCenter.post(:processing_started, layout)
73
+
71
74
  # Layout
72
- @site.compiler.stack.push(layout)
73
75
  result = filter.run(layout.raw_content, filter_args)
74
- @site.compiler.stack.pop
75
76
 
76
77
  # Append to erbout if we have a block
77
78
  if block_given?
@@ -81,6 +82,9 @@ module Nanoc3::Helpers
81
82
 
82
83
  # Done
83
84
  result
85
+ ensure
86
+ # Notify end
87
+ Nanoc3::NotificationCenter.post(:processing_ended, layout)
84
88
  end
85
89
 
86
90
  end
@@ -9,10 +9,6 @@ module Nanoc3::Tasks
9
9
  end
10
10
 
11
11
  def run
12
- # Load site data
13
- @site.load_data
14
-
15
- # Delete all compiled item reps
16
12
  filenames.each do |filename|
17
13
  FileUtils.rm_f filename unless filename.nil?
18
14
  end
data/lib/nanoc3.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Nanoc3
4
4
 
5
5
  # The current nanoc version.
6
- VERSION = '3.2.0a1'
6
+ VERSION = '3.2.0a2'
7
7
 
8
8
  end
9
9
 
data/nanoc3.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ $LOAD_PATH.unshift(File.expand_path('../lib/', __FILE__))
4
+ require 'nanoc3'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'nanoc3'
8
+ s.version = Nanoc3::VERSION
9
+ s.homepage = 'http://nanoc.stoneship.org/'
10
+ s.summary = 'a web publishing system written in Ruby for building small to medium-sized websites.'
11
+ s.description = 'nanoc is a simple but very flexible static site generator written in Ruby. It operates on local files, and therefore does not run on the server. nanoc “compiles” the local source files into HTML (usually), by evaluating eRuby, Markdown, etc.'
12
+
13
+ s.author = 'Denis Defreyne'
14
+ s.email = 'denis.defreyne@stoneship.org'
15
+
16
+ s.files = Dir['[A-Z]*'] + Dir['lib/**/*'] + Dir['doc/yardoc_templates/**/*'] + [ 'nanoc3.gemspec' ]
17
+ s.default_executable = 'nanoc3'
18
+ s.executables = [ 'nanoc3' ]
19
+ s.require_paths = [ 'lib' ]
20
+
21
+ s.has_rdoc = 'yard'
22
+ s.rdoc_options = [ '--main', 'README.md' ]
23
+ s.extra_rdoc_files = [ 'ChangeLog', 'LICENSE', 'README.md', 'NEWS.md' ]
24
+
25
+ s.add_runtime_dependency('cri', '>= 1.0.0')
26
+
27
+ s.post_install_message = %q{------------------------------------------------------------------------------
28
+ Thanks for installing nanoc 3.2! Here are some resources to help you get
29
+ started:
30
+
31
+ * The web site at <http://nanoc.stoneship.org/>
32
+ * The tutorial at <http://nanoc.stoneship.org/docs/3-getting-started/>
33
+ * The manual at <http://nanoc.stoneship.org/docs/4-basic-concepts/>
34
+
35
+ If you have questions, issues or simply want to share ideas, join the
36
+ discussion at <http://groups.google.com/group/nanoc> or stop by in the IRC
37
+ channel on irc.freenode.net, channel #nanoc. See you there!
38
+
39
+ Enjoy!
40
+ ------------------------------------------------------------------------------
41
+ }
42
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc3
3
3
  version: !ruby/object:Gem::Version
4
+ hash: -142061300
4
5
  prerelease: true
5
6
  segments:
6
7
  - 3
7
8
  - 2
8
- - 0a1
9
- version: 3.2.0a1
9
+ - 0a2
10
+ version: 3.2.0a2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Denis Defreyne
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-16 00:00:00 +02:00
18
+ date: 2010-07-09 00:00:00 +02:00
18
19
  default_executable: nanoc3
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: cri
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 23
27
30
  segments:
28
31
  - 1
29
32
  - 0
@@ -31,7 +34,7 @@ dependencies:
31
34
  version: 1.0.0
32
35
  type: :runtime
33
36
  version_requirements: *id001
34
- description:
37
+ description: "nanoc is a simple but very flexible static site generator written in Ruby. It operates on local files, and therefore does not run on the server. nanoc \xE2\x80\x9Ccompiles\xE2\x80\x9D the local source files into HTML (usually), by evaluating eRuby, Markdown, etc."
35
38
  email: denis.defreyne@stoneship.org
36
39
  executables:
37
40
  - nanoc3
@@ -48,30 +51,35 @@ files:
48
51
  - NEWS.md
49
52
  - Rakefile
50
53
  - README.md
51
- - lib/nanoc3/base/checksummer.rb
52
- - lib/nanoc3/base/code_snippet.rb
53
- - lib/nanoc3/base/compiled_content_cache.rb
54
- - lib/nanoc3/base/compiler.rb
55
- - lib/nanoc3/base/compiler_dsl.rb
54
+ - lib/nanoc3/base/compilation/checksum_store.rb
55
+ - lib/nanoc3/base/compilation/checksummer.rb
56
+ - lib/nanoc3/base/compilation/compiled_content_cache.rb
57
+ - lib/nanoc3/base/compilation/compiler.rb
58
+ - lib/nanoc3/base/compilation/compiler_dsl.rb
59
+ - lib/nanoc3/base/compilation/dependency_tracker.rb
60
+ - lib/nanoc3/base/compilation/filter.rb
61
+ - lib/nanoc3/base/compilation/item_rep_proxy.rb
62
+ - lib/nanoc3/base/compilation/outdatedness_checker.rb
63
+ - lib/nanoc3/base/compilation/outdatedness_reasons.rb
64
+ - lib/nanoc3/base/compilation/rule.rb
65
+ - lib/nanoc3/base/compilation/rule_context.rb
56
66
  - lib/nanoc3/base/context.rb
57
67
  - lib/nanoc3/base/core_ext/array.rb
58
68
  - lib/nanoc3/base/core_ext/hash.rb
59
69
  - lib/nanoc3/base/core_ext/string.rb
60
70
  - lib/nanoc3/base/core_ext.rb
61
- - lib/nanoc3/base/data_source.rb
62
- - lib/nanoc3/base/dependency_tracker.rb
63
71
  - lib/nanoc3/base/directed_graph.rb
64
72
  - lib/nanoc3/base/errors.rb
65
- - lib/nanoc3/base/filter.rb
66
- - lib/nanoc3/base/item.rb
67
- - lib/nanoc3/base/item_rep.rb
68
- - lib/nanoc3/base/layout.rb
69
73
  - lib/nanoc3/base/notification_center.rb
70
74
  - lib/nanoc3/base/ordered_hash.rb
71
75
  - lib/nanoc3/base/plugin_registry.rb
72
- - lib/nanoc3/base/rule.rb
73
- - lib/nanoc3/base/rule_context.rb
74
- - lib/nanoc3/base/site.rb
76
+ - lib/nanoc3/base/result_data/item_rep.rb
77
+ - lib/nanoc3/base/source_data/code_snippet.rb
78
+ - lib/nanoc3/base/source_data/data_source.rb
79
+ - lib/nanoc3/base/source_data/item.rb
80
+ - lib/nanoc3/base/source_data/layout.rb
81
+ - lib/nanoc3/base/source_data/site.rb
82
+ - lib/nanoc3/base/store.rb
75
83
  - lib/nanoc3/base.rb
76
84
  - lib/nanoc3/cli/base.rb
77
85
  - lib/nanoc3/cli/commands/autocompile.rb
@@ -114,6 +122,7 @@ files:
114
122
  - lib/nanoc3/extra/vcses/subversion.rb
115
123
  - lib/nanoc3/extra/vcses.rb
116
124
  - lib/nanoc3/extra.rb
125
+ - lib/nanoc3/filters/asciidoc.rb
117
126
  - lib/nanoc3/filters/bluecloth.rb
118
127
  - lib/nanoc3/filters/coderay.rb
119
128
  - lib/nanoc3/filters/colorize_syntax.rb
@@ -150,6 +159,9 @@ files:
150
159
  - lib/nanoc3/tasks/validate.rake
151
160
  - lib/nanoc3/tasks.rb
152
161
  - lib/nanoc3.rb
162
+ - doc/yardoc_templates/default/layout/html/footer.erb
163
+ - nanoc3.gemspec
164
+ - bin/nanoc3
153
165
  has_rdoc: yard
154
166
  homepage: http://nanoc.stoneship.org/
155
167
  licenses: []
@@ -176,16 +188,20 @@ rdoc_options:
176
188
  require_paths:
177
189
  - lib
178
190
  required_ruby_version: !ruby/object:Gem::Requirement
191
+ none: false
179
192
  requirements:
180
193
  - - ">="
181
194
  - !ruby/object:Gem::Version
195
+ hash: 3
182
196
  segments:
183
197
  - 0
184
198
  version: "0"
185
199
  required_rubygems_version: !ruby/object:Gem::Requirement
200
+ none: false
186
201
  requirements:
187
202
  - - ">"
188
203
  - !ruby/object:Gem::Version
204
+ hash: 25
189
205
  segments:
190
206
  - 1
191
207
  - 3
@@ -194,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
210
  requirements: []
195
211
 
196
212
  rubyforge_project:
197
- rubygems_version: 1.3.6
213
+ rubygems_version: 1.3.7
198
214
  signing_key:
199
215
  specification_version: 3
200
216
  summary: a web publishing system written in Ruby for building small to medium-sized websites.
@@ -1,40 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3
4
-
5
- # Responsible for creating checksums of files. Such checksums are used to
6
- # determine whether files have changed between compilations.
7
- class Checksummer
8
-
9
- # Returns a checksum for the specified file. Multiple invocations of this
10
- # method with the same filename argument will yield the same result.
11
- #
12
- # The returned checksum has the property that for two given files with
13
- # different content, the returned checksum will be different with a very
14
- # high probability. In practice, this boils down to using a secure
15
- # cryptographic hash function, such as SHA-1.
16
- #
17
- # The format of the resulting checksum should not be relied upon. In
18
- # future versions of nanoc, this function may use a different method for
19
- # generating checksums.
20
- #
21
- # @param [String] filename The name of the file for which the checksum
22
- # should be calculated
23
- #
24
- # @return [String] The checksum for the given files
25
- def self.checksum_for(filename)
26
- require 'digest'
27
-
28
- digest = Digest::SHA1.new
29
- File.open(filename, 'r') do |io|
30
- until io.eof
31
- data = io.readpartial(2**10)
32
- digest.update(data)
33
- end
34
- end
35
- digest.hexdigest
36
- end
37
-
38
- end
39
-
40
- end