nanoc 4.7.11 → 4.7.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +46 -0
  3. data/NEWS.md +10 -0
  4. data/README.md +1 -0
  5. data/lib/nanoc/base/entities/configuration.rb +6 -0
  6. data/lib/nanoc/base/entities/outdatedness_reasons.rb +0 -5
  7. data/lib/nanoc/base/repos/checksum_store.rb +3 -0
  8. data/lib/nanoc/base/repos/dependency_store.rb +2 -1
  9. data/lib/nanoc/base/services/compiler/stages/calculate_checksums.rb +6 -1
  10. data/lib/nanoc/base/services/compiler_loader.rb +1 -1
  11. data/lib/nanoc/base/services/outdatedness_checker.rb +15 -7
  12. data/lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb +2 -2
  13. data/lib/nanoc/base/services/outdatedness_rules.rb +0 -1
  14. data/lib/nanoc/cli/commands/show-data.rb +24 -4
  15. data/lib/nanoc/deploying/deployers/fog.rb +7 -6
  16. data/lib/nanoc/version.rb +1 -1
  17. data/nanoc.gemspec +1 -1
  18. data/spec/nanoc/base/compiler_spec.rb +1 -1
  19. data/spec/nanoc/base/repos/dependency_store_spec.rb +1 -1
  20. data/spec/nanoc/base/services/compiler/stages/calculate_checksums_spec.rb +3 -0
  21. data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +1 -1
  22. data/spec/nanoc/base/services/dependency_tracker_spec.rb +1 -1
  23. data/spec/nanoc/base/services/outdatedness_checker_spec.rb +41 -1
  24. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +5 -22
  25. data/spec/nanoc/base/views/document_view_spec.rb +1 -1
  26. data/spec/nanoc/base/views/item_rep_view_spec.rb +1 -1
  27. data/spec/nanoc/base/views/item_view_spec.rb +1 -1
  28. data/spec/nanoc/cli/commands/show_data_spec.rb +29 -1
  29. data/spec/nanoc/deploying/fog_spec.rb +4 -0
  30. data/spec/nanoc/integration/outdatedness_integration_spec.rb +55 -4
  31. data/spec/spec_helper.rb +39 -0
  32. data/test/base/test_dependency_tracker.rb +14 -14
  33. data/test/filters/test_xsl.rb +1 -1
  34. data/test/helpers/test_blogging.rb +1 -1
  35. data/test/helpers/test_xml_sitemap.rb +1 -1
  36. metadata +4 -4
  37. data/lib/nanoc/base/services/outdatedness_rules/configuration_modified.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99eef92742ae4e7c6eec52f7efc9c456a44b72ca
4
- data.tar.gz: 2d4f5da906f23c186cf965541a582175a91fe38f
3
+ metadata.gz: fc70bc281ec6b39ca3de14107a1c2374d13e2807
4
+ data.tar.gz: 0f16fd6cd14eb18bafd194ee2d0e0421fae93765
5
5
  SHA512:
