nanoc3 3.0.9 → 3.1.0a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/LICENSE +1 -1
  2. data/NEWS.md +360 -0
  3. data/README.md +85 -0
  4. data/Rakefile +2 -2
  5. data/bin/nanoc3 +0 -4
  6. data/lib/nanoc3/base/code_snippet.rb +14 -6
  7. data/lib/nanoc3/base/compiler.rb +68 -49
  8. data/lib/nanoc3/base/compiler_dsl.rb +70 -29
  9. data/lib/nanoc3/base/context.rb +47 -0
  10. data/lib/nanoc3/base/core_ext/array.rb +4 -0
  11. data/lib/nanoc3/base/core_ext/hash.rb +5 -1
  12. data/lib/nanoc3/base/core_ext/string.rb +2 -0
  13. data/lib/nanoc3/base/data_source.rb +132 -96
  14. data/lib/nanoc3/base/dependency_tracker.rb +160 -185
  15. data/lib/nanoc3/base/directed_graph.rb +252 -0
  16. data/lib/nanoc3/base/errors.rb +52 -4
  17. data/lib/nanoc3/base/filter.rb +43 -28
  18. data/lib/nanoc3/base/item.rb +93 -25
  19. data/lib/nanoc3/base/item_rep.rb +166 -55
  20. data/lib/nanoc3/base/layout.rb +16 -13
  21. data/lib/nanoc3/base/notification_center.rb +28 -12
  22. data/lib/nanoc3/base/plugin_registry.rb +158 -0
  23. data/lib/nanoc3/base/rule.rb +27 -8
  24. data/lib/nanoc3/base/rule_context.rb +59 -46
  25. data/lib/nanoc3/base/site.rb +124 -77
  26. data/lib/nanoc3/base.rb +7 -2
  27. data/lib/nanoc3/cli/base.rb +4 -1
  28. data/lib/nanoc3/cli/commands/autocompile.rb +5 -4
  29. data/lib/nanoc3/cli/commands/compile.rb +28 -7
  30. data/lib/nanoc3/cli/commands/create_item.rb +1 -1
  31. data/lib/nanoc3/cli/commands/create_layout.rb +1 -1
  32. data/lib/nanoc3/cli/commands/create_site.rb +46 -22
  33. data/lib/nanoc3/cli/commands/debug.rb +100 -0
  34. data/lib/nanoc3/cli/commands/help.rb +1 -1
  35. data/lib/nanoc3/cli/commands/info.rb +1 -1
  36. data/lib/nanoc3/cli/commands/view.rb +85 -0
  37. data/lib/nanoc3/cli/commands.rb +2 -0
  38. data/lib/nanoc3/cli/logger.rb +7 -0
  39. data/lib/nanoc3/cli.rb +0 -3
  40. data/lib/nanoc3/data_sources/{delicious.rb → deprecated/delicious.rb} +1 -24
  41. data/lib/nanoc3/data_sources/{last_fm.rb → deprecated/last_fm.rb} +1 -27
  42. data/lib/nanoc3/data_sources/{twitter.rb → deprecated/twitter.rb} +1 -14
  43. data/lib/nanoc3/data_sources/filesystem.rb +188 -176
  44. data/lib/nanoc3/data_sources/filesystem_unified.rb +107 -0
  45. data/lib/nanoc3/data_sources/filesystem_verbose.rb +80 -0
  46. data/lib/nanoc3/data_sources.rb +18 -9
  47. data/lib/nanoc3/extra/core_ext/enumerable.rb +39 -0
  48. data/lib/nanoc3/extra/core_ext/time.rb +2 -2
  49. data/lib/nanoc3/extra/core_ext.rb +1 -0
  50. data/lib/nanoc3/extra/deployers/rsync.rb +49 -3
  51. data/lib/nanoc3/extra/file_proxy.rb +7 -0
  52. data/lib/nanoc3/extra/vcs.rb +25 -24
  53. data/lib/nanoc3/extra/vcses/bazaar.rb +4 -0
  54. data/lib/nanoc3/extra/vcses/dummy.rb +4 -0
  55. data/lib/nanoc3/extra/vcses/git.rb +4 -0
  56. data/lib/nanoc3/extra/vcses/mercurial.rb +4 -0
  57. data/lib/nanoc3/extra/vcses/subversion.rb +4 -0
  58. data/lib/nanoc3/extra.rb +4 -1
  59. data/lib/nanoc3/filters/erb.rb +1 -1
  60. data/lib/nanoc3/filters/erubis.rb +1 -1
  61. data/lib/nanoc3/filters/haml.rb +1 -1
  62. data/lib/nanoc3/filters/kramdown.rb +14 -0
  63. data/lib/nanoc3/filters/maruku.rb +1 -1
  64. data/lib/nanoc3/filters/rainpress.rb +1 -1
  65. data/lib/nanoc3/filters/rdiscount.rb +3 -1
  66. data/lib/nanoc3/filters.rb +2 -0
  67. data/lib/nanoc3/helpers/blogging.rb +91 -75
  68. data/lib/nanoc3/helpers/breadcrumbs.rb +18 -10
  69. data/lib/nanoc3/helpers/capturing.rb +24 -29
  70. data/lib/nanoc3/helpers/filtering.rb +20 -17
  71. data/lib/nanoc3/helpers/html_escape.rb +7 -4
  72. data/lib/nanoc3/helpers/link_to.rb +51 -41
  73. data/lib/nanoc3/helpers/rendering.rb +15 -8
  74. data/lib/nanoc3/helpers/tagging.rb +27 -21
  75. data/lib/nanoc3/helpers/text.rb +12 -8
  76. data/lib/nanoc3/helpers/xml_sitemap.rb +13 -15
  77. data/lib/nanoc3/tasks/deploy/rsync.rake +4 -1
  78. data/lib/nanoc3/tasks.rb +2 -1
  79. data/lib/nanoc3.rb +24 -1
  80. metadata +43 -87
  81. data/NEWS.rdoc +0 -328
  82. data/README.rdoc +0 -83
  83. data/lib/nanoc3/base/plugin.rb +0 -88
  84. data/lib/nanoc3/base/preprocessor_context.rb +0 -37
  85. data/lib/nanoc3/data_sources/filesystem_combined.rb +0 -214
  86. data/lib/nanoc3/data_sources/filesystem_common.rb +0 -22
  87. data/lib/nanoc3/data_sources/filesystem_compact.rb +0 -256
  88. data/lib/nanoc3/extra/context.rb +0 -24
  89. data/lib/nanoc3/package.rb +0 -107
  90. data/vendor/cri/ChangeLog +0 -0
  91. data/vendor/cri/LICENSE +0 -19
  92. data/vendor/cri/NEWS +0 -0
  93. data/vendor/cri/README +0 -4
  94. data/vendor/cri/Rakefile +0 -25
  95. data/vendor/cri/lib/cri/base.rb +0 -153
  96. data/vendor/cri/lib/cri/command.rb +0 -105
  97. data/vendor/cri/lib/cri/core_ext/string.rb +0 -41
  98. data/vendor/cri/lib/cri/core_ext.rb +0 -8
  99. data/vendor/cri/lib/cri/option_parser.rb +0 -186
  100. data/vendor/cri/lib/cri.rb +0 -12
  101. data/vendor/cri/test/test_base.rb +0 -6
  102. data/vendor/cri/test/test_command.rb +0 -6
  103. data/vendor/cri/test/test_core_ext.rb +0 -21
  104. data/vendor/cri/test/test_option_parser.rb +0 -279
