Sha256: 57e7e75b11e063f50c23bb2715ab5a3beb88b0c232e7776ebde1f5efb60c95b4

Contents?: true

Size: 1.75 KB

Versions: 18

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

describe 'Partial recompilation', site: true, stdio: true do
  before do
    File.write('content/foo.md', "---\ntitle: hello\n---\n\nfoo")
    File.write('content/bar.md', '<%= @items["/foo.*"].compiled_content %><% raise "boom" %>')

    File.write('Rules', <<~EOS)
      compile '/foo.*' do
        write '/foo.html'
      end

      compile '/bar.*' do
        filter :erb
        write '/bar.html'
      end
EOS
  end

  example do
    expect(File.file?('output/foo.html')).not_to be
    expect(File.file?('output/bar.html')).not_to be

    expect { Nanoc::CLI.run(%w[show-data --no-color]) }
      .to(output(/^item \/foo\.md, rep default:\n  is outdated:/).to_stdout)
    expect { Nanoc::CLI.run(%w[show-data --no-color]) }
      .to(output(/^item \/bar\.md, rep default:\n  is outdated:/).to_stdout)

    expect { Nanoc::CLI.run(%w[compile --verbose]) rescue nil }
      .to output(/create.*output\/foo\.html/).to_stdout

    expect { Nanoc::CLI.run(%w[show-data --no-color]) }
      .to(output(/^item \/foo\.md, rep default:\n  is not outdated/).to_stdout)
    expect { Nanoc::CLI.run(%w[show-data --no-color]) }
      .to(output(/^item \/bar\.md, rep default:\n  is outdated:/).to_stdout)

    expect(File.file?('output/foo.html')).to be
    expect(File.file?('output/bar.html')).not_to be

    File.write('content/bar.md', '<% raise "boom" %>')

    expect { Nanoc::CLI.run(%w[compile --verbose --debug]) rescue nil }
      .to output(/skip.*output\/foo\.html/).to_stdout

    expect { Nanoc::CLI.run(%w[show-data --no-color]) }
      .to(output(/^item \/foo\.md, rep default:\n  is not outdated/).to_stdout)
    expect { Nanoc::CLI.run(%w[show-data --no-color]) }
      .to(output(/^item \/bar\.md, rep default:\n  is outdated:/).to_stdout)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
nanoc-4.8.12 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.11 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.10 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.9 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.8 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.7 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.6 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.5 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.4 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.3 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.2 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.1 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.8.0 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.7.14 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.7.13 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.7.12 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.7.11 spec/nanoc/integration/partial_recompilation_spec.rb
nanoc-4.7.10 spec/nanoc/integration/partial_recompilation_spec.rb