nanoc 2.1.4 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,6 +1,13 @@
1
1
  nanoc Release Notes
2
2
  ===================
3
3
 
4
+ 2.1.5
5
+ -----
6
+
7
+ * Added Ruby 1.9 compatibility
8
+ * The Filesystem and FilesystemCombined data sources now preserve custom
9
+ extensions
10
+
4
11
  2.1.4
5
12
  -----
6
13
 
data/Rakefile CHANGED
@@ -1,14 +1,33 @@
1
1
  ##### Requirements
2
2
 
3
+ # Rake etc
3
4
  require 'rake'
4
-
5
5
  require 'rake/clean'
6
6
  require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
7
  require 'rake/testtask'
9
8
 
9
+ # Rdoc
10
+ begin
11
+ require 'hanna/rdoctask'
12
+ rescue LoadError
13
+ warn "Tried loading hanna but failed; falling back to the normal RDoc template"
14
+ require 'rake/rdoctask'
15
+ end
16
+
17
+ # nanoc itself
10
18
  require File.dirname(__FILE__) + '/lib/nanoc.rb'
11
19
 
20
+ ##### Test Ruby 1.9
21
+
22
+ if RUBY_VERSION >= '1.9'
23
+ # Check presence of vendor/mocha
24
+ unless File.directory?('vendor/mocha')
25
+ warn "You appear to be running Ruby 1.9. Please make sure that, before " +
26
+ "running the tests, you have a version of mocha that is " +
27
+ "compatible with Ruby 1.9."
28
+ end
29
+ end
30
+
12
31
  ##### General details
13
32
 
14
33
  NAME = 'nanoc'
data/lib/nanoc.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Nanoc
2
2
 
3
3
  # The current nanoc version.
4
- VERSION = '2.1.4'
4
+ VERSION = '2.1.5'
5
5
 
6
6
  # Generic error. Superclass for all nanoc-specific errors.
7
7
  class Error < RuntimeError ; end
@@ -79,7 +79,9 @@ module Nanoc
79
79
  # Deprecated
80
80
  def extensions(*extensions) # :nodoc:
81
81
  # Initialize
82
- @extensions = [] unless instance_variables.include?('@extensions')
82
+ if !instance_variables.include?('@extensions') && !instance_variables.include?(:'@extensions')
83
+ @extensions = []
84
+ end
83
85
 
84
86
  if extensions.empty?
85
87
  @extensions
@@ -92,7 +94,9 @@ module Nanoc
92
94
  # Deprecated
93
95
  def extension(extension=nil) # :nodoc:
94
96
  # Initialize
95
- @extensions = [] unless instance_variables.include?('@extensions')
97
+ if !instance_variables.include?('@extensions') && !instance_variables.include?(:'@extensions')
98
+ @extensions = []
99
+ end
96
100
 
97
101
  if extension.nil?
98
102
  @extensions.first
@@ -270,6 +270,8 @@ module Nanoc
270
270
  # Run filter
271
271
  Nanoc::NotificationCenter.post(:filtering_started, self, klass.identifier)
272
272
  content = filter.run(content)
273
+ # FIXME hacky
274
+ content.force_encoding('utf-8') if content.respond_to?(:'force_encoding')
273
275
  Nanoc::NotificationCenter.post(:filtering_ended, self, klass.identifier)
274
276
  end
275
277
 
@@ -19,7 +19,9 @@ module Nanoc
19
19
  # symbols for this plugin.
20
20
  def identifiers(*identifiers)
21
21
  # Initialize
22
- @identifiers = [] unless instance_variables.include?('@identifiers')
22
+ if !instance_variables.include?('@identifiers') && !instance_variables.include?(:'@identifiers')
23
+ @identifiers = []
24
+ end
23
25
 
24
26
  if identifiers.empty?
25
27
  @identifiers
@@ -35,7 +37,9 @@ module Nanoc
35
37
  # When given nothing, returns the identifier for this plugin.
36
38
  def identifier(identifier=nil)
37
39
  # Initialize
38
- @identifiers = [] unless instance_variables.include?('@identifiers')
40
+ if !instance_variables.include?('@identifiers') && !instance_variables.include?(:'@identifiers')
41
+ @identifiers = []
42
+ end
39
43
 
40
44
  if identifier.nil?
41
45
  @identifiers.first