@@ -1,214 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::DataSources
4
-
5
- # = Items
6
- #
7
- # The filesystem data source stores its items in nested directories. A item
8
- # is represented by a single file. The root directory is the 'content'
9
- # directory.
10
- #
11
- # The metadata for a item is embedded into the file itself. It is stored at
12
- # the top of the file, between '---' (three dashes) separators. For example:
13
- #
14
- # ---
15
- # title: "Moo!"
16
- # ---
17
- # h1. Hello!
18
- #
19
- # The identifier of a item is determined as follows. A file with an
20
- # 'index.*' filename, such as 'index.txt', will have the filesystem path
21
- # with the 'index.*' part stripped as a identifier. For example,
22
- # 'foo/bar/index.html' will have '/foo/bar/' as identifier. In other cases,
23
- # the identifier is calculated by stripping the extension; if there is more
24
- # than one extension, only the last extension is stripped and the previous
25
- # extensions will be part of the identifier.
26
- #
27
- # A file with a filename not starting with 'index.', such as 'foo.html',
28
- # will have an identifier ending in 'foo/'. For example, 'foo/bar.html' will
29
- # have '/foo/bar/' as identifier.
30
- #
31
- # Note that it is possible for two different, separate files to have the
32
- # same identifier. It is therefore recommended to avoid such situations.
33
- #
34
- # Some more examples:
35
- #
36
- # content/index.html --> /
37
- # content/foo.html --> /foo/
38
- # content/foo/index.html --> /foo/
39
- # content/foo/bar.html --> /foo/bar/
40
- # content/foo/bar/index.html --> /foo/bar/
41
- #
42
- # File extensions are ignored by nanoc. The file extension does not
43
- # determine the filters to run on it; the metadata in the file defines the
44
- # list of filters.
45
- #
46
- # = Layouts
47
- #
48
- # Layouts are stored as files in the 'layouts' directory. Similar to items,
49
- # each layout consists of a metadata part and a content part, separated by
50
- # '---' (three dashes).
51
- #
52
- # The identifier for layouts is generated the same way as identifiers for
53
- # items (see above for details).
54
- #
55
- # = Code Snippets
56
- #
57
- # Code snippets are stored in '.rb' files in the 'lib' directory. Code
58
- # snippets can reside in sub-directories.
59
- class FilesystemCombined < Nanoc3::DataSource
60
-
61
- include Nanoc3::DataSources::FilesystemCommon
62
-
63
- ########## VCSes ##########
64
-
65
- attr_accessor :vcs
66
-
67
- def vcs
68
- @vcs ||= Nanoc3::Extra::VCSes::Dummy.new
69
- end
70
-
71
- ########## Preparation ##########
72
-
73
- def up
74
- end
75
-
76
- def down
77
- end
78
-
79
- def setup
80
- # Create directories
81
- %w( content layouts lib ).each do |dir|
82
- FileUtils.mkdir_p(dir)
83
- vcs.add(dir)
84
- end
85
- end
86
-
87
- ########## Loading data ##########
88
-
89
- def items
90
- files('content', true).map do |filename|
91
- # Read and parse data
92
- meta, content = *parse_file(filename, 'item')
93
-
94
- # Get attributes
95
- attributes = meta.merge(:file => Nanoc3::Extra::FileProxy.new(filename))
96
-
97
- # Get actual identifier
98
- identifier = filename_to_identifier(filename, /^content/)
99
-
100
- # Get mtime
101
- mtime = File.stat(filename).mtime
102
-
103
- # Build item
104
- Nanoc3::Item.new(content, attributes, identifier, mtime)
105
- end
106
- end
107
-
108
- def layouts
109
- files('layouts', true).map do |filename|
110
- # Read and parse data
111
- meta, content = *parse_file(filename, 'layout')
112
-
113
- # Get actual identifier
114
- identifier = filename_to_identifier(filename, /^layouts/)
115
-
116
- # Get mtime
117
- mtime = File.stat(filename).mtime
118
-
119
- # Build layout
120
- Nanoc3::Layout.new(content, meta, identifier, mtime)
121
- end.compact
122
- end
123
-
124
- ########## Creating data ##########
125
-
126
- # Creates a new item with the given content, attributes and identifier.
127
- def create_item(content, attributes, identifier)
128
- # Determine path
129
- if identifier == '/'
130
- path = 'content/index.html'
131
- else
132
- path = 'content' + identifier[0..-2] + '.html'
133
- end
134
- parent_path = File.dirname(path)
135
-
136
- # Notify
137
- Nanoc3::NotificationCenter.post(:file_created, path)
138
-
139
- # Write item
140
- FileUtils.mkdir_p(parent_path)
141
- File.open(path, 'w') do |io|
142
- io.write(YAML.dump(attributes.stringify_keys) + "\n")
143
- io.write("---\n")
144
- io.write(content)
145
- end
146
- end
147
-
148
- # Creates a new layout with the given content, attributes and identifier.
149
- def create_layout(content, attributes, identifier)
150
- # Determine path
151
- path = 'layouts' + identifier[0..-2] + '.html'
152
- parent_path = File.dirname(path)
153
-
154
- # Notify
155
- Nanoc3::NotificationCenter.post(:file_created, path)
156
-
157
- # Write layout
158
- FileUtils.mkdir_p(parent_path)
159
- File.open(path, 'w') do |io|
160
- io.write(YAML.dump(attributes.stringify_keys) + "\n")
161
- io.write("---\n")
162
- io.write(content)
163
- end
164
- end
165
-
166
- private
167
-
168
- # Returns a list of all files in +dir+, ignoring any unwanted files (files
169
- # that end with '~', '.orig', '.rej' or '.bak').
170
- #
171
- # +recursively+:: When +true+, finds files in +dir+ as well as its
172
- # subdirectories; when +false+, only searches +dir+
173
- # itself.
174
- def files(dir, recursively)
175
- glob = File.join([dir] + (recursively ? [ '**', '*' ] : [ '*' ]))
176
- Dir[glob].reject { |f| File.directory?(f) or f =~ /(~|\.orig|\.rej|\.bak)$/ }
177
- end
178
-
179
- # Parses the file named +filename+ and returns an array with its first
180
- # element a hash with the file's metadata, and with its second element the
181
- # file content itself.
182
- def parse_file(filename, kind)
183
- # Split file
184
- pieces = File.read(filename).split(/^(-{5}|-{3})/).compact
185
- if pieces.size < 4
186
- raise RuntimeError.new(
187
- "The file '#{filename}' does not seem to be a nanoc #{kind}"
188
- )
189
- end
190
-
191
- # Parse
192
- meta = YAML.load(pieces[2]) || {}
193
- content = pieces[4..-1].join.strip
194
-
195
- [ meta, content ]
196
- end
197
-
198
- def filename_to_identifier(filename, regex)
199
- identifier = filename.sub(regex, '')
200
- if filename =~ /\/index\.[^\/]+$/
201
- regex = ((@config && @config[:allow_periods_in_identifiers]) ? /index\.[^\/\.]+$/ : /index\.[^\/]+$/)
202
- identifier.sub!(regex, '')
203
- else
204
- regex = ((@config && @config[:allow_periods_in_identifiers]) ? /\.[^\/\.]+$/ : /\.[^\/]+$/)
205
- identifier.sub!(regex, '')
206
- end
207
- identifier << '/'
208
-
209
- identifier
210
- end
211
-
212
- end
213
-
214
- end
@@ -1,22 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::DataSources
4
-
5
- # The Nanoc3::DataSources::FilesystemCommon module provides code
6
- # snippet-loading and rule-loading methods that are used by both the
7
- # filesystem and the filesystem_combined data sources.
8
- module FilesystemCommon
9
-
10
- def code_snippets
11
- Dir['lib/**/*.rb'].sort.map do |filename|
12
- Nanoc3::CodeSnippet.new(
13
- File.read(filename),
14
- filename.sub(/^lib\//, ''),
15
- File.stat(filename).mtime
16
- )
17
- end
18
- end
19
-
20
- end
21
-
22
- end
@@ -1,256 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::DataSources
4
-
5
- # The filesystem_combined data source is the default data source for a new
6
- # nanoc site. It stores all data as files on the hard disk.
7
- #
8
- # None of the methods are documented in this file. See Nanoc3::DataSource
9
- # for documentation on the overridden methods instead.
10
- #
11
- # = Items
12
- #
13
- # Items are stored as pairs of two files: a content file, containing the
14
- # actual item content, and a meta file, containing the item's attributes,
15
- # formatted as YAML. The content file and the corresponding meta file have
16
- # the same filename but not the same extension; the meta file's extension is
17
- # .yaml.
18
- #
19
- # Items are stored in the "content" directory of the nanoc site.
20
- #
21
- # The home page item, located at /, is represented by an index.yaml meta
22
- # file, along with its corresponding content file.
23
- #
24
- # Subitems of other pages can be achieved in two ways: they can either be
25
- # nested in directories and named "index" such as the home page item, or
26
- # they can simply be given a non-"index" name.
27
- #
28
- # The identifier is calculated by stripping the extension; if there is more
29
- # than one extension, only the last extension is stripped and the previous
30
- # extensions will be part of the identifier.
31
- #
32
- # For example, this directory structure:
33
- #
34
- # content/
35
- # index.html
36
- # index.yaml
37
- # about.html
38
- # about.yaml
39
- # journal.html
40
- # journal.yaml
41
- # journal/
42
- # 2005.html
43
- # 2005.yaml
44
- # 2005/
45
- # a-very-old-post.html
46
- # a-very-old-post.yaml
47
- # another-very-old-post.html
48
- # another-very-old-post.yaml
49
- # foo.entry.html
50
- # foo.entry.yaml
51
- # myst/
52
- # index.html
53
- # index.yaml
54
- #
55
- # … corresponds with the following items:
56
- #
57
- # /
58
- # /about/
59
- # /journal/
60
- # /journal/2005/
61
- # /journal/2005/a-very-old-post/
62
- # /journal/2005/another-very-old-post/
63
- # /journal/2005/foo.entry/
64
- # /myst/
65
- #
66
- # = Layouts
67
- #
68
- # Layouts are stored the same way as items, except that they are stored in
69
- # the "layouts" directory instead of the "content" directory.
70
- #
71
- # The identifier for layouts is generated the same way as identifiers for
72
- # items (see above for details).
73
- #
74
- # = Code Snippets
75
- #
76
- # Code snippets are stored in '.rb' files in the 'lib' directory. Code
77
- # snippets can reside in sub-directories.
78
- class FilesystemCompact < Nanoc3::DataSource
79
-
80
- include Nanoc3::DataSources::FilesystemCommon
81
-
82
- ########## VCSes ##########
83
-
84
- attr_accessor :vcs
85
-
86
- def vcs
87
- @vcs ||= Nanoc3::Extra::VCSes::Dummy.new
88
- end
89
-
90
- ########## Preparation ##########
91
-
92
- def setup
93
- # Create directories
94
- %w( content layouts lib ).each do |dir|
95
- FileUtils.mkdir_p(dir)
96
- vcs.add(dir)
97
- end
98
- end
99
-
100
- ########## Loading data ##########
101
-
102
- def items
103
- meta_filenames('content').map do |meta_filename|
104
- # Read metadata
105
- meta = YAML.load_file(meta_filename) || {}
106
-
107
- # Get content
108
- content_filename = content_filename_for_meta_filename(meta_filename)
109
- content = File.read(content_filename)
110
-
111
- # Get attributes
112
- attributes = meta.merge(:file => Nanoc3::Extra::FileProxy.new(content_filename))
113
-
114
- # Get identifier
115
- identifier = identifier_for_meta_filename(meta_filename.sub(/^content/, ''))
116
-
117
- # Get modification times
118
- meta_mtime = File.stat(meta_filename).mtime
119
- content_mtime = File.stat(content_filename).mtime
120
- mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime
121
-
122
- # Create item object
123
- Nanoc3::Item.new(content, attributes, identifier, mtime)
124
- end
125
- end
126
-
127
- def layouts
128
- meta_filenames('layouts').map do |meta_filename|
129
- # Get content
130
- content_filename = content_filename_for_meta_filename(meta_filename)
131
- content = File.read(content_filename)
132
-
133
- # Get attributes
134
- attributes = YAML.load_file(meta_filename) || {}
135
-
136
- # Get identifier
137
- identifier = identifier_for_meta_filename(meta_filename.sub(/^layouts/, ''))
138
-
139
- # Get modification times
140
- meta_mtime = File.stat(meta_filename).mtime
141
- content_mtime = File.stat(content_filename).mtime
142
- mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime
143
-
144
- # Create layout object
145
- Nanoc3::Layout.new(content, attributes, identifier, mtime)
146
- end
147
- end
148
-
149
- ########## Creating data ##########
150
-
151
- # Creates a new item with the given content, attributes and identifier.
152
- def create_item(content, attributes, identifier)
153
- # Get filenames
154
- base_path = 'content' + (identifier == '/' ? '/index' : identifier[0..-2])
155
- meta_filename = base_path + '.yaml'
156
- content_filename = base_path + '.html'
157
-
158
- # Notify
159
- Nanoc3::NotificationCenter.post(:file_created, meta_filename)
160
- Nanoc3::NotificationCenter.post(:file_created, content_filename)
161
-
162
- # Create files
163
- FileUtils.mkdir_p(File.dirname(meta_filename))
164
- File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }
165
- File.open(content_filename, 'w') { |io| io.write(content) }
166
- end
167
-
168
- # Creates a new layout with the given content, attributes and identifier.
169
- def create_layout(content, attributes, identifier)
170
- # Get filenames
171
- base_path = 'layouts' + identifier[0..-2]
172
- meta_filename = base_path + '.yaml'
173
- content_filename = base_path + '.html'
174
-
175
- # Notify
176
- Nanoc3::NotificationCenter.post(:file_created, meta_filename)
177
- Nanoc3::NotificationCenter.post(:file_created, content_filename)
178
-
179
- # Create files
180
- FileUtils.mkdir_p(File.dirname(meta_filename))
181
- File.open(meta_filename, 'w') { |io| io.write(YAML.dump(attributes.stringify_keys)) }
182
- File.open(content_filename, 'w') { |io| io.write(content) }
183
- end
184
-
185
- private
186
-
187
- ########## Custom functions ##########
188
-
189
- # Returns the identifier for the given meta filename. This method assumes
190
- # that the base is already stripped. The identifier is calculated by
191
- # stripping the extension; if there is more than one extension, only the
192
- # last extension is stripped and the previous extensions will be part of
193
- # the identifier.
194
- #
195
- # For example:
196
- #
197
- # /foo.yaml -> /foo/
198
- # /foo/index.yaml -> /foo/
199
- # /foo/foo.yaml -> /foo/foo/
200
- # /foo/bar.yaml -> /foo/bar/
201
- # /foo/bar.entry.yaml -> /foo/bar.entry/
202
- def identifier_for_meta_filename(meta_filename)
203
- # Split into components
204
- components = meta_filename.gsub(%r{(^/|/$)}, '').split('/')
205
- if @config && @config[:allow_periods_in_identifiers]
206
- components[-1].sub!(/\.yaml$/, '')
207
- else
208
- components[-1].sub!(/\.[^\/\.]+$/, '')
209
- end
210
-
211
- if components[-1] == 'index'
212
- components[0..-2].join('/').cleaned_identifier
213
- else
214
- components.join('/').cleaned_identifier
215
- end
216
- end
217
-
218
- # Returns the list of all meta files in the given base directory as well
219
- # as its subdirectories.
220
- def meta_filenames(base)
221
- Dir[base + '/**/*.yaml']
222
- end
223
-
224
- # Returns the filename of the content file corresponding to the given meta
225
- # file, ignoring any unwanted files (files that end with '~', '.orig',
226
- # '.rej' or '.bak')
227
- def content_filename_for_meta_filename(meta_filename)
228
- # Find all files
229
- if @config && @config[:allow_periods_in_identifiers]
230
- base_filename = File.basename(meta_filename, '.yaml')
231
- dirname = File.dirname(meta_filename)
232
- filenames = Dir.entries(dirname).select { |f| f =~ /^#{base_filename}\.[^.]+$/ }.map { |f| "#{dirname}/#{f}" }
233
- else
234
- filenames = Dir[meta_filename.sub(/\.yaml$/, '.*')]
235
- end
236
-
237
- # Reject meta files
238
- filenames.reject! { |f| f =~ /\.yaml$/ }
239
-
240
- # Reject backups
241
- filenames.reject! { |f| f =~ /(~|\.orig|\.rej|\.bak)$/ }
242
-
243
- # Make sure there is only one content file
244
- if filenames.size != 1
245
- raise RuntimeError.new(
246
- "Expected 1 content file for the metafile #{meta_filename} but found #{filenames.size}"
247
- )
248
- end
249
-
250
- # Return content filename
251
- filenames.first
252
- end
253
-
254
- end
255
-
256
- end
@@ -1,24 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::Extra
4
-
5
- # Nanoc3::Extra::Context provides a context and a Binding for use in various
6
- # filters, such as the ERB and Haml one.
7
- class Context
8
-
9
- # Creates a new context based off the contents of the hash. Each pair in
10
- # the hash will be converted to an instance variable. For example, passing
11
- # the hash { :foo => 'bar' } will cause @foo to have the value "bar".
12
- def initialize(hash)
13
- hash.each_pair do |key, value|
14
- instance_variable_set('@' + key.to_s, value)
15
- end
16
- end
17
-
18
- # Returns a binding for this context.
19
- def get_binding
20
- binding
21
- end
22
-
23
- end
24
- end
@@ -1,107 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'singleton'
4
-
5
- module Nanoc3
6
-
7
- # Nanoc3::Package is a singleton that contains metadata about the nanoc
8
- # project, which is used for packaging releases.
9
- class Package
10
-
11
- include Singleton
12
-
13
- # The name of the application.
14
- def name
15
- 'nanoc3'
16
- end
17
-
18
- # The files to include in the package. This is also the list of files that
19
- # will be included in the documentation (with the exception of the files
20
- # in undocumented_files).
21
- def files
22
- @files ||= (%w( ChangeLog LICENSE NEWS.rdoc Rakefile README.rdoc ) +
23
- Dir['bin/**/*'] +
24
- Dir['lib/**/*'] +
25
- Dir['vendor/**/*']).reject { |f| File.directory?(f) }
26
- end
27
-
28
- # The files that are included in the documentation by default.
29
- def files_documented_by_default
30
- Dir['lib/**/*'].reject { |f| File.directory?(f) }
31
- end
32
-
33
- # The files that should not be included in the documentation.
34
- def files_not_in_documentation
35
- Dir['lib/**/*.rake'] +
36
- Dir['vendor/**/*'].reject { |f| File.directory?(f) }
37
- end
38
-
39
- # The files that should be included in the documentation.
40
- def files_in_documentation
41
- files - files_not_in_documentation
42
- end
43
-
44
- # The files that are not documented by RDoc by default, but should still
45
- # be included in the documentation.
46
- def extra_rdoc_files
47
- files_in_documentation - files_documented_by_default
48
- end
49
-
50
- # The name of the file that should be used as entry point for the
51
- # documentation.
52
- def main_documentation_file
53
- 'README.rdoc'
54
- end
55
-
56
- # The Gem::Specification used for packaging.
57
- def gem_spec
58
- @gem_spec ||= Gem::Specification.new do |s|
59
- s.name = self.name
60
- s.version = Nanoc3::VERSION
61
- s.platform = Gem::Platform::RUBY
62
- s.summary = 'a tool that runs on your local computer ' +
63
- 'and compiles Markdown, Textile, Haml, ' +
64
- '... documents into static web pages'
65
- s.description = s.summary
66
- s.homepage = 'http://nanoc.stoneship.org/'
67
- s.rubyforge_project = 'nanoc'
68
-
69
- s.author = 'Denis Defreyne'
70
- s.email = 'denis.defreyne@stoneship.org'
71
-
72
- s.post_install_message = <<EOS
73
- ------------------------------------------------------------------------------
74
- Thanks for installing nanoc 3.0! Here are some resources to help you get started:
75
-
76
- * The tutorial at <http://nanoc.stoneship.org/tutorial/>
77
- * The manual at <http://nanoc.stoneship.org/manual/>
78
- * The discussion group at <http://groups.google.com/group/nanoc>
79
- * The IRC channel #nanoc on Freenode
80
-
81
- Because nanoc 3.0 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.
82
-
83
- Enjoy!
84
- ------------------------------------------------------------------------------
85
- EOS
86
-
87
- s.required_ruby_version = '>= 1.8.5'
88
-
89
- s.has_rdoc = true
90
- s.extra_rdoc_files = self.extra_rdoc_files
91
- s.rdoc_options = []
92
- s.rdoc_options += [ '--title', self.name ]
93
- s.rdoc_options += [ '--main', self.main_documentation_file ]
94
- self.files_not_in_documentation.each do |file|
95
- s.rdoc_options += [ '--exclude', file ]
96
- end
97
-
98
- s.files = self.files
99
- s.executables = [ 'nanoc3' ]
100
- s.require_path = 'lib'
101
- s.bindir = 'bin'
102
- end
103
- end
104
-
105
- end
106
-
107
- end
data/vendor/cri/ChangeLog DELETED
File without changes
data/vendor/cri/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2009‒2010 Denis Defreyne and contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
data/vendor/cri/NEWS DELETED
File without changes
data/vendor/cri/README DELETED
@@ -1,4 +0,0 @@
1
- Cri
2
- ===
3
-
4
- Cri is a library for building easy-to-use commandline tools.
data/vendor/cri/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- ##### Requirements
2
-
3
- # Rake etc
4
- require 'rake'
5
- require 'minitest/unit'
6
-
7
- # Cri itself
8
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/lib'))
9
- require 'cri'
10
-
11
- ##### Testing
12
-
13
- desc 'Runs all tests'
14
- task :test do
15
- ENV['QUIET'] ||= 'true'
16
-
17
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/..'))
18
-
19
- MiniTest::Unit.autorun
20
-
21
- test_files = Dir['test/test_*.rb']
22
- test_files.each { |f| require f }
23
- end
24
-
25
- task :default => :test