6
- metadata.gz: 95a74693fa0cc09e0789bbaca9cc2c8f846f5936ae3e57f49ce8bba64721b970809438f200057aa3d7c8d3c520795015a19a7c220a462dfae6d0f7bbb048b8b8
7
- data.tar.gz: d1bd24af79448f4e22250c95ce4ebc1a3fab8e9e827d24b130bc5c486154c8db099dace97e669903d9d7c8f8559d43134afcb1478875d177938fbecde08c46a6
6
+ metadata.gz: ea4bfbf259d607544769201bf1cb950c5f8f9d4cbfe80aa48f53be0aaaa68db8b861949374a557700afb91193922c66dc62c16c510a2b2dddc99e4ea2d2b5858
7
+ data.tar.gz: 3be571aecf8dbf7c742894aa1415726c915ee7eee916506f31f79c0d0ae986589176f76bfd90c8564111e11194fcd7ded82fe5aa1694340f4cddd9abf0facf10
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at denis+nanoc-coc@stoneship.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/NEWS.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.7.12 (2017-06-23)
4
+
5
+ Fixes:
6
+
7
+ * Fixed an issue in which the fog deployer could run out of open file descriptors (#1189)
8
+
9
+ Enhancements:
10
+
11
+ * Made changes to `@config` only cause outdatedness of items that depend on `@config` (#1188)
12
+
3
13
  ## 4.7.11 (2017-06-17)
4
14
 
5
15
  Fixes:
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Gem version](http://img.shields.io/gem/v/nanoc.svg)](http://rubygems.org/gems/nanoc)
2
+ [![Gem downloads](https://img.shields.io/gem/dt/nanoc.svg)](http://rubygems.org/gems/nanoc)
2
3
  [![Build status](http://img.shields.io/travis/nanoc/nanoc.svg)](https://travis-ci.org/nanoc/nanoc)
3
4
  [![Code Climate](http://img.shields.io/codeclimate/github/nanoc/nanoc.svg)](https://codeclimate.com/github/nanoc/nanoc)
4
5
  [![Code Coverage](https://img.shields.io/codecov/c/github/nanoc/nanoc.svg)](https://codecov.io/gh/nanoc/nanoc)
@@ -80,6 +80,12 @@ module Nanoc::Int
80
80
  @wrapped
81
81
  end
82
82
 
83
+ # For compat
84
+ contract C::None => Hash
85
+ def attributes
86
+ to_h
87
+ end
88
+
83
89
  contract C::Any => C::Bool
84
90
  def key?(key)
85
91
  @wrapped.key?(key)
@@ -27,11 +27,6 @@ module Nanoc::Int
27
27
  Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
28
28
  )
29
29
 
30
- ConfigurationModified = Generic.new(
31
- 'The site configuration has been modified since the last time the site was compiled.',
32
- Props.new(raw_content: true, attributes: true, compiled_content: true, path: true),
33
- )
34
-
35
30
  DependenciesOutdated = Generic.new(
36
31
  'This item uses content or attributes that have changed since the last time the site was compiled.',
37
32
  )
@@ -31,6 +31,9 @@ module Nanoc::Int
31
31
  def add(obj)
32
32
  if obj.is_a?(Nanoc::Int::Document)
33
33
  @checksums[[obj.reference, :content]] = Nanoc::Int::Checksummer.calc_for_content_of(obj)
34
+ end
35
+
36
+ if obj.is_a?(Nanoc::Int::Document) || obj.is_a?(Nanoc::Int::Configuration)
34
37
  @checksums[[obj.reference, :each_attribute]] = Nanoc::Int::Checksummer.calc_for_each_attribute_of(obj)
35
38
  end
36
39
 
@@ -8,7 +8,7 @@ module Nanoc::Int
8
8
  attr_accessor :items
9
9
  attr_accessor :layouts
10
10
 
11
- def initialize(items, layouts, site: nil)
11
+ def initialize(items, layouts, config, site: nil)
12
12
  super(Nanoc::Int::Store.tmp_path_for(site: site, store_name: 'dependencies'), 4)
13
13
 
14
14
  @items = items
@@ -17,6 +17,7 @@ module Nanoc::Int
17
17
  @refs2objs = {}
18
18
  items.each { |o| add_vertex_for(o) }
19
19
  layouts.each { |o| add_vertex_for(o) }
20
+ add_vertex_for(config)
20
21
 
21
22
  @new_objects = []
22
23
  @graph = Nanoc::Int::DirectedGraph.new([nil] + objs2refs(@items) + objs2refs(@layouts))
@@ -21,12 +21,17 @@ module Nanoc::Int::Compiler::Stages
21
21
  end
22
22
  end
23
23
 
24
- [@items, @layouts, @code_snippets, [@config]].each do |objs|
24
+ [@items, @layouts, @code_snippets].each do |objs|
25
25
  objs.each do |obj|
26
26
  checksums[obj.reference] = Nanoc::Int::Checksummer.calc(obj)
27
27
  end
28
28
  end
29
29
 
30
+ checksums[@config.reference] =
31
+ Nanoc::Int::Checksummer.calc(@config)
32
+ checksums[[@config.reference, :each_attribute]] =
33
+ Nanoc::Int::Checksummer.calc_for_each_attribute_of(@config)
34
+
30
35
  Nanoc::Int::ChecksumCollection.new(checksums)
31
36
  end
32
37
  end
@@ -7,7 +7,7 @@ module Nanoc::Int
7
7
  action_sequence_store = Nanoc::Int::ActionSequenceStore.new(site: site)
8
8
 
9
9
  dependency_store =
10
- Nanoc::Int::DependencyStore.new(site.items, site.layouts, site: site)
10
+ Nanoc::Int::DependencyStore.new(site.items, site.layouts, site.config, site: site)
11
11
 
12
12
  objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]
13
13
 
@@ -19,7 +19,6 @@ module Nanoc::Int
19
19
  Rules::AttributesModified,
20
20
  Rules::NotWritten,
21
21
  Rules::CodeSnippetsModified,
22
- Rules::ConfigurationModified,
23
22
  Rules::UsesAlwaysOutdatedFilter,
24
23
  ].freeze
25
24
 
@@ -31,13 +30,20 @@ module Nanoc::Int
31
30
  Rules::UsesAlwaysOutdatedFilter,
32
31
  ].freeze
33
32
 
33
+ RULES_FOR_CONFIG =
34
+ [
35
+ Rules::AttributesModified,
36
+ ].freeze
37
+
38
+ C_OBJ_MAYBE_REP = C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Configuration, Nanoc::Int::Layout]
39
+
34
40
  contract C::KeywordArgs[outdatedness_checker: OutdatednessChecker, reps: Nanoc::Int::ItemRepRepo] => C::Any
35
41
  def initialize(outdatedness_checker:, reps:)
36
42
  @outdatedness_checker = outdatedness_checker
37
43
  @reps = reps
38
44
  end
39
45
 
40
- contract C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout] => C::Maybe[OutdatednessStatus]
46
+ contract C_OBJ_MAYBE_REP => C::Maybe[OutdatednessStatus]
41
47
  memoized def outdatedness_status_for(obj)
42
48
  case obj
43
49
  when Nanoc::Int::ItemRep
@@ -46,6 +52,8 @@ module Nanoc::Int
46
52
  apply_rules_multi(RULES_FOR_ITEM_REP, @reps[obj])
47
53
  when Nanoc::Int::Layout
48
54
  apply_rules(RULES_FOR_LAYOUT, obj)
55
+ when Nanoc::Int::Configuration
56
+ apply_rules(RULES_FOR_CONFIG, obj)
49
57
  else
50
58
  raise Nanoc::Int::Errors::InternalInconsistency, "do not know how to check outdatedness of #{obj.inspect}"
51
59
  end
@@ -53,7 +61,7 @@ module Nanoc::Int
53
61
 
54
62
  private
55
63
 
56
- contract C::ArrayOf[Class], C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout], OutdatednessStatus => C::Maybe[OutdatednessStatus]
64
+ contract C::ArrayOf[Class], C_OBJ_MAYBE_REP, OutdatednessStatus => C::Maybe[OutdatednessStatus]
57
65
  def apply_rules(rules, obj, status = OutdatednessStatus.new)
58
66
  rules.inject(status) do |acc, rule|
59
67
  if !acc.useful_to_apply?(rule)
@@ -69,7 +77,7 @@ module Nanoc::Int
69
77
  end
70
78
  end
71
79
 
72
- contract C::ArrayOf[Class], C::ArrayOf[C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout]] => C::Maybe[OutdatednessStatus]
80
+ contract C::ArrayOf[Class], C::ArrayOf[C_OBJ_MAYBE_REP] => C::Maybe[OutdatednessStatus]
73
81
  def apply_rules_multi(rules, objs)
74
82
  objs.inject(OutdatednessStatus.new) { |acc, elem| apply_rules(rules, elem, acc) }
75
83
  end
@@ -88,7 +96,7 @@ module Nanoc::Int
88
96
 
89
97
  Reasons = Nanoc::Int::OutdatednessReasons
90
98
 
91
- C_OBJ = C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout]
99
+ C_OBJ = C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Configuration, Nanoc::Int::Layout]
92
100
  C_ACTION_SEQUENCES = C::HashOf[C_OBJ => Nanoc::Int::ActionSequence]