@@ -5,7 +5,7 @@ module Nanoc
5
5
  # calling destructive methods.
6
6
  class Proxy
7
7
 
8
- instance_methods.each { |m| undef_method m unless m =~ /^__/ }
8
+ instance_methods.each { |m| undef_method m unless m =~ /^__/ || m.to_s == 'object_id' }
9
9
 
10
10
  # Creates a proxy for the given object.
11
11
  def initialize(obj)
@@ -32,7 +32,8 @@ module Nanoc::CLI
32
32
 
33
33
  # Handle version option
34
34
  if parsed_arguments[:options].has_key?(:version)
35
- puts "nanoc #{Nanoc::VERSION} (c) 2007-2008 Denis Defreyne."
35
+ puts "nanoc #{Nanoc::VERSION} (c) 2007-2009 Denis Defreyne."
36
+ puts "Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) running on #{RUBY_PLATFORM}"
36
37
  exit 1
37
38
  # Handle help option
38
39
  elsif parsed_arguments[:options].has_key?(:help)
@@ -207,14 +207,10 @@ EOS
207
207
 
208
208
  # Build entire site
209
209
  FileUtils.mkdir_p(path)
210
- begin
211
- FileUtils.cd(File.join(path))
212
-
210
+ FileUtils.cd(File.join(path)) do
213
211
  site_create_minimal(data_source)
214
212
  site_setup
215
213
  site_populate
216
- ensure
217
- FileUtils.cd(File.join(path.map { |n| '..' }))
218
214
  end
219
215
 
220
216
  puts "Created a blank nanoc site at '#{path}'. Enjoy!"
@@ -220,7 +220,7 @@ module Nanoc::DataSources
220
220
  content_file = File.new(content_filename)
221
221
 
222
222
  # Get attributes
223
- attributes = meta.merge(:extension => File.extname(content_filename)[1..-1])
223
+ attributes = { 'extension' => File.extname(content_filename)[1..-1] }.merge(meta)
224
224
 
225
225
  # Get path
226
226
  path = meta_filename.sub(/^assets/, '').sub(/[^\/]+\.yaml$/, '')
@@ -363,8 +363,7 @@ module Nanoc::DataSources
363
363
 
364
364
  def layouts # :nodoc:
365
365
  # Determine what layout directory structure is being used
366
- dir_count = Dir[File.join('layouts', '*')].select { |f| File.directory?(f) }.size
367
- is_old_school = (dir_count == 0)
366
+ is_old_school = (Dir['layouts/*'].select { |f| File.file?(f) }.size > 0)
368
367
 
369
368
  if is_old_school
370
369
  # Warn about deprecation
@@ -414,8 +413,8 @@ module Nanoc::DataSources
414
413
 
415
414
  def save_layout(layout) # :nodoc:
416
415
  # Determine what layout directory structure is being used
417
- layout_file_count = Dir[File.join('layouts', '*')].select { |f| File.file?(f) }.size
418
- error_outdated if layout_file_count > 0
416
+ is_old_school = (Dir['layouts/*'].select { |f| File.file?(f) }.size > 0)
417
+ error_outdated if is_old_school
419
418
 
420
419
  # Get paths
421
420
  last_component = layout.path.split('/')[-1]
@@ -205,7 +205,7 @@ module Nanoc::DataSources
205
205
  return nil if meta[:is_draft]
206
206
 
207
207
  # Get attributes
208
- attributes = meta.merge(:extension => File.extname(filename)[1..-1])
208
+ attributes = { 'extension' => File.extname(filename)[1..-1] }.merge(meta)
209
209
 
210
210
  # Get actual path
211
211
  if filename =~ /\/index\.[^\/]+$/
@@ -8,7 +8,7 @@ module Nanoc::Extra
8
8
  # proxy will make sure the File object is not created until it is used.
9
9
  class FileProxy
10
10
 
11
- instance_methods.each { |m| undef_method m unless m =~ /^__/ }
11
+ instance_methods.each { |m| undef_method m unless m =~ /^__/ || m.to_s == 'object_id' }
12
12
 
13
13
  # Creates a new file proxy for the given path. This is similar to
14
14
  # creating a File object with the same path, except that the File object
@@ -4,11 +4,11 @@ module Nanoc::Filters
4
4
  identifiers :rdoc
5
5
 
