nanoc 4.8.14 → 4.8.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +13 -1
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +1 -1
- data/lib/nanoc/base/services/pruner.rb +3 -1
- data/lib/nanoc/cli/commands/compile_listeners/timing_recorder.rb +7 -7
- data/lib/nanoc/cli/commands/view.rb +3 -0
- data/lib/nanoc/filters/erubi.rb +3 -1
- data/lib/nanoc/version.rb +1 -1
- metadata +17 -11
- data/lib/nanoc/telemetry.rb +0 -21
- data/lib/nanoc/telemetry/counter.rb +0 -15
- data/lib/nanoc/telemetry/labelled_counter.rb +0 -35
- data/lib/nanoc/telemetry/labelled_summary.rb +0 -37
- data/lib/nanoc/telemetry/registry.rb +0 -18
- data/lib/nanoc/telemetry/stopwatch.rb +0 -43
- data/lib/nanoc/telemetry/summary.rb +0 -55
- data/lib/nanoc/telemetry/table.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72454ce3213cfb07daf01923f88260c8e1c3e439e163a1b38ecd603cb74794a2
|
4
|
+
data.tar.gz: fd783734d7a4fd46fe5b391f8ef0a3373bb51ad0e6300e356af66d03478e8b7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33d234ba1e4646f801f273b26d43b5993cbe4f06f306d58139b8a9f2f6af01007b319dc3f47bf5b0ffa059c836cb3356b6d329a95901445382dc40eaec57dd2e
|
7
|
+
data.tar.gz: cefdbfa34c2f66ea3fe70fc42f6496b2fa4d607361ff7c5fb8065503f508b0e5786063679e350b996d581ed848860a68cf56055355796db8ddc3f8beb9eca226
|
data/NEWS.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.8.15 (2017-12-02)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Made `nanoc` show item being compiled in crash logs of all errors, not just errors inheriting from `StandardError` (#1258)
|
8
|
+
* Made Erubi stack traces include the filename of the item or layout that is being compiled (#1255, #1259)
|
9
|
+
* Prevented `view --live-reload` from crashing when the output directory does not exist (#1254, #1261)
|
10
|
+
|
11
|
+
Enhancements:
|
12
|
+
|
13
|
+
* Made pruner not remove the output directory if it’s empty (#1260)
|
14
|
+
|
3
15
|
## 4.8.14 (2017-11-27)
|
4
16
|
|
5
17
|
Same as 4.8.13, but published with the proper release date.
|
@@ -95,7 +107,7 @@ Enhancements:
|
|
95
107
|
|
96
108
|
* Various speed improvements
|
97
109
|
|
98
|
-
## 4.8
|
110
|
+
## 4.8 (2017-07-17)
|
99
111
|
|
100
112
|
Features:
|
101
113
|
|
data/lib/nanoc.rb
CHANGED
@@ -24,6 +24,7 @@ require 'ddplugin'
|
|
24
24
|
require 'hamster'
|
25
25
|
require 'ref'
|
26
26
|
require 'slow_enumerator_tools'
|
27
|
+
require 'ddtelemetry'
|
27
28
|
|
28
29
|
# Load general requirements
|
29
30
|
require 'cgi'
|
@@ -50,7 +51,6 @@ require 'yaml'
|
|
50
51
|
# Load Nanoc
|
51
52
|
require 'nanoc/version'
|
52
53
|
require 'nanoc/base'
|
53
|
-
require 'nanoc/telemetry'
|
54
54
|
require 'nanoc/checking'
|
55
55
|
require 'nanoc/deploying'
|
56
56
|
require 'nanoc/extra'
|
@@ -80,6 +80,8 @@ module Nanoc
|
|
80
80
|
present_files = []
|
81
81
|
present_dirs = []
|
82
82
|
|
83
|
+
expanded_dir = File.expand_path(dir)
|
84
|
+
|
83
85
|
Find.find(dir) do |f|
|
84
86
|
basename = File.basename(f)
|
85
87
|
|
@@ -91,7 +93,7 @@ module Nanoc
|
|
91
93
|
when 'directory'
|
92
94
|
if exclude?(basename)
|
93
95
|
Find.prune
|
94
|
-
|
96
|
+
elsif expanded_dir != File.expand_path(f)
|
95
97
|
present_dirs << f
|
96
98
|
end
|
97
99
|
end
|
@@ -12,12 +12,12 @@ module Nanoc::CLI::Commands::CompileListeners
|
|
12
12
|
# @param [Enumerable<Nanoc::Int::ItemRep>] reps
|
13
13
|
def initialize(reps:)
|
14
14
|
@reps = reps
|
15
|
-
@telemetry =
|
15
|
+
@telemetry = DDTelemetry.new
|
16
16
|
end
|
17
17
|
|
18
18
|
# @see Listener#start
|
19
19
|
def start
|
20
|
-
stage_stopwatch =
|
20
|
+
stage_stopwatch = DDTelemetry::Stopwatch.new
|
21
21
|
|
22
22
|
on(:stage_started) do |_klass|
|
23
23
|
stage_stopwatch.start
|
@@ -27,14 +27,14 @@ module Nanoc::CLI::Commands::CompileListeners
|
|
27
27
|
stage_stopwatch.stop
|
28
28
|
name = klass.to_s.sub(/.*::/, '')
|
29
29
|
@telemetry.summary(:stages).observe(stage_stopwatch.duration, name)
|
30
|
-
stage_stopwatch =
|
30
|
+
stage_stopwatch = DDTelemetry::Stopwatch.new
|
31
31
|
end
|
32
32
|
|
33
33
|
outdatedness_rule_stopwatches = {}
|
34
34
|
|
35
35
|
on(:outdatedness_rule_started) do |klass, obj|
|
36
36
|
stopwatches = outdatedness_rule_stopwatches.fetch(klass) { outdatedness_rule_stopwatches[klass] = {} }
|
37
|
-
stopwatch = stopwatches.fetch(obj) { stopwatches[obj] =
|
37
|
+
stopwatch = stopwatches.fetch(obj) { stopwatches[obj] = DDTelemetry::Stopwatch.new }
|
38
38
|
stopwatch.start
|
39
39
|
end
|
40
40
|
|
@@ -51,7 +51,7 @@ module Nanoc::CLI::Commands::CompileListeners
|
|
51
51
|
|
52
52
|
on(:filtering_started) do |rep, _filter_name|
|
53
53
|
stopwatch_stack = filter_stopwatches.fetch(rep) { filter_stopwatches[rep] = [] }
|
54
|
-
stopwatch_stack <<
|
54
|
+
stopwatch_stack << DDTelemetry::Stopwatch.new
|
55
55
|
stopwatch_stack.last.start
|
56
56
|
end
|
57
57
|
|
@@ -74,7 +74,7 @@ module Nanoc::CLI::Commands::CompileListeners
|
|
74
74
|
|
75
75
|
on(:phase_started) do |phase_name, rep|
|
76
76
|
stopwatches = phase_stopwatches.fetch(rep) { phase_stopwatches[rep] = {} }
|
77
|
-
stopwatches[phase_name] =
|
77
|
+
stopwatches[phase_name] = DDTelemetry::Stopwatch.new.tap(&:start)
|
78
78
|
end
|
79
79
|
|
80
80
|
on(:phase_ended) do |phase_name, rep|
|
@@ -196,7 +196,7 @@ module Nanoc::CLI::Commands::CompileListeners
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def print_table(rows)
|
199
|
-
puts
|
199
|
+
puts DDTelemetry::Table.new(rows).to_s
|
200
200
|
end
|
201
201
|
end
|
202
202
|
end
|
@@ -23,6 +23,9 @@ module Nanoc::CLI::Commands
|
|
23
23
|
|
24
24
|
config = Nanoc::Int::ConfigLoader.new.new_from_cwd
|
25
25
|
|
26
|
+
# Create output dir so that viewer/watcher doesn’t explode.
|
27
|
+
FileUtils.mkdir_p(config[:output_dir])
|
28
|
+
|
26
29
|
server =
|
27
30
|
Adsf::Server.new(
|
28
31
|
root: File.absolute_path(config[:output_dir]),
|
data/lib/nanoc/filters/erubi.rb
CHANGED
@@ -23,7 +23,9 @@ module Nanoc::Filters
|
|
23
23
|
assigns_binding = context.get_binding(&proc)
|
24
24
|
|
25
25
|
# Get result
|
26
|
-
|
26
|
+
engine_opts = { bufvar: '_erbout', filename: filename }.merge(params)
|
27
|
+
engine = ::Erubi::Engine.new(content, engine_opts)
|
28
|
+
eval(engine.src, assigns_binding, filename)
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
data/lib/nanoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ddtelemetry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0a1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0a1
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: hamster
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -360,14 +374,6 @@ files:
|
|
360
374
|
- lib/nanoc/rule_dsl/rules_collection.rb
|
361
375
|
- lib/nanoc/rule_dsl/rules_loader.rb
|
362
376
|
- lib/nanoc/spec.rb
|
363
|
-
- lib/nanoc/telemetry.rb
|
364
|
-
- lib/nanoc/telemetry/counter.rb
|
365
|
-
- lib/nanoc/telemetry/labelled_counter.rb
|
366
|
-
- lib/nanoc/telemetry/labelled_summary.rb
|
367
|
-
- lib/nanoc/telemetry/registry.rb
|
368
|
-
- lib/nanoc/telemetry/stopwatch.rb
|
369
|
-
- lib/nanoc/telemetry/summary.rb
|
370
|
-
- lib/nanoc/telemetry/table.rb
|
371
377
|
- lib/nanoc/version.rb
|
372
378
|
homepage: http://nanoc.ws/
|
373
379
|
licenses:
|
@@ -391,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
397
|
version: '0'
|
392
398
|
requirements: []
|
393
399
|
rubyforge_project:
|
394
|
-
rubygems_version: 2.7.
|
400
|
+
rubygems_version: 2.7.3
|
395
401
|
signing_key:
|
396
402
|
specification_version: 4
|
397
403
|
summary: A static-site generator with a focus on flexibility.
|
data/lib/nanoc/telemetry.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc
|
4
|
-
# @api private
|
5
|
-
module Telemetry
|
6
|
-
def self.new
|
7
|
-
Registry.new
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
require_relative 'telemetry/counter'
|
13
|
-
require_relative 'telemetry/summary'
|
14
|
-
|
15
|
-
require_relative 'telemetry/labelled_counter'
|
16
|
-
require_relative 'telemetry/labelled_summary'
|
17
|
-
|
18
|
-
require_relative 'telemetry/registry'
|
19
|
-
require_relative 'telemetry/stopwatch'
|
20
|
-
|
21
|
-
require_relative 'telemetry/table'
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Telemetry
|
4
|
-
class LabelledCounter
|
5
|
-
def initialize
|
6
|
-
@counters = {}
|
7
|
-
end
|
8
|
-
|
9
|
-
def increment(label)
|
10
|
-
get(label).increment
|
11
|
-
end
|
12
|
-
|
13
|
-
def get(label)
|
14
|
-
@counters.fetch(label) { @counters[label] = Counter.new }
|
15
|
-
end
|
16
|
-
|
17
|
-
def empty?
|
18
|
-
@counters.empty?
|
19
|
-
end
|
20
|
-
|
21
|
-
def value(label)
|
22
|
-
get(label).value
|
23
|
-
end
|
24
|
-
|
25
|
-
def values
|
26
|
-
@counters.each_with_object({}) do |(label, counter), res|
|
27
|
-
res[label] = counter.value
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def map
|
32
|
-
@counters.map { |(label, counter)| yield(label, counter) }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Telemetry
|
4
|
-
class LabelledSummary
|
5
|
-
def initialize
|
6
|
-
@summaries = {}
|
7
|
-
end
|
8
|
-
|
9
|
-
def observe(value, label)
|
10
|
-
get(label).observe(value)
|
11
|
-
end
|
12
|
-
|
13
|
-
def get(label)
|
14
|
-
@summaries.fetch(label) { @summaries[label] = Summary.new }
|
15
|
-
end
|
16
|
-
|
17
|
-
def empty?
|
18
|
-
@summaries.empty?
|
19
|
-
end
|
20
|
-
|
21
|
-
def quantile(fraction, label)
|
22
|
-
get(label).quantile(fraction)
|
23
|
-
end
|
24
|
-
|
25
|
-
def map
|
26
|
-
@summaries.map { |(label, summary)| yield(label, summary) }
|
27
|
-
end
|
28
|
-
|
29
|
-
# TODO: add quantiles(fraction)
|
30
|
-
# TODO: add min(label)
|
31
|
-
# TODO: add mins
|
32
|
-
# TODO: add max(label)
|
33
|
-
# TODO: add maxs
|
34
|
-
# TODO: add sum(label)
|
35
|
-
# TODO: add sums
|
36
|
-
end
|
37
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Telemetry
|
4
|
-
class Registry
|
5
|
-
def initialize
|
6
|
-
@counters = {}
|
7
|
-
@summaries = {}
|
8
|
-
end
|
9
|
-
|
10
|
-
def counter(name)
|
11
|
-
@counters.fetch(name) { @counters[name] = LabelledCounter.new }
|
12
|
-
end
|
13
|
-
|
14
|
-
def summary(name)
|
15
|
-
@summaries.fetch(name) { @summaries[name] = LabelledSummary.new }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Telemetry
|
4
|
-
class Stopwatch
|
5
|
-
attr_reader :duration
|
6
|
-
|
7
|
-
class AlreadyRunningError < StandardError
|
8
|
-
def message
|
9
|
-
'Cannot start, because stopwatch is already running'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class NotRunningError < StandardError
|
14
|
-
def message
|
15
|
-
'Cannot stop, because stopwatch is not running'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize
|
20
|
-
@duration = 0.0
|
21
|
-
@last_start = nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def start
|
25
|
-
raise AlreadyRunningError if running?
|
26
|
-
@last_start = Time.now
|
27
|
-
end
|
28
|
-
|
29
|
-
def stop
|
30
|
-
raise NotRunningError unless running?
|
31
|
-
@duration += (Time.now - @last_start)
|
32
|
-
@last_start = nil
|
33
|
-
end
|
34
|
-
|
35
|
-
def running?
|
36
|
-
!@last_start.nil?
|
37
|
-
end
|
38
|
-
|
39
|
-
def stopped?
|
40
|
-
!running?
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Telemetry
|
4
|
-
class Summary
|
5
|
-
class EmptySummaryError < StandardError
|
6
|
-
def message
|
7
|
-
'Cannot calculate quantile for empty summary'
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@values = []
|
13
|
-
end
|
14
|
-
|
15
|
-
def observe(value)
|
16
|
-
@values << value
|
17
|
-
@sorted_values = nil
|
18
|
-
end
|
19
|
-
|
20
|
-
def count
|
21
|
-
@values.size
|
22
|
-
end
|
23
|
-
|
24
|
-
def sum
|
25
|
-
raise EmptySummaryError if @values.empty?
|
26
|
-
@values.reduce(:+)
|
27
|
-
end
|
28
|
-
|
29
|
-
def avg
|
30
|
-
sum / count
|
31
|
-
end
|
32
|
-
|
33
|
-
def min
|
34
|
-
quantile(0.0)
|
35
|
-
end
|
36
|
-
|
37
|
-
def max
|
38
|
-
quantile(1.0)
|
39
|
-
end
|
40
|
-
|
41
|
-
def quantile(fraction)
|
42
|
-
raise EmptySummaryError if @values.empty?
|
43
|
-
|
44
|
-
target = (@values.size - 1) * fraction.to_f
|
45
|
-
interp = target % 1.0
|
46
|
-
sorted_values[target.floor] * (1.0 - interp) + sorted_values[target.ceil] * interp
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def sorted_values
|
52
|
-
@sorted_values ||= @values.sort
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Nanoc::Telemetry
|
4
|
-
class Table
|
5
|
-
def initialize(rows)
|
6
|
-
@rows = rows
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_s
|
10
|
-
columns = @rows.transpose
|
11
|
-
column_lengths = columns.map { |c| c.map(&:size).max }
|
12
|
-
|
13
|
-
[].tap do |lines|
|
14
|
-
lines << row_to_s(@rows[0], column_lengths)
|
15
|
-
lines << separator(column_lengths)
|
16
|
-
lines.concat(@rows.drop(1).map { |r| row_to_s(r, column_lengths) })
|
17
|
-
end.join("\n")
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def row_to_s(row, column_lengths)
|
23
|
-
values = row.zip(column_lengths).map { |text, length| text.rjust(length) }
|
24
|
-
values[0] + ' │ ' + values[1..-1].join(' ')
|
25
|
-
end
|
26
|
-
|
27
|
-
def separator(column_lengths)
|
28
|
-
(+'').tap do |s|
|
29
|
-
s << '─' * column_lengths[0]
|
30
|
-
s << '─┼─'
|
31
|
-
s << column_lengths[1..-1].map { |l| '─' * l }.join('───')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|