93
101
 
94
102
  contract C::KeywordArgs[site: Nanoc::Int::Site, checksum_store: Nanoc::Int::ChecksumStore, checksums: Nanoc::Int::ChecksumCollection, dependency_store: Nanoc::Int::DependencyStore, action_sequence_store: Nanoc::Int::ActionSequenceStore, action_sequences: C_ACTION_SEQUENCES, reps: Nanoc::Int::ItemRepRepo] => C::Any
@@ -113,7 +121,7 @@ module Nanoc::Int
113
121
  outdatedness_reasons_for(obj).any?
114
122
  end
115
123
 
116
- contract C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout] => C::IterOf[Reasons::Generic]
124
+ contract C_OBJ => C::IterOf[Reasons::Generic]
117
125
  def outdatedness_reasons_for(obj)
118
126
  reasons = basic.outdatedness_status_for(obj).reasons
119
127
  if reasons.any?
@@ -132,7 +140,7 @@ module Nanoc::Int
132
140
  @_basic ||= Basic.new(outdatedness_checker: self, reps: @reps)
133
141
  end
134
142
 
135
- contract C::Or[Nanoc::Int::Item, Nanoc::Int::ItemRep, Nanoc::Int::Layout], Hamster::Set => C::Bool
143
+ contract C_OBJ, Hamster::Set => C::Bool
136
144
  def outdated_due_to_dependencies?(obj, processed = Hamster::Set.new)
137
145
  # Convert from rep to item if necessary
138
146
  obj = obj.item if obj.is_a?(Nanoc::Int::ItemRep)
@@ -6,12 +6,12 @@ module Nanoc::Int::OutdatednessRules
6
6
 
7
7
  affects_props :attributes, :compiled_content
8
8
 
9
- contract C::Or[Nanoc::Int::ItemRep, Nanoc::Int::Item, Nanoc::Int::Layout], C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
9
+ contract C::Or[Nanoc::Int::ItemRep, Nanoc::Int::Item, Nanoc::Int::Configuration, Nanoc::Int::Layout], C::Named['Nanoc::Int::OutdatednessChecker'] => C::Maybe[Nanoc::Int::OutdatednessReasons::Generic]
10
10
  def apply(obj, outdatedness_checker)
11
11
  case obj
12
12
  when Nanoc::Int::ItemRep
13
13
  apply(obj.item, outdatedness_checker)
14
- when Nanoc::Int::Item, Nanoc::Int::Layout
14
+ when Nanoc::Int::Item, Nanoc::Int::Layout, Nanoc::Int::Configuration
15
15
  if outdatedness_checker.checksum_store[obj] == outdatedness_checker.checksums.checksum_for(obj)
16
16
  return nil
17
17
  end
@@ -8,7 +8,6 @@ end
8
8
 
9
9
  require_relative 'outdatedness_rules/attributes_modified'
10
10
  require_relative 'outdatedness_rules/code_snippets_modified'
11
- require_relative 'outdatedness_rules/configuration_modified'
12
11
  require_relative 'outdatedness_rules/content_modified'
13
12
  require_relative 'outdatedness_rules/not_written'
14
13
  require_relative 'outdatedness_rules/rules_modified'
@@ -71,13 +71,23 @@ module Nanoc::CLI::Commands
71
71
  puts ' p = dependency on the path'
72
72
  puts
73
73
 