6
6
  def run(content)
7
- require 'rdoc/markup/simple_markup'
8
- require 'rdoc/markup/simple_markup/to_html'
7
+ require 'rdoc/markup'
8
+ require 'rdoc/markup/to_html'
9
9
 
10
10
  # Get result
11
- ::SM::SimpleMarkup.new.convert(content, SM::ToHtml.new)
11
+ ::RDoc::Markup.new.convert(content, ::RDoc::Markup::ToHtml.new)
12
12
  end
13
13
 
14
14
  end
@@ -15,6 +15,10 @@ module Nanoc::Helpers
15
15
  # the documentation for these functions.
16
16
  #
17
17
  # The two main functions are sorted_articles and atom_feed.
18
+ #
19
+ # To activate this helper, +include+ it, like this:
20
+ #
21
+ # include Nanoc::Helpers::Blogging
18
22
  module Blogging
19
23
 
20
24
  # Returns the list of articles, sorted by descending creation date (so
@@ -30,6 +30,10 @@ module Nanoc::Helpers
30
30
  # When the site is compiled, the sidebar of the about page will say “On
31
31
  # this page, the purpose of nanoc is described, blah blah blah,” as
32
32
  # expected.
33
+ #
34
+ # To activate this helper, +include+ it, like this:
35
+ #
36
+ # include Nanoc::Helpers::Capturing
33
37
  module Capturing
34
38
 
35
39
  # Captures the content inside the block into a page attribute named
@@ -2,6 +2,8 @@ module Nanoc::Helpers
2
2
 
3
3
  # Nanoc::Helpers::HTMLEscape contains functionality for HTML-escaping
4
4
  # strings.
5
+ #
6
+ # This helper is activated automatically.
5
7
  module HTMLEscape
6
8
 
7
9
  # Returns the HTML-escaped representation of the given string. Only &, <,
@@ -1,6 +1,10 @@
1
1
  module Nanoc::Helpers
2
2
 
3
3
  # Nanoc::Helpers::LinkTo contains functions for linking to pages.
4
+ #
5
+ # To activate this helper, +include+ it, like this:
6
+ #
7
+ # include Nanoc::Helpers::LinkTo
4
8
  module LinkTo
5
9
 
6
10
  include Nanoc::Helpers::HTMLEscape
@@ -2,6 +2,8 @@ module Nanoc::Helpers
2
2
 
3
3
  # Nanoc::Helpers::Render provides functionality for rendering layouts as
4
4
  # partials.
5
+ #
6
+ # This helper is activated automatically.
5
7
  module Render
6
8
 
7
9
  # Returns a string containing the rendered given layout.
@@ -5,6 +5,10 @@ module Nanoc::Helpers
5
5
  # tags that should be applied to the page. For example:
6
6
  #
7
7
  # tags: [ 'foo', 'bar', 'baz' ]
8
+ #
9
+ # To activate this helper, +include+ it, like this:
10
+ #
11
+ # include Nanoc::Helpers::Tagging
8
12
  module Tagging
9
13
 
10
14
  # Returns a formatted list of tags for the given page as a string. Several
@@ -3,6 +3,10 @@ module Nanoc::Helpers
3
3
  # Nanoc::Helpers::XMLSitemap contains functionality for building XML
4
4
  # sitemaps that will be crawled by search engines. See the Sitemaps protocol
5
5
  # web site, http://www.sitemaps.org, for details.
6
+ #
7
+ # To activate this helper, +include+ it, like this:
8
+ #
9
+ # include Nanoc::Helpers::XMLSitemap
6
10
  module XMLSitemap
7
11
 
8
12
  # Returns the XML sitemap as a string.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-15 00:00:00 +01:00
12
+ date: 2009-02-01 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -154,6 +154,7 @@ rdoc_options:
154
154
  - --exclude
155
155
  - test
156
156
  - --line-numbers
157
+ - --inline-source
157
158
  require_paths:
158
159
  - lib
159
160
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -171,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
172
  requirements: []
172
173
 
173
174
  rubyforge_project: nanoc
174
- rubygems_version: 1.2.0
175
+ rubygems_version: 1.3.1
175
176
  signing_key:
176
177
  specification_version: 2
177
178
  summary: a tool that runs on your local computer and compiles Markdown, Textile, Haml, ... documents into static web pages