nanoc 4.8.12 → 4.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +6 -0
- data/lib/nanoc/base/entities/document.rb +16 -1
- data/lib/nanoc/base/feature.rb +1 -1
- data/lib/nanoc/base/repos/action_sequence_store.rb +3 -3
- data/lib/nanoc/base/repos/checksum_store.rb +3 -3
- data/lib/nanoc/base/repos/compiled_content_cache.rb +3 -3
- data/lib/nanoc/base/repos/dependency_store.rb +3 -3
- data/lib/nanoc/base/repos/outdatedness_store.rb +3 -3
- data/lib/nanoc/base/repos/store.rb +3 -5
- data/lib/nanoc/base/services/compiler_loader.rb +5 -5
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +2 -14
- data/lib/nanoc/cli/commands/compile.rb +18 -0
- data/lib/nanoc/cli/commands/live.rb +1 -0
- data/lib/nanoc/cli/commands/view.rb +12 -35
- data/lib/nanoc/filters/redcarpet.rb +26 -65
- data/lib/nanoc/version.rb +1 -1
- metadata +2 -293
- data/.rspec +0 -3
- data/.rubocop.yml +0 -173
- data/Rakefile +0 -25
- data/nanoc.gemspec +0 -44
- data/nanoc.manifest +0 -543
- data/spec/contributors_spec.rb +0 -20
- data/spec/gem_spec.rb +0 -21
- data/spec/manifest_spec.rb +0 -22
- data/spec/nanoc/base/changes_stream_spec.rb +0 -45
- data/spec/nanoc/base/checksummer_spec.rb +0 -419
- data/spec/nanoc/base/compiler_spec.rb +0 -149
- data/spec/nanoc/base/core_ext/array_spec.rb +0 -35
- data/spec/nanoc/base/core_ext/hash_spec.rb +0 -41
- data/spec/nanoc/base/core_ext/string_spec.rb +0 -23
- data/spec/nanoc/base/directed_graph_spec.rb +0 -258
- data/spec/nanoc/base/entities/action_sequence_spec.rb +0 -297
- data/spec/nanoc/base/entities/code_snippet_spec.rb +0 -60
- data/spec/nanoc/base/entities/configuration_spec.rb +0 -132
- data/spec/nanoc/base/entities/content_spec.rb +0 -195
- data/spec/nanoc/base/entities/context_spec.rb +0 -26
- data/spec/nanoc/base/entities/document_spec.rb +0 -258
- data/spec/nanoc/base/entities/identifiable_collection_spec.rb +0 -209
- data/spec/nanoc/base/entities/identifier_spec.rb +0 -472
- data/spec/nanoc/base/entities/item_rep_spec.rb +0 -26
- data/spec/nanoc/base/entities/item_spec.rb +0 -13
- data/spec/nanoc/base/entities/layout_spec.rb +0 -13
- data/spec/nanoc/base/entities/lazy_value_spec.rb +0 -108
- data/spec/nanoc/base/entities/outdatedness_status_spec.rb +0 -115
- data/spec/nanoc/base/entities/pattern_spec.rb +0 -133
- data/spec/nanoc/base/entities/processing_action_spec.rb +0 -11
- data/spec/nanoc/base/entities/processing_actions/filter_spec.rb +0 -20
- data/spec/nanoc/base/entities/processing_actions/layout_spec.rb +0 -20
- data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +0 -40
- data/spec/nanoc/base/entities/props_spec.rb +0 -413
- data/spec/nanoc/base/entities/site_spec.rb +0 -80
- data/spec/nanoc/base/errors/dependency_cycle_spec.rb +0 -35
- data/spec/nanoc/base/feature_spec.rb +0 -109
- data/spec/nanoc/base/filter_spec.rb +0 -166
- data/spec/nanoc/base/item_rep_writer_spec.rb +0 -140
- data/spec/nanoc/base/memoization_spec.rb +0 -108
- data/spec/nanoc/base/repos/aggregate_data_source_spec.rb +0 -87
- data/spec/nanoc/base/repos/checksum_store_spec.rb +0 -155
- data/spec/nanoc/base/repos/compiled_content_cache_spec.rb +0 -65
- data/spec/nanoc/base/repos/config_loader_spec.rb +0 -245
- data/spec/nanoc/base/repos/data_source_spec.rb +0 -95
- data/spec/nanoc/base/repos/dependency_store_spec.rb +0 -515
- data/spec/nanoc/base/repos/in_mem_data_source_spec.rb +0 -39
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +0 -72
- data/spec/nanoc/base/repos/prefixed_data_source_spec.rb +0 -39
- data/spec/nanoc/base/repos/site_loader_spec.rb +0 -264
- data/spec/nanoc/base/repos/snapshot_repo_spec.rb +0 -316
- data/spec/nanoc/base/repos/store_spec.rb +0 -93
- data/spec/nanoc/base/services/compiler/phases/abstract_spec.rb +0 -63
- data/spec/nanoc/base/services/compiler/phases/cache_spec.rb +0 -156
- data/spec/nanoc/base/services/compiler/stages/calculate_checksums_spec.rb +0 -74
- data/spec/nanoc/base/services/compiler/stages/cleanup_spec.rb +0 -88
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +0 -142
- data/spec/nanoc/base/services/compiler/stages/determine_outdatedness_spec.rb +0 -148
- data/spec/nanoc/base/services/compiler/stages/preprocess_spec.rb +0 -110
- data/spec/nanoc/base/services/dependency_tracker_spec.rb +0 -245
- data/spec/nanoc/base/services/executor_spec.rb +0 -686
- data/spec/nanoc/base/services/item_rep_router_spec.rb +0 -198
- data/spec/nanoc/base/services/item_rep_selector_spec.rb +0 -227
- data/spec/nanoc/base/services/notification_center_spec.rb +0 -25
- data/spec/nanoc/base/services/outdatedness_checker_spec.rb +0 -778
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +0 -495
- data/spec/nanoc/base/services/pruner_spec.rb +0 -116
- data/spec/nanoc/base/services/temp_filename_factory_spec.rb +0 -89
- data/spec/nanoc/base/views/basic_item_rep_collection_view_spec.rb +0 -8
- data/spec/nanoc/base/views/basic_item_rep_view_spec.rb +0 -9
- data/spec/nanoc/base/views/compilation_item_rep_collection_view_spec.rb +0 -8
- data/spec/nanoc/base/views/compilation_item_rep_view_spec.rb +0 -136
- data/spec/nanoc/base/views/config_view_spec.rb +0 -144
- data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +0 -23
- data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +0 -23
- data/spec/nanoc/base/views/item_view_spec.rb +0 -376
- data/spec/nanoc/base/views/layout_collection_view_spec.rb +0 -23
- data/spec/nanoc/base/views/layout_view_spec.rb +0 -18
- data/spec/nanoc/base/views/mutable_config_view_spec.rb +0 -18
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +0 -60
- data/spec/nanoc/base/views/mutable_item_view_spec.rb +0 -26
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +0 -60
- data/spec/nanoc/base/views/mutable_layout_view_spec.rb +0 -17
- data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +0 -8
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +0 -216
- data/spec/nanoc/base/views/post_compile_item_view_spec.rb +0 -58
- data/spec/nanoc/base/views/support/document_view_examples.rb +0 -340
- data/spec/nanoc/base/views/support/identifiable_collection_view_examples.rb +0 -277
- data/spec/nanoc/base/views/support/item_rep_collection_view_examples.rb +0 -140
- data/spec/nanoc/base/views/support/item_rep_view_examples.rb +0 -308
- data/spec/nanoc/base/views/support/mutable_document_view_examples.rb +0 -188
- data/spec/nanoc/base/views/support/mutable_identifiable_collection_view_examples.rb +0 -44
- data/spec/nanoc/checking/runner_spec.rb +0 -26
- data/spec/nanoc/cli/command_runner_spec.rb +0 -107
- data/spec/nanoc/cli/commands/compile/abstract_spec.rb +0 -80
- data/spec/nanoc/cli/commands/compile/diff_generator_spec.rb +0 -44
- data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +0 -112
- data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +0 -287
- data/spec/nanoc/cli/commands/compile_spec.rb +0 -45
- data/spec/nanoc/cli/commands/deploy_spec.rb +0 -329
- data/spec/nanoc/cli/commands/shell_spec.rb +0 -77
- data/spec/nanoc/cli/commands/show_data_spec.rb +0 -286
- data/spec/nanoc/cli/commands/show_plugins_spec.rb +0 -20
- data/spec/nanoc/cli/commands/show_rules_spec.rb +0 -118
- data/spec/nanoc/cli/commands/view_spec.rb +0 -75
- data/spec/nanoc/cli/error_handler_spec.rb +0 -43
- data/spec/nanoc/cli/stack_trace_writer_spec.rb +0 -156
- data/spec/nanoc/cli/stream_cleaners/utf8_spec.rb +0 -9
- data/spec/nanoc/cli_spec.rb +0 -44
- data/spec/nanoc/data_sources/filesystem_spec.rb +0 -128
- data/spec/nanoc/deploying/fog_spec.rb +0 -199
- data/spec/nanoc/deploying/git_spec.rb +0 -305
- data/spec/nanoc/extra/live_recompiler_spec.rb +0 -129
- data/spec/nanoc/extra/parallel_collection_spec.rb +0 -110
- data/spec/nanoc/filters/asciidoctor_spec.rb +0 -12
- data/spec/nanoc/filters/colorize_syntax/rouge_spec.rb +0 -155
- data/spec/nanoc/filters/less_spec.rb +0 -122
- data/spec/nanoc/helpers/blogging_spec.rb +0 -219
- data/spec/nanoc/helpers/breadcrumbs_spec.rb +0 -135
- data/spec/nanoc/helpers/capturing_spec.rb +0 -256
- data/spec/nanoc/helpers/child_parent_spec.rb +0 -76
- data/spec/nanoc/helpers/filtering_spec.rb +0 -77
- data/spec/nanoc/helpers/html_escape_spec.rb +0 -37
- data/spec/nanoc/helpers/link_to_spec.rb +0 -320
- data/spec/nanoc/helpers/rendering_spec.rb +0 -144
- data/spec/nanoc/helpers/tagging_spec.rb +0 -106
- data/spec/nanoc/helpers/text_spec.rb +0 -60
- data/spec/nanoc/integration/compile_command_spec.rb +0 -33
- data/spec/nanoc/integration/outdatedness_integration_spec.rb +0 -269
- data/spec/nanoc/integration/partial_recompilation_spec.rb +0 -50
- data/spec/nanoc/regressions/gh_1015_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_1022_spec.rb +0 -26
- data/spec/nanoc/regressions/gh_1031_spec.rb +0 -56
- data/spec/nanoc/regressions/gh_1035_spec.rb +0 -35
- data/spec/nanoc/regressions/gh_1037a_spec.rb +0 -31
- data/spec/nanoc/regressions/gh_1037b_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_1040_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_1045_spec.rb +0 -50
- data/spec/nanoc/regressions/gh_1047_spec.rb +0 -30
- data/spec/nanoc/regressions/gh_1064_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_1067_spec.rb +0 -36
- data/spec/nanoc/regressions/gh_1082a_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_1082b_spec.rb +0 -22
- data/spec/nanoc/regressions/gh_1082c_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_1082d_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_1093_spec.rb +0 -51
- data/spec/nanoc/regressions/gh_1094_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_1097_spec.rb +0 -23
- data/spec/nanoc/regressions/gh_1100_spec.rb +0 -22
- data/spec/nanoc/regressions/gh_1102_spec.rb +0 -28
- data/spec/nanoc/regressions/gh_1107_spec.rb +0 -15
- data/spec/nanoc/regressions/gh_1130_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_1134_spec.rb +0 -29
- data/spec/nanoc/regressions/gh_1145_spec.rb +0 -18
- data/spec/nanoc/regressions/gh_1171_spec.rb +0 -57
- data/spec/nanoc/regressions/gh_1185_spec.rb +0 -22
- data/spec/nanoc/regressions/gh_1216_spec.rb +0 -91
- data/spec/nanoc/regressions/gh_1248_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_761_spec.rb +0 -25
- data/spec/nanoc/regressions/gh_767_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_769_spec.rb +0 -32
- data/spec/nanoc/regressions/gh_776_spec.rb +0 -42
- data/spec/nanoc/regressions/gh_787_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_795_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_804_spec.rb +0 -28
- data/spec/nanoc/regressions/gh_807_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_809_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_813_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_815_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_828_spec.rb +0 -25
- data/spec/nanoc/regressions/gh_833_spec.rb +0 -16
- data/spec/nanoc/regressions/gh_841_spec.rb +0 -17
- data/spec/nanoc/regressions/gh_867_spec.rb +0 -17
- data/spec/nanoc/regressions/gh_882_spec.rb +0 -31
- data/spec/nanoc/regressions/gh_885_spec.rb +0 -32
- data/spec/nanoc/regressions/gh_891_spec.rb +0 -28
- data/spec/nanoc/regressions/gh_913_spec.rb +0 -26
- data/spec/nanoc/regressions/gh_924_spec.rb +0 -91
- data/spec/nanoc/regressions/gh_928_spec.rb +0 -7
- data/spec/nanoc/regressions/gh_937_spec.rb +0 -27
- data/spec/nanoc/regressions/gh_942_spec.rb +0 -23
- data/spec/nanoc/regressions/gh_947_spec.rb +0 -23
- data/spec/nanoc/regressions/gh_948_spec.rb +0 -18
- data/spec/nanoc/regressions/gh_951_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_954_spec.rb +0 -35
- data/spec/nanoc/regressions/gh_970a_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_970b_spec.rb +0 -52
- data/spec/nanoc/regressions/gh_974_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_981_spec.rb +0 -23
- data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +0 -230
- data/spec/nanoc/rule_dsl/recording_executor_spec.rb +0 -145
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +0 -251
- data/spec/nanoc/rule_dsl/rule_spec.rb +0 -111
- data/spec/nanoc/rule_dsl/rules_collection_spec.rb +0 -301
- data/spec/nanoc/spec_spec.rb +0 -70
- data/spec/nanoc/telemetry/counter_spec.rb +0 -20
- data/spec/nanoc/telemetry/labelled_counter_spec.rb +0 -94
- data/spec/nanoc/telemetry/labelled_summary_spec.rb +0 -78
- data/spec/nanoc/telemetry/stopwatch_spec.rb +0 -63
- data/spec/nanoc/telemetry/summary_spec.rb +0 -68
- data/spec/nanoc/telemetry/table_spec.rb +0 -22
- data/spec/nanoc/telemetry_spec.rb +0 -28
- data/spec/regression_filenames_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -371
- data/test/base/test_compiler.rb +0 -389
- data/test/base/test_filter.rb +0 -73
- data/test/base/test_site.rb +0 -146
- data/test/checking/checks/test_css.rb +0 -66
- data/test/checking/checks/test_external_links.rb +0 -88
- data/test/checking/checks/test_html.rb +0 -47
- data/test/checking/checks/test_internal_links.rb +0 -118
- data/test/checking/checks/test_mixed_content.rb +0 -190
- data/test/checking/checks/test_stale.rb +0 -69
- data/test/checking/test_check.rb +0 -22
- data/test/checking/test_dsl.rb +0 -35
- data/test/checking/test_runner.rb +0 -45
- data/test/cli/commands/test_check.rb +0 -20
- data/test/cli/commands/test_compile.rb +0 -199
- data/test/cli/commands/test_create_site.rb +0 -126
- data/test/cli/commands/test_help.rb +0 -10
- data/test/cli/commands/test_prune.rb +0 -157
- data/test/cli/test_cleaning_stream.rb +0 -97
- data/test/cli/test_cli.rb +0 -195
- data/test/cli/test_error_handler.rb +0 -102
- data/test/cli/test_logger.rb +0 -7
- data/test/data_sources/test_filesystem.rb +0 -1033
- data/test/data_sources/test_filesystem_tools.rb +0 -146
- data/test/deploying/test_fog.rb +0 -117
- data/test/deploying/test_git.rb +0 -263
- data/test/deploying/test_rsync.rb +0 -94
- data/test/extra/core_ext/test_time.rb +0 -17
- data/test/extra/test_link_collector.rb +0 -110
- data/test/extra/test_piper.rb +0 -48
- data/test/filters/colorize_syntax/test_coderay.rb +0 -247
- data/test/filters/colorize_syntax/test_common.rb +0 -109
- data/test/filters/colorize_syntax/test_pygmentize.rb +0 -39
- data/test/filters/colorize_syntax/test_pygments.rb +0 -21
- data/test/filters/colorize_syntax/test_simon.rb +0 -24
- data/test/filters/test_asciidoc.rb +0 -16
- data/test/filters/test_bluecloth.rb +0 -16
- data/test/filters/test_coffeescript.rb +0 -16
- data/test/filters/test_erb.rb +0 -107
- data/test/filters/test_erubi.rb +0 -75
- data/test/filters/test_erubis.rb +0 -76
- data/test/filters/test_haml.rb +0 -94
- data/test/filters/test_handlebars.rb +0 -61
- data/test/filters/test_kramdown.rb +0 -56
- data/test/filters/test_markaby.rb +0 -16
- data/test/filters/test_maruku.rb +0 -16
- data/test/filters/test_mustache.rb +0 -43
- data/test/filters/test_pandoc.rb +0 -47
- data/test/filters/test_rainpress.rb +0 -27
- data/test/filters/test_rdiscount.rb +0 -30
- data/test/filters/test_rdoc.rb +0 -14
- data/test/filters/test_redcarpet.rb +0 -111
- data/test/filters/test_redcloth.rb +0 -31
- data/test/filters/test_relativize_paths.rb +0 -887
- data/test/filters/test_rubypants.rb +0 -16
- data/test/filters/test_sass.rb +0 -315
- data/test/filters/test_slim.rb +0 -59
- data/test/filters/test_typogruby.rb +0 -18
- data/test/filters/test_uglify_js.rb +0 -30
- data/test/filters/test_xsl.rb +0 -192
- data/test/filters/test_yui_compressor.rb +0 -42
- data/test/fixtures/vcr_cassettes/css_run_error.yml +0 -70
- data/test/fixtures/vcr_cassettes/css_run_ok.yml +0 -60
- data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +0 -70
- data/test/fixtures/vcr_cassettes/html_run_error.yml +0 -56
- data/test/fixtures/vcr_cassettes/html_run_ok.yml +0 -58
- data/test/helper.rb +0 -255
- data/test/helpers/test_blogging.rb +0 -684
- data/test/helpers/test_capturing.rb +0 -184
- data/test/helpers/test_link_to.rb +0 -57
- data/test/helpers/test_xml_sitemap.rb +0 -246
- data/test/rule_dsl/test_action_provider.rb +0 -80
- data/test/rule_dsl/test_compiler_dsl.rb +0 -448
- data/test/rule_dsl/test_rules_collection.rb +0 -93
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_examples 'a mutable identifiable collection view' do
|
4
|
-
let(:view) { described_class.new(wrapped, view_context) }
|
5
|
-
|
6
|
-
let(:view_context) { double(:view_context) }
|
7
|
-
|
8
|
-
let(:config) do
|
9
|
-
{}
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#delete_if' do
|
13
|
-
let(:wrapped) do
|
14
|
-
collection_class.new(
|
15
|
-
config,
|
16
|
-
[double(:identifiable, identifier: Nanoc::Identifier.new('/asdf'))],
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'deletes matching' do
|
21
|
-
view.delete_if { |i| i.identifier == '/asdf' }
|
22
|
-
expect(view.unwrap).to be_empty
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'does not mutate' do
|
26
|
-
view.delete_if { |i| i.identifier == '/asdf' }
|
27
|
-
expect(wrapped).not_to be_empty
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'deletes no non-matching' do
|
31
|
-
view.delete_if { |i| i.identifier == '/blah' }
|
32
|
-
expect(wrapped).not_to be_empty
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'returns self' do
|
36
|
-
ret = view.delete_if { |_i| false }
|
37
|
-
expect(ret).to equal(view)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'yields items with the proper context' do
|
41
|
-
view.delete_if { |i| expect(i._context).to equal(view_context) }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Checking::Runner do
|
4
|
-
subject(:runner) { described_class.new(site) }
|
5
|
-
|
6
|
-
let(:site) { double(:site) }
|
7
|
-
|
8
|
-
describe '#check_classes_named' do
|
9
|
-
subject { runner.check_classes_named(names) }
|
10
|
-
|
11
|
-
context 'given one full name' do
|
12
|
-
let(:names) { %w[internal_links] }
|
13
|
-
it { is_expected.to eq([Nanoc::Checking::Checks::InternalLinks]) }
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'given one full name with dash instead of underscore' do
|
17
|
-
let(:names) { %w[internal-links] }
|
18
|
-
it { is_expected.to eq([Nanoc::Checking::Checks::InternalLinks]) }
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'given one abbreviated name' do
|
22
|
-
let(:names) { %w[ilinks] }
|
23
|
-
it { is_expected.to eq([Nanoc::Checking::Checks::InternalLinks]) }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::CLI::CommandRunner, stdio: true do
|
4
|
-
describe '.find_site_dir' do
|
5
|
-
subject { described_class.find_site_dir }
|
6
|
-
|
7
|
-
context 'config file in current dir' do
|
8
|
-
before { File.write('nanoc.yaml', 'hi') }
|
9
|
-
|
10
|
-
it 'returns the current dir' do
|
11
|
-
expect(subject).to eq(File.expand_path(Dir.getwd))
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'config file in parent dir' do
|
16
|
-
around do |ex|
|
17
|
-
FileUtils.mkdir_p('root/sub')
|
18
|
-
File.write('root/nanoc.yaml', 'hi')
|
19
|
-
chdir('root/sub') { ex.run }
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'returns the parent dir' do
|
23
|
-
expect(subject).to match(/root$/)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'config file in grandparent dir' do
|
28
|
-
around do |ex|
|
29
|
-
FileUtils.mkdir_p('root/sub1/sub2')
|
30
|
-
File.write('root/nanoc.yaml', 'hi')
|
31
|
-
chdir('root/sub1/sub2') { ex.run }
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'returns the parent dir' do
|
35
|
-
expect(subject).to match(/root$/)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'no config file in ancestral paths' do
|
40
|
-
it 'returns nil' do
|
41
|
-
expect(subject).to be_nil
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '.enter_site_dir' do
|
47
|
-
subject do
|
48
|
-
described_class.enter_site_dir
|
49
|
-
Dir.getwd
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'config file in current dir' do
|
53
|
-
before { File.write('nanoc.yaml', 'hi') }
|
54
|
-
|
55
|
-
it 'returns the current dir' do
|
56
|
-
expect(subject).to eq(File.expand_path(Dir.getwd))
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'config file in parent dir' do
|
61
|
-
around do |ex|
|
62
|
-
FileUtils.mkdir_p('root/sub')
|
63
|
-
File.write('root/nanoc.yaml', 'hi')
|
64
|
-
chdir('root/sub') { ex.run }
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'returns the parent dir' do
|
68
|
-
expect(subject).to match(/root$/)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'config file in grandparent dir' do
|
73
|
-
around do |ex|
|
74
|
-
FileUtils.mkdir_p('root/sub1/sub2')
|
75
|
-
File.write('root/nanoc.yaml', 'hi')
|
76
|
-
chdir('root/sub1/sub2') { ex.run }
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'enters the parent dir' do
|
80
|
-
expect(subject).to match(/root$/)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'no config file in ancestral paths' do
|
85
|
-
it 'raises' do
|
86
|
-
expect { subject }.to raise_error(::Nanoc::Int::Errors::GenericTrivial, 'The current working directory, nor any of its parents, seems to be a Nanoc site.')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#load_site' do
|
92
|
-
let(:command_runner) { described_class.new(nil, nil, nil) }
|
93
|
-
|
94
|
-
subject { command_runner.load_site }
|
95
|
-
|
96
|
-
before { File.write('nanoc.yaml', '{}') }
|
97
|
-
|
98
|
-
it 'does not set @site' do
|
99
|
-
expect(command_runner.instance_variable_get(:@site)).to be_nil
|
100
|
-
expect { subject }.not_to change { command_runner.instance_variable_get(:@site) }
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'returns site' do
|
104
|
-
expect(subject).to be_a(Nanoc::Int::Site)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::CLI::Commands::CompileListeners::Abstract do
|
4
|
-
subject { klass.new }
|
5
|
-
|
6
|
-
context 'abstract class' do
|
7
|
-
let(:klass) { described_class }
|
8
|
-
|
9
|
-
it 'errors on starting' do
|
10
|
-
expect { subject.start }.to raise_error(NotImplementedError)
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'stops silently' do
|
14
|
-
subject.stop
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'concrete subclass' do
|
19
|
-
let(:klass) do
|
20
|
-
Class.new(described_class) do
|
21
|
-
attr_reader :started
|
22
|
-
attr_reader :stopped
|
23
|
-
|
24
|
-
def initialize
|
25
|
-
@started = false
|
26
|
-
@stopped = false
|
27
|
-
end
|
28
|
-
|
29
|
-
def start
|
30
|
-
@started = true
|
31
|
-
end
|
32
|
-
|
33
|
-
def stop
|
34
|
-
@stopped = true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'starts' do
|
40
|
-
subject.start
|
41
|
-
expect(subject.started).to be
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'stops' do
|
45
|
-
subject.start
|
46
|
-
subject.stop
|
47
|
-
expect(subject.stopped).to be
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'starts safely' do
|
51
|
-
subject.start_safely
|
52
|
-
expect(subject.started).to be
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'stops safely' do
|
56
|
-
subject.start_safely
|
57
|
-
subject.stop_safely
|
58
|
-
expect(subject.stopped).to be
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'listener that does not start or stop properly' do
|
63
|
-
let(:klass) do
|
64
|
-
Class.new(described_class) do
|
65
|
-
def start
|
66
|
-
raise 'boom'
|
67
|
-
end
|
68
|
-
|
69
|
-
def stop
|
70
|
-
raise 'boom'
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'raises on start, but not stop' do
|
76
|
-
expect { subject.start_safely }.to raise_error(RuntimeError)
|
77
|
-
expect { subject.stop_safely }.not_to raise_error
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::CLI::Commands::CompileListeners::DiffGenerator do
|
4
|
-
describe '.enable_for?' do
|
5
|
-
subject { described_class.enable_for?(command_runner, site) }
|
6
|
-
|
7
|
-
let(:options) { {} }
|
8
|
-
let(:config_hash) { {} }
|
9
|
-
|
10
|
-
let(:arguments) { double(:arguments) }
|
11
|
-
let(:command) { double(:command) }
|
12
|
-
|
13
|
-
let(:site) do
|
14
|
-
Nanoc::Int::Site.new(
|
15
|
-
config: config,
|
16
|
-
code_snippets: code_snippets,
|
17
|
-
data_source: Nanoc::Int::InMemDataSource.new(items, layouts),
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:config) { Nanoc::Int::Configuration.new(hash: config_hash).with_defaults }
|
22
|
-
let(:items) { [] }
|
23
|
-
let(:layouts) { [] }
|
24
|
-
let(:code_snippets) { [] }
|
25
|
-
|
26
|
-
let(:command_runner) do
|
27
|
-
Nanoc::CLI::Commands::Compile.new(options, arguments, command)
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'default' do
|
31
|
-
it { is_expected.not_to be }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'enabled in config' do
|
35
|
-
let(:config_hash) { { enable_output_diff: true } }
|
36
|
-
it { is_expected.to be }
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'enabled on command line' do
|
40
|
-
let(:options) { { diff: true } }
|
41
|
-
it { is_expected.to be }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::CLI::Commands::CompileListeners::FileActionPrinter, stdio: true do
|
4
|
-
let(:listener) { described_class.new(reps: reps) }
|
5
|
-
|
6
|
-
before { Timecop.freeze(Time.local(2008, 1, 2, 14, 5, 0)) }
|
7
|
-
after { Timecop.return }
|
8
|
-
|
9
|
-
let(:reps) do
|
10
|
-
Nanoc::Int::ItemRepRepo.new.tap do |reps|
|
11
|
-
reps << rep
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:item) { Nanoc::Int::Item.new('<%= 1 + 2 %>', {}, '/hi.md') }
|
16
|
-
|
17
|
-
let(:rep) do
|
18
|
-
Nanoc::Int::ItemRep.new(item, :default).tap do |rep|
|
19
|
-
rep.raw_paths = { default: ['/hi.html'] }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'records from compilation_started to rep_written' do
|
24
|
-
listener.start
|
25
|
-
|
26
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
27
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
28
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
29
|
-
|
30
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', true, true) }
|
31
|
-
.to output(/create.*\[1\.00s\]/).to_stdout
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'stops listening after #stop' do
|
35
|
-
listener.start
|
36
|
-
listener.stop
|
37
|
-
|
38
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
39
|
-
|
40
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', true, true) }
|
41
|
-
.not_to output(/create/).to_stdout
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'records from compilation_started over compilation_suspended to rep_written' do
|
45
|
-
listener.start
|
46
|
-
|
47
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
48
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
49
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
50
|
-
Nanoc::Int::NotificationCenter.post(:compilation_suspended, rep, :__irrelevant__)
|
51
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 3))
|
52
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
53
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 6))
|
54
|
-
|
55
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', true, true) }
|
56
|
-
.to output(/create.*\[4\.00s\]/).to_stdout
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'log level = high' do
|
60
|
-
before { listener.start }
|
61
|
-
before { Nanoc::CLI::Logger.instance.level = :high }
|
62
|
-
|
63
|
-
it 'does not print skipped (uncompiled) reps' do
|
64
|
-
expect { listener.stop }
|
65
|
-
.not_to output(/skip/).to_stdout
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'prints nothing' do
|
69
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
70
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
71
|
-
|
72
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', false, false) }
|
73
|
-
.not_to output(/identical/).to_stdout
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'prints nothing' do
|
77
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
78
|
-
Nanoc::Int::NotificationCenter.post(:cached_content_used, rep)
|
79
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
80
|
-
|
81
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', false, false) }
|
82
|
-
.not_to output(/cached/).to_stdout
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'log level = low' do
|
87
|
-
before { listener.start }
|
88
|
-
before { Nanoc::CLI::Logger.instance.level = :low }
|
89
|
-
|
90
|
-
it 'prints skipped (uncompiled) reps' do
|
91
|
-
expect { listener.stop }
|
92
|
-
.to output(/skip.*\/hi\.html/).to_stdout
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'prints “identical” if not cached' do
|
96
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
97
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
98
|
-
|
99
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', false, false) }
|
100
|
-
.to output(/identical/).to_stdout
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'prints “cached” if cached' do
|
104
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
105
|
-
Nanoc::Int::NotificationCenter.post(:cached_content_used, rep)
|
106
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
107
|
-
|
108
|
-
expect { Nanoc::Int::NotificationCenter.post(:rep_written, rep, false, '/foo.html', false, false) }
|
109
|
-
.to output(/cached/).to_stdout
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,287 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::CLI::Commands::CompileListeners::TimingRecorder, stdio: true do
|
4
|
-
let(:listener) { described_class.new(reps: reps) }
|
5
|
-
|
6
|
-
before { Timecop.freeze(Time.local(2008, 1, 2, 14, 5, 0)) }
|
7
|
-
after { Timecop.return }
|
8
|
-
|
9
|
-
before { Nanoc::CLI.verbosity = 2 }
|
10
|
-
|
11
|
-
before { listener.start }
|
12
|
-
after { listener.stop_safely }
|
13
|
-
|
14
|
-
let(:reps) do
|
15
|
-
Nanoc::Int::ItemRepRepo.new.tap do |reps|
|
16
|
-
reps << rep
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:item) { Nanoc::Int::Item.new('<%= 1 + 2 %>', {}, '/hi.md') }
|
21
|
-
|
22
|
-
let(:rep) do
|
23
|
-
Nanoc::Int::ItemRep.new(item, :default).tap do |rep|
|
24
|
-
rep.raw_paths = { default: ['/hi.html'] }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
let(:other_rep) do
|
29
|
-
Nanoc::Int::ItemRep.new(item, :other).tap do |rep|
|
30
|
-
rep.raw_paths = { default: ['/bye.html'] }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'prints filters table' do
|
35
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
36
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :erb)
|
37
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
38
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)
|
39
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 14, 1))
|
40
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :erb)
|
41
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 14, 3))
|
42
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)
|
43
|
-
|
44
|
-
expect { listener.stop }
|
45
|
-
.to output(/^\s*erb │ 2 1\.00s 1\.50s 1\.90s 1\.95s 2\.00s 3\.00s$/).to_stdout
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'records single from filtering_started to filtering_ended' do
|
49
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
50
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :erb)
|
51
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
52
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)
|
53
|
-
|
54
|
-
expect(listener.telemetry.summary(:filters).get('erb').min).to eq(1.00)
|
55
|
-
expect(listener.telemetry.summary(:filters).get('erb').avg).to eq(1.00)
|
56
|
-
expect(listener.telemetry.summary(:filters).get('erb').max).to eq(1.00)
|
57
|
-
expect(listener.telemetry.summary(:filters).get('erb').sum).to eq(1.00)
|
58
|
-
expect(listener.telemetry.summary(:filters).get('erb').count).to eq(1.00)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'records multiple from filtering_started to filtering_ended' do
|
62
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
63
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :erb)
|
64
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
65
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)
|
66
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 14, 1))
|
67
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :erb)
|
68
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 14, 3))
|
69
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)
|
70
|
-
|
71
|
-
expect(listener.telemetry.summary(:filters).get('erb').min).to eq(1.00)
|
72
|
-
expect(listener.telemetry.summary(:filters).get('erb').avg).to eq(1.50)
|
73
|
-
expect(listener.telemetry.summary(:filters).get('erb').max).to eq(2.00)
|
74
|
-
expect(listener.telemetry.summary(:filters).get('erb').sum).to eq(3.00)
|
75
|
-
expect(listener.telemetry.summary(:filters).get('erb').count).to eq(2.00)
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'records filters in nested filtering_started/filtering_ended' do
|
79
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
80
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :outer)
|
81
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
82
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :inner)
|
83
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 3))
|
84
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :inner)
|
85
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 6))
|
86
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :outer)
|
87
|
-
|
88
|
-
expect(listener.telemetry.summary(:filters).get('inner').min).to eq(2.00)
|
89
|
-
expect(listener.telemetry.summary(:filters).get('inner').avg).to eq(2.00)
|
90
|
-
expect(listener.telemetry.summary(:filters).get('inner').max).to eq(2.00)
|
91
|
-
expect(listener.telemetry.summary(:filters).get('inner').sum).to eq(2.00)
|
92
|
-
expect(listener.telemetry.summary(:filters).get('inner').count).to eq(1.00)
|
93
|
-
|
94
|
-
expect(listener.telemetry.summary(:filters).get('outer').min).to eq(6.00)
|
95
|
-
expect(listener.telemetry.summary(:filters).get('outer').avg).to eq(6.00)
|
96
|
-
expect(listener.telemetry.summary(:filters).get('outer').max).to eq(6.00)
|
97
|
-
expect(listener.telemetry.summary(:filters).get('outer').sum).to eq(6.00)
|
98
|
-
expect(listener.telemetry.summary(:filters).get('outer').count).to eq(1.00)
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'pauses outer stopwatch when suspended' do
|
102
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
103
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
104
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :outer)
|
105
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
106
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :inner)
|
107
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 3))
|
108
|
-
Nanoc::Int::NotificationCenter.post(:compilation_suspended, rep, :__anything__)
|
109
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 6))
|
110
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
111
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 10))
|
112
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :inner)
|
113
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :outer)
|
114
|
-
|
115
|
-
expect(listener.telemetry.summary(:filters).get('outer').min).to eq(7.00)
|
116
|
-
expect(listener.telemetry.summary(:filters).get('outer').avg).to eq(7.00)
|
117
|
-
expect(listener.telemetry.summary(:filters).get('outer').max).to eq(7.00)
|
118
|
-
expect(listener.telemetry.summary(:filters).get('outer').sum).to eq(7.00)
|
119
|
-
expect(listener.telemetry.summary(:filters).get('outer').count).to eq(1.00)
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'records single from filtering_started over compilation_{suspended,started} to filtering_ended' do
|
123
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
124
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
125
|
-
Nanoc::Int::NotificationCenter.post(:filtering_started, rep, :erb)
|
126
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
127
|
-
Nanoc::Int::NotificationCenter.post(:compilation_suspended, rep, :__anything__)
|
128
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 3))
|
129
|
-
Nanoc::Int::NotificationCenter.post(:compilation_started, rep)
|
130
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 7))
|
131
|
-
Nanoc::Int::NotificationCenter.post(:filtering_ended, rep, :erb)
|
132
|
-
|
133
|
-
expect(listener.telemetry.summary(:filters).get('erb').min).to eq(5.00)
|
134
|
-
expect(listener.telemetry.summary(:filters).get('erb').avg).to eq(5.00)
|
135
|
-
expect(listener.telemetry.summary(:filters).get('erb').max).to eq(5.00)
|
136
|
-
expect(listener.telemetry.summary(:filters).get('erb').sum).to eq(5.00)
|
137
|
-
expect(listener.telemetry.summary(:filters).get('erb').count).to eq(1.00)
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'records single phase start+stop' do
|
141
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
142
|
-
Nanoc::Int::NotificationCenter.post(:phase_started, 'donkey', rep)
|
143
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
144
|
-
Nanoc::Int::NotificationCenter.post(:phase_ended, 'donkey', rep)
|
145
|
-
|
146
|
-
expect(listener.telemetry.summary(:phases).get('donkey').min).to eq(1.00)
|
147
|
-
expect(listener.telemetry.summary(:phases).get('donkey').avg).to eq(1.00)
|
148
|
-
expect(listener.telemetry.summary(:phases).get('donkey').max).to eq(1.00)
|
149
|
-
expect(listener.telemetry.summary(:phases).get('donkey').sum).to eq(1.00)
|
150
|
-
expect(listener.telemetry.summary(:phases).get('donkey').count).to eq(1.00)
|
151
|
-
end
|
152
|
-
|
153
|
-
it 'records multiple phase start+stop' do
|
154
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
155
|
-
Nanoc::Int::NotificationCenter.post(:phase_started, 'donkey', rep)
|
156
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
157
|
-
Nanoc::Int::NotificationCenter.post(:phase_ended, 'donkey', rep)
|
158
|
-
Timecop.freeze(Time.local(2008, 9, 1, 11, 6, 0))
|
159
|
-
Nanoc::Int::NotificationCenter.post(:phase_started, 'donkey', rep)
|
160
|
-
Timecop.freeze(Time.local(2008, 9, 1, 11, 6, 2))
|
161
|
-
Nanoc::Int::NotificationCenter.post(:phase_ended, 'donkey', rep)
|
162
|
-
|
163
|
-
expect(listener.telemetry.summary(:phases).get('donkey').min).to eq(1.00)
|
164
|
-
expect(listener.telemetry.summary(:phases).get('donkey').avg).to eq(1.50)
|
165
|
-
expect(listener.telemetry.summary(:phases).get('donkey').max).to eq(2.00)
|
166
|
-
expect(listener.telemetry.summary(:phases).get('donkey').sum).to eq(3.00)
|
167
|
-
expect(listener.telemetry.summary(:phases).get('donkey').count).to eq(2.00)
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'records single phase start+yield+resume+stop' do
|
171
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
172
|
-
Nanoc::Int::NotificationCenter.post(:phase_started, 'donkey', rep)
|
173
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
174
|
-
Nanoc::Int::NotificationCenter.post(:phase_yielded, 'donkey', rep)
|
175
|
-
Timecop.freeze(Time.local(2008, 9, 1, 11, 6, 0))
|
176
|
-
Nanoc::Int::NotificationCenter.post(:phase_resumed, 'donkey', rep)
|
177
|
-
Timecop.freeze(Time.local(2008, 9, 1, 11, 6, 2))
|
178
|
-
Nanoc::Int::NotificationCenter.post(:phase_ended, 'donkey', rep)
|
179
|
-
|
180
|
-
expect(listener.telemetry.summary(:phases).get('donkey').min).to eq(3.00)
|
181
|
-
expect(listener.telemetry.summary(:phases).get('donkey').avg).to eq(3.00)
|
182
|
-
expect(listener.telemetry.summary(:phases).get('donkey').max).to eq(3.00)
|
183
|
-
expect(listener.telemetry.summary(:phases).get('donkey').sum).to eq(3.00)
|
184
|
-
expect(listener.telemetry.summary(:phases).get('donkey').count).to eq(1.00)
|
185
|
-
end
|
186
|
-
|
187
|
-
it 'records single phase start+yield+abort+start+stop' do
|
188
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
189
|
-
Nanoc::Int::NotificationCenter.post(:phase_started, 'donkey', rep)
|
190
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
191
|
-
Nanoc::Int::NotificationCenter.post(:phase_yielded, 'donkey', rep)
|
192
|
-
Timecop.freeze(Time.local(2008, 9, 1, 11, 6, 0))
|
193
|
-
Nanoc::Int::NotificationCenter.post(:phase_aborted, 'donkey', rep)
|
194
|
-
Timecop.freeze(Time.local(2008, 9, 1, 12, 7, 2))
|
195
|
-
Nanoc::Int::NotificationCenter.post(:phase_started, 'donkey', rep)
|
196
|
-
Timecop.freeze(Time.local(2008, 9, 1, 12, 7, 5))
|
197
|
-
Nanoc::Int::NotificationCenter.post(:phase_ended, 'donkey', rep)
|
198
|
-
|
199
|
-
expect(listener.telemetry.summary(:phases).get('donkey').min).to eq(1.00)
|
200
|
-
expect(listener.telemetry.summary(:phases).get('donkey').avg).to eq(2.00)
|
201
|
-
expect(listener.telemetry.summary(:phases).get('donkey').max).to eq(3.00)
|
202
|
-
expect(listener.telemetry.summary(:phases).get('donkey').sum).to eq(4.00)
|
203
|
-
expect(listener.telemetry.summary(:phases).get('donkey').count).to eq(2.00)
|
204
|
-
end
|
205
|
-
|
206
|
-
it 'records stage duration' do
|
207
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
208
|
-
Nanoc::Int::NotificationCenter.post(:stage_started, 'donkey', rep)
|
209
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
210
|
-
Nanoc::Int::NotificationCenter.post(:stage_ended, 'donkey', rep)
|
211
|
-
|
212
|
-
expect(listener.telemetry.summary(:stages).get('donkey').sum).to eq(1.00)
|
213
|
-
expect(listener.telemetry.summary(:stages).get('donkey').count).to eq(1.00)
|
214
|
-
end
|
215
|
-
|
216
|
-
it 'prints stage durations' do
|
217
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
218
|
-
Nanoc::Int::NotificationCenter.post(:stage_started, 'donkey', rep)
|
219
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
220
|
-
Nanoc::Int::NotificationCenter.post(:stage_ended, 'donkey', rep)
|
221
|
-
|
222
|
-
expect { listener.stop }
|
223
|
-
.to output(/^\s*donkey │ 1\.00s$/).to_stdout
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'prints out outdatedness rule durations' do
|
227
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
228
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_started, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)
|
229
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
230
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_ended, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)
|
231
|
-
|
232
|
-
expect { listener.stop }
|
233
|
-
.to output(/^\s*CodeSnippetsModified │ 1 1\.00s 1\.00s 1\.00s 1\.00s 1\.00s 1\.00s$/).to_stdout
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'records single outdatedness rule duration' do
|
237
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
238
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_started, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)
|
239
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
240
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_ended, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)
|
241
|
-
|
242
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').min).to eq(1.00)
|
243
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').avg).to eq(1.00)
|
244
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').max).to eq(1.00)
|
245
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').sum).to eq(1.00)
|
246
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').count).to eq(1.00)
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'records multiple outdatedness rule duration' do
|
250
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 0))
|
251
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_started, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)
|
252
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 5, 1))
|
253
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_ended, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, rep)
|
254
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 6, 0))
|
255
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_started, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, other_rep)
|
256
|
-
Timecop.freeze(Time.local(2008, 9, 1, 10, 6, 3))
|
257
|
-
Nanoc::Int::NotificationCenter.post(:outdatedness_rule_ended, Nanoc::Int::OutdatednessRules::CodeSnippetsModified, other_rep)
|
258
|
-
|
259
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').min).to eq(1.00)
|
260
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').avg).to eq(2.00)
|
261
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').max).to eq(3.00)
|
262
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').sum).to eq(4.00)
|
263
|
-
expect(listener.telemetry.summary(:outdatedness_rules).get('CodeSnippetsModified').count).to eq(2.00)
|
264
|
-
end
|
265
|
-
|
266
|
-
it 'records memoization usage' do
|
267
|
-
Nanoc::Int::NotificationCenter.post(:memoization_hit, 'Foo#bar', rep)
|
268
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
269
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
270
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
271
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
272
|
-
|
273
|
-
expect(listener.telemetry.counter(:memoization).get(['Foo#bar', :hit]).value).to eq(1)
|
274
|
-
expect(listener.telemetry.counter(:memoization).get(['Foo#bar', :miss]).value).to eq(4)
|
275
|
-
end
|
276
|
-
|
277
|
-
it 'prints memoization table' do
|
278
|
-
Nanoc::Int::NotificationCenter.post(:memoization_hit, 'Foo#bar', rep)
|
279
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
280
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
281
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
282
|
-
Nanoc::Int::NotificationCenter.post(:memoization_miss, 'Foo#bar', rep)
|
283
|
-
|
284
|
-
expect { listener.stop }
|
285
|
-
.to output(/^\s*Foo#bar │ 1 4 20\.0%$/).to_stdout
|
286
|
-
end
|
287
|
-
end
|