74
+ sorter =
75
+ lambda do |dep|
76
+ case dep
77
+ when Nanoc::Int::Document
78
+ dep.from.identifier.to_s
79
+ else
80
+ ''
81
+ end
82
+ end
83
+
74
84
  sorted_with_prev(items) do |item, prev|
75
85
  puts if prev
76
86
  puts "item #{item.identifier} depends on:"
77
87
  dependencies =
78
88
  dependency_store
79
89
  .dependencies_causing_outdatedness_of(item)
80
- .sort_by { |dep| dep.from ? dep.from.identifier : '' }
90
+ .sort_by(&sorter)
81
91
  dependencies.each do |dep|
82
92
  pred = dep.from
83
93
 
@@ -85,10 +95,20 @@ module Nanoc::CLI::Commands
85
95
  case pred
86
96
  when Nanoc::Int::Layout
87
97
  'layout'
88
- when Nanoc::Int::ItemRep
89
- 'item rep'
90
98
  when Nanoc::Int::Item
91
99
  'item'
100
+ when Nanoc::Int::Configuration
101
+ 'config'
102
+ else
103
+ raise Nanoc::Int::Errors::InternalInconsistency, "unexpected pred type #{pred}"
104
+ end
105
+
106
+ pred_identifier =
107
+ case pred
108
+ when Nanoc::Int::Document
109
+ pred.identifier.to_s
110
+ when Nanoc::Int::Configuration
111
+ nil
92
112
  end
93
113
 
94
114
  props = String.new
@@ -98,7 +118,7 @@ module Nanoc::CLI::Commands
98
118
  props << (dep.props.path? ? 'p' : '_')
99
119
 
100
120
  if pred
101
- puts " [ #{format '%6s', type} ] (#{props}) #{pred.identifier}"
121
+ puts " [ #{format '%6s', type} ] (#{props}) #{pred_identifier}"
102
122
  else
103
123
  puts ' ( removed item )'
104
124
  end
@@ -35,12 +35,13 @@ module Nanoc::Deploying::Deployers
35
35
  log_effectful("uploading #{source_filename} -> #{destination_key}")
36
36
 
37
37
  unless dry_run?
38
- # FIXME: source_filename file is never closed
39
- @directory.files.create(
40
- key: destination_key,
41
- body: File.open(source_filename),
42
- public: true,
43
- )
38
+ File.open(source_filename) do |io|
39
+ @directory.files.create(
40
+ key: destination_key,
41
+ body: io,
42
+ public: true,
43
+ )
44
+ end
44
45
  end
45
46
  end
46
47
 
data/lib/nanoc/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.7.11'
5
+ VERSION = '4.7.12'
6
6
  end
data/nanoc.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = 'Nanoc is a static-site generator focused on flexibility. It transforms content from a format such as Markdown or AsciiDoc into another format, usually HTML, and lays out pages consistently to retain the site’s look and feel throughout. Static sites built with Nanoc can be deployed to any web server.'
11
11
 
12
12
  s.author = 'Denis Defreyne'
13
- s.email = 'denis.defreyne@stoneship.org'
13
+ s.email = 'denis@stoneship.org'
14
14
  s.license = 'MIT'
15
15
 
16
16
  s.files = `git ls-files -z`.split("\x0")
@@ -17,7 +17,7 @@ describe Nanoc::Int::Compiler do
17
17
  let(:checksum_store) { Nanoc::Int::ChecksumStore.new(objects: items) }
18
18
  let(:action_sequence_store) { Nanoc::Int::ActionSequenceStore.new }
19
19
 
20
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts) }
20
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts, config) }
21
21
  let(:reps) { Nanoc::Int::ItemRepRepo.new }
22
22
 
23
23
  let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site, reps: reps) }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  describe Nanoc::Int::DependencyStore do
4
- let(:store) { described_class.new(items, layouts) }
4
+ let(:store) { described_class.new(items, layouts, config) }
5
5
 
6
6
  let(:item_a) { Nanoc::Int::Item.new('a', {}, '/a.md') }
7
7
  let(:item_b) { Nanoc::Int::Item.new('b', {}, '/b.md') }
@@ -61,6 +61,9 @@ describe Nanoc::Int::Compiler::Stages::CalculateChecksums do
61
61
  it 'checksums config' do
62
62
  expect(subject.checksum_for(config))
63
63
  .to eq(Nanoc::Int::Checksummer.calc(config))
64
+
65
+ expect(subject.attributes_checksum_for(config))
66
+ .to eq(Nanoc::Int::Checksummer.calc_for_each_attribute_of(config))
64
67
  end
65
68
 
66
69
  it 'checksums code snippets' do
@@ -28,7 +28,7 @@ describe Nanoc::Int::Compiler::Stages::CompileReps do
28
28
  let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
29
29
 
30
30
  let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site, reps: reps) }
31
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts) }
31
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts, config) }
32
32
 
33
33
  let(:rep) { Nanoc::Int::ItemRep.new(item, :default) }
34
34
  let(:item) { Nanoc::Int::Item.new('<%= 1 + 2 %>', {}, '/hi.md') }
@@ -3,7 +3,7 @@
3
3
  describe Nanoc::Int::DependencyTracker do
4
4
  let(:tracker) { described_class.new(store) }
5
5
 
6
- let(:store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection) }
6
+ let(:store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection, config) }
7
7
 
