nanoc 2.2.1 → 2.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.
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/asset.rb +4 -0
- data/lib/nanoc/base/asset_rep.rb +10 -5
- data/lib/nanoc/base/layout.rb +4 -0
- data/lib/nanoc/base/page.rb +4 -0
- data/lib/nanoc/base/page_rep.rb +4 -0
- data/lib/nanoc/data_sources/filesystem.rb +1 -1
- data/lib/nanoc/filters.rb +1 -0
- data/lib/nanoc/filters/relativize_paths.rb +16 -0
- data/lib/nanoc/filters/relativize_paths_in_html.rb +1 -1
- data/lib/nanoc/helpers/link_to.rb +1 -1
- metadata +7 -23
data/lib/nanoc.rb
CHANGED
data/lib/nanoc/base/asset.rb
CHANGED
data/lib/nanoc/base/asset_rep.rb
CHANGED
@@ -203,13 +203,14 @@ module Nanoc
|
|
203
203
|
private
|
204
204
|
|
205
205
|
# Computes and returns the MD5 digest for the given file.
|
206
|
-
def digest(
|
206
|
+
def digest(filename)
|
207
207
|
# Create hash
|
208
208
|
incr_digest = Digest::MD5.new()
|
209
209
|
|
210
210
|
# Collect data
|
211
|
-
|
212
|
-
|
211
|
+
File.open(filename, 'r') do |io|
|
212
|
+
incr_digest << io.read(1000) until io.eof?
|
213
|
+
end
|
213
214
|
|
214
215
|
# Calculate hex hash
|
215
216
|
incr_digest.hexdigest
|
@@ -218,7 +219,7 @@ module Nanoc
|
|
218
219
|
# Compiles the asset rep, treating its contents as binary data.
|
219
220
|
def compile_binary
|
220
221
|
# Calculate digest before
|
221
|
-
digest_before = File.file?(disk_path) ? digest(
|
222
|
+
digest_before = File.file?(disk_path) ? digest(disk_path) : nil
|
222
223
|
|
223
224
|
# Run filters
|
224
225
|
current_file = @asset.file
|
@@ -242,7 +243,7 @@ module Nanoc
|
|
242
243
|
FileUtils.cp(current_file.path, disk_path)
|
243
244
|
|
244
245
|
# Calculate digest after
|
245
|
-
digest_after = digest(
|
246
|
+
digest_after = digest(disk_path)
|
246
247
|
@modified = (digest_after != digest_before)
|
247
248
|
end
|
248
249
|
|
@@ -272,6 +273,10 @@ module Nanoc
|
|
272
273
|
File.open(self.disk_path, 'w') { |io| io.write(current_content) }
|
273
274
|
end
|
274
275
|
|
276
|
+
def inspect
|
277
|
+
"<#{self.class} name=#{self.name} asset.path=#{self.asset.path}>"
|
278
|
+
end
|
279
|
+
|
275
280
|
end
|
276
281
|
|
277
282
|
end
|
data/lib/nanoc/base/layout.rb
CHANGED
data/lib/nanoc/base/page.rb
CHANGED
data/lib/nanoc/base/page_rep.rb
CHANGED
@@ -216,7 +216,7 @@ module Nanoc::DataSources
|
|
216
216
|
|
217
217
|
# Get content file
|
218
218
|
content_filename = content_filename_for_dir(File.dirname(meta_filename))
|
219
|
-
content_file =
|
219
|
+
content_file = Nanoc::Extra::FileProxy.new(content_filename)
|
220
220
|
|
221
221
|
# Get attributes
|
222
222
|
attributes = { 'extension' => File.extname(content_filename)[1..-1] }.merge(meta)
|
data/lib/nanoc/filters.rb
CHANGED
@@ -9,6 +9,7 @@ require 'nanoc/filters/rainpress'
|
|
9
9
|
require 'nanoc/filters/rdiscount'
|
10
10
|
require 'nanoc/filters/rdoc'
|
11
11
|
require 'nanoc/filters/redcloth'
|
12
|
+
require 'nanoc/filters/relativize_paths'
|
12
13
|
require 'nanoc/filters/relativize_paths_in_css'
|
13
14
|
require 'nanoc/filters/relativize_paths_in_html'
|
14
15
|
require 'nanoc/filters/rubypants'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Nanoc::Filters
|
2
|
+
class RelativizePaths < Nanoc::Filter
|
3
|
+
|
4
|
+
identifier :relativize_paths
|
5
|
+
|
6
|
+
def run(content)
|
7
|
+
raise RuntimeError.new(
|
8
|
+
"The relativize_paths filter itself does not exist anymore. " +
|
9
|
+
"If you want to relativize paths in HTML, use the " +
|
10
|
+
"relativize_paths_in_html filter; if you want to relativize paths " +
|
11
|
+
"in CSS, use the relativize_paths_in_css filter."
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -89,7 +89,7 @@ module Nanoc::Helpers
|
|
89
89
|
|
90
90
|
# Get source and destination paths
|
91
91
|
dst_path = Pathname.new(path)
|
92
|
-
src_path = Pathname.new((@page
|
92
|
+
src_path = Pathname.new((defined?(@page) ? @page : @asset).path)
|
93
93
|
|
94
94
|
# Calculate elative path (method depends on whether destination is a
|
95
95
|
# directory or not).
|
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.2.
|
4
|
+
version: 2.2.2
|
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-
|
12
|
+
date: 2009-05-18 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,15 +27,12 @@ files:
|
|
27
27
|
- ChangeLog
|
28
28
|
- Rakefile
|
29
29
|
- bin/nanoc
|
30
|
-
- lib/nanoc
|
31
|
-
- lib/nanoc/base
|
32
30
|
- lib/nanoc/base/asset.rb
|
33
31
|
- lib/nanoc/base/asset_defaults.rb
|
34
32
|
- lib/nanoc/base/asset_rep.rb
|
35
33
|
- lib/nanoc/base/binary_filter.rb
|
36
34
|
- lib/nanoc/base/code.rb
|
37
35
|
- lib/nanoc/base/compiler.rb
|
38
|
-
- lib/nanoc/base/core_ext
|
39
36
|
- lib/nanoc/base/core_ext/hash.rb
|
40
37
|
- lib/nanoc/base/core_ext/string.rb
|
41
38
|
- lib/nanoc/base/core_ext.rb
|
@@ -48,7 +45,6 @@ files:
|
|
48
45
|
- lib/nanoc/base/page_defaults.rb
|
49
46
|
- lib/nanoc/base/page_rep.rb
|
50
47
|
- lib/nanoc/base/plugin.rb
|
51
|
-
- lib/nanoc/base/proxies
|
52
48
|
- lib/nanoc/base/proxies/asset_proxy.rb
|
53
49
|
- lib/nanoc/base/proxies/asset_rep_proxy.rb
|
54
50
|
- lib/nanoc/base/proxies/layout_proxy.rb
|
@@ -60,12 +56,9 @@ files:
|
|
60
56
|
- lib/nanoc/base/site.rb
|
61
57
|
- lib/nanoc/base/template.rb
|
62
58
|
- lib/nanoc/base.rb
|
63
|
-
- lib/nanoc/binary_filters
|
64
59
|
- lib/nanoc/binary_filters/image_science_thumbnail.rb
|
65
60
|
- lib/nanoc/binary_filters.rb
|
66
|
-
- lib/nanoc/cli
|
67
61
|
- lib/nanoc/cli/base.rb
|
68
|
-
- lib/nanoc/cli/commands
|
69
62
|
- lib/nanoc/cli/commands/autocompile.rb
|
70
63
|
- lib/nanoc/cli/commands/compile.rb
|
71
64
|
- lib/nanoc/cli/commands/create_layout.rb
|
@@ -79,20 +72,16 @@ files:
|
|
79
72
|
- lib/nanoc/cli/commands.rb
|
80
73
|
- lib/nanoc/cli/logger.rb
|
81
74
|
- lib/nanoc/cli.rb
|
82
|
-
- lib/nanoc/data_sources
|
83
75
|
- lib/nanoc/data_sources/filesystem.rb
|
84
76
|
- lib/nanoc/data_sources/filesystem_combined.rb
|
85
77
|
- lib/nanoc/data_sources.rb
|
86
|
-
- lib/nanoc/extra
|
87
78
|
- lib/nanoc/extra/auto_compiler.rb
|
88
79
|
- lib/nanoc/extra/context.rb
|
89
|
-
- lib/nanoc/extra/core_ext
|
90
80
|
- lib/nanoc/extra/core_ext/hash.rb
|
91
81
|
- lib/nanoc/extra/core_ext/time.rb
|
92
82
|
- lib/nanoc/extra/core_ext.rb
|
93
83
|
- lib/nanoc/extra/file_proxy.rb
|
94
84
|
- lib/nanoc/extra/vcs.rb
|
95
|
-
- lib/nanoc/extra/vcses
|
96
85
|
- lib/nanoc/extra/vcses/bazaar.rb
|
97
86
|
- lib/nanoc/extra/vcses/dummy.rb
|
98
87
|
- lib/nanoc/extra/vcses/git.rb
|
@@ -100,7 +89,6 @@ files:
|
|
100
89
|
- lib/nanoc/extra/vcses/subversion.rb
|
101
90
|
- lib/nanoc/extra/vcses.rb
|
102
91
|
- lib/nanoc/extra.rb
|
103
|
-
- lib/nanoc/filters
|
104
92
|
- lib/nanoc/filters/bluecloth.rb
|
105
93
|
- lib/nanoc/filters/erb.rb
|
106
94
|
- lib/nanoc/filters/erubis.rb
|
@@ -112,12 +100,12 @@ files:
|
|
112
100
|
- lib/nanoc/filters/rdiscount.rb
|
113
101
|
- lib/nanoc/filters/rdoc.rb
|
114
102
|
- lib/nanoc/filters/redcloth.rb
|
103
|
+
- lib/nanoc/filters/relativize_paths.rb
|
115
104
|
- lib/nanoc/filters/relativize_paths_in_css.rb
|
116
105
|
- lib/nanoc/filters/relativize_paths_in_html.rb
|
117
106
|
- lib/nanoc/filters/rubypants.rb
|
118
107
|
- lib/nanoc/filters/sass.rb
|
119
108
|
- lib/nanoc/filters.rb
|
120
|
-
- lib/nanoc/helpers
|
121
109
|
- lib/nanoc/helpers/blogging.rb
|
122
110
|
- lib/nanoc/helpers/capturing.rb
|
123
111
|
- lib/nanoc/helpers/filtering.rb
|
@@ -128,19 +116,14 @@ files:
|
|
128
116
|
- lib/nanoc/helpers/text.rb
|
129
117
|
- lib/nanoc/helpers/xml_sitemap.rb
|
130
118
|
- lib/nanoc/helpers.rb
|
131
|
-
- lib/nanoc/routers
|
132
119
|
- lib/nanoc/routers/default.rb
|
133
120
|
- lib/nanoc/routers/no_dirs.rb
|
134
121
|
- lib/nanoc/routers/versioned.rb
|
135
122
|
- lib/nanoc/routers.rb
|
136
123
|
- lib/nanoc.rb
|
137
|
-
- vendor/cri
|
138
124
|
- vendor/cri/ChangeLog
|
139
|
-
- vendor/cri/lib
|
140
|
-
- vendor/cri/lib/cri
|
141
125
|
- vendor/cri/lib/cri/base.rb
|
142
126
|
- vendor/cri/lib/cri/command.rb
|
143
|
-
- vendor/cri/lib/cri/core_ext
|
144
127
|
- vendor/cri/lib/cri/core_ext/string.rb
|
145
128
|
- vendor/cri/lib/cri/core_ext.rb
|
146
129
|
- vendor/cri/lib/cri/option_parser.rb
|
@@ -149,13 +132,14 @@ files:
|
|
149
132
|
- vendor/cri/NEWS
|
150
133
|
- vendor/cri/Rakefile
|
151
134
|
- vendor/cri/README
|
152
|
-
- vendor/cri/test
|
153
135
|
- vendor/cri/test/test_base.rb
|
154
136
|
- vendor/cri/test/test_command.rb
|
155
137
|
- vendor/cri/test/test_core_ext.rb
|
156
138
|
- vendor/cri/test/test_option_parser.rb
|
157
139
|
has_rdoc: true
|
158
140
|
homepage: http://nanoc.stoneship.org/
|
141
|
+
licenses: []
|
142
|
+
|
159
143
|
post_install_message: |-
|
160
144
|
------------------------------------------------------------------------------
|
161
145
|
Thanks for installing nanoc 2.2! Here are some resources to help you get started:
|
@@ -208,9 +192,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
192
|
requirements: []
|
209
193
|
|
210
194
|
rubyforge_project: nanoc
|
211
|
-
rubygems_version: 1.3.
|
195
|
+
rubygems_version: 1.3.3
|
212
196
|
signing_key:
|
213
|
-
specification_version:
|
197
|
+
specification_version: 3
|
214
198
|
summary: a tool that runs on your local computer and compiles Markdown, Textile, Haml, ... documents into static web pages
|
215
199
|
test_files: []
|
216
200
|
|