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,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::InMemDataSource, stdio: true do
|
4
|
-
let(:klass) do
|
5
|
-
Class.new(Nanoc::DataSource) do
|
6
|
-
def item_changes
|
7
|
-
%i[one_foo one_bar]
|
8
|
-
end
|
9
|
-
|
10
|
-
def layout_changes
|
11
|
-
%i[one_foo one_bar]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:original_data_source) do
|
17
|
-
klass.new({}, nil, nil, {})
|
18
|
-
end
|
19
|
-
|
20
|
-
subject(:data_source) do
|
21
|
-
described_class.new([], [], original_data_source)
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#item_changes' do
|
25
|
-
subject { data_source.item_changes }
|
26
|
-
|
27
|
-
it 'yields changes from the original' do
|
28
|
-
expect(subject).to eq(original_data_source.item_changes)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#layout_changes' do
|
33
|
-
subject { data_source.layout_changes }
|
34
|
-
|
35
|
-
it 'yields changes from the original' do
|
36
|
-
expect(subject).to eq(original_data_source.layout_changes)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::OutdatednessStore do
|
4
|
-
subject(:store) { described_class.new(site: site) }
|
5
|
-
|
6
|
-
let(:site) { double(:site) }
|
7
|
-
|
8
|
-
let(:item) { Nanoc::Int::Item.new('foo', {}, '/foo.md') }
|
9
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
|
10
|
-
|
11
|
-
let(:site) do
|
12
|
-
Nanoc::Int::Site.new(
|
13
|
-
config: config,
|
14
|
-
code_snippets: code_snippets,
|
15
|
-
data_source: Nanoc::Int::InMemDataSource.new(items, layouts),
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
let(:config) { Nanoc::Int::Configuration.new.with_defaults }
|
20
|
-
let(:items) { [] }
|
21
|
-
let(:layouts) { [] }
|
22
|
-
let(:code_snippets) { [] }
|
23
|
-
|
24
|
-
describe '#include?, #add and #remove' do
|
25
|
-
subject { store.include?(rep) }
|
26
|
-
|
27
|
-
context 'nothing added' do
|
28
|
-
it { is_expected.not_to be }
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'rep added' do
|
32
|
-
before { store.add(rep) }
|
33
|
-
it { is_expected.to be }
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'rep added and removed' do
|
37
|
-
before do
|
38
|
-
store.add(rep)
|
39
|
-
store.remove(rep)
|
40
|
-
end
|
41
|
-
|
42
|
-
it { is_expected.not_to be }
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'rep added, removed, and added again' do
|
46
|
-
before do
|
47
|
-
store.add(rep)
|
48
|
-
store.remove(rep)
|
49
|
-
store.add(rep)
|
50
|
-
end
|
51
|
-
|
52
|
-
it { is_expected.to be }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'reloading' do
|
57
|
-
subject do
|
58
|
-
store.store
|
59
|
-
store.load
|
60
|
-
store.include?(rep)
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'not added' do
|
64
|
-
it { is_expected.not_to be }
|
65
|
-
end
|
66
|
-
|
67
|
-
context 'added' do
|
68
|
-
before { store.add(rep) }
|
69
|
-
it { is_expected.to be }
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::PrefixedDataSource, stdio: true do
|
4
|
-
let(:klass) do
|
5
|
-
Class.new(Nanoc::DataSource) do
|
6
|
-
def item_changes
|
7
|
-
%i[one_foo one_bar]
|
8
|
-
end
|
9
|
-
|
10
|
-
def layout_changes
|
11
|
-
%i[one_foo one_bar]
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:original_data_source) do
|
17
|
-
klass.new({}, nil, nil, {})
|
18
|
-
end
|
19
|
-
|
20
|
-
subject(:data_source) do
|
21
|
-
described_class.new(original_data_source, '/itemz', '/layoutz')
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#item_changes' do
|
25
|
-
subject { data_source.item_changes }
|
26
|
-
|
27
|
-
it 'yields changes from the original' do
|
28
|
-
expect(subject).to eq(original_data_source.item_changes)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#layout_changes' do
|
33
|
-
subject { data_source.layout_changes }
|
34
|
-
|
35
|
-
it 'yields changes from the original' do
|
36
|
-
expect(subject).to eq(original_data_source.layout_changes)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,264 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::SiteLoader do
|
4
|
-
let(:loader) { described_class.new }
|
5
|
-
|
6
|
-
describe '#new_empty' do
|
7
|
-
subject { loader.new_empty }
|
8
|
-
|
9
|
-
it 'has the default configuration' do
|
10
|
-
expect(subject.config).to be_a(Nanoc::Int::Configuration)
|
11
|
-
expect(subject.config[:index_filenames]).to eq(['index.html'])
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'has no code snippets' do
|
15
|
-
expect(subject.code_snippets).to be_empty
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'has no items' do
|
19
|
-
expect(subject.items).to be_empty
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'has no layouts' do
|
23
|
-
expect(subject.layouts).to be_empty
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#new_with_config' do
|
28
|
-
subject { loader.new_with_config(arg) }
|
29
|
-
|
30
|
-
let(:arg) { { foo: 'bar' } }
|
31
|
-
|
32
|
-
it 'has a slightly modified configuration' do
|
33
|
-
expect(subject.config).to be_a(Nanoc::Int::Configuration)
|
34
|
-
expect(subject.config[:index_filenames]).to eq(['index.html'])
|
35
|
-
expect(subject.config[:foo]).to eq('bar')
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'has no code snippets' do
|
39
|
-
expect(subject.code_snippets).to be_empty
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'has no items' do
|
43
|
-
expect(subject.items).to be_empty
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'has no layouts' do
|
47
|
-
expect(subject.layouts).to be_empty
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#new_from_cwd' do
|
52
|
-
subject { loader.new_from_cwd }
|
53
|
-
|
54
|
-
context 'no config file' do
|
55
|
-
it 'errors' do
|
56
|
-
expect { subject }.to raise_error(
|
57
|
-
Nanoc::Int::ConfigLoader::NoConfigFileFoundError,
|
58
|
-
)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
shared_examples 'a directory with a config file' do
|
63
|
-
it 'has the default configuration' do
|
64
|
-
expect(subject.config).to be_a(Nanoc::Int::Configuration)
|
65
|
-
expect(subject.config[:index_filenames]).to eq(['index.html'])
|
66
|
-
expect(subject.config[:foo]).to eq('bar')
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'has no code snippets' do
|
70
|
-
expect(subject.code_snippets).to be_empty
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'has no items' do
|
74
|
-
expect(subject.items).to be_empty
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'has no layouts' do
|
78
|
-
expect(subject.layouts).to be_empty
|
79
|
-
end
|
80
|
-
|
81
|
-
context 'some items, layouts, and code snippets' do
|
82
|
-
before do
|
83
|
-
FileUtils.mkdir_p('lib')
|
84
|
-
File.write('lib/foo.rb', '$spirit_animal = :donkey')
|
85
|
-
|
86
|
-
FileUtils.mkdir_p('content')
|
87
|
-
File.write('content/about.md', 'I am Denis!')
|
88
|
-
|
89
|
-
FileUtils.mkdir_p('layouts')
|
90
|
-
File.write('layouts/page.erb', '<html><%= yield %></html>')
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'has a code snippet' do
|
94
|
-
expect(subject.code_snippets.size).to eq(1)
|
95
|
-
expect(subject.code_snippets[0].data).to eq('$spirit_animal = :donkey')
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'has an item' do
|
99
|
-
expect(subject.items.size).to eq(1)
|
100
|
-
expect(subject.items['/about.md'].content).to be_a(Nanoc::Int::TextualContent)
|
101
|
-
expect(subject.items['/about.md'].content.string).to eq('I am Denis!')
|
102
|
-
expect(subject.items['/about.md'].attributes[:content_filename])
|
103
|
-
.to eq('content/about.md')
|
104
|
-
expect(subject.items['/about.md'].attributes[:extension])
|
105
|
-
.to eq('md')
|
106
|
-
expect(subject.items['/about.md'].attributes[:filename])
|
107
|
-
.to eq('content/about.md')
|
108
|
-
expect(subject.items['/about.md'].attributes[:meta_filename])
|
109
|
-
.to be_nil
|
110
|
-
expect(subject.items['/about.md'].attributes[:mtime])
|
111
|
-
.to be > Time.now - 5
|
112
|
-
expect(subject.items['/about.md'].identifier.to_s).to eq('/about.md')
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'has a layout' do
|
116
|
-
expect(subject.layouts.size).to eq(1)
|
117
|
-
expect(subject.layouts['/page.erb'].content).to be_a(Nanoc::Int::TextualContent)
|
118
|
-
expect(subject.layouts['/page.erb'].content.string).to eq('<html><%= yield %></html>')
|
119
|
-
expect(subject.layouts['/page.erb'].attributes[:content_filename])
|
120
|
-
.to eq('layouts/page.erb')
|
121
|
-
expect(subject.layouts['/page.erb'].attributes[:extension])
|
122
|
-
.to eq('erb')
|
123
|
-
expect(subject.layouts['/page.erb'].attributes[:filename])
|
124
|
-
.to eq('layouts/page.erb')
|
125
|
-
expect(subject.layouts['/page.erb'].attributes[:meta_filename])
|
126
|
-
.to be_nil
|
127
|
-
expect(subject.layouts['/page.erb'].attributes[:mtime])
|
128
|
-
.to be > Time.now - 5
|
129
|
-
expect(subject.layouts['/page.erb'].identifier.to_s).to eq('/page.erb')
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
context 'nanoc.yaml config file' do
|
135
|
-
before do
|
136
|
-
File.write('nanoc.yaml', "---\nfoo: bar\n")
|
137
|
-
end
|
138
|
-
|
139
|
-
it_behaves_like 'a directory with a config file'
|
140
|
-
end
|
141
|
-
|
142
|
-
context 'config.yaml config file' do
|
143
|
-
before do
|
144
|
-
File.write('config.yaml', "---\nfoo: bar\n")
|
145
|
-
end
|
146
|
-
|
147
|
-
it_behaves_like 'a directory with a config file'
|
148
|
-
end
|
149
|
-
|
150
|
-
context 'configuration has non-existant data source' do
|
151
|
-
before do
|
152
|
-
File.write('nanoc.yaml', <<-EOS.gsub(/^ {10}/, ''))
|
153
|
-
data_sources:
|
154
|
-
- type: eenvaleed
|
155
|
-
EOS
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'raises an error' do
|
159
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::UnknownDataSource)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
context 'environments defined' do
|
164
|
-
before do
|
165
|
-
File.write('nanoc.yaml', <<-EOS.gsub(/^ {10}/, ''))
|
166
|
-
animal: donkey
|
167
|
-
environments:
|
168
|
-
staging:
|
169
|
-
animal: giraffe
|
170
|
-
EOS
|
171
|
-
end
|
172
|
-
|
173
|
-
before do
|
174
|
-
expect(ENV).to receive(:fetch).with('NANOC_ENV', 'default').and_return('staging')
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'does not load environment' do
|
178
|
-
expect(subject.config[:animal]).to eq('giraffe')
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
context 'code snippet with data source implementation' do
|
183
|
-
before do
|
184
|
-
FileUtils.mkdir_p('lib')
|
185
|
-
File.write('lib/foo_data_source.rb', <<-EOS.gsub(/^ {10}/, ''))
|
186
|
-
class FooDataSource < Nanoc::DataSource
|
187
|
-
identifier :site_loader_spec_sample
|
188
|
-
|
189
|
-
def items
|
190
|
-
[
|
191
|
-
Nanoc::Int::Item.new(
|
192
|
-
'Generated content!',
|
193
|
-
{ generated: true },
|
194
|
-
'/generated.txt',
|
195
|
-
)
|
196
|
-
]
|
197
|
-
end
|
198
|
-
end
|
199
|
-
EOS
|
200
|
-
|
201
|
-
File.write('nanoc.yaml', <<-EOS.gsub(/^ {10}/, ''))
|
202
|
-
data_sources:
|
203
|
-
- type: site_loader_spec_sample
|
204
|
-
EOS
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'loads code snippets before items/layouts' do
|
208
|
-
expect(subject.items.size).to eq(1)
|
209
|
-
expect(subject.items['/generated.txt'].content).to be_a(Nanoc::Int::TextualContent)
|
210
|
-
expect(subject.items['/generated.txt'].content.string).to eq('Generated content!')
|
211
|
-
expect(subject.items['/generated.txt'].attributes).to eq(generated: true)
|
212
|
-
expect(subject.items['/generated.txt'].identifier.to_s).to eq('/generated.txt')
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
describe '#code_snippets_from_config' do
|
218
|
-
subject { loader.send(:code_snippets_from_config, config) }
|
219
|
-
|
220
|
-
let(:config) { Nanoc::Int::Configuration.new.with_defaults }
|
221
|
-
|
222
|
-
before { FileUtils.mkdir_p('lib') }
|
223
|
-
|
224
|
-
context 'no explicit encoding specified' do
|
225
|
-
example do
|
226
|
-
File.write('lib/asdf.rb', 'hi 🔥', encoding: 'utf-8')
|
227
|
-
expect(subject.size).to eq(1)
|
228
|
-
expect(subject.first.data).to eq('hi 🔥')
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
context '# encoding: x specified' do
|
233
|
-
example do
|
234
|
-
File.write('lib/asdf.rb', "# encoding: iso-8859-1\n\nBRØKEN", encoding: 'iso-8859-1')
|
235
|
-
expect(subject.size).to eq(1)
|
236
|
-
expect(subject.first.data).to eq('BRØKEN')
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
context '# coding: x specified' do
|
241
|
-
example do
|
242
|
-
File.write('lib/asdf.rb', "# coding: iso-8859-1\n\nBRØKEN", encoding: 'iso-8859-1')
|
243
|
-
expect(subject.size).to eq(1)
|
244
|
-
expect(subject.first.data).to eq('BRØKEN')
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
context '# -*- encoding: x -*- specified' do
|
249
|
-
example do
|
250
|
-
File.write('lib/asdf.rb', "# -*- encoding: iso-8859-1 -*-\n\nBRØKEN", encoding: 'iso-8859-1')
|
251
|
-
expect(subject.size).to eq(1)
|
252
|
-
expect(subject.first.data).to eq('BRØKEN')
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
context '# -*- coding: x -*- specified' do
|
257
|
-
example do
|
258
|
-
File.write('lib/asdf.rb', "# -*- coding: iso-8859-1 -*-\n\nBRØKEN", encoding: 'iso-8859-1')
|
259
|
-
expect(subject.size).to eq(1)
|
260
|
-
expect(subject.first.data).to eq('BRØKEN')
|
261
|
-
end
|
262
|
-
end
|
263
|
-
end
|
264
|
-
end
|
@@ -1,316 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::SnapshotRepo do
|
4
|
-
subject(:repo) { described_class.new }
|
5
|
-
|
6
|
-
describe '#get' do
|
7
|
-
subject { repo.get(rep, snapshot_name) }
|
8
|
-
|
9
|
-
let(:item) { Nanoc::Int::Item.new('contentz', {}, '/foo.md') }
|
10
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
|
11
|
-
let(:snapshot_name) { :donkey }
|
12
|
-
|
13
|
-
context 'rep does not exist in repo' do
|
14
|
-
it { is_expected.to be_nil }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'rep exists in repo' do
|
18
|
-
before { repo.set(rep, :foobar, Nanoc::Int::TextualContent.new('other content')) }
|
19
|
-
|
20
|
-
context 'snapshot does not exist in repo' do
|
21
|
-
it { is_expected.to be_nil }
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'snapshot exists in repo' do
|
25
|
-
before { repo.set(rep, :donkey, Nanoc::Int::TextualContent.new('donkey')) }
|
26
|
-
it { is_expected.to be_some_textual_content('donkey') }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#get_all' do
|
32
|
-
subject { repo.get_all(rep) }
|
33
|
-
|
34
|
-
let(:item) { Nanoc::Int::Item.new('contentz', {}, '/foo.md') }
|
35
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
|
36
|
-
|
37
|
-
context 'rep does not exist in repo' do
|
38
|
-
it { is_expected.to eq({}) }
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'rep exists in repo' do
|
42
|
-
before { repo.set(rep, :foobar, Nanoc::Int::TextualContent.new('donkey')) }
|
43
|
-
it { is_expected.to match(foobar: some_textual_content('donkey')) }
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#set' do
|
48
|
-
subject { repo.set(rep, snapshot_name, contents) }
|
49
|
-
|
50
|
-
let(:item) { Nanoc::Int::Item.new('contentz', {}, '/foo.md') }
|
51
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
|
52
|
-
let(:snapshot_name) { :donkey }
|
53
|
-
let(:contents) { Nanoc::Int::TextualContent.new('donkey') }
|
54
|
-
|
55
|
-
it 'changes the given rep+snapshot' do
|
56
|
-
expect { subject }
|
57
|
-
.to change { repo.get(rep, snapshot_name) }
|
58
|
-
.from(nil)
|
59
|
-
.to(some_textual_content('donkey'))
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe '#set_all' do
|
64
|
-
subject { repo.set_all(rep, contents_by_snapshot) }
|
65
|
-
|
66
|
-
let(:other_item) { Nanoc::Int::Item.new('contentz', {}, '/foo.md') }
|
67
|
-
let(:other_rep) { Nanoc::Int::ItemRep.new(other_item, :foo) }
|
68
|
-
|
69
|
-
let(:item) { Nanoc::Int::Item.new('contentz', {}, '/foo.md') }
|
70
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
|
71
|
-
let(:contents_by_snapshot) { { donkey: Nanoc::Int::TextualContent.new('donkey') } }
|
72
|
-
|
73
|
-
it 'changes the given rep+snapshot' do
|
74
|
-
expect { subject }
|
75
|
-
.to change { repo.get(rep, :donkey) }
|
76
|
-
.from(nil)
|
77
|
-
.to(some_textual_content('donkey'))
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'leaves other reps intact' do
|
81
|
-
expect { subject }
|
82
|
-
.not_to change { repo.get(other_rep, :donkey) }
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'leaves other snapshots intact' do
|
86
|
-
expect { subject }
|
87
|
-
.not_to change { repo.get(rep, :giraffe) }
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#compiled_content' do
|
92
|
-
subject { repo.compiled_content(rep: rep, snapshot: snapshot_name) }
|
93
|
-
|
94
|
-
let(:snapshot_name) { raise 'override me' }
|
95
|
-
|
96
|
-
let(:item) { Nanoc::Int::Item.new('contentz', {}, '/foo.md') }
|
97
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
|
98
|
-
|
99
|
-
shared_examples 'a non-moving snapshot with content' do
|
100
|
-
context 'no snapshot def' do
|
101
|
-
it 'raises' do
|
102
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::NoSuchSnapshot)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'snapshot def exists' do
|
107
|
-
before do
|
108
|
-
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, binary: false)]
|
109
|
-
repo.set_all(rep, snapshot_name => content)
|
110
|
-
end
|
111
|
-
|
112
|
-
context 'content is textual' do
|
113
|
-
let(:content) { Nanoc::Int::TextualContent.new('hellos') }
|
114
|
-
it { is_expected.to eql('hellos') }
|
115
|
-
end
|
116
|
-
|
117
|
-
context 'content is binary' do
|
118
|
-
before { File.write('donkey.dat', 'binary data') }
|
119
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('donkey.dat')) }
|
120
|
-
|
121
|
-
it 'raises' do
|
122
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
shared_examples 'a non-moving snapshot' do
|
129
|
-
include_examples 'a non-moving snapshot with content'
|
130
|
-
|
131
|
-
context 'snapshot def exists, but not content' do
|
132
|
-
before do
|
133
|
-
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, binary: false)]
|
134
|
-
repo.set_all(rep, {})
|
135
|
-
end
|
136
|
-
|
137
|
-
it 'errors' do
|
138
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
shared_examples 'snapshot :last' do
|
144
|
-
context 'no snapshot def' do
|
145
|
-
it 'errors' do
|
146
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::NoSuchSnapshot)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
context 'snapshot exists' do
|
151
|
-
context 'snapshot is not final' do
|
152
|
-
before do
|
153
|
-
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, binary: false)]
|
154
|
-
end
|
155
|
-
|
156
|
-
context 'snapshot content does not exist' do
|
157
|
-
before do
|
158
|
-
repo.set_all(rep, {})
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'errors' do
|
162
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
context 'snapshot content exists' do
|
167
|
-
context 'content is textual' do
|
168
|
-
before do
|
169
|
-
repo.set(rep, snapshot_name, Nanoc::Int::TextualContent.new('hellos'))
|
170
|
-
end
|
171
|
-
|
172
|
-
context 'not compiled' do
|
173
|
-
before { rep.compiled = false }
|
174
|
-
|
175
|
-
it 'raises' do
|
176
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context 'compiled' do
|
181
|
-
before { rep.compiled = true }
|
182
|
-
|
183
|
-
it { is_expected.to eql('hellos') }
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
context 'content is binary' do
|
188
|
-
before do
|
189
|
-
File.write('donkey.dat', 'binary data')
|
190
|
-
repo.set(rep, snapshot_name, Nanoc::Int::BinaryContent.new(File.expand_path('donkey.dat')))
|
191
|
-
end
|
192
|
-
|
193
|
-
context 'not compiled' do
|
194
|
-
before { rep.compiled = false }
|
195
|
-
|
196
|
-
it 'raises' do
|
197
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
context 'compiled' do
|
202
|
-
before { rep.compiled = true }
|
203
|
-
|
204
|
-
it 'raises' do
|
205
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem)
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
context 'snapshot is final' do
|
213
|
-
before do
|
214
|
-
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(snapshot_name, binary: false)]
|
215
|
-
end
|
216
|
-
|
217
|
-
context 'snapshot content does not exist' do
|
218
|
-
before do
|
219
|
-
repo.set_all(rep, {})
|
220
|
-
end
|
221
|
-
|
222
|
-
it 'errors' do
|
223
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
context 'snapshot content exists' do
|
228
|
-
context 'content is textual' do
|
229
|
-
before do
|
230
|
-
repo.set(rep, snapshot_name, Nanoc::Int::TextualContent.new('hellos'))
|
231
|
-
end
|
232
|
-
|
233
|
-
context 'not compiled' do
|
234
|
-
before { rep.compiled = false }
|
235
|
-
|
236
|
-
it 'errors' do
|
237
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
context 'compiled' do
|
242
|
-
before { rep.compiled = true }
|
243
|
-
|
244
|
-
it { is_expected.to eql('hellos') }
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
context 'content is binary' do
|
249
|
-
before do
|
250
|
-
File.write('donkey.dat', 'binary data')
|
251
|
-
repo.set(rep, snapshot_name, Nanoc::Int::BinaryContent.new(File.expand_path('donkey.dat')))
|
252
|
-
end
|
253
|
-
|
254
|
-
context 'not compiled' do
|
255
|
-
before { rep.compiled = false }
|
256
|
-
|
257
|
-
it 'raises' do
|
258
|
-
expect { subject }.to yield_from_fiber(an_instance_of(Nanoc::Int::Errors::UnmetDependency))
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
context 'compiled' do
|
263
|
-
before { rep.compiled = true }
|
264
|
-
|
265
|
-
it 'raises' do
|
266
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::CannotGetCompiledContentOfBinaryItem)
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
context 'snapshot nil' do
|
276
|
-
let(:snapshot_name) { :last }
|
277
|
-
subject { repo.compiled_content(rep: rep, snapshot: nil) }
|
278
|
-
include_examples 'snapshot :last'
|
279
|
-
end
|
280
|
-
|
281
|
-
context 'snapshot not specified' do
|
282
|
-
subject { repo.compiled_content(rep: rep) }
|
283
|
-
|
284
|
-
context 'pre exists' do
|
285
|
-
before { repo.set(rep, :pre, Nanoc::Int::TextualContent.new('omg')) }
|
286
|
-
let(:snapshot_name) { :pre }
|
287
|
-
include_examples 'a non-moving snapshot with content'
|
288
|
-
end
|
289
|
-
|
290
|
-
context 'pre does not exist' do
|
291
|
-
let(:snapshot_name) { :last }
|
292
|
-
include_examples 'snapshot :last'
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
context 'snapshot :pre specified' do
|
297
|
-
let(:snapshot_name) { :pre }
|
298
|
-
include_examples 'a non-moving snapshot'
|
299
|
-
end
|
300
|
-
|
301
|
-
context 'snapshot :post specified' do
|
302
|
-
let(:snapshot_name) { :post }
|
303
|
-
include_examples 'a non-moving snapshot'
|
304
|
-
end
|
305
|
-
|
306
|
-
context 'snapshot :last specified' do
|
307
|
-
let(:snapshot_name) { :last }
|
308
|
-
include_examples 'snapshot :last'
|
309
|
-
end
|
310
|
-
|
311
|
-
context 'snapshot :donkey specified' do
|
312
|
-
let(:snapshot_name) { :donkey }
|
313
|
-
include_examples 'a non-moving snapshot'
|
314
|
-
end
|
315
|
-
end
|
316
|
-
end
|