8
8
  let(:item_a) { Nanoc::Int::Item.new('a', {}, '/a.md') }
9
9
  let(:item_b) { Nanoc::Int::Item.new('b', {}, '/b.md') }
@@ -25,7 +25,7 @@ describe Nanoc::Int::OutdatednessChecker do
25
25
  end
26
26
 
27
27
  let(:dependency_store) do
28
- Nanoc::Int::DependencyStore.new(items, layouts)
28
+ Nanoc::Int::DependencyStore.new(items, layouts, config)
29
29
  end
30
30
 
31
31
  let(:items) { Nanoc::Int::IdentifiableCollection.new(config, [item]) }
@@ -324,6 +324,46 @@ describe Nanoc::Int::OutdatednessChecker do
324
324
  end
325
325
  end
326
326
 
327
+ context 'generic dependency on config' do
328
+ before do
329
+ dependency_store.record_dependency(item, config, attributes: true)
330
+ end
331
+
332
+ context 'nothing changed' do
333
+ it { is_expected.not_to be }
334
+ end
335
+
336
+ context 'attribute changed' do
337
+ before { config[:title] = 'omg new title' }
338
+ it { is_expected.to be }
339
+ end
340
+
341
+ context 'other attribute changed' do
342
+ before { config[:subtitle] = 'tagline here' }
343
+ it { is_expected.to be }
344
+ end
345
+ end
346
+
347
+ context 'specific dependency on config' do
348
+ before do
349
+ dependency_store.record_dependency(item, config, attributes: [:title])
350
+ end
351
+
352
+ context 'nothing changed' do
353
+ it { is_expected.not_to be }
354
+ end
355
+
356
+ context 'attribute changed' do
357
+ before { config[:title] = 'omg new title' }
358
+ it { is_expected.to be }
359
+ end
360
+
361
+ context 'other attribute changed' do
362
+ before { config[:subtitle] = 'tagline here' }
363
+ it { is_expected.not_to be }
364
+ end
365
+ end
366
+
327
367
  context 'only raw content dependency' do
328
368
  before do
329
369
  dependency_store.record_dependency(item, other_item, raw_content: true)
@@ -35,7 +35,7 @@ describe Nanoc::Int::OutdatednessRules do
35
35
 
36
36
  let(:action_sequences) { {} }
37
37
  let(:reps) { Nanoc::Int::ItemRepRepo.new }
38
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts) }
38
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts, config) }
39
39
  let(:action_sequence_store) { Nanoc::Int::ActionSequenceStore.new }
40
40
  let(:checksum_store) { Nanoc::Int::ChecksumStore.new(objects: objects) }
41
41
 
@@ -84,27 +84,6 @@ describe Nanoc::Int::OutdatednessRules do
84
84
  end
85
85
  end
86
86
 
87
- context 'ConfigurationModified' do
88
- let(:rule_class) { Nanoc::Int::OutdatednessRules::ConfigurationModified }
89
-
90
- context 'non-outdated' do
91
- let(:config) { Nanoc::Int::Configuration.new }
92
-
93
- before { checksum_store.add(config) }
94
-
95
- it { is_expected.not_to be }
96
- end
97
-
98
- context 'outdated' do
99
- let(:config) { Nanoc::Int::Configuration.new }
100
- let(:config_old) { Nanoc::Int::Configuration.new(hash: { foo: 125 }) }
101
-
102
- before { checksum_store.add(config_old) }
103
-
104
- it { is_expected.to be }
105
- end
106
- end
107
-
108
87
  context 'NotWritten' do
109
88
  let(:rule_class) { Nanoc::Int::OutdatednessRules::NotWritten }
110
89
 
@@ -311,6 +290,10 @@ describe Nanoc::Int::OutdatednessRules do
311
290
  end
312
291
  end
313
292
  end
293
+
294
+ context 'config' do
295
+ # TODO
296
+ end
314
297
  end
315
298
 
316
299
  context 'RulesModified' do
@@ -14,7 +14,7 @@ shared_examples 'a document view' do
14
14
  end
15
15
 
16
16
  let(:dependency_tracker) { Nanoc::Int::DependencyTracker.new(dependency_store) }
17
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection) }
17
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection, config) }
18
18
  let(:base_item) { Nanoc::Int::Item.new('base', {}, '/base.md') }
19
19
 
20
20
  let(:empty_identifiable_collection) do
@@ -17,7 +17,7 @@ describe Nanoc::ItemRepView do
17
17
  let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
18
18
 
19
19
  let(:dependency_tracker) { Nanoc::Int::DependencyTracker.new(dependency_store) }
20
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection) }
20
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection, config) }
21
21
  let(:base_item) { Nanoc::Int::Item.new('base', {}, '/base.md') }
22
22
 
23
23
  let(:empty_identifiable_collection) do
@@ -18,7 +18,7 @@ describe Nanoc::ItemWithRepsView do
18
18
  let(:reps) { [] }
19
19
  let(:items) { [] }
20
20
  let(:dependency_tracker) { Nanoc::Int::DependencyTracker.new(dependency_store) }
21
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection) }
21
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_identifiable_collection, empty_identifiable_collection, config) }
22
22
  let(:compilation_context) { double(:compilation_context) }
23
23
  let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
24
24
 
