nanoc 2.1.6 → 2.2

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.
Files changed (65) hide show
  1. data/ChangeLog +3 -221
  2. data/Rakefile +9 -51
  3. data/bin/nanoc +5 -2
  4. data/lib/nanoc.rb +9 -31
  5. data/lib/nanoc/base.rb +26 -0
  6. data/lib/nanoc/base/core_ext.rb +2 -0
  7. data/lib/nanoc/base/filter.rb +11 -41
  8. data/lib/nanoc/base/layout.rb +1 -5
  9. data/lib/nanoc/base/page_rep.rb +1 -1
  10. data/lib/nanoc/base/proxies.rb +5 -0
  11. data/lib/nanoc/base/site.rb +4 -2
  12. data/lib/nanoc/binary_filters.rb +1 -0
  13. data/lib/nanoc/cli.rb +9 -1
  14. data/lib/nanoc/cli/base.rb +41 -129
  15. data/lib/nanoc/cli/commands.rb +10 -0
  16. data/lib/nanoc/cli/commands/autocompile.rb +1 -1
  17. data/lib/nanoc/cli/commands/compile.rb +51 -13
  18. data/lib/nanoc/cli/commands/create_layout.rb +1 -1
  19. data/lib/nanoc/cli/commands/create_page.rb +1 -1
  20. data/lib/nanoc/cli/commands/create_site.rb +1 -1
  21. data/lib/nanoc/cli/commands/create_template.rb +1 -1
  22. data/lib/nanoc/cli/commands/help.rb +1 -1
  23. data/lib/nanoc/cli/commands/info.rb +1 -1
  24. data/lib/nanoc/cli/commands/switch.rb +1 -1
  25. data/lib/nanoc/cli/commands/update.rb +1 -1
  26. data/lib/nanoc/cli/logger.rb +13 -7
  27. data/lib/nanoc/data_sources.rb +2 -0
  28. data/lib/nanoc/data_sources/filesystem.rb +3 -38
  29. data/lib/nanoc/extra.rb +6 -0
  30. data/lib/nanoc/extra/core_ext.rb +2 -0
  31. data/lib/nanoc/extra/vcses.rb +5 -0
  32. data/lib/nanoc/filters.rb +14 -0
  33. data/lib/nanoc/filters/erb.rb +3 -2
  34. data/lib/nanoc/filters/haml.rb +1 -1
  35. data/lib/nanoc/filters/markaby.rb +0 -1
  36. data/lib/nanoc/filters/rainpress.rb +13 -0
  37. data/lib/nanoc/filters/relativize_paths.rb +25 -0
  38. data/lib/nanoc/filters/sass.rb +1 -0
  39. data/lib/nanoc/helpers.rb +9 -0
  40. data/lib/nanoc/helpers/blogging.rb +55 -12
  41. data/lib/nanoc/helpers/filtering.rb +54 -0
  42. data/lib/nanoc/helpers/link_to.rb +40 -0
  43. data/lib/nanoc/helpers/text.rb +38 -0
  44. data/lib/nanoc/helpers/xml_sitemap.rb +3 -2
  45. data/lib/nanoc/routers.rb +3 -0
  46. data/vendor/cri/ChangeLog +0 -0
  47. data/vendor/cri/LICENSE +19 -0
  48. data/vendor/cri/NEWS +0 -0
  49. data/vendor/cri/README +4 -0
  50. data/vendor/cri/Rakefile +25 -0
  51. data/vendor/cri/lib/cri.rb +12 -0
  52. data/vendor/cri/lib/cri/base.rb +153 -0
  53. data/{lib/nanoc/cli → vendor/cri/lib/cri}/command.rb +5 -6
  54. data/vendor/cri/lib/cri/core_ext.rb +8 -0
  55. data/vendor/cri/lib/cri/core_ext/string.rb +41 -0
  56. data/{lib/nanoc/cli → vendor/cri/lib/cri}/option_parser.rb +35 -17
  57. data/vendor/cri/test/test_base.rb +6 -0
  58. data/vendor/cri/test/test_command.rb +6 -0
  59. data/vendor/cri/test/test_core_ext.rb +21 -0
  60. data/vendor/cri/test/test_option_parser.rb +279 -0
  61. data/vendor/mime-types/lib/mime/types.rb +1558 -0
  62. metadata +45 -9
  63. data/lib/nanoc/base/enhancements.rb +0 -14
  64. data/lib/nanoc/cli/cli.rb +0 -16
  65. data/lib/nanoc/cli/ext.rb +0 -37
