nanoc 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,6 +1,17 @@
1
1
  nanoc Release Notes
2
2
  ===================
3
3
 
4
+ 2.1.6
5
+ -----
6
+
7
+ * The FilesystemCombined data source now supports empty metadata sections
8
+ * The RDoc filter now works for both RDoc 1.x and 2.x
9
+ * The autocompiler now serves a 500 when an exception occurs outside
10
+ compilation
11
+ * The autocompiler no longer serves index files when the request path does not
12
+ end with a slash
13
+ * The autocompiler now always serves asset content correctly
14
+
4
15
  2.1.5
5
16
  -----
6
17
 
data/Rakefile CHANGED
@@ -5,14 +5,7 @@ require 'rake'
5
5
  require 'rake/clean'
6
6
  require 'rake/gempackagetask'
7
7
  require 'rake/testtask'
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
8
+ require 'rake/rdoctask'
16
9
 
17
10
  # nanoc itself
18
11
  require File.dirname(__FILE__) + '/lib/nanoc.rb'
@@ -90,7 +83,9 @@ spec = Gem::Specification.new do |s|
90
83
  '--exclude' << 'lib/nanoc/binary_filters' <<
91
84
  '--exclude' << 'lib/nanoc/extra/vcses' <<
92
85
  '--exclude' << 'lib/nanoc/filters' <<
86
+ '--exclude' << 'doc' <<
93
87
  '--exclude' << 'test' <<
88
+ '--exclude' << 'vendor' <<
94
89
  '--line-numbers'
95
90
 
96
91
  s.files = %w( README LICENSE ChangeLog Rakefile ) + Dir[File.join('{bin,lib}', '**', '*')]
@@ -1,7 +1,7 @@
1
1
  module Nanoc
2
2
 
3
3
  # The current nanoc version.
4
- VERSION = '2.1.5'
4
+ VERSION = '2.1.6'
5
5
 
6
6
  # Generic error. Superclass for all nanoc-specific errors.
7
7
  class Error < RuntimeError ; end
@@ -484,7 +484,7 @@ module Nanoc::DataSources
484
484
  end
485
485
 
486
486
  # Parse
487
- meta = YAML.load(pieces[1])
487
+ meta = YAML.load(pieces[1]) || {}
488
488
  content = pieces[2..-1].join.strip
489
489
 
490
490
  [ meta, content ]
@@ -98,7 +98,13 @@ END
98
98
  end
99
99
 
100
100
  # Build Rack app
101
- app = lambda { |env| handle_request(env['PATH_INFO']) }
101
+ app = lambda do |env|
102
+ begin
103
+ handle_request(env['PATH_INFO'])
104
+ rescue Exception => exception
105
+ return serve_500(nil, exception)
106
+ end
107
+ end
102
108
 
103
109
  # Run Rack app
104
110
  port ||= 3000
@@ -173,14 +179,13 @@ END
173
179
  # Reload site data
174
180
  @site.load_data(true)
175
181
 
176
- # Get paths
177
- rep_path = path.cleaned_path
182
+ # Get file path
178
183
  file_path = @site.config[:output_dir] + path
179
184
 
180
185
  # Find rep
181
186
  objs = @site.pages + @site.assets
182
187
  reps = objs.map { |o| o.reps }.flatten
183
- rep = reps.find { |r| r.web_path == rep_path }
188
+ rep = reps.find { |r| r.web_path == path }
184
189
 
185
190
  if rep.nil?
186
191
  # Get list of possible filenames
@@ -271,7 +276,7 @@ END
271
276
  [
272
277
  200,
273
278
  { 'Content-Type' => mime_type_of(rep.disk_path, 'text/html') },
274
- [ rep.content(:post) ]
279
+ [ File.read(rep.disk_path) ]
275
280
  ]
276
281
  end
277
282
 
@@ -4,11 +4,19 @@ module Nanoc::Filters
4
4
  identifiers :rdoc
5
5
 
6
6
  def run(content)
7
- require 'rdoc/markup'
8
- require 'rdoc/markup/to_html'
7
+ begin
8
+ # new RDoc
9
+ require 'rdoc/markup'
10
+ require 'rdoc/markup/to_html'
11
+
12
+ ::RDoc::Markup.new.convert(content, ::RDoc::Markup::ToHtml.new)
13
+ rescue LoadError
14
+ # old RDoc
15
+ require 'rdoc/markup/simple_markup'
16
+ require 'rdoc/markup/simple_markup/to_html'
9
17
 
10
- # Get result
11
- ::RDoc::Markup.new.convert(content, ::RDoc::Markup::ToHtml.new)
18
+ ::SM::SimpleMarkup.new.convert(content, ::SM::ToHtml.new)
19
+ end
12
20
  end
13
21
 
14
22
  end
@@ -51,10 +51,10 @@ module Nanoc::Helpers
51
51
  #
52
52
  # Examples:
53
53
  #
54
- # link_to('Blog', '/blog/')
54
+ # link_to_unless_current('Blog', '/blog/')
55
55
  # # => '<a href="/blog/">Blog</a>'
56
56
  #
57
- # link_to('This Page', @page_rep)
57
+ # link_to_unless_current('This Page', @page_rep)
58
58
  # # => '<span class="active">This Page</span>'
59
59
  def link_to_unless_current(text, path_or_rep, attributes={})
60
60
  # Find path
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.5
4
+ version: 2.1.6
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: 2009-02-01 00:00:00 +01:00
12
+ date: 2009-02-28 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -152,9 +152,12 @@ rdoc_options:
152
152
  - --exclude
153
153
  - lib/nanoc/filters
154
154
  - --exclude
155
+ - doc
156
+ - --exclude
155
157
  - test
158
+ - --exclude
159
+ - vendor
156
160
  - --line-numbers
157
- - --inline-source
158
161
  require_paths:
159
162
  - lib
160
163
  required_ruby_version: !ruby/object:Gem::Requirement