@@ -30,7 +30,7 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
30
30
  let(:config) { Nanoc::Int::Configuration.new }
31
31
 
32
32
  let(:dependency_store) do
33
- Nanoc::Int::DependencyStore.new(items, layouts)
33
+ Nanoc::Int::DependencyStore.new(items, layouts, config)
34
34
  end
35
35
 
36
36
  let(:layouts) do
@@ -55,6 +55,24 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
55
55
  end
56
56
  end
57
57
 
58
+ context 'dependency (without props) from config to dog' do
59
+ before do
60
+ dependency_store.record_dependency(item_dog, config)
61
+ end
62
+
63
+ it 'outputs no dependencies for /about.md' do
64
+ expect { subject }.to output(%r{^item /about.md depends on:\n \(nothing\)$}m).to_stdout
65
+ end
66
+
67
+ it 'outputs dependencies for /dog.md' do
68
+ expect { subject }.to output(%r{^item /dog.md depends on:\n \[ config \] \(racp\) $}m).to_stdout
69
+ end
70
+
71
+ it 'outputs no dependencies for /other.dat' do
72
+ expect { subject }.to output(%r{^item /other.dat depends on:\n \(nothing\)$}m).to_stdout
73
+ end
74
+ end
75
+
58
76
  context 'dependency (without props) from about to dog' do
59
77
  before do
60
78
  dependency_store.record_dependency(item_dog, item_about)
@@ -93,6 +111,16 @@ describe Nanoc::CLI::Commands::ShowData, stdio: true do
93
111
  end
94
112
  end
95
113
 
114
+ context 'dependency (with attributes prop) from config to dog' do
115
+ before do
116
+ dependency_store.record_dependency(item_dog, config, attributes: true)
117
+ end
118
+
119
+ it 'outputs dependencies for /dog.md' do
120
+ expect { subject }.to output(%r{^item /dog.md depends on:\n \[ config \] \(_a__\) $}m).to_stdout
121
+ end
122
+ end
123
+
96
124
  context 'dependency (with compiled_content prop) from about to dog' do
97
125
  before do
98
126
  dependency_store.record_dependency(item_dog, item_about, compiled_content: true)
@@ -48,6 +48,10 @@ describe Nanoc::Deploying::Deployers::Fog, stdio: true do
48
48
  'remote/bucky/woof',
49
49
  ])
50
50
  end
51
+
52
+ it 'does not leave lingering open files' do
53
+ expect { subject }.not_to leak_open_files
54
+ end
51
55
  end
52
56
 
53
57
  context 'dry run' do
@@ -20,7 +20,7 @@ describe 'Outdatedness integration', site: true, stdio: true do
20
20
  filter :erb
21
21
  write '/bar.html'
22
22
  end
23
- EOS
23
+ EOS
24
24
  end
25
25
 
26
26
  before { Nanoc::CLI.run(%w[compile]) }
@@ -71,6 +71,57 @@ EOS
71
71
  end
72
72
  end
73
73
 
74
+ context 'only attribute dependency on config' do
75
+ let(:time) { Time.now }
76
+
77
+ before do
78
+ File.write('content/bar.md', '<%= @config[:title] %>')
79
+
80
+ FileUtils.touch('content/bar.md', mtime: time)
81
+
82
+ File.write('nanoc.yaml', <<~EOS)
83
+ title: The Original
84
+ EOS
85
+
86
+ File.write('Rules', <<~EOS)
87
+ compile '/foo.*' do
88
+ write '/foo.html'
89
+ end
90
+
91
+ compile '/bar.*' do
92
+ filter :erb
93
+ write '/bar.html'
94
+ end
95
+ EOS
96
+ end
97
+
98
+ before { Nanoc::CLI.run(%w[compile]) }
99
+
100
+ it 'shows default rep outdatedness' do
101
+ expect { Nanoc::CLI.run(%w[show-data --no-color]) }.to(
102
+ output(/^item \/bar\.md, rep default:\n is not outdated/).to_stdout,
103
+ )
104
+ end
105
+
106
+ it 'shows file as outdated after modification' do
107
+ File.write('content/bar.md', 'JUST BAR!')
108
+ FileUtils.touch('content/bar.md', mtime: time)
109
+
110
+ expect { Nanoc::CLI.run(%w[show-data --no-color]) }.to(
111
+ output(/^item \/bar\.md, rep default:\n is outdated:/).to_stdout,
112
+ )
113
+ end
114
+
115
+ it 'shows file and dependencies as outdated after title modification' do
116
+ File.write('nanoc.yaml', 'title: Totes Newz')
117
+ FileUtils.touch('nanoc.yaml', mtime: time)
118
+
119
+ expect { Nanoc::CLI.run(%w[show-data --no-color]) }.to(
120
+ output(/^item \/bar\.md, rep default:\n is outdated:/).to_stdout,
121
+ )
122
+ end
123
+ end
124
+
74
125
  context 'only raw content dependency' do
75
126
  before do
76
127
  File.write('content/foo.md', "---\ntitle: hello\n---\n\nfoo")
@@ -85,7 +136,7 @@ EOS
85
136
  filter :erb
86
137
  write '/bar.html'
87
138
  end
88
- EOS
139
+ EOS
89
140
  end
90
141
 
