nanoc3 3.2.4 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. metadata +14 -313
  2. data/.gemtest +0 -0
  3. data/ChangeLog +0 -3
  4. data/Gemfile +0 -29
  5. data/LICENSE +0 -19
  6. data/NEWS.md +0 -449
  7. data/README.md +0 -108
  8. data/Rakefile +0 -14
  9. data/bin/nanoc3 +0 -12
  10. data/doc/yardoc_templates/default/layout/html/footer.erb +0 -10
  11. data/lib/nanoc3.rb +0 -28
  12. data/lib/nanoc3/base.rb +0 -49
  13. data/lib/nanoc3/base/compilation/checksum_store.rb +0 -57
  14. data/lib/nanoc3/base/compilation/compiled_content_cache.rb +0 -62
  15. data/lib/nanoc3/base/compilation/compiler.rb +0 -455
  16. data/lib/nanoc3/base/compilation/compiler_dsl.rb +0 -214
  17. data/lib/nanoc3/base/compilation/dependency_tracker.rb +0 -196
  18. data/lib/nanoc3/base/compilation/filter.rb +0 -165
  19. data/lib/nanoc3/base/compilation/item_rep_proxy.rb +0 -102
  20. data/lib/nanoc3/base/compilation/item_rep_recorder_proxy.rb +0 -88
  21. data/lib/nanoc3/base/compilation/outdatedness_checker.rb +0 -223
  22. data/lib/nanoc3/base/compilation/outdatedness_reasons.rb +0 -46
  23. data/lib/nanoc3/base/compilation/rule.rb +0 -73
  24. data/lib/nanoc3/base/compilation/rule_context.rb +0 -84
  25. data/lib/nanoc3/base/compilation/rule_memory_calculator.rb +0 -40
  26. data/lib/nanoc3/base/compilation/rule_memory_store.rb +0 -53
  27. data/lib/nanoc3/base/compilation/rules_collection.rb +0 -231
  28. data/lib/nanoc3/base/context.rb +0 -47
  29. data/lib/nanoc3/base/core_ext.rb +0 -6
  30. data/lib/nanoc3/base/core_ext/array.rb +0 -62
  31. data/lib/nanoc3/base/core_ext/hash.rb +0 -63
  32. data/lib/nanoc3/base/core_ext/pathname.rb +0 -26
  33. data/lib/nanoc3/base/core_ext/string.rb +0 -46
  34. data/lib/nanoc3/base/directed_graph.rb +0 -275
  35. data/lib/nanoc3/base/errors.rb +0 -174
  36. data/lib/nanoc3/base/memoization.rb +0 -67
  37. data/lib/nanoc3/base/notification_center.rb +0 -84
  38. data/lib/nanoc3/base/ordered_hash.rb +0 -200
  39. data/lib/nanoc3/base/plugin_registry.rb +0 -165
  40. data/lib/nanoc3/base/result_data/item_rep.rb +0 -488
  41. data/lib/nanoc3/base/source_data/code_snippet.rb +0 -58
  42. data/lib/nanoc3/base/source_data/configuration.rb +0 -24
  43. data/lib/nanoc3/base/source_data/data_source.rb +0 -234
  44. data/lib/nanoc3/base/source_data/item.rb +0 -301
  45. data/lib/nanoc3/base/source_data/layout.rb +0 -130
  46. data/lib/nanoc3/base/source_data/site.rb +0 -361
  47. data/lib/nanoc3/base/store.rb +0 -135
  48. data/lib/nanoc3/cli.rb +0 -133
  49. data/lib/nanoc3/cli/command.rb +0 -139
  50. data/lib/nanoc3/cli/commands/autocompile.rb +0 -60
  51. data/lib/nanoc3/cli/commands/compile.rb +0 -280
  52. data/lib/nanoc3/cli/commands/create_item.rb +0 -62
  53. data/lib/nanoc3/cli/commands/create_layout.rb +0 -75
  54. data/lib/nanoc3/cli/commands/create_site.rb +0 -410
  55. data/lib/nanoc3/cli/commands/debug.rb +0 -119
  56. data/lib/nanoc3/cli/commands/info.rb +0 -98
  57. data/lib/nanoc3/cli/commands/nanoc.rb +0 -37
  58. data/lib/nanoc3/cli/commands/update.rb +0 -72
  59. data/lib/nanoc3/cli/commands/view.rb +0 -84
  60. data/lib/nanoc3/cli/commands/watch.rb +0 -125
  61. data/lib/nanoc3/cli/error_handler.rb +0 -193
  62. data/lib/nanoc3/cli/logger.rb +0 -91
  63. data/lib/nanoc3/data_sources.rb +0 -29
  64. data/lib/nanoc3/data_sources/deprecated/delicious.rb +0 -42
  65. data/lib/nanoc3/data_sources/deprecated/last_fm.rb +0 -87
  66. data/lib/nanoc3/data_sources/deprecated/twitter.rb +0 -38
  67. data/lib/nanoc3/data_sources/filesystem.rb +0 -299
  68. data/lib/nanoc3/data_sources/filesystem_unified.rb +0 -116
  69. data/lib/nanoc3/data_sources/filesystem_verbose.rb +0 -86
  70. data/lib/nanoc3/extra.rb +0 -22
  71. data/lib/nanoc3/extra/auto_compiler.rb +0 -103
  72. data/lib/nanoc3/extra/chick.rb +0 -125
  73. data/lib/nanoc3/extra/core_ext.rb +0 -4
  74. data/lib/nanoc3/extra/core_ext/enumerable.rb +0 -33
  75. data/lib/nanoc3/extra/core_ext/time.rb +0 -19
  76. data/lib/nanoc3/extra/deployers.rb +0 -11
  77. data/lib/nanoc3/extra/deployers/rsync.rb +0 -114
  78. data/lib/nanoc3/extra/file_proxy.rb +0 -40
  79. data/lib/nanoc3/extra/validators.rb +0 -12
  80. data/lib/nanoc3/extra/validators/links.rb +0 -264
  81. data/lib/nanoc3/extra/validators/w3c.rb +0 -95
  82. data/lib/nanoc3/extra/vcs.rb +0 -66
  83. data/lib/nanoc3/extra/vcses.rb +0 -17
  84. data/lib/nanoc3/extra/vcses/bazaar.rb +0 -25
  85. data/lib/nanoc3/extra/vcses/dummy.rb +0 -24
  86. data/lib/nanoc3/extra/vcses/git.rb +0 -25
  87. data/lib/nanoc3/extra/vcses/mercurial.rb +0 -25
  88. data/lib/nanoc3/extra/vcses/subversion.rb +0 -25
  89. data/lib/nanoc3/filters.rb +0 -53
  90. data/lib/nanoc3/filters/asciidoc.rb +0 -38
  91. data/lib/nanoc3/filters/bluecloth.rb +0 -19
  92. data/lib/nanoc3/filters/coderay.rb +0 -21
  93. data/lib/nanoc3/filters/colorize_syntax.rb +0 -261
  94. data/lib/nanoc3/filters/erb.rb +0 -35
  95. data/lib/nanoc3/filters/erubis.rb +0 -27
  96. data/lib/nanoc3/filters/haml.rb +0 -27
  97. data/lib/nanoc3/filters/kramdown.rb +0 -20
  98. data/lib/nanoc3/filters/less.rb +0 -53
  99. data/lib/nanoc3/filters/markaby.rb +0 -20
  100. data/lib/nanoc3/filters/maruku.rb +0 -20
  101. data/lib/nanoc3/filters/mustache.rb +0 -24
  102. data/lib/nanoc3/filters/rainpress.rb +0 -19
  103. data/lib/nanoc3/filters/rdiscount.rb +0 -22
  104. data/lib/nanoc3/filters/rdoc.rb +0 -33
  105. data/lib/nanoc3/filters/redcarpet.rb +0 -27
  106. data/lib/nanoc3/filters/redcloth.rb +0 -47
  107. data/lib/nanoc3/filters/relativize_paths.rb +0 -45
  108. data/lib/nanoc3/filters/rubypants.rb +0 -20
  109. data/lib/nanoc3/filters/sass.rb +0 -66
  110. data/lib/nanoc3/filters/slim.rb +0 -25
  111. data/lib/nanoc3/filters/typogruby.rb +0 -23
  112. data/lib/nanoc3/filters/uglify_js.rb +0 -42
  113. data/lib/nanoc3/helpers.rb +0 -16
  114. data/lib/nanoc3/helpers/blogging.rb +0 -319
  115. data/lib/nanoc3/helpers/breadcrumbs.rb +0 -40
  116. data/lib/nanoc3/helpers/capturing.rb +0 -138
  117. data/lib/nanoc3/helpers/filtering.rb +0 -50
  118. data/lib/nanoc3/helpers/html_escape.rb +0 -55
  119. data/lib/nanoc3/helpers/link_to.rb +0 -151
  120. data/lib/nanoc3/helpers/rendering.rb +0 -140
  121. data/lib/nanoc3/helpers/tagging.rb +0 -71
  122. data/lib/nanoc3/helpers/text.rb +0 -44
  123. data/lib/nanoc3/helpers/xml_sitemap.rb +0 -76
  124. data/lib/nanoc3/tasks.rb +0 -10
  125. data/lib/nanoc3/tasks/clean.rake +0 -16
  126. data/lib/nanoc3/tasks/clean.rb +0 -29
  127. data/lib/nanoc3/tasks/deploy/rsync.rake +0 -14
  128. data/lib/nanoc3/tasks/validate.rake +0 -92
  129. data/nanoc3.gemspec +0 -49
  130. data/tasks/doc.rake +0 -16
  131. data/tasks/test.rake +0 -44
  132. data/test/base/core_ext/array_spec.rb +0 -73
  133. data/test/base/core_ext/hash_spec.rb +0 -98
  134. data/test/base/core_ext/pathname_spec.rb +0 -27
  135. data/test/base/core_ext/string_spec.rb +0 -37
  136. data/test/base/test_checksum_store.rb +0 -35
  137. data/test/base/test_code_snippet.rb +0 -31
  138. data/test/base/test_compiler.rb +0 -316
  139. data/test/base/test_compiler_dsl.rb +0 -161
  140. data/test/base/test_context.rb +0 -31
  141. data/test/base/test_data_source.rb +0 -46
  142. data/test/base/test_dependency_tracker.rb +0 -262
  143. data/test/base/test_directed_graph.rb +0 -283
  144. data/test/base/test_filter.rb +0 -83
  145. data/test/base/test_item.rb +0 -179
  146. data/test/base/test_item_rep.rb +0 -553
  147. data/test/base/test_layout.rb +0 -59
  148. data/test/base/test_memoization.rb +0 -90
  149. data/test/base/test_notification_center.rb +0 -34
  150. data/test/base/test_outdatedness_checker.rb +0 -394
  151. data/test/base/test_plugin.rb +0 -30
  152. data/test/base/test_rule.rb +0 -19
  153. data/test/base/test_rule_context.rb +0 -65
  154. data/test/base/test_site.rb +0 -190
  155. data/test/cli/commands/test_compile.rb +0 -33
  156. data/test/cli/commands/test_create_item.rb +0 -14
  157. data/test/cli/commands/test_create_layout.rb +0 -28
  158. data/test/cli/commands/test_create_site.rb +0 -24
  159. data/test/cli/commands/test_help.rb +0 -12
  160. data/test/cli/commands/test_info.rb +0 -11
  161. data/test/cli/commands/test_update.rb +0 -10
  162. data/test/cli/test_cli.rb +0 -102
  163. data/test/cli/test_error_handler.rb +0 -29
  164. data/test/cli/test_logger.rb +0 -10
  165. data/test/data_sources/test_filesystem.rb +0 -433
  166. data/test/data_sources/test_filesystem_unified.rb +0 -536
  167. data/test/data_sources/test_filesystem_verbose.rb +0 -357
  168. data/test/extra/core_ext/test_enumerable.rb +0 -30
  169. data/test/extra/core_ext/test_time.rb +0 -15
  170. data/test/extra/deployers/test_rsync.rb +0 -232
  171. data/test/extra/test_auto_compiler.rb +0 -417
  172. data/test/extra/test_file_proxy.rb +0 -19
  173. data/test/extra/test_vcs.rb +0 -22
  174. data/test/extra/validators/test_links.rb +0 -51
  175. data/test/extra/validators/test_w3c.rb +0 -47
  176. data/test/filters/test_asciidoc.rb +0 -22
  177. data/test/filters/test_bluecloth.rb +0 -18
  178. data/test/filters/test_coderay.rb +0 -44
  179. data/test/filters/test_colorize_syntax.rb +0 -283
  180. data/test/filters/test_erb.rb +0 -99
  181. data/test/filters/test_erubis.rb +0 -70
  182. data/test/filters/test_haml.rb +0 -96
  183. data/test/filters/test_kramdown.rb +0 -18
  184. data/test/filters/test_less.rb +0 -113
  185. data/test/filters/test_markaby.rb +0 -24
  186. data/test/filters/test_maruku.rb +0 -18
  187. data/test/filters/test_mustache.rb +0 -25
  188. data/test/filters/test_rainpress.rb +0 -29
  189. data/test/filters/test_rdiscount.rb +0 -31
  190. data/test/filters/test_rdoc.rb +0 -18
  191. data/test/filters/test_redcarpet.rb +0 -63
  192. data/test/filters/test_redcloth.rb +0 -33
  193. data/test/filters/test_relativize_paths.rb +0 -332
  194. data/test/filters/test_rubypants.rb +0 -18
  195. data/test/filters/test_sass.rb +0 -229
  196. data/test/filters/test_slim.rb +0 -35
  197. data/test/filters/test_typogruby.rb +0 -21
  198. data/test/filters/test_uglify_js.rb +0 -30
  199. data/test/gem_loader.rb +0 -11
  200. data/test/helper.rb +0 -179
  201. data/test/helpers/test_blogging.rb +0 -754
  202. data/test/helpers/test_breadcrumbs.rb +0 -81
  203. data/test/helpers/test_capturing.rb +0 -41
  204. data/test/helpers/test_filtering.rb +0 -106
  205. data/test/helpers/test_html_escape.rb +0 -32
  206. data/test/helpers/test_link_to.rb +0 -249
  207. data/test/helpers/test_rendering.rb +0 -89
  208. data/test/helpers/test_tagging.rb +0 -87
  209. data/test/helpers/test_text.rb +0 -24
  210. data/test/helpers/test_xml_sitemap.rb +0 -103
  211. data/test/tasks/test_clean.rb +0 -67
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::Extra
4
-
5
- module Validators
6
-
7
- autoload 'W3C', 'nanoc3/extra/validators/w3c'
8
- autoload 'Links', 'nanoc3/extra/validators/links'
9
-
10
- end
11
-
12
- end
@@ -1,264 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::Extra::Validators
4
-
5
- # A validator that verifies that all links (`<a href="…">…</a>`) point to a
6
- # location that exists.
7
- class Links
8
-
9
- # @param [String] dir The directory that will be searched for HTML files
10
- # to validate
11
- #
12
- # @param [Array<String>] index_filenames An array of index filenames that
13
- # will be appended to URLs by web servers if a directory is requested
14
- # instead of a file
15
- #
16
- # @option params [Boolean] :internal (false) True if internal links should
17
- # be checked; false if they should not
18
- #
19
- # @option params [Boolean] :external (false) True if external links should
20
- # be checked; false if they should not
21
- def initialize(dir, index_filenames, params={})
22
- @dir = dir
23
- @index_filenames = index_filenames
24
- @include_internal = params.has_key?(:internal) && params[:internal]
25
- @include_external = params.has_key?(:external) && params[:external]
26
- end
27
-
28
- # Starts the validator. The results will be printed to stdout.
29
- #
30
- # @return [void]
31
- def run
32
- require 'nokogiri'
33
-
34
- @delegate = self
35
- links = all_broken_hrefs
36
- if links.empty?
37
- puts "No broken links found!"
38
- else
39
- links.each_pair do |href, origins|
40
- puts "Broken link: #{href} -- referenced from:"
41
- origins.each do |origin|
42
- puts " #{origin}"
43
- end
44
- puts
45
- end
46
- end
47
- end
48
-
49
- private
50
-
51
- # Enumerates all key-value pairs of a given hash in a thread-safe way.
52
- #
53
- # This class is a helper class, which means that it is not used directly
54
- # by nanoc. Future versions of nanoc may no longer contain this class. Do
55
- # not depend on this class to be available.
56
- class ThreadsafeHashEnumerator
57
-
58
- # Creates a new enumerator for the given hash.
59
- #
60
- # @param [Hash] hash The hash for which the enumerator should return
61
- # key-value pairs
62
- def initialize(hash)
63
- @hash = hash
64
- @unprocessed_keys = @hash.keys.dup
65
- @mutex = Mutex.new
66
- end
67
-
68
- # Returns the next key-value pair in the hash.
69
- #
70
- # @return [Array] An array containing the key and the corresponding
71
- # value of teh next key-value pair
72
- def next_pair
73
- @mutex.synchronize do
74
- key = @unprocessed_keys.shift
75
- return (key ? [ key, @hash[key] ] : nil)
76
- end
77
- end
78
-
79
- end
80
-
81
- def all_broken_hrefs
82
- broken_hrefs = {}
83
-
84
- internal_hrefs = {}
85
- external_hrefs = {}
86
-
87
- # Split into internal and external hrefs
88
- all_hrefs_per_filename.each_pair do |filename, hrefs|
89
- hrefs.each do |href|
90
- if is_external_href?(href)
91
- external_hrefs[href] ||= []
92
- external_hrefs[href] << filename
93
- else
94
- internal_hrefs[href] ||= []
95
- internal_hrefs[href] << filename
96
- end
97
- end
98
- end
99
-
100
- # Validate hrefs
101
- validate_internal_hrefs(internal_hrefs, broken_hrefs) if @include_internal
102
- validate_external_hrefs(external_hrefs, broken_hrefs) if @include_external
103
-
104
- # Done
105
- broken_hrefs
106
- end
107
-
108
- def all_files
109
- Dir[@dir + '/**/*.html']
110
- end
111
-
112
- def all_hrefs_per_filename
113
- hrefs = {}
114
- all_files.each do |filename|
115
- hrefs[filename] ||= all_hrefs_in_file(filename)
116
- end
117
- hrefs
118
- end
119
-
120
- def all_hrefs_in_file(filename)
121
- doc = Nokogiri::HTML(::File.read(filename))
122
- doc.css('a').map { |l| l[:href] }.compact
123
- end
124
-
125
- def is_external_href?(href)
126
- !!(href =~ %r{^[a-z\-]+:})
127
- end
128
-
129
- def is_valid_internal_href?(href, origin)
130
- # Skip hrefs that point to self
131
- # FIXME this is ugly and won’t always be correct
132
- return true if href == '.'
133
-
134
- # Remove target
135
- path = href.sub(/#.*$/, '')
136
- return true if path.empty?
137
-
138
- # Make absolute
139
- if path[0, 1] == '/'
140
- path = @dir + path
141
- else
142
- path = ::File.expand_path(path, ::File.dirname(origin))
143
- end
144
-
145
- # Check whether file exists
146
- return true if File.file?(path)
147
-
148
- # Check whether directory with index file exists
149
- return true if File.directory?(path) && @index_filenames.any? { |fn| File.file?(File.join(path, fn)) }
150
-
151
- # Nope :(
152
- return false
153
- end
154
-
155
- def is_valid_external_href?(href)
156
- require 'net/http'
157
- require 'uri'
158
-
159
- # Parse
160
- uri = nil
161
- begin
162
- uri = URI.parse(href)
163
- rescue URI::InvalidURIError
164
- @delegate && @delegate.send(:external_href_validated, href, false)
165
- return false
166
- end
167
-
168
- # Skip non-HTTP URLs
169
- return true if uri.scheme !~ /^https?$/
170
-
171
- # Get status
172
- status = fetch_http_status_for(uri)
173
- is_valid = !!(status && status >= 200 && status <= 299)
174
-
175
- # Notify
176
- @delegate && @delegate.send(:external_href_validated, href, is_valid)
177
-
178
- # Done
179
- is_valid
180
- end
181
-
182
- def validate_internal_hrefs(hrefs, broken_hrefs)
183
- hrefs.each_pair do |href, filenames|
184
- filenames.each do |filename|
185
- if !is_valid_internal_href?(href, filename)
186
- broken_hrefs[href] = filenames
187
- end
188
- end
189
- end
190
- end
191
-
192
- def validate_external_hrefs(hrefs, broken_hrefs)
193
- @mutex = Mutex.new
194
-
195
- enum = ThreadsafeHashEnumerator.new(hrefs)
196
-
197
- threads = []
198
- 10.times do
199
- threads << Thread.new do
200
- loop do
201
- # Get next pair
202
- pair = enum.next_pair
203
- break if pair.nil?
204
- href, filenames = pair[0], pair[1]
205
-
206
- # Validate
207
- if !is_valid_external_href?(href)
208
- @mutex.synchronize do
209
- broken_hrefs[href] = filenames
210
- end
211
- end
212
- end
213
- end
214
- end
215
- threads.each { |t| t.join }
216
- end
217
-
218
- def fetch_http_status_for(url, params={})
219
- 5.times do |i|
220
- begin
221
- res = nil
222
- Timeout::timeout(10) do
223
- res = request_url_once(url)
224
- end
225
-
226
- if res.code =~ /^3..$/
227
- url = URI.parse(res['location'])
228
- return nil if i == 5
229
- else
230
- return res.code.to_i
231
- end
232
- rescue
233
- return nil
234
- end
235
- end
236
- end
237
-
238
- def request_url_once(url)
239
- path = (url.path.nil? || url.path.empty? ? '/' : url.path)
240
- req = Net::HTTP::Head.new(path)
241
- res = Net::HTTP.start(url.host, url.port) { |h| h.request(req) }
242
- res
243
- end
244
-
245
- def external_href_validated(href, is_valid)
246
- texts = {
247
- true => 'ok',
248
- false => ' ERROR '
249
- }
250
-
251
- colors = {
252
- true => "\e[32m",
253
- false => "\e[41m\e[37m",
254
- :off => "\033[0m"
255
- }
256
-
257
- @mutex.synchronize do
258
- puts href + ': ' + colors[is_valid] + texts[is_valid] + colors[:off]
259
- end
260
- end
261
-
262
- end
263
-
264
- end
@@ -1,95 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::Extra::Validators
4
-
5
- # A validator that uses the W3C web service to validate HTML and CSS files.
6
- class W3C
7
-
8
- # @param [String] dir The directory that will be searched for HTML and/or
9
- # CSS files to validate
10
- #
11
- # @param [Array<Symbol>] types A list of types to check. Allowed types are
12
- # `:html` and `:css`.
13
- def initialize(dir, types)
14
- @dir = dir
15
- @types = types
16
- end
17
-
18
- # Starts the validator. The results will be printed to stdout.
19
- #
20
- # @return [void]
21
- def run
22
- # Load validator
23
- require 'w3c_validators'
24
-
25
- # Find all files
26
- filenames = []
27
- extensions = types_to_extensions(@types)
28
- extensions.each { |extension| filenames.concat(Dir[@dir + '/**/*.' + extension]) }
29
-
30
- # Validate each file
31
- filenames.each do |filename|
32
- validation_started(filename)
33
-
34
- extension = File.extname(filename)[1..-1]
35
- results = validator_for(extension).validate_file(filename)
36
-
37
- validation_ended(filename, results.errors)
38
- end
39
- end
40
-
41
- private
42
-
43
- # Returns all extensions for the given types
44
- def types_to_extensions(types)
45
- extensions = []
46
- types.each { |type| extensions.concat(type_to_extensions(type)) }
47
- extensions
48
- end
49
-
50
- # Returns all extensions for the given type
51
- def type_to_extensions(type)
52
- case type
53
- when :html
54
- [ 'html', 'htm' ]
55
- when :css
56
- [ 'css' ]
57
- else
58
- raise RuntimeError, "unknown type: #{type}"
59
- end
60
- end
61
-
62
- # Returns the validator class for the given extension
63
- def validator_class_for(extension)
64
- case extension
65
- when 'html', 'htm'
66
- ::W3CValidators::MarkupValidator
67
- when 'css'
68
- ::W3CValidators::CSSValidator
69
- else
70
- raise RuntimeError, "unknown extension: #{extension}"
71
- end
72
- end
73
-
74
- # Returns the validator for the given extension
75
- def validator_for(extension)
76
- @validators ||= {}
77
- @validators[extension] ||= validator_class_for(extension).new
78
- end
79
-
80
- def validation_started(file)
81
- $stdout.print "Validating #{file}... "
82
- $stdout.flush
83
- end
84
-
85
- def validation_ended(file, errors)
86
- $stdout.puts(errors.empty? ? "valid" : "INVALID")
87
-
88
- errors.each do |err|
89
- puts " #{err}"
90
- end
91
- end
92
-
93
- end
94
-
95
- end
@@ -1,66 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::Extra
4
-
5
- # A very simple representation of a version control system (VCS) that
6
- # abstracts the add, remove and move operations. It does not commit. This
7
- # class is primarily used by data sources that store data as flat files on
8
- # the disk.
9
- #
10
- # @abstract Subclass and override {#add}, {#remove} and {#move} to implement
11
- # a custom VCS.
12
- class VCS
13
-
14
- extend Nanoc3::PluginRegistry::PluginMethods
15
-
16
- # Adds the file with the given filename to the working copy.
17
- #
18
- # @param [String] filename The name of the file to add
19
- #
20
- # @return [void]
21
- #
22
- # @abstract
23
- def add(filename)
24
- not_implemented('add')
25
- end
26
-
27
- # Removes the file with the given filename from the working copy. When
28
- # this method is executed, the file should no longer be present on the
29
- # disk.
30
- #
31
- # @param [String] filename The name of the file to remove
32
- #
33
- # @return [void]
34
- #
35
- # @abstract
36
- def remove(filename)
37
- not_implemented('remove')
38
- end
39
-
40
- # Moves the file with the given filename to a new location. When this
41
- # method is executed, the original file should no longer be present on the
42
- # disk.
43
- #
44
- # @param [String] src The old filename
45
- #
46
- # @param [String] dst The new filename
47
- #
48
- # @return [void]
49
- #
50
- # @abstract
51
- def move(src, dst)
52
- not_implemented('move')
53
- end
54
-
55
- private
56
-
57
- def not_implemented(name)
58
- raise NotImplementedError.new(
59
- "#{self.class} does not override ##{name}, which is required for " +
60
- "this data source to be used."
61
- )
62
- end
63
-
64
- end
65
-
66
- end
@@ -1,17 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3::Extra::VCSes
4
-
5
- autoload 'Bazaar', 'nanoc3/extra/vcses/bazaar'
6
- autoload 'Dummy', 'nanoc3/extra/vcses/dummy'
7
- autoload 'Git', 'nanoc3/extra/vcses/git'
8
- autoload 'Mercurial', 'nanoc3/extra/vcses/mercurial'
9
- autoload 'Subversion', 'nanoc3/extra/vcses/subversion'
10
-
11
- Nanoc3::Extra::VCS.register '::Nanoc3::Extra::VCSes::Bazaar', :bazaar, :bzr
12
- Nanoc3::Extra::VCS.register '::Nanoc3::Extra::VCSes::Dummy', :dummy
13
- Nanoc3::Extra::VCS.register '::Nanoc3::Extra::VCSes::Git', :git
14
- Nanoc3::Extra::VCS.register '::Nanoc3::Extra::VCSes::Mercurial', :mercurial, :hg
15
- Nanoc3::Extra::VCS.register '::Nanoc3::Extra::VCSes::Subversion', :subversion, :svn
16
-
17
- end