data/ChangeLog CHANGED
@@ -1,221 +1,3 @@
1
- nanoc Release Notes
2
- ===================
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
-
15
- 2.1.5
16
- -----
17
-
18
- * Added Ruby 1.9 compatibility
19
- * The Filesystem and FilesystemCombined data sources now preserve custom
20
- extensions
21
-
22
- 2.1.4
23
- -----
24
-
25
- * Fixed an issue where the autocompiler in Windows would serve broken assets
26
-
27
- 2.1.3
28
- -----
29
-
30
- * The Haml and Sass filters now correctly take their options from assets
31
- * Autocompiler now serves index files instead of 404s
32
- * Layouts named "index" are now handled correctly
33
- * filesystem_combined now properly handles assets
34
-
35
- 2.1.2
36
- -----
37
-
38
- * Autocompiler now compiles assets as well
39
- * Sass filter now takes options (just like the Haml filter)
40
- * Haml/Sass options are now taken from the page *rep* instead of the page
41
-
42
- 2.1.1
43
- -----
44
-
45
- * Fixed issue which would cause files not to be required in the right order
46
-
47
- 2.1
48
- ---
49
-
50
- This is only a short summary of all changes in 2.1. For details, see the nanoc
51
- web site at <http://nanoc.stoneship.org/> -- especially the blog and the
52
- updated manual will be useful.
53
-
54
- New:
55
-
56
- * New filters: RDiscount, Maruku, Erubis
57
- * A better commandline frontend
58
- * A new filesystem data source named "filesystem_combined"
59
- * Routers, which decide where compiled pages should be written to
60
- * Page/layout mtimes can now be retrieved through page.mtime/layout.mtime
61
-
62
- Changed:
63
-
64
- * Already compiled pages will no longer be re-compiled unless outdated
65
- * Layout processors and filters have been merged
66
- * Layouts no longer rely on file extensions to determine the layout processor
67
- * Greatly improved source code documentation
68
- * Greatly improved unit test suite
69
-
70
- Removed:
71
-
72
- * Several filters have been removed and replaced by newer filters:
73
- * `eruby`: use `erb` or `erubis` instead
74
- * `markdown`: use `bluecloth`, `rdiscount` or `maruku` instead
75
- * `textile`: use `redcloth` instead
76
-
77
- 2.0.4
78
- -----
79
-
80
- * Fixed default.rb's `html_escape`
81
- * Updated Haml filter and layout processor so that @page, @pages and @config
82
- are now available as instance variables instead of local variables
83
-
84
- 2.0.3
85
- -----
86
-
87
- * The autocompiler now honors custom paths
88
- * The autocompiler now attempts to serve pages with the most appropriate MIME
89
- type, instead of always serving everything as "text/html"
90
-
91
- 2.0.2
92
- -----
93
-
94
- * nanoc now requires Ruby 1.8.5 instead of 1.8.6
95
-
96
- 2.0.1
97
- -----
98
-
99
- * Fixed a "too many open files" error that could appear during (auto)compiling
100
-
101
- 2.0
102
- ---
103
-
104
- New:
105
-
106
- * Support for custom layout processors
107
- * Support for custom data sources
108
- * Database data source
109
- * Auto-compiler
110
- * Pages have `parent` and `children`
111
-
112
- Changed:
113
-
114
- * The source has been restructured and cleaned up a great deal
115
- * Filters are defined in a different way now
116
- * The 'eruby' filter now uses ERB instead of Erubis
117
-
118
- Removed:
119
-
120
- * The `filters` property; use `filters_pre` instead
121
- * Support for Liquid
122
-
123
- 1.6.2
124
- -----
125
-
126
- * Fixed an issue which prevented the content capturing plugin from working
127
-
128
- 1.6.1
129
- -----
130
-
131
- * Removed a stray debug message
132
-
133
- 1.6
134
- ---
135
-
136
- * Added support for post-layout filters
137
- * Added support for getting a File object for the page, so you can now e.g.
138
- easily get the modification time for a given page (`@page.file.mtime`)
139
- * Cleaned up the source code a lot
140
- * Removed deprecated asset-copying functionality
141
-
142
- 1.5
143
- ---
144
-
145
- * Added support for custom filters
146
- * Improved Liquid support -- Liquid is now a first-class nanoc citizen
147
- * Deprecated assets -- use something like rsync instead
148
- * Added eruby_engine option, which can be 'erb' or 'erubis'
149
-
150
- 1.4
151
- ---
152
-
153
- * nanoc now supports ERB (as well as Erubis); Erubis no longer is a dependency
154
- * meta.yaml can now have haml_options property, which is passed to Haml
155
- * Pages can now have a 'filename' property, which defaults to 'index' [Dennis
156
- Sutch]
157
- * Pages now know in what order they should be compiled, eliminating the need
158
- for custom page ordering [Dennis Sutch]
159
-
160
- 1.3.1
161
- -----
162
-
163
- * The contents of the 'assets' directory are now copied into the output
164
- directory specified in 'config.yaml'
165
-
166
- 1.3
167
- ---
168
-
169
- * The @pages array now also contains uncompiled pages
170
- * Pages with 'skip_output' set to true will not be outputted
171
- * Added new filters
172
- * Textile/RedCloth
173
- * Sass
174
- * nanoc now warns before overwriting in create_site, create_page and
175
- create_template (but not in compile)
176
-
177
- 1.2
178
- ---
179
-
180
- * Sites now have an 'assets' directory, whose contents are copied to the
181
- 'output' directory when compiling [Soryu]
182
- * Added support for non-eRuby layouts (Markaby, Haml, Liquid, ...)
183
- * Added more filters (Markaby, Haml, Liquid, RDoc [Dmitry Bilunov])
184
- * Improved error reporting
185
- * Accessing page attributes using instance variables, and not through @page,
186
- is no longer possible
187
- * Page attributes can now be accessed using dot notation, i.e. @page.title as
188
- well as @page[:title]
189
-
190
- 1.1.3
191
- -----
192
-
193
- * Fixed bug which would cause layoutless pages to be outputted incorrectly
194
-
195
- 1.1.2
196
- -----
197
-
198
- * Backup files (files ending with a “~”) are now ignored
199
- * Fixed bug which would cause subpages not to be generated correctly
200
-
201
- 1.1
202
- ---
203
-
204
- * Added support for nested layouts
205
- * Added coloured logging
206
- * @page now hold the page that is currently being processed
207
- * Index files are now called “content” files and are now named after the
208
- directory they are in [Colin Barrett]
209
- * It is now possible to access @page in the page’s content file
210
-
211
- 1.0.1
212
- -----
213
-
214
- * Fixed a bug which would cause a “no such template” error to be displayed
215
- when the template existed but compiling it would raise an exception
216
- * Fixed bug which would cause pages not to be sorted by order before compiling
217
-
218
- 1.0
219
- ---
220
-
221
- * Initial release
1
+ For a list of all changes, please see the changelog on the project repository
2
+ instead (http://projects.stoneship.org/hg/shared/nanoc/shortlog). For release
3
+ notes, please see the NEWS file.
data/Rakefile CHANGED
@@ -2,13 +2,11 @@
2
2
 
3
3
  # Rake etc
4
4
  require 'rake'
5
- require 'rake/clean'
6
5
  require 'rake/gempackagetask'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
6
 
10
7
  # nanoc itself
11
- require File.dirname(__FILE__) + '/lib/nanoc.rb'
8
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/lib'))
9
+ require 'nanoc'
12
10
 
13
11
  ##### Test Ruby 1.9
14
12
 
@@ -33,31 +31,21 @@ AUTHOR = 'Denis Defreyne'
33
31
  EMAIL = 'denis.defreyne@stoneship.org'
34
32
 
35
33
  MESSAGE = <<EOS
36
- Thanks for installing nanoc 2.1! Here are some resources to help you get started:
34
+ Thanks for installing nanoc 2.2! Here are some resources to help you get started:
37
35
 
38
36
  * The tutorial at <http://nanoc.stoneship.org/help/tutorial/>
39
37
  * The manual at <http://nanoc.stoneship.org/help/manual/>
40
38
  * The discussion group at <http://groups.google.com/group/nanoc>
41
39
 
42
- Because nanoc 2.1 has a lot of new features, be sure to check out the nanoc blog at <http://nanoc.stoneship.org/blog/> for details about this release.
40
+ Be sure to check out the nanoc blog at <http://nanoc.stoneship.org/blog/> for
41
+ details about this release.
43
42
 
44
43
  Enjoy!
45
44
  EOS
46
45
 
47
- ##### Cleaning
48
-
49
- CLEAN.include([
50
- 'coverage',
51
- 'rdoc',
52
- 'tmp',
53
- File.join('test', 'fixtures', '*', 'output', '*'),
54
- File.join('test', 'fixtures', '*', 'tmp')
55
- ])
56
- CLOBBER.include([ 'pkg' ])
57
-
58
46
  ##### Packaging
59
47
 
60
- spec = Gem::Specification.new do |s|
48
+ GemSpec = Gem::Specification.new do |s|
61
49
  s.name = NAME
62
50
  s.version = VERS
63
51
  s.platform = Gem::Platform::RUBY
@@ -88,42 +76,12 @@ spec = Gem::Specification.new do |s|
88
76
  '--exclude' << 'vendor' <<
89
77
  '--line-numbers'
90
78
 
91
- s.files = %w( README LICENSE ChangeLog Rakefile ) + Dir[File.join('{bin,lib}', '**', '*')]
79
+ s.files = %w( README LICENSE ChangeLog Rakefile ) + Dir[File.join('{bin,lib,vendor}', '**', '*')]
92
80
  s.executables = [ 'nanoc' ]
93
81
  s.require_path = 'lib'
94
82
  s.bindir = 'bin'
95
83
  end
96
84
 
97
- Rake::GemPackageTask.new(spec) { |task| }
98
-
99
- task :install_gem do
100
- sh %{rake package}
101
- sh %{gem install pkg/#{NAME}-#{VERS}}
102
- end
103
-
104
- task :uninstall_gem do
105
- sh %{gem uninstall #{NAME}}
106
- end
107
-
108
- ### Documentation
109
-
110
- Rake::RDocTask.new do |task|
111
- task.rdoc_files.include(spec.extra_rdoc_files + [ 'lib' ])
112
- task.rdoc_dir = 'rdoc'
113
- task.options = spec.rdoc_options
114
- end
115
-
116
- ### Testing
117
-
118
- task :rcov do
119
- sh %{rcov test/**/test_*.rb -I test -x /Library}
120
- end
121
-
122
- Rake::TestTask.new(:test) do |task|
123
- ENV['QUIET'] = 'true'
124
-
125
- task.libs = [ 'lib', 'test' ]
126
- task.test_files = Dir[ 'test/**/test_*.rb' ]
127
- end
85
+ Dir.glob('tasks/**/*.rake').each { |r| Rake.application.add_import r }
128
86
 
129
- task :default => [ :test ]
87
+ task :default => [ :fetch_dependencies, :test ]
data/bin/nanoc CHANGED
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Add lib to load path
4
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
5
+
3
6
  # Load nanoc
4
- require File.dirname(__FILE__) + '/../lib/nanoc.rb'
5
- require File.dirname(__FILE__) + '/../lib/nanoc/cli.rb'
7
+ require 'nanoc'
8
+ require 'nanoc/cli'
6
9
 
7
10
  # Load custom code that can't be load later
8
11
  Dir['lib/commands/*.rb'].each { |f| require f }
@@ -1,7 +1,7 @@
1
1
  module Nanoc
2
2
 
3
3
  # The current nanoc version.
4
- VERSION = '2.1.6'
4
+ VERSION = '2.2'
5
5
 
6
6
  # Generic error. Superclass for all nanoc-specific errors.
7
7
  class Error < RuntimeError ; end
@@ -57,39 +57,17 @@ module Nanoc
57
57
  module Routers # :nodoc:
58
58
  end
59
59
 
60
- # Requires the given Ruby files at the specified path.
61
- #
62
- # +path+:: An array containing path segments. This path is relative to the
63
- # directory this file (nanoc.rb) is in. Can contain wildcards.
64
- def self.load(*path)
65
- full_path = [ File.dirname(__FILE__), 'nanoc' ] + path
66
- Dir[File.join(full_path)].sort.each { |f| require f }
67
- end
68
-
69
60
  end
70
61
 
71
62
  # Load requirements
72
- begin ; require 'rubygems' ; rescue LoadError ; end
73
63
  require 'yaml'
74
64
  require 'fileutils'
75
65
 
76
- # Load base
77
- Nanoc.load('base', 'enhancements.rb')
78
- Nanoc.load('base', 'defaults.rb')
79
- Nanoc.load('base', 'proxy.rb')
80
- Nanoc.load('base', 'proxies', '*.rb')
81
- Nanoc.load('base', 'core_ext', '*.rb')
82
- Nanoc.load('base', 'plugin.rb')
83
- Nanoc.load('base', '*.rb')
84
-
85
- # Load extra's
86
- Nanoc.load('extra', 'core_ext', '*.rb')
87
- Nanoc.load('extra', '*.rb')
88
- Nanoc.load('extra', 'vcses', '*.rb')
89
-
90
- # Load plugins
91
- Nanoc.load('data_sources', '*.rb')
92
- Nanoc.load('filters', '*.rb')
93
- Nanoc.load('binary_filters', '*.rb')
94
- Nanoc.load('routers', '*.rb')
95
- Nanoc.load('helpers', '*.rb')
66
+ # Load nanoc
67
+ require 'nanoc/base'
68
+ require 'nanoc/extra'
69
+ require 'nanoc/data_sources'
70
+ require 'nanoc/binary_filters'
71
+ require 'nanoc/filters'
72
+ require 'nanoc/routers'
73
+ require 'nanoc/helpers'
@@ -0,0 +1,26 @@
1
+ module Nanoc
2
+
3
+ autoload :Asset, 'nanoc/base/asset'
4
+ autoload :AssetDefaults, 'nanoc/base/asset_defaults'
5
+ autoload :AssetRep, 'nanoc/base/asset_rep'
6
+ autoload :BinaryFilter, 'nanoc/base/binary_filter'
7
+ autoload :Code, 'nanoc/base/code'
8
+ autoload :Compiler, 'nanoc/base/compiler'
9
+ autoload :DataSource, 'nanoc/base/data_source'
10
+ autoload :Defaults, 'nanoc/base/defaults'
11
+ autoload :Filter, 'nanoc/base/filter'
12
+ autoload :Layout, 'nanoc/base/layout'
13
+ autoload :NotificationCenter, 'nanoc/base/notification_center'
14
+ autoload :Page, 'nanoc/base/page'
15
+ autoload :PageDefaults, 'nanoc/base/page_defaults'
16
+ autoload :PageRep, 'nanoc/base/page_rep'
17
+ autoload :Plugin, 'nanoc/base/plugin'
18
+ autoload :Proxy, 'nanoc/base/proxy'
19
+ autoload :Router, 'nanoc/base/router'
20
+ autoload :Site, 'nanoc/base/site'
21
+ autoload :Template, 'nanoc/base/template'
22
+
23
+ require 'nanoc/base/core_ext'
24
+ require 'nanoc/base/proxies'
25
+
26
+ end
@@ -0,0 +1,2 @@
1
+ require 'nanoc/base/core_ext/hash'
2
+ require 'nanoc/base/core_ext/string'
@@ -74,48 +74,18 @@ module Nanoc
74
74
  })
75
75
  end
76
76
 
77
- class << self
78
-
79
- # Deprecated
80
- def extensions(*extensions) # :nodoc:
81
- # Initialize
82
- if !instance_variables.include?('@extensions') && !instance_variables.include?(:'@extensions')
83
- @extensions = []
84
- end
85
-
86
- if extensions.empty?
87
- @extensions
88
- else
89
- @extensions = extensions
90
- @extensions.each { |e| register_extension(e, self) }
91
- end
92
- end
93
-
94
- # Deprecated
95
- def extension(extension=nil) # :nodoc:
96
- # Initialize
97
- if !instance_variables.include?('@extensions') && !instance_variables.include?(:'@extensions')
98
- @extensions = []
99
- end
100
-
101
- if extension.nil?
102
- @extensions.first
103
- else
104
- @extensions = [ extension ]
105
- register_extension(extension, self)
106
- end
107
- end
108
-
109
- # Deprecated
110
- def register_extension(extension, klass)
111
- EXTENSIONS_MAP[extension] = klass
112
- end
113
-
114
- # Deprecated
115
- def with_extension(extension)
116
- EXTENSIONS_MAP[extension]
77
+ # Returns the filename associated with the item that is being filtered.
78
+ # The returned filename is in the format "page <path> (rep <name>)".
79
+ def filename
80
+ if assigns[:layout]
81
+ "layout #{assigns[:layout].path}"
82
+ elsif assigns[:page]
83
+ "page #{assigns[:_obj].path} (rep #{assigns[:_obj_rep].name})"
84
+ elsif assigns[:asset]
85
+ "asset #{assigns[:_obj].path} (rep #{assigns[:_obj_rep].name})"
86
+ else
87
+ '?'
117
88
  end
118
-
119
89
  end
120
90
 
121
91
  end