91
142
  before { Nanoc::CLI.run(%w[compile]) }
@@ -147,7 +198,7 @@ EOS
147
198
  filter :erb
148
199
  write '/bar.html'
149
200
  end
150
- EOS
201
+ EOS
151
202
  end
152
203
 
153
204
  before { Nanoc::CLI.run(%w[compile]) }
@@ -205,7 +256,7 @@ EOS
205
256
  filter :erb
206
257
  write '/bar.html'
207
258
  end
208
- EOS
259
+ EOS
209
260
 
210
261
  expect { Nanoc::CLI.run(%w[show-data --no-color]) }.to(
211
262
  output(/^item \/foo\.md, rep default:\n is outdated:/).to_stdout,
data/spec/spec_helper.rb CHANGED
@@ -277,3 +277,42 @@ RSpec::Matchers.define :send_notification do |name, *expected_args|
277
277
  "expected that proc would not send notification #{name.inspect} with args #{expected_args.inspect}"
278
278
  end
279
279
  end
280
+
281
+ RSpec::Matchers.define :leak_open_files do |_name, *_expected_args|
282
+ # Some remarks:
283
+ #
284
+ # • This matcher relies on global state (list of file descriptors and their
285
+ # state), which means that a test case that uses this matcher can fail if
286
+ # tests are being run in parallel.
287
+ #
288
+ # • This matcher assumes that file descriptors are closed explicitly, rather
289
+ # than implicitly through garbage collection. This means that a test case
290
+ # that uses this matcher can fail if the code exercised by the test case
291
+ # relies on file descriptors to be closed when they are garbage collected.
292
+
293
+ supports_block_expectations
294
+
295
+ match do |actual|
296
+ open_files_before = []
297
+ ObjectSpace.each_object(File) { |f| open_files_before << f.fileno unless f.closed? }
298
+
299
+ actual.call
300
+
301
+ open_files_after = []
302
+ ObjectSpace.each_object(File) { |f| open_files_after << f.fileno unless f.closed? }
303
+
304
+ open_files_before.sort != open_files_after.sort
305
+ end
306
+
307
+ description do
308
+ 'leak open files'
309
+ end
310
+
311
+ failure_message do |_actual|
312
+ 'expected that proc would leak open files'
313
+ end
314
+
315
+ failure_message_when_negated do |_actual|
316
+ 'expected that proc would not leak open files'
317
+ end
318
+ end
@@ -13,7 +13,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
13
13
  ])
14
14
 
15
15
  # Create
16
- store = Nanoc::Int::DependencyStore.new(items, layouts)
16
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
17
17
 
18
18
  # Verify no dependencies yet
19
19
  assert_empty store.objects_causing_outdatedness_of(items.to_a[0])
@@ -30,7 +30,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
30
30
  ])
31
31
 
32
32
  # Create
33
- store = Nanoc::Int::DependencyStore.new(items, layouts)
33
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
34
34
 
35
35
  # Record some dependencies
36
36
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -49,7 +49,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
49
49
  ])
50
50
 
51
51
  # Create
52
- store = Nanoc::Int::DependencyStore.new(items, layouts)
52
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
53
53
 
54
54
  # Record some dependencies
55
55
  store.record_dependency(items.to_a[0], items.to_a[0])
@@ -69,7 +69,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
69
69
  ])
70
70
 
71
71
  # Create
72
- store = Nanoc::Int::DependencyStore.new(items, layouts)
72
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
73
73
 
74
74
  # Record some dependencies
75
75
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -91,7 +91,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
91
91
  ])
92
92
 
93
93
  # Create
94
- store = Nanoc::Int::DependencyStore.new(items, layouts)
94
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
95
95
 
96
96
  # Record some dependencies
97
97
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -113,7 +113,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
113
113
  ])
114
114
 
115
115
  # Create
116
- store = Nanoc::Int::DependencyStore.new(items, layouts)
116
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
117
117
 
118
118
  # Record some dependencies
119
119
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -125,7 +125,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
125
125
  assert File.file?(store.filename)
126
126
 
127
127
  # Re-create
128
- store = Nanoc::Int::DependencyStore.new(items, layouts)
128
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
129
129
 
130
130
  # Load
131
131
  store.load
@@ -153,7 +153,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
153
153
  new_items = Nanoc::Int::IdentifiableCollection.new(config, [items.to_a[0], items.to_a[1], items.to_a[2]])
154
154
 
155
155
  # Create
156
- store = Nanoc::Int::DependencyStore.new(old_items, layouts)
156
+ store = Nanoc::Int::DependencyStore.new(old_items, layouts, config)
157
157
 
158
158
  # Record some dependencies
159
159
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -165,7 +165,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
165
165
  assert File.file?(store.filename)
166
166
 
167
167
  # Re-create
168
- store = Nanoc::Int::DependencyStore.new(new_items, layouts)
168
+ store = Nanoc::Int::DependencyStore.new(new_items, layouts, config)
169
169
 
170
170
  # Load
171
171
  store.load
@@ -187,7 +187,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
187
187
  ])
188
188
 
189
189
  # Create
190
- store = Nanoc::Int::DependencyStore.new(items, layouts)
190
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
191
191
 
192
192
  # Record some dependencies
193
193
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -198,7 +198,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
198
198
  assert File.file?(store.filename)
199
199
 
200
200
  # Re-create
201
- store = Nanoc::Int::DependencyStore.new(items, layouts)
201
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
202
202
 
203
203
  # Load
204
204
  store.load
@@ -219,7 +219,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
219
219
  ])
220
220
 
221
221
  # Create
222
- store = Nanoc::Int::DependencyStore.new(items, layouts)
222
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
223
223
 
224
224
  # Record some dependencies
225
225
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -230,7 +230,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
230
230
  assert File.file?(store.filename)
231
231
 
232
232
  # Re-create
233
- store = Nanoc::Int::DependencyStore.new(items, layouts)
233
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
234
234
 
235
235
  # Load
236
236
  store.load
@@ -251,7 +251,7 @@ class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
251
251
  ])
252
252
 
253
253
  # Create
254
- store = Nanoc::Int::DependencyStore.new(items, layouts)
254
+ store = Nanoc::Int::DependencyStore.new(items, layouts, config)
255
255
 
256
256
  # Record some dependencies
257
257
  store.record_dependency(items.to_a[0], items.to_a[1])
@@ -92,7 +92,7 @@ EOS
92
92
  items = Nanoc::Int::IdentifiableCollection.new(config)
93
93
  layouts = Nanoc::Int::IdentifiableCollection.new(config)
94
94
 
95
- @dependency_store = Nanoc::Int::DependencyStore.new(items, layouts)
95
+ @dependency_store = Nanoc::Int::DependencyStore.new(items, layouts, config)
96
96
  @dependency_tracker = Nanoc::Int::DependencyTracker.new(@dependency_store)
97
97
 
98
98
  @base_item = Nanoc::Int::Item.new('base', {}, '/base.md')
@@ -34,7 +34,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
34
34
  config = Nanoc::Int::Configuration.new.with_defaults
35
35
  items = Nanoc::Int::IdentifiableCollection.new(config)
36
36
  layouts = Nanoc::Int::IdentifiableCollection.new(config)
37
- dep_store = Nanoc::Int::DependencyStore.new(items, layouts)
37
+ dep_store = Nanoc::Int::DependencyStore.new(items, layouts, config)
38
38
  dependency_tracker = Nanoc::Int::DependencyTracker.new(dep_store)
39
39
 
40
40
  @view_context = Nanoc::ViewContext.new(
@@ -11,7 +11,7 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
11
11
  config = Nanoc::Int::Configuration.new.with_defaults
12
12
  items = Nanoc::Int::IdentifiableCollection.new(config)
13
13
  layouts = Nanoc::Int::IdentifiableCollection.new(config)
14
- dep_store = Nanoc::Int::DependencyStore.new(items, layouts)
14
+ dep_store = Nanoc::Int::DependencyStore.new(items, layouts, config)
15
15
  dependency_tracker = Nanoc::Int::DependencyTracker.new(dep_store)
16
16
 
17
17
  @reps = Nanoc::Int::ItemRepRepo.new
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.7.11
4
+ version: 4.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-17 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -104,7 +104,7 @@ description: Nanoc is a static-site generator focused on flexibility. It transfo
104
104
  content from a format such as Markdown or AsciiDoc into another format, usually
105
105
  HTML, and lays out pages consistently to retain the site’s look and feel throughout.
106
106
  Static sites built with Nanoc can be deployed to any web server.
107
- email: denis.defreyne@stoneship.org
107
+ email: denis@stoneship.org
108
108
  executables:
109
109
  - nanoc
110
110
  extensions: []
@@ -121,6 +121,7 @@ files:
121
121
  - ".rubocop.yml"
122
122
  - ".travis.yml"
123
123
  - Appraisals
124
+ - CODE_OF_CONDUCT.md
124
125
  - Gemfile
125
126
  - Guardfile
126
127
  - LICENSE
@@ -222,7 +223,6 @@ files:
222
223
  - lib/nanoc/base/services/outdatedness_rules.rb
223
224
  - lib/nanoc/base/services/outdatedness_rules/attributes_modified.rb
224
225
  - lib/nanoc/base/services/outdatedness_rules/code_snippets_modified.rb
225
- - lib/nanoc/base/services/outdatedness_rules/configuration_modified.rb
226
226
  - lib/nanoc/base/services/outdatedness_rules/content_modified.rb
227
227
  - lib/nanoc/base/services/outdatedness_rules/not_written.rb
228
228
  - lib/nanoc/base/services/outdatedness_rules/rules_modified.rb
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::Int::OutdatednessRules
4
- class ConfigurationModified < Nanoc::Int::OutdatednessRule
5
- extend Nanoc::Int::Memoization
6
-
7
- affects_props :raw_content, :attributes, :compiled_content, :path
8
-
9
- def apply(_obj, outdatedness_checker)
10
- if config_modified?(outdatedness_checker)
11
- Nanoc::Int::OutdatednessReasons::ConfigurationModified
12
- end
13
- end
14
-
15
- private
16
-
17
- memoized def config_modified?(outdatedness_checker)
18
- obj = outdatedness_checker.site.config
19
- ch_old = outdatedness_checker.checksum_store[obj]
20
- ch_new = outdatedness_checker.checksums.checksum_for(obj)
21
- ch_old != ch_new
22
- end
23
- end
24
- end