nanoc 3.6.6 → 3.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +4 -3
- data/Gemfile.lock +48 -40
- data/NEWS.md +20 -2
- data/lib/nanoc/cli/cleaning_stream.rb +21 -6
- data/lib/nanoc/cli/commands/autocompile.rb +1 -0
- data/lib/nanoc/cli/commands/compile.rb +57 -25
- data/lib/nanoc/cli/commands/create-site.rb +1 -1
- data/lib/nanoc/cli/commands/watch.rb +3 -2
- data/lib/nanoc/cli.rb +9 -4
- data/lib/nanoc/extra/deployers/fog.rb +5 -5
- data/lib/nanoc/filters/handlebars.rb +3 -1
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +13 -20
- data/lib/nanoc/filters/sass.rb +5 -20
- data/lib/nanoc/version.rb +1 -1
- data/lib/nanoc.rb +5 -0
- data/tasks/test.rake +16 -25
- data/test/base/test_context.rb +1 -1
- data/test/base/test_directed_graph.rb +1 -1
- data/test/cli/commands/test_compile.rb +61 -0
- data/test/cli/commands/test_deploy.rb +3 -0
- data/test/cli/commands/test_prune.rb +1 -0
- data/test/cli/commands/test_watch.rb +2 -0
- data/test/cli/test_cleaning_stream.rb +9 -1
- data/test/data_sources/test_filesystem.rb +1 -1
- data/test/data_sources/test_static.rb +2 -0
- data/test/extra/test_filesystem_tools.rb +4 -0
- data/test/filters/test_asciidoc.rb +1 -3
- data/test/filters/test_colorize_syntax.rb +4 -10
- data/test/filters/test_handlebars.rb +21 -0
- data/test/filters/test_less.rb +1 -1
- data/test/filters/test_maruku.rb +1 -1
- data/test/filters/test_pandoc.rb +1 -3
- data/test/filters/test_sass.rb +65 -0
- data/test/helper.rb +36 -5
- data/test/helpers/test_link_to.rb +3 -3
- data/test/helpers/test_rendering.rb +2 -2
- data/test/test_gem.rb +1 -1
- metadata +5 -19
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDYwZDczMTNhNTI0MzcxNDYwZjAzY2ZhMzRiY2E1OTA5ZmJjZDZjZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzhlNjQyMjdiMmQ0ZWEzZGM2NWMwNjRjZWI4NTVmN2YzYTE3MWM5NA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTY3NDMxNjY3ZWFlY2FkN2EwZjA2ZWNiMGI2MDJiYTRlY2Y5N2Y4Y2QxZjQ0
|
10
|
+
NThlYTg0ZTQ4OWU0YjA2YjM4ZDBlOTQwY2ExNTQxMDdhMTZhYzM1NmUyZDQx
|
11
|
+
YThkZDI5ZjdmYmZmMGE5NGU0ZDZjMzMyNjk0YWM1NTNlYzM3NmE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NWEwMzcxMTY2ODBjMDBkYWE5NjUyNjI1MTEyMDU4MDNlNGI4NDcwMWI0ZTJj
|
14
|
+
OTVmNWY2YjU4ZTQ4N2I2YmRjNzdkYWQ3ZjhkY2RiNzdjN2FhN2VkNTQ0Mjc4
|
15
|
+
MGIyNWI2M2NlNmQ2ZWYyZmZmN2I1YTcwNzIxZTFhY2VmNmM4NGY=
|
data/Gemfile
CHANGED
@@ -3,16 +3,17 @@ source "http://rubygems.org"
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
gem 'adsf'
|
6
|
-
gem 'bluecloth'
|
6
|
+
gem 'bluecloth', :platforms => :ruby
|
7
7
|
gem 'builder'
|
8
8
|
gem 'coderay'
|
9
|
+
gem 'compass'
|
9
10
|
gem 'coffee-script'
|
10
11
|
gem 'erubis'
|
11
12
|
gem 'fog'
|
12
13
|
gem 'haml'
|
13
|
-
gem 'handlebars'
|
14
|
+
gem 'handlebars', :platforms => :ruby
|
14
15
|
gem 'kramdown'
|
15
|
-
gem 'less', '~> 2.0'
|
16
|
+
gem 'less', '~> 2.0', :platforms => :ruby
|
16
17
|
gem 'listen'
|
17
18
|
gem 'markaby'
|
18
19
|
gem 'maruku'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (3.6.
|
4
|
+
nanoc (3.6.7)
|
5
5
|
cri (~> 2.3)
|
6
6
|
|
7
7
|
GEM
|
@@ -12,22 +12,29 @@ GEM
|
|
12
12
|
rack (>= 1.0.0)
|
13
13
|
bluecloth (2.2.0)
|
14
14
|
builder (3.2.2)
|
15
|
-
|
15
|
+
celluloid (0.15.2)
|
16
|
+
timers (~> 1.1.0)
|
17
|
+
chunky_png (1.2.9)
|
18
|
+
coderay (1.1.0)
|
16
19
|
coffee-script (2.2.0)
|
17
20
|
coffee-script-source
|
18
21
|
execjs
|
19
22
|
coffee-script-source (1.6.3)
|
20
23
|
colored (1.2)
|
21
|
-
commonjs (0.2.
|
24
|
+
commonjs (0.2.7)
|
25
|
+
compass (0.12.2)
|
26
|
+
chunky_png (~> 1.2)
|
27
|
+
fssm (>= 0.2.7)
|
28
|
+
sass (~> 3.1)
|
22
29
|
cri (2.4.0)
|
23
30
|
colored (>= 1.2)
|
24
31
|
erubis (2.7.0)
|
25
|
-
excon (0.
|
26
|
-
execjs (2.0.
|
27
|
-
ffi (1.9.
|
28
|
-
fog (1.
|
32
|
+
excon (0.28.0)
|
33
|
+
execjs (2.0.2)
|
34
|
+
ffi (1.9.3)
|
35
|
+
fog (1.18.0)
|
29
36
|
builder
|
30
|
-
excon (~> 0.
|
37
|
+
excon (~> 0.28.0)
|
31
38
|
formatador (~> 0.2.0)
|
32
39
|
mime-types
|
33
40
|
multi_json (~> 1.0)
|
@@ -36,82 +43,82 @@ GEM
|
|
36
43
|
nokogiri (~> 1.5)
|
37
44
|
ruby-hmac
|
38
45
|
formatador (0.2.4)
|
39
|
-
|
46
|
+
fssm (0.2.10)
|
47
|
+
haml (4.0.4)
|
40
48
|
tilt
|
41
|
-
handlebars (0.
|
49
|
+
handlebars (0.5.0)
|
42
50
|
commonjs (~> 0.2.3)
|
43
|
-
|
44
|
-
|
51
|
+
handlebars-source (~> 1.0.12)
|
52
|
+
therubyracer (~> 0.12.0)
|
53
|
+
handlebars-source (1.0.12)
|
54
|
+
json (1.8.1)
|
45
55
|
kramdown (1.2.0)
|
46
|
-
less (2.
|
47
|
-
commonjs (~> 0.2.
|
48
|
-
libv8 (3.
|
49
|
-
listen (
|
56
|
+
less (2.4.0)
|
57
|
+
commonjs (~> 0.2.7)
|
58
|
+
libv8 (3.16.14.3)
|
59
|
+
listen (2.2.0)
|
60
|
+
celluloid (>= 0.15.2)
|
50
61
|
rb-fsevent (>= 0.9.3)
|
51
62
|
rb-inotify (>= 0.9)
|
52
|
-
rb-kqueue (>= 0.2)
|
53
63
|
markaby (0.7.2)
|
54
64
|
builder (>= 2.0.0)
|
55
|
-
maruku (0.
|
56
|
-
syntax (>= 1.0.0)
|
65
|
+
maruku (0.7.0)
|
57
66
|
metaclass (0.0.1)
|
58
67
|
method_source (0.8.2)
|
59
|
-
mime-types (
|
68
|
+
mime-types (2.0)
|
60
69
|
minitest (4.7.5)
|
61
70
|
mocha (0.14.0)
|
62
71
|
metaclass (~> 0.0.1)
|
63
|
-
multi_json (1.
|
64
|
-
mustache (0.99.
|
72
|
+
multi_json (1.8.2)
|
73
|
+
mustache (0.99.5)
|
65
74
|
net-scp (1.1.2)
|
66
75
|
net-ssh (>= 2.6.5)
|
67
|
-
net-ssh (2.
|
76
|
+
net-ssh (2.7.0)
|
68
77
|
nokogiri (1.5.10)
|
69
78
|
pandoc-ruby (0.7.5)
|
70
79
|
posix-spawn (0.3.6)
|
71
|
-
pry (0.9.12.
|
72
|
-
coderay (~> 1.0
|
80
|
+
pry (0.9.12.4)
|
81
|
+
coderay (~> 1.0)
|
73
82
|
method_source (~> 0.8)
|
74
83
|
slop (~> 3.4)
|
75
|
-
pygments.rb (0.5.
|
84
|
+
pygments.rb (0.5.4)
|
76
85
|
posix-spawn (~> 0.3.6)
|
77
86
|
yajl-ruby (~> 1.1.0)
|
78
87
|
rack (1.5.2)
|
79
88
|
rainpress (1.0)
|
80
89
|
rake (10.1.0)
|
81
90
|
rb-fsevent (0.9.3)
|
82
|
-
rb-inotify (0.9.
|
91
|
+
rb-inotify (0.9.2)
|
83
92
|
ffi (>= 0.5.0)
|
84
|
-
|
85
|
-
ffi (>= 0.5.0)
|
86
|
-
rdiscount (2.1.6)
|
93
|
+
rdiscount (2.1.7)
|
87
94
|
rdoc (4.0.1)
|
88
95
|
json (~> 1.4)
|
89
96
|
redcarpet (3.0.0)
|
90
97
|
ref (1.0.5)
|
91
98
|
ruby-hmac (0.4.0)
|
92
99
|
rubypants (0.2.0)
|
93
|
-
sass (3.2.
|
94
|
-
slim (2.0.
|
100
|
+
sass (3.2.12)
|
101
|
+
slim (2.0.2)
|
95
102
|
temple (~> 0.6.6)
|
96
103
|
tilt (>= 1.3.3, < 2.1)
|
97
|
-
slop (3.4.
|
98
|
-
syntax (1.0.0)
|
104
|
+
slop (3.4.7)
|
99
105
|
systemu (2.5.2)
|
100
|
-
temple (0.6.
|
101
|
-
therubyracer (0.
|
102
|
-
libv8 (~> 3.
|
106
|
+
temple (0.6.7)
|
107
|
+
therubyracer (0.12.0)
|
108
|
+
libv8 (~> 3.16.14.0)
|
103
109
|
ref
|
104
110
|
tilt (1.4.1)
|
111
|
+
timers (1.1.0)
|
105
112
|
typogruby (1.0.16)
|
106
113
|
rubypants
|
107
|
-
uglifier (2.
|
114
|
+
uglifier (2.3.1)
|
108
115
|
execjs (>= 0.3.0)
|
109
|
-
|
116
|
+
json (>= 1.8.0)
|
110
117
|
w3c_validators (1.2)
|
111
118
|
json
|
112
119
|
nokogiri
|
113
120
|
yajl-ruby (1.1.0)
|
114
|
-
yard (0.8.7)
|
121
|
+
yard (0.8.7.3)
|
115
122
|
yuicompressor (1.2.1)
|
116
123
|
|
117
124
|
PLATFORMS
|
@@ -124,6 +131,7 @@ DEPENDENCIES
|
|
124
131
|
builder
|
125
132
|
coderay
|
126
133
|
coffee-script
|
134
|
+
compass
|
127
135
|
erubis
|
128
136
|
fog
|
129
137
|
haml
|
data/NEWS.md
CHANGED
@@ -1,17 +1,35 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.6.7 (2013-12-09)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Made Handlebars filter usable outside layouts (#346, #348)
|
8
|
+
* Fixed ANSI color support on Windows (#352, #356)
|
9
|
+
* Made fog deployer handle prefixes properly (#351) [Oliver Byford]
|
10
|
+
* Fixed crash in watcher (#358)
|
11
|
+
* Fixed huge durations when showing skipped items after compilation (#360, #364)
|
12
|
+
* Fixed output of `--verbose` compilation statistics (#359, #365)
|
13
|
+
* Fixed issue with Sass files not recompiling (#350, 370)
|
14
|
+
|
15
|
+
Enhancements:
|
16
|
+
|
17
|
+
* Fixed Windows compatibility issues in test suite (#353) [Raphael von der Grün]
|
18
|
+
* Hid deprecated `autocompile` and `watch` commands in help
|
19
|
+
* Made CLI swallow broken pipe errors when piping to a process that terminates prematurely (#318, #369)
|
20
|
+
|
3
21
|
## 3.6.6 (2013-11-08)
|
4
22
|
|
5
23
|
Enhancements:
|
6
24
|
|
7
25
|
* Reduced number of dependencies generated by Sass filter (#306) [Gregory Pakosz]
|
8
|
-
* Recognised lowercase `utf` in language value (e.g. `en_US.utf8`) as being UTF-8 (#335)
|
26
|
+
* Recognised lowercase `utf` in language value (e.g. `en_US.utf8`) as being UTF-8 (#335, #338)
|
9
27
|
* Set [Thin](http://code.macournoyer.com/thin/) as the default server for `nanoc view` (#342, #345)
|
10
28
|
* Removed watcher section from the default configuration file (#343, #344)
|
11
29
|
|
12
30
|
Fixes:
|
13
31
|
|
14
|
-
* Prevented capturing helper from erroneously compiling items twice (#337)
|
32
|
+
* Prevented capturing helper from erroneously compiling items twice (#331, #337)
|
15
33
|
|
16
34
|
## 3.6.5 (2013-09-29)
|
17
35
|
|
@@ -41,12 +41,16 @@ module Nanoc::CLI
|
|
41
41
|
|
42
42
|
# @see IO#write
|
43
43
|
def write(s)
|
44
|
-
|
44
|
+
self._nanoc_swallow_broken_pipe_errors_while do
|
45
|
+
@stream.write(self._nanoc_clean(s))
|
46
|
+
end
|
45
47
|
end
|
46
48
|
|
47
49
|
# @see IO#<<
|
48
50
|
def <<(s)
|
49
|
-
|
51
|
+
self._nanoc_swallow_broken_pipe_errors_while do
|
52
|
+
@stream.<<(self._nanoc_clean(s))
|
53
|
+
end
|
50
54
|
end
|
51
55
|
|
52
56
|
# @see IO#tty?
|
@@ -56,7 +60,9 @@ module Nanoc::CLI
|
|
56
60
|
|
57
61
|
# @see IO#flush
|
58
62
|
def flush
|
59
|
-
|
63
|
+
self._nanoc_swallow_broken_pipe_errors_while do
|
64
|
+
@stream.flush
|
65
|
+
end
|
60
66
|
end
|
61
67
|
|
62
68
|
# @see IO#tell
|
@@ -66,12 +72,16 @@ module Nanoc::CLI
|
|
66
72
|
|
67
73
|
# @see IO#print
|
68
74
|
def print(s)
|
69
|
-
|
75
|
+
self._nanoc_swallow_broken_pipe_errors_while do
|
76
|
+
@stream.print(self._nanoc_clean(s))
|
77
|
+
end
|
70
78
|
end
|
71
79
|
|
72
80
|
# @see IO#puts
|
73
81
|
def puts(*s)
|
74
|
-
|
82
|
+
self._nanoc_swallow_broken_pipe_errors_while do
|
83
|
+
@stream.puts(*s.map { |ss| self._nanoc_clean(ss) })
|
84
|
+
end
|
75
85
|
end
|
76
86
|
|
77
87
|
# @see StringIO#string
|
@@ -111,10 +121,15 @@ module Nanoc::CLI
|
|
111
121
|
|
112
122
|
protected
|
113
123
|
|
114
|
-
def
|
124
|
+
def _nanoc_clean(s)
|
115
125
|
@stream_cleaners.inject(s) { |m,c| c.clean(m) }
|
116
126
|
end
|
117
127
|
|
128
|
+
def _nanoc_swallow_broken_pipe_errors_while
|
129
|
+
yield
|
130
|
+
rescue Errno::EPIPE
|
131
|
+
end
|
132
|
+
|
118
133
|
end
|
119
134
|
|
120
135
|
end
|
@@ -162,33 +162,33 @@ module Nanoc::CLI::Commands
|
|
162
162
|
|
163
163
|
# @option params [Array<Nanoc::ItemRep>] :reps The list of item representations in the site
|
164
164
|
def initialize(params={})
|
165
|
-
@
|
165
|
+
@times = {}
|
166
166
|
|
167
|
-
@reps
|
167
|
+
@reps = params.fetch(:reps)
|
168
168
|
end
|
169
169
|
|
170
170
|
# @see Listener#start
|
171
171
|
def start
|
172
172
|
Nanoc::NotificationCenter.on(:filtering_started) do |rep, filter_name|
|
173
|
-
@
|
174
|
-
@
|
173
|
+
@times[filter_name] ||= []
|
174
|
+
@times[filter_name] << { :start => Time.now }
|
175
175
|
end
|
176
176
|
Nanoc::NotificationCenter.on(:filtering_ended) do |rep, filter_name|
|
177
|
-
@
|
177
|
+
@times[filter_name].last[:stop] = Time.now
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
181
|
# @see Listener#stop
|
182
182
|
def stop
|
183
|
-
super
|
184
183
|
self.print_profiling_feedback
|
184
|
+
super
|
185
185
|
end
|
186
186
|
|
187
187
|
protected
|
188
188
|
|
189
189
|
def print_profiling_feedback
|
190
190
|
# Get max filter length
|
191
|
-
max_filter_name_length =
|
191
|
+
max_filter_name_length = durations_per_filter.keys.map { |k| k.to_s.size }.max
|
192
192
|
return if max_filter_name_length.nil?
|
193
193
|
|
194
194
|
# Print warning if necessary
|
@@ -203,19 +203,19 @@ module Nanoc::CLI::Commands
|
|
203
203
|
puts ' ' * max_filter_name_length + ' | count min avg max tot'
|
204
204
|
puts '-' * max_filter_name_length + '-+-----------------------------------'
|
205
205
|
|
206
|
-
|
207
|
-
self.print_row(row)
|
206
|
+
durations_per_filter.to_a.sort_by { |r| r[1] }.each do |row|
|
207
|
+
self.print_row(row, max_filter_name_length)
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
def print_row(row)
|
211
|
+
def print_row(row, length)
|
212
212
|
# Extract data
|
213
213
|
filter_name, samples = *row
|
214
214
|
|
215
215
|
# Calculate stats
|
216
216
|
count = samples.size
|
217
217
|
min = samples.min
|
218
|
-
tot = samples.inject { |memo, i| memo + i}
|
218
|
+
tot = samples.inject(0) { |memo, i| memo + i }
|
219
219
|
avg = tot/count
|
220
220
|
max = samples.max
|
221
221
|
|
@@ -227,8 +227,26 @@ module Nanoc::CLI::Commands
|
|
227
227
|
tot = format('%5.2f', tot)
|
228
228
|
|
229
229
|
# Output stats
|
230
|
-
|
231
|
-
puts "#{
|
230
|
+
key = format("%#{length}s", filter_name)
|
231
|
+
puts "#{key} | #{count} #{min}s #{avg}s #{max}s #{tot}s"
|
232
|
+
end
|
233
|
+
|
234
|
+
def durations_per_filter
|
235
|
+
@_durations_per_filter ||= begin
|
236
|
+
@times.keys.each_with_object({}) do |filter_name, result|
|
237
|
+
if durations = durations_for_filter(filter_name)
|
238
|
+
result[filter_name] = durations
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def durations_for_filter(filter_name)
|
245
|
+
@times[filter_name].each_with_object([]) do |sample, result|
|
246
|
+
if sample[:start] && sample[:stop]
|
247
|
+
result << sample[:stop] - sample[:start]
|
248
|
+
end
|
249
|
+
end
|
232
250
|
end
|
233
251
|
|
234
252
|
end
|
@@ -310,26 +328,26 @@ module Nanoc::CLI::Commands
|
|
310
328
|
# Prints file actions (created, updated, deleted, identical, skipped)
|
311
329
|
class FileActionPrinter < Listener
|
312
330
|
|
313
|
-
# @option params [Array<Nanoc::ItemRep>] :reps The list of item representations in the site
|
331
|
+
# @option params [Array<Nanoc::ItemRep>] :reps The list of item representations in the site
|
314
332
|
def initialize(params={})
|
315
|
-
@
|
333
|
+
@start_times = {}
|
334
|
+
@stop_times = {}
|
316
335
|
|
317
|
-
@reps
|
336
|
+
@reps = params.fetch(:reps)
|
318
337
|
end
|
319
338
|
|
320
339
|
# @see Listener#start
|
321
340
|
def start
|
322
341
|
Nanoc::NotificationCenter.on(:compilation_started) do |rep|
|
323
|
-
@
|
342
|
+
@start_times[rep.raw_path] = Time.now
|
324
343
|
end
|
325
344
|
Nanoc::NotificationCenter.on(:compilation_ended) do |rep|
|
326
|
-
@
|
345
|
+
@stop_times[rep.raw_path] = Time.now
|
327
346
|
end
|
328
347
|
Nanoc::NotificationCenter.on(:rep_written) do |rep, path, is_created, is_modified|
|
329
348
|
action = (is_created ? :create : (is_modified ? :update : :identical))
|
330
349
|
level = (is_created ? :high : (is_modified ? :high : :low))
|
331
|
-
|
332
|
-
Nanoc::CLI::Logger.instance.file(level, action, path, duration)
|
350
|
+
log(level, action, path, duration_for(rep))
|
333
351
|
end
|
334
352
|
end
|
335
353
|
|
@@ -337,14 +355,28 @@ module Nanoc::CLI::Commands
|
|
337
355
|
def stop
|
338
356
|
super
|
339
357
|
@reps.select { |r| !r.compiled? }.each do |rep|
|
340
|
-
rep.raw_paths.each do |snapshot_name,
|
341
|
-
|
342
|
-
duration = @rep_times[filename]
|
343
|
-
Nanoc::CLI::Logger.instance.file(:high, :skip, filename, duration)
|
358
|
+
rep.raw_paths.each do |snapshot_name, raw_path|
|
359
|
+
log(:low, :skip, raw_path, duration_for(rep))
|
344
360
|
end
|
345
361
|
end
|
346
362
|
end
|
347
363
|
|
364
|
+
private
|
365
|
+
|
366
|
+
def duration_for(rep)
|
367
|
+
return nil if rep.raw_path.nil?
|
368
|
+
|
369
|
+
start = @start_times[rep.raw_path]
|
370
|
+
stop = @stop_times[rep.raw_path]
|
371
|
+
return nil if start.nil? || stop.nil?
|
372
|
+
|
373
|
+
stop - start
|
374
|
+
end
|
375
|
+
|
376
|
+
def log(level, action, path, duration)
|
377
|
+
Nanoc::CLI::Logger.instance.file(level, action, path, duration)
|
378
|
+
end
|
379
|
+
|
348
380
|
end
|
349
381
|
|
350
382
|
def initialize(options, arguments, command, params={})
|
@@ -371,7 +403,7 @@ module Nanoc::CLI::Commands
|
|
371
403
|
|
372
404
|
protected
|
373
405
|
|
374
|
-
def prune
|
406
|
+
def prune
|
375
407
|
if self.site.config[:prune][:auto_prune]
|
376
408
|
Nanoc::Extra::Pruner.new(self.site, :exclude => self.prune_config_exclude).run
|
377
409
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
usage 'watch [options]'
|
4
4
|
summary 'start the watcher'
|
5
|
+
be_hidden
|
5
6
|
description <<-EOS
|
6
7
|
Start the watcher. When a change is detected, the site will be recompiled.
|
7
8
|
EOS
|
@@ -71,7 +72,7 @@ module Nanoc::CLI::Commands
|
|
71
72
|
dirs_to_watch = watcher_config[:dirs_to_watch] || [ 'content', 'layouts', 'lib' ]
|
72
73
|
files_to_watch = watcher_config[:files_to_watch] || [ 'nanoc.yaml', 'config.yaml', 'Rules', 'rules', 'Rules.rb', 'rules.rb' ]
|
73
74
|
files_to_watch = Regexp.new(files_to_watch.map { |name| Regexp.quote(name) + '$' }.join('|'))
|
74
|
-
ignore_dir = Regexp.new(Dir.glob('*').map { |dir| dir if File.
|
75
|
+
ignore_dir = Regexp.new(Dir.glob('*').map { |dir| dir if File.directory?(dir) }.compact.join('|'))
|
75
76
|
|
76
77
|
# Watch
|
77
78
|
puts "Watching for changes…"
|
@@ -169,7 +170,7 @@ module Nanoc::CLI::Commands
|
|
169
170
|
end
|
170
171
|
|
171
172
|
def on_windows?
|
172
|
-
|
173
|
+
Nanoc.on_windows?
|
173
174
|
end
|
174
175
|
|
175
176
|
end
|
data/lib/nanoc/cli.rb
CHANGED
@@ -8,6 +8,13 @@ rescue LoadError => e
|
|
8
8
|
exit 1
|
9
9
|
end
|
10
10
|
|
11
|
+
if Nanoc.on_windows?
|
12
|
+
begin
|
13
|
+
require 'Win32/Console/ANSI'
|
14
|
+
rescue LoadError
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
11
18
|
module Nanoc::CLI
|
12
19
|
|
13
20
|
module Commands
|
@@ -191,10 +198,8 @@ protected
|
|
191
198
|
def self.enable_ansi_colors?(io)
|
192
199
|
return false if !io.tty?
|
193
200
|
|
194
|
-
|
195
|
-
|
196
|
-
rescue LoadError
|
197
|
-
return false
|
201
|
+
if Nanoc.on_windows?
|
202
|
+
return defined?(::Win32::Console::ANSI)
|
198
203
|
end
|
199
204
|
|
200
205
|
return true
|
@@ -23,10 +23,10 @@ module Nanoc::Extra::Deployers
|
|
23
23
|
def run
|
24
24
|
require 'fog'
|
25
25
|
|
26
|
-
# Get params
|
26
|
+
# Get params, unsetting anything we don't want to pass through to fog.
|
27
27
|
src = File.expand_path(self.source_path)
|
28
28
|
bucket = self.config.delete(:bucket) || self.config.delete(:bucket_name)
|
29
|
-
path = self.config
|
29
|
+
path = self.config.delete(:path)
|
30
30
|
|
31
31
|
self.config.delete(:kind)
|
32
32
|
|
@@ -45,7 +45,7 @@ module Nanoc::Extra::Deployers
|
|
45
45
|
# Get bucket
|
46
46
|
puts "Getting bucket"
|
47
47
|
begin
|
48
|
-
directory = connection.directories.get(bucket)
|
48
|
+
directory = connection.directories.get(bucket, :prefix => path)
|
49
49
|
rescue ::Excon::Errors::NotFound
|
50
50
|
should_create_bucket = true
|
51
51
|
end
|
@@ -53,7 +53,7 @@ module Nanoc::Extra::Deployers
|
|
53
53
|
|
54
54
|
# Create bucket if necessary
|
55
55
|
if should_create_bucket
|
56
|
-
directory = connection.directories.create(:key => bucket)
|
56
|
+
directory = connection.directories.create(:key => bucket, :prefix => path)
|
57
57
|
end
|
58
58
|
|
59
59
|
# Get list of remote files
|
@@ -71,7 +71,7 @@ module Nanoc::Extra::Deployers
|
|
71
71
|
FileUtils.cd(src) do
|
72
72
|
files = Dir['**/*'].select { |f| File.file?(f) }
|
73
73
|
files.each do |file_path|
|
74
|
-
key =
|
74
|
+
key = path ? File.join(path, file_path) : file_path
|
75
75
|
directory.files.create(
|
76
76
|
:key => key,
|
77
77
|
:body => File.open(file_path),
|
@@ -18,9 +18,11 @@ module Nanoc::Filters
|
|
18
18
|
def run(content, params={})
|
19
19
|
context = item.attributes.dup
|
20
20
|
context[:item] = assigns[:item].attributes
|
21
|
-
context[:layout] = assigns[:layout].attributes
|
22
21
|
context[:config] = assigns[:config]
|
23
22
|
context[:yield] = assigns[:content]
|
23
|
+
if assigns.has_key?(:layout)
|
24
|
+
context[:layout] = assigns[:layout].attributes
|
25
|
+
end
|
24
26
|
|
25
27
|
handlebars = ::Handlebars::Context.new
|
26
28
|
template = handlebars.compile(content)
|
@@ -1,28 +1,21 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
class Sass
|
3
|
+
class ::Sass::Importers::Filesystem
|
5
4
|
|
6
|
-
|
7
|
-
# import file path.
|
8
|
-
class SassFilesystemImporter < ::Sass::Importers::Filesystem
|
5
|
+
alias_method :_orig_find, :_find
|
9
6
|
|
10
|
-
|
7
|
+
def _find(dir, name, options)
|
8
|
+
# Find filename
|
9
|
+
full_filename, syntax = ::Sass::Util.destructure(find_real_file(dir, name, options))
|
10
|
+
return nil if full_filename.nil?
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
filter = options[:nanoc_current_filter]
|
17
|
-
item = filter.imported_filename_to_item(full_filename)
|
18
|
-
filter.depend_on([ item ]) unless item.nil?
|
19
|
-
|
20
|
-
options[:syntax] = syntax
|
21
|
-
options[:filename] = full_filename
|
22
|
-
options[:importer] = self
|
23
|
-
::Sass::Engine.new(File.read(full_filename), options)
|
24
|
-
end
|
25
|
-
end
|
12
|
+
# Create dependency
|
13
|
+
filter = options[:nanoc_current_filter]
|
14
|
+
item = filter.imported_filename_to_item(full_filename)
|
15
|
+
filter.depend_on([ item ]) unless item.nil?
|
26
16
|
|
17
|
+
# Call original _find
|
18
|
+
_orig_find(dir, name, options)
|
27
19
|
end
|
20
|
+
|
28
21
|
end
|