nanoc 4.4.6 → 4.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ describe 'Partial recompilation', site: true, stdio: true do
2
+ before do
3
+ File.write('content/foo.md', "---\ntitle: hello\n---\n\nfoo")
4
+ File.write('content/bar.md', '<%= @items["/foo.*"].compiled_content %><% raise "boom" %>')
5
+
6
+ File.write('Rules', <<EOS)
7
+ compile '/foo.*' do
8
+ write '/foo.html'
9
+ end
10
+
11
+ compile '/bar.*' do
12
+ filter :erb
13
+ write '/bar.html'
14
+ end
15
+ EOS
16
+ end
17
+
18
+ example do
19
+ expect(File.file?('output/foo.html')).not_to be
20
+ expect(File.file?('output/bar.html')).not_to be
21
+
22
+ expect { Nanoc::CLI.run(%w(show-data --no-color)) }
23
+ .to(output(/^item \/foo\.md, rep default:\n is outdated: /).to_stdout)
24
+ expect { Nanoc::CLI.run(%w(show-data --no-color)) }
25
+ .to(output(/^item \/bar\.md, rep default:\n is outdated: /).to_stdout)
26
+
27
+ expect { Nanoc::CLI.run(%w(compile --verbose)) rescue nil }
28
+ .to output(/create.*output\/foo\.html/).to_stdout
29
+
30
+ expect { Nanoc::CLI.run(%w(show-data --no-color)) }
31
+ .to(output(/^item \/foo\.md, rep default:\n is not outdated/).to_stdout)
32
+ expect { Nanoc::CLI.run(%w(show-data --no-color)) }
33
+ .to(output(/^item \/bar\.md, rep default:\n is outdated: /).to_stdout)
34
+
35
+ expect(File.file?('output/foo.html')).to be
36
+ expect(File.file?('output/bar.html')).not_to be
37
+
38
+ File.write('content/bar.md', '<% raise "boom" %>')
39
+
40
+ expect { Nanoc::CLI.run(%w(compile --verbose --debug)) rescue nil }
41
+ .to output(/skip.*output\/foo\.html/).to_stdout
42
+
43
+ expect { Nanoc::CLI.run(%w(show-data --no-color)) }
44
+ .to(output(/^item \/foo\.md, rep default:\n is not outdated/).to_stdout)
45
+ expect { Nanoc::CLI.run(%w(show-data --no-color)) }
46
+ .to(output(/^item \/bar\.md, rep default:\n is outdated: /).to_stdout)
47
+ end
48
+ end
@@ -0,0 +1,48 @@
1
+ describe 'GH-1045', site: true, stdio: true do
2
+ before do
3
+ File.write('content/foo.txt', 'foo')
4
+ FileUtils.touch('content/foo.txt', mtime: Time.parse('2015-03-02 10:00:00Z'))
5
+
6
+ File.write('content/sitemap.erb', '<%= xml_sitemap(items: items.select { |i| i.path.end_with?(\'/\') }) %>')
7
+
8
+ File.write('nanoc.yaml', <<EOS)
9
+ base_url: 'http://example.com'
10
+ EOS
11
+
12
+ File.write('lib/default.rb', <<EOS)
13
+ include Nanoc::Helpers::XMLSitemap
14
+ EOS
15
+
16
+ File.write('Rules', <<EOS)
17
+ compile '/*.txt' do
18
+ write item.identifier.without_ext + '/index.html'
19
+ end
20
+
21
+ compile '/sitemap.erb' do
22
+ filter :erb
23
+ write item.identifier.without_ext + '.xml'
24
+ end
25
+ EOS
26
+ end
27
+
28
+ it 'creates the sitemap' do
29
+ Nanoc::CLI.run(%w(compile))
30
+
31
+ expect(File.file?('output/sitemap.xml')).to be
32
+ contents = File.read('output/sitemap.xml')
33
+ expect(contents).to match(%r{<loc>http://example.com/foo/</loc>})
34
+ expect(contents).to match(%r{<lastmod>2015-03-02</lastmod>})
35
+ end
36
+
37
+ it 'updates the sitemap' do
38
+ Nanoc::CLI.run(%w(compile))
39
+ File.write('content/foo.txt', 'foo 2')
40
+ FileUtils.touch('content/foo.txt', mtime: Time.parse('2016-04-03 10:00:00Z'))
41
+ Nanoc::CLI.run(%w(compile))
42
+
43
+ expect(File.file?('output/sitemap.xml')).to be
44
+ contents = File.read('output/sitemap.xml')
45
+ expect(contents).to match(%r{<loc>http://example.com/foo/</loc>})
46
+ expect(contents).to match(%r{<lastmod>2016-04-03</lastmod>})
47
+ end
48
+ end
@@ -0,0 +1,28 @@
1
+ describe 'GH-1047', site: true, stdio: true do
2
+ before do
3
+ File.write('Rules', <<EOS)
4
+ compile '/*' do
5
+ filter :erb
6
+ write item.identifier
7
+ end
8
+ EOS
9
+ end
10
+
11
+ it 'does not reuse old content' do
12
+ File.write('content/foo.md', 'I am old foo!')
13
+ File.write('content/bar.md', 'I am old bar!')
14
+ Nanoc::CLI.run(%w(compile))
15
+ expect(File.read('output/foo.md')).to eql('I am old foo!')
16
+ expect(File.read('output/bar.md')).to eql('I am old bar!')
17
+
18
+ File.write('content/foo.md', 'I am foo!')
19
+ File.write('content/bar.md', '<%= @items["/foo.*"].compiled_content %><%= raise "boom" %>')
20
+ expect { Nanoc::CLI.run(%w(compile)) }.to raise_error(Nanoc::Int::Errors::CompilationError)
21
+ expect(File.read('output/foo.md')).to eql('I am foo!')
22
+
23
+ File.write('content/bar.md', '[<%= @items["/foo.*"].compiled_content %>]')
24
+ Nanoc::CLI.run(%w(compile))
25
+ expect(File.read('output/foo.md')).to eql('I am foo!')
26
+ expect(File.read('output/bar.md')).to eql('[I am foo!]')
27
+ end
28
+ end
@@ -24,6 +24,7 @@ class Nanoc::Int::CompilerTest < Nanoc::TestCase
24
24
  ),
25
25
  action_provider: action_provider,
26
26
  reps: reps,
27
+ outdatedness_store: Nanoc::Int::OutdatednessStore.new(site: site, reps: reps),
27
28
  }
28
29
 
29
30
  params[:outdatedness_checker] =
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.4.6
4
+ version: 4.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-28 00:00:00.000000000 Z
11
+ date: 2017-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -154,6 +154,7 @@ files:
154
154
  - lib/nanoc/base/repos/data_source.rb
155
155
  - lib/nanoc/base/repos/dependency_store.rb
156
156
  - lib/nanoc/base/repos/item_rep_repo.rb
157
+ - lib/nanoc/base/repos/outdatedness_store.rb
157
158
  - lib/nanoc/base/repos/rule_memory_store.rb
158
159
  - lib/nanoc/base/repos/site_loader.rb
159
160
  - lib/nanoc/base/repos/store.rb
@@ -333,6 +334,7 @@ files:
333
334
  - spec/nanoc/base/repos/compiled_content_cache_spec.rb
334
335
  - spec/nanoc/base/repos/config_loader_spec.rb
335
336
  - spec/nanoc/base/repos/dependency_store_spec.rb
337
+ - spec/nanoc/base/repos/outdatedness_store_spec.rb
336
338
  - spec/nanoc/base/repos/site_loader_spec.rb
337
339
  - spec/nanoc/base/services/dependency_tracker_spec.rb
338
340
  - spec/nanoc/base/services/executor_spec.rb
@@ -386,10 +388,13 @@ files:
386
388
  - spec/nanoc/helpers/tagging_spec.rb
387
389
  - spec/nanoc/helpers/text_spec.rb
388
390
  - spec/nanoc/integration/outdatedness_integration_spec.rb
391
+ - spec/nanoc/integration/partial_recompilation_spec.rb
389
392
  - spec/nanoc/regressions/gh_1015_spec.rb
390
393
  - spec/nanoc/regressions/gh_1031_spec.rb
391
394
  - spec/nanoc/regressions/gh_1035_spec.rb
392
395
  - spec/nanoc/regressions/gh_1040_spec.rb
396
+ - spec/nanoc/regressions/gh_1045_spec.rb
397
+ - spec/nanoc/regressions/gh_1047_spec.rb
393
398
  - spec/nanoc/regressions/gh_761_spec.rb
394
399
  - spec/nanoc/regressions/gh_767_spec.rb
395
400
  - spec/nanoc/regressions/gh_769_spec.rb