Sha256: 0ab360cad715b0af427ed11acb52d610853c387e371abc66084cbd611e6afb3f

Contents?: true

Size: 992 Bytes

Versions: 4

Compression:

Stored size: 992 Bytes

Contents

describe 'GH-1093', site: true, stdio: true do
  before do
    File.write('content/index.html', '<%= @items["/z.dat"].reps.all? { |r| File.file?(r.raw_path) } %>')
    File.write('content/z.dat', 'asdf')

    File.write('Rules', <<EOS)
  class TestFilter < Nanoc::Filter
    identifier :gh_1093_test

    def run(content, params = {})
      depend_on(deps)
      content
    end

    private

    def deps
      assigns[:items].find_all('/**/*.dat')
    end
  end

  compile '/**/*.html' do
    filter :gh_1093_test
    filter :erb
    write item.identifier.to_s
  end

  compile '/**/*.dat' do
    write @item.identifier.to_s
  end

  compile '/**/*.dat', rep: :foo do
    write @item.identifier.to_s + '.foo'
  end

  compile '/index.html' do
    filter :erb
    write item.identifier.without_ext + '.txt'
  end

  passthrough '/*.dat'
EOS
  end

  it 'generates dependency on all reps' do
    Nanoc::CLI.run(%w[compile])
    expect(File.read('output/index.html')).to eql('true')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nanoc-4.7.9 spec/nanoc/regressions/gh_1093_spec.rb
nanoc-4.7.8 spec/nanoc/regressions/gh_1093_spec.rb
nanoc-4.7.7 spec/nanoc/regressions/gh_1093_spec.rb
nanoc-4.7.6 spec/nanoc/regressions/gh_1093_spec.rb