nanoc 4.8.5 → 4.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +41 -48
  3. data/NEWS.md +6 -0
  4. data/lib/nanoc.rb +2 -1
  5. data/lib/nanoc/base/entities/context.rb +2 -2
  6. data/lib/nanoc/base/entities/identifiable_collection.rb +5 -0
  7. data/lib/nanoc/base/entities/item_rep.rb +2 -4
  8. data/lib/nanoc/base/entities/pattern.rb +1 -1
  9. data/lib/nanoc/base/entities/props.rb +1 -1
  10. data/lib/nanoc/base/entities/site.rb +1 -1
  11. data/lib/nanoc/base/repos/compiled_content_cache.rb +1 -2
  12. data/lib/nanoc/base/repos/dependency_store.rb +3 -3
  13. data/lib/nanoc/base/services/checksummer.rb +1 -1
  14. data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +12 -0
  15. data/lib/nanoc/checking/checks/internal_links.rb +1 -1
  16. data/lib/nanoc/cli/cleaning_stream.rb +2 -2
  17. data/lib/nanoc/cli/commands/deploy.rb +1 -1
  18. data/lib/nanoc/cli/commands/show-data.rb +1 -1
  19. data/lib/nanoc/cli/commands/show-rules.rb +1 -1
  20. data/lib/nanoc/cli/error_handler.rb +2 -2
  21. data/lib/nanoc/deploying/deployers/fog.rb +1 -1
  22. data/lib/nanoc/filters/colorize_syntax.rb +1 -1
  23. data/lib/nanoc/filters/colorize_syntax/colorizers.rb +1 -1
  24. data/lib/nanoc/filters/sass.rb +1 -1
  25. data/lib/nanoc/helpers/blogging.rb +1 -1
  26. data/lib/nanoc/helpers/capturing.rb +2 -2
  27. data/lib/nanoc/helpers/link_to.rb +1 -1
  28. data/lib/nanoc/helpers/xml_sitemap.rb +2 -2
  29. data/lib/nanoc/rule_dsl/recording_executor.rb +1 -1
  30. data/lib/nanoc/spec.rb +1 -1
  31. data/lib/nanoc/telemetry/table.rb +1 -1
  32. data/lib/nanoc/version.rb +1 -1
  33. data/nanoc.gemspec +1 -0
  34. data/spec/nanoc/base/entities/code_snippet_spec.rb +2 -2
  35. data/spec/nanoc/base/entities/identifiable_collection_spec.rb +6 -0
  36. data/spec/nanoc/base/entities/lazy_value_spec.rb +1 -1
  37. data/spec/nanoc/base/feature_spec.rb +2 -2
  38. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +1 -1
  39. data/spec/nanoc/base/views/mutable_document_view_spec.rb +81 -0
  40. data/spec/nanoc/deploying/git_spec.rb +2 -2
  41. data/spec/nanoc/helpers/capturing_spec.rb +4 -4
  42. data/spec/nanoc/helpers/html_escape_spec.rb +1 -1
  43. data/spec/nanoc/regressions/gh_1216_spec.rb +91 -0
  44. data/test/base/test_code_snippet.rb +0 -12
  45. data/test/base/test_item_array.rb +1 -1
  46. data/test/deploying/test_git.rb +6 -6
  47. data/test/filters/test_erb.rb +4 -4
  48. data/test/filters/test_erubi.rb +4 -4
  49. data/test/filters/test_erubis.rb +4 -4
  50. data/test/helpers/test_blogging.rb +4 -16
  51. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cafd3c0aac9622344c7d94be09957d8b616426a2
4
- data.tar.gz: 1f239f61b0329e35bd5cb56bce1f6fe762898926
3
+ metadata.gz: 6d488b6ffac3f6bdcd6e411cb5d84625842b373c
4
+ data.tar.gz: 0c5c0e6bf848cf835f89cb36919059ac5e5486a4
5
5
  SHA512:
6
- metadata.gz: ae453f24b6d9a652a8a9c9499bc121ac3bc056f0947713b83e43e62ea413e32ae1415a0897f3ccf982c38c9deaf77a15999918f0e7337ecdfa48150fcb77338f
7
- data.tar.gz: b1ab390568886eaf34ce69704be75396f34f32859fa50fa073dac06d46ef2ca2171d4dd31f6acc2e3d6770e491ede4e4a62ecfafcabeb4ec10cfb0e40afe9554
6
+ metadata.gz: 83b4a5c841d3a75d164372d26577efb52075a9a5a1fed0f8de70741db075087a9808b15758f1603267bf41053aa26a0304f915e8028141f9decbd80846dd250a
7
+ data.tar.gz: 4f1570f8ebdba18d4acccd1b8775fed99138d1536a7a1851eef55be082bb009dda31173fb68fac93489727946556d61104a4c9047e3471ceae577bebb8e2f724
@@ -5,22 +5,9 @@ AllCops:
5
5
  DisplayCopNames: true
6
6
 
7
7
  # We use filenames such as “create-site.rb” that translate to method names.
8
- FileName:
8
+ Naming/FileName:
9
9
  Exclude:
10
10
  - 'lib/nanoc/cli/commands/*.rb'
11
- - 'Appraisals'
12
-
13
- # A common pattern in tests is to define anonymous classes in which methods are defined, which trips
14
- # up Rubocop’s nested method definition cop.
15
- Lint/NestedMethodDefinition:
16
- Exclude:
17
- - 'test/**/*.rb'
18
- - 'spec/**/*.rb'
19
-
20
- # This is used in tests, to verify the effect of state-changing functions.
21
- Style/GlobalVars:
22
- Exclude:
23
- - 'test/**/*.rb'
24
11
 
25
12
  Style/TrailingCommaInArguments:
26
13
  EnforcedStyleForMultiline: comma
@@ -28,40 +15,47 @@ Style/TrailingCommaInArguments:
28
15
  Style/TrailingCommaInLiteral:
29
16
  EnforcedStyleForMultiline: comma
30
17
 
18
+ Layout/IndentArray:
19
+ EnforcedStyle: consistent
20
+
21
+
22
+
23
+ # ----- CONFIGURED (exceptions for tests) -----
24
+
25
+ # This breaks RSpec on occasion, e.g. `expect { subject }.not_to change { foo }`,
26
+ # and generally does not provide useful warnings
27
+ Lint/AmbiguousBlockAssociation:
28
+ Exclude:
29
+ - 'spec/**/*.rb'
30
+
31
31
  # `rescue nil` is useful in specs where the exception is not important, but
32
32
  # the size effects are.
33
33
  Style/RescueModifier:
34
34
  Exclude:
35
35
  - 'spec/**/*.rb'
36
36
 
37
- Layout/IndentArray:
38
- EnforcedStyle: consistent
39
-
40
- Lint/DuplicateMethods:
37
+ # A common pattern in tests is to define anonymous classes in which methods are defined, which trips
38
+ # up Rubocop’s nested method definition cop.
39
+ Lint/NestedMethodDefinition:
41
40
  Exclude:
42
- - 'test/data_sources/test_filesystem.rb'
43
- - 'spec/spec_helper.rb'
41
+ - 'test/**/*.rb'
42
+ - 'spec/**/*.rb'
44
43
 
45
- # This needs to be fixed in Ruby 2.4.
46
- Lint/UnifiedInteger:
47
- Enabled: false
44
+ # This is used in tests, to verify the effect of state-changing functions.
45
+ Style/GlobalVars:
46
+ Exclude:
47
+ - 'test/**/*.rb'
48
48
 
49
- Layout/IndentHeredoc:
50
- EnforcedStyle: squiggly
51
49
 
52
- # This breaks RSpec on occasion, e.g. `expect { subject }.not_to change { foo }`,
53
- # and generally does not provide useful warnings
54
- Lint/AmbiguousBlockAssociation:
55
- Enabled: false
56
50
 
57
51
  # ----- TO ENABLE LATER -----
58
52
 
59
53
  # Valid cops, but fixing the offenses they report is non-trivial.
60
54
 
61
- RegexpLiteral:
55
+ Style/RegexpLiteral:
62
56
  Enabled: false
63
57
 
64
- ClassAndModuleChildren:
58
+ Style/ClassAndModuleChildren:
65
59
  Enabled: false
66
60
 
67
61
  Style/EmptyElse:
@@ -70,12 +64,11 @@ Style/EmptyElse:
70
64
  Style/Next:
71
65
  Enabled: false
72
66
 
67
+ # This cop is broken (#4731, #4745)
68
+ Style/SafeNavigation:
69
+ Enabled: false
73
70
 
74
-
75
- # ----- DISABLED (hard) -----
76
-
77
- # Rubocop trips up on this.
78
- Layout/LeadingCommentSpace:
71
+ Naming/HeredocDelimiterNaming:
79
72
  Enabled: false
80
73
 
81
74
 
@@ -98,6 +91,7 @@ Security/Eval:
98
91
  - 'lib/nanoc/filters/erubi.rb'
99
92
 
100
93
 
94
+
101
95
  # ----- DISABLED (metrics) -----
102
96
 
103
97
  # Cops for metrics are disabled because they should not cause tests to fail.
@@ -138,37 +132,36 @@ Metrics/PerceivedComplexity:
138
132
 
139
133
  # We should embrace UTF-8, not avoid it. Since the Encoding cop is enabled,
140
134
  # there’s no point in enforcing ASCII comments.
141
- AsciiComments:
135
+ Style/AsciiComments:
142
136
  Enabled: false
143
137
 
144
138
  # It does not make sense to enforce everything to have documentation.
145
- Documentation:
139
+ Style/Documentation:
146
140
  Enabled: false
147
141
 
148
142
  # Nanoc suppresses exceptions for valid reasons in a few cases.
149
- HandleExceptions:
143
+ Lint/HandleExceptions:
150
144
  Enabled: false
151
145
 
152
146
  # if/unless at the end of the line makes it too easy to oversee.
153
- IfUnlessModifier:
147
+ Style/IfUnlessModifier:
154
148
  Enabled: false
155
149
 
156
150
  # Personal preference is to have decent constructors for exceptions rather than
157
151
  # just a class and a message.
158
- RaiseArgs:
159
- Enabled: false
160
-
161
- # Personal preference is to use `raise` to signal exceptions (normal control
162
- # flow should not use exceptions anyway).
163
- SignalException:
152
+ Style/RaiseArgs:
164
153
  Enabled: false
165
154
 
166
155
  # Some methods that appear to be accessors (return a single value or set a
167
156
  # single value) should still not be considered to be accessors. This is a purely
168
157
  # semantic difference.
169
- TrivialAccessors:
158
+ Style/TrivialAccessors:
170
159
  Enabled: false
171
160
 
172
161
  # This does not always semantically make sense.
173
- GuardClause:
162
+ Style/GuardClause:
163
+ Enabled: false
164
+
165
+ # Used for “undo work, whatever error happens”
166
+ Lint/RescueWithoutErrorClass:
174
167
  Enabled: false
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.8.6 (2017-09-17)
4
+
5
+ Fixes:
6
+
7
+ * Fixed issue which would cause items not to be considered as outdated when their content and/or attributes are changed in the preprocessor (#1216, #1217)
8
+
3
9
  ## 4.8.5 (2017-09-07)
4
10
 
5
11
  Enhancements:
@@ -8,7 +8,7 @@ module Nanoc
8
8
  def self.version_information
9
9
  gem_info = defined?(Gem) ? "with RubyGems #{Gem::VERSION}" : 'without RubyGems'
10
10
  engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
11
- res = String.new
11
+ res = +''
12
12
  res << "Nanoc #{Nanoc::VERSION} © 2007-2017 Denis Defreyne.\n"
13
13
  res << "Running #{engine} #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) on #{RUBY_PLATFORM} #{gem_info}.\n"
14
14
  res
@@ -26,6 +26,7 @@ end
26
26
  require 'hamster'
27
27
  require 'ref'
28
28
  require 'ddplugin'
29
+ require 'addressable'
29
30
 
30
31
  # Load general requirements
31
32
  require 'digest'
@@ -34,11 +34,11 @@ module Nanoc::Int
34
34
  # Returns a binding for this instance.
35
35
  #
36
36
  # @return [Binding] A binding for this instance
37
- # rubocop:disable Style/AccessorMethodName
37
+ # rubocop:disable Naming/AccessorMethodName
38
38
  def get_binding
39
39
  binding
40
40
  end
41
- # rubocop:enable Style/AccessorMethodName
41
+ # rubocop:enable Naming/AccessorMethodName
42
42
 
43
43
  def method_missing(method, *args, &blk)
44
44
  ivar_name = '@' + method.to_s
@@ -23,6 +23,11 @@ module Nanoc::Int
23
23
  @name = name
24
24
  end
25
25
 
26
+ contract C::None => String
27
+ def inspect
28
+ "<#{self.class}>"
29
+ end
30
+
26
31
  contract C::None => self
27
32
  def freeze
28
33
  @objects.freeze
@@ -44,16 +44,14 @@ module Nanoc::Int
44
44
  @modified = false
45
45
  end
46
46
 
47
- contract C::HashOf[Symbol => C::IterOf[String]] => self
47
+ contract C::HashOf[Symbol => C::IterOf[String]] => C::HashOf[Symbol => C::IterOf[String]]
48
48
  def raw_paths=(val)
49
49
  @raw_paths = val
50
- self
51
50
  end
52
51
 
53
- contract C::HashOf[Symbol => C::IterOf[String]] => self
52
+ contract C::HashOf[Symbol => C::IterOf[String]] => C::HashOf[Symbol => C::IterOf[String]]
54
53
  def paths=(val)
55
54
  @paths = val
56
- self
57
55
  end
58
56
 
59
57
  contract Symbol => C::Bool
@@ -72,7 +72,7 @@ module Nanoc::Int
72
72
  contract C::Or[Nanoc::Identifier, String] => C::Maybe[C::ArrayOf[String]]
73
73
  def captures(identifier)
74
74
  matches = @regexp.match(identifier.to_s)
75
- matches && matches.captures
75
+ matches&.captures
76
76
  end
77
77
 
78
78
  contract C::None => String
@@ -39,7 +39,7 @@ module Nanoc::Int
39
39
 
40
40
  contract C::None => String
41
41
  def inspect
42
- String.new.tap do |s|
42
+ (+'').tap do |s|
43
43
  s << 'Props('
44
44
  s << (raw_content? ? 'r' : '_')
45
45
  s << (attributes? ? 'a' : '_')
@@ -8,7 +8,7 @@ module Nanoc::Int
8
8
  attr_reader :code_snippets
9
9
  attr_reader :config
10
10
  attr_accessor :data_source
11
- attr_accessor :compiler
11
+ attr_writer :compiler
12
12
 
13
13
  contract C::KeywordArgs[config: Nanoc::Int::Configuration, code_snippets: C::IterOf[Nanoc::Int::CodeSnippet], data_source: C::Maybe[C::Named['Nanoc::DataSource']]] => C::Any
14
14
  def initialize(config:, code_snippets:, data_source:)
@@ -26,7 +26,7 @@ module Nanoc::Int
26
26
  item_cache[rep.name]
27
27
  end
28
28
 
29
- contract Nanoc::Int::ItemRep, C::HashOf[Symbol => Nanoc::Int::Content] => self
29
+ contract Nanoc::Int::ItemRep, C::HashOf[Symbol => Nanoc::Int::Content] => C::HashOf[Symbol => Nanoc::Int::Content]
30
30
  # Sets the compiled content for the given representation.
31
31
  #
32
32
  # This cached compiled content is a hash where the keys are the snapshot
@@ -34,7 +34,6 @@ module Nanoc::Int
34
34
  def []=(rep, content)
35
35
  @cache[rep.item.identifier] ||= {}
36
36
  @cache[rep.item.identifier][rep.name] = content
37
- self
38
37
  end
39
38
 
40
39
  protected
@@ -5,8 +5,8 @@ module Nanoc::Int
5
5
  class DependencyStore < ::Nanoc::Int::Store
6
6
  include Nanoc::Int::ContractsSupport
7
7
 
8
- attr_accessor :items
9
- attr_accessor :layouts
8
+ attr_reader :items
9
+ attr_reader :layouts
10
10
 
11
11
  contract Nanoc::Int::ItemCollection, Nanoc::Int::LayoutCollection, Nanoc::Int::Configuration, C::KeywordArgs[site: C::Optional[C::Maybe[Nanoc::Int::Site]]] => C::Any
12
12
  def initialize(items, layouts, config, site: nil)
@@ -140,7 +140,7 @@ module Nanoc::Int
140
140
  protected
141
141
 
142
142
  def obj2ref(obj)
143
- obj && obj.reference
143
+ obj&.reference
144
144
  end
145
145
 
146
146
  def ref2obj(reference)
@@ -10,7 +10,7 @@ module Nanoc::Int
10
10
  class Checksummer
11
11
  class VerboseDigest
12
12
  def initialize
13
- @str = String.new
13
+ @str = +''
14
14
  end
15
15
 
16
16
  def update(str)
@@ -16,6 +16,10 @@ module Nanoc
16
16
  end
17
17
 
18
18
  def raw_content=(arg)
19
+ # FIXME: clearing checksum data should be done in the document
20
+ unwrap.checksum_data = nil
21
+ unwrap.content_checksum_data = nil
22
+
19
23
  unwrap.content = Nanoc::Int::Content.create(arg)
20
24
  end
21
25
 
@@ -25,6 +29,10 @@ module Nanoc
25
29
  #
26
30
  # @see Hash#[]=
27
31
  def []=(key, value)
32
+ # FIXME: clearing checksum data should be done in the document
33
+ unwrap.checksum_data = nil
34
+ unwrap.attributes_checksum_data = nil
35
+
28
36
  disallowed_value_classes = Set.new([
29
37
  Nanoc::Int::Item,
30
38
  Nanoc::Int::Layout,
@@ -51,6 +59,10 @@ module Nanoc
51
59
  #
52
60
  # @return [self]
53
61
  def update_attributes(hash)
62
+ # FIXME: clearing checksum data should be done in the document
63
+ unwrap.checksum_data = nil
64
+ unwrap.attributes_checksum_data = nil
65
+
54
66
  hash.each { |k, v| unwrap.attributes[k] = v }
55
67
  self
56
68
  end
@@ -53,7 +53,7 @@ module Nanoc::Checking::Checks
53
53
  return true if path.empty?
54
54
 
55
55
  # Decode URL (e.g. '%20' -> ' ')
56
- path = URI.unescape(path)
56
+ path = CGI.unescape(path)
57
57
 
58
58
  # Make absolute
59
59
  path =
@@ -140,11 +140,11 @@ module Nanoc::CLI
140
140
  end
141
141
 
142
142
  # @see ARGF.set_encoding
143
- # rubocop:disable Style/AccessorMethodName
143
+ # rubocop:disable Naming/AccessorMethodName
144
144
  def set_encoding(*args)
145
145
  @stream.set_encoding(*args)
146
146
  end
147
- # rubocop:enable Style/AccessorMethodName
147
+ # rubocop:enable Naming/AccessorMethodName
148
148
 
149
149
  protected
150
150
 
@@ -42,7 +42,7 @@ module Nanoc::CLI::Commands
42
42
  puts 'No deployment configurations.'
43
43
  else
44
44
  puts 'Available deployment configurations:'
45
- deploy_configs.keys.each do |name|
45
+ deploy_configs.each_key do |name|
46
46
  puts " #{name}"
47
47
  end
48
48
  end
@@ -115,7 +115,7 @@ module Nanoc::CLI::Commands
115
115
  nil
116
116
  end
117
117
 
118
- props = String.new
118
+ props = +''
119
119
  props << (dep.props.raw_content? ? 'r' : '_')
120
120
  props << (dep.props.attributes? ? 'a' : '_')
121
121
  props << (dep.props.compiled_content? ? 'c' : '_')
@@ -46,7 +46,7 @@ module Nanoc::CLI::Commands
46
46
  puts "#{@c.c('Layout ' + layout.identifier, :bold, :yellow)}:"
47
47
 
48
48
  found = false
49
- @rules.layout_filter_mapping.each do |pattern, _|
49
+ @rules.layout_filter_mapping.each_key do |pattern|
50
50
  if pattern.match?(layout.identifier)
51
51
  puts " #{pattern}"
52
52
  found = true
@@ -155,12 +155,12 @@ module Nanoc::CLI
155
155
 
156
156
  # @return [Nanoc::Int::Site] The site that is currently being processed
157
157
  def site
158
- @command && @command.site
158
+ @command&.site
159
159
  end
160
160
 
161
161
  # @return [Nanoc::Int::Compiler] The compiler for the current site
162
162
  def compiler
163
- site && site.compiler
163
+ site&.compiler
164
164
  end
165
165
 
166
166
  # @return [Hash<String, Array>] A hash containing the gem names as keys and gem versions as value
@@ -89,7 +89,7 @@ module Nanoc::Deploying::Deployers
89
89
  path = config[:path]
90
90
  cdn_id = config[:cdn_id]
91
91
 
92
- if path && path.end_with?('/')
92
+ if path&.end_with?('/')
93
93
  raise "The path `#{path}` is not supposed to have a trailing slash"
94
94
  end
95
95
 
@@ -36,7 +36,7 @@ module Nanoc::Filters
36
36
 
37
37
  # Add language-something class
38
38
  unless extracted_language.from_class
39
- klass = element['class'] || String.new
39
+ klass = element['class'] || +''
40
40
  klass << ' ' unless [' ', nil].include?(klass[-1, 1])
41
41
  klass << "language-#{extracted_language.language}"
42
42
  element['class'] = klass
@@ -104,7 +104,7 @@ module Nanoc::Filters::ColorizeSyntax::Colorizers
104
104
  check_availability('highlight', '--version')
105
105
 
106
106
  cmd = ['highlight', '--syntax', language, '--fragment']
107
- params.each do |key, _value|
107
+ params.each_key do |key|
108
108
  if SIMON_HIGHLIGHT_OPT_MAP[key]
109
109
  cmd << SIMON_HIGHLIGHT_OPT_MAP[key]
110
110
  else
@@ -16,7 +16,7 @@ module Nanoc::Filters
16
16
  def run(content, params = {})
17
17
  options = params.merge(
18
18
  nanoc_current_filter: self,
19
- filename: @item && @item.raw_filename,
19
+ filename: @item&.raw_filename,
20
20
  )
21
21
  engine = ::Sass::Engine.new(content, options)
22
22
  engine.render
@@ -52,7 +52,7 @@ module Nanoc::Helpers
52
52
  end
53
53
 
54
54
  def build
55
- buffer = String.new
55
+ buffer = +''
56
56
  xml = Builder::XmlMarkup.new(target: buffer, indent: 2)
57
57
  build_for_feed(xml)
58
58
  buffer
@@ -130,7 +130,7 @@ module Nanoc::Helpers
130
130
  "of the capture, optionally params, and the content) but got #{args.size} instead"
131
131
  end
132
132
 
133
- _erbout = String.new # rubocop:disable Lint/UnderscorePrefixedVariableName
133
+ _erbout = +'' # rubocop:disable Lint/UnderscorePrefixedVariableName
134
134
  SetContent.new(name, params, @item).run { _erbout << content }
135
135
  else # Get content
136
136
  if args.size != 2
@@ -157,7 +157,7 @@ module Nanoc::Helpers
157
157
  erbout_addition = erbout[erbout_length..-1]
158
158
 
159
159
  # Remove addition
160
- erbout[erbout_length..-1] = String.new
160
+ erbout[erbout_length..-1] = +''
161
161
 
162
162
  # Depending on how the filter outputs, the result might be a
163
163
  # single string or an array of strings (slim outputs the latter).
@@ -42,7 +42,7 @@ module Nanoc::Helpers
42
42
  # Find path
43
43
  path = target.is_a?(String) ? target : target.path
44
44
 
45
- if @item_rep && @item_rep.path == path
45
+ if @item_rep&.path == path
46
46
  # Create message
47
47
  "<span class=\"active\">#{text}</span>"
48
48
  else
@@ -15,7 +15,7 @@ module Nanoc::Helpers
15
15
  select_proc = params.fetch(:rep_select, nil)
16
16
 
17
17
  # Create builder
18
- buffer = String.new
18
+ buffer = +''
19
19
  xml = Builder::XmlMarkup.new(target: buffer, indent: 2)
20
20
 
21
21
  # Check for required attributes
@@ -32,7 +32,7 @@ module Nanoc::Helpers
32
32
  reps.select! { |r| select_proc[r] } if select_proc
33
33
  reps.sort_by { |r| r.name.to_s }.each do |rep|
34
34
  xml.url do
35
- xml.loc URI.escape(@config[:base_url] + rep.path)
35
+ xml.loc Addressable::URI.escape(@config[:base_url] + rep.path)
36
36
  xml.lastmod item[:mtime].__nanoc_to_iso8601_date unless item[:mtime].nil?
37
37
  xml.changefreq item[:changefreq] unless item[:changefreq].nil?
38
38
  xml.priority item[:priority] unless item[:priority].nil?
@@ -35,7 +35,7 @@ module Nanoc
35
35
  Pathlike = C::Maybe[C::Or[String, Nanoc::Identifier]]
36
36
  contract Symbol, C::KeywordArgs[path: C::Optional[Pathlike]] => nil
37
37
  def snapshot(snapshot_name, path: nil)
38
- @action_sequence_builder.add_snapshot(snapshot_name, path && path.to_s)
38
+ @action_sequence_builder.add_snapshot(snapshot_name, path&.to_s)
39
39
  case snapshot_name
40
40
  when :last
41
41
  @last_snapshot = true
@@ -23,7 +23,7 @@ module Nanoc
23
23
  def initialize(mod)
24
24
  @mod = mod
25
25
 
26
- @erbout = String.new
26
+ @erbout = +''
27
27
  @action_sequence = {}
28
28
  @config = Nanoc::Int::Configuration.new.with_defaults
29
29
  @reps = Nanoc::Int::ItemRepRepo.new
@@ -25,7 +25,7 @@ module Nanoc::Telemetry
25
25
  end
26
26
 
27
27
  def separator(column_lengths)
28
- String.new.tap do |s|
28
+ (+'').tap do |s|
29
29
  s << '─' * column_lengths[0]
30
30
  s << '─┼─'
31
31
  s << column_lengths[1..-1].map { |l| '─' * l }.join('───')
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.8.5'
5
+ VERSION = '4.8.6'
6
6
  end
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency('hamster', '~> 3.0')
27
27
  s.add_runtime_dependency('ref', '~> 2.0')
28
28
  s.add_runtime_dependency('ddplugin', '~> 1.0')
29
+ s.add_runtime_dependency('addressable', '~> 2.5')
29
30
 
30
31
  s.add_development_dependency('bundler', '>= 1.7.10', '< 2.0')
31
32
  s.add_development_dependency('appraisal', '~> 2.1')
@@ -19,7 +19,7 @@ describe Nanoc::Int::CodeSnippet do
19
19
  EOS
20
20
  end
21
21
 
22
- it 'makes helper functions available in contexts' do
22
+ it 'makes helper functions available everywhere' do
23
23
  expect { subject }
24
24
  .to change { [Nanoc::Int::Context.new({}).respond_to?(:fe345b48e4), Complex.respond_to?(:fe345b48e4)] }
25
25
  .from([false, false])
@@ -40,7 +40,7 @@ describe Nanoc::Int::CodeSnippet do
40
40
  EOS
41
41
  end
42
42
 
43
- it 'makes helper functions available everywhere' do
43
+ it 'makes helper functions available in helpers only' do
44
44
  expect { subject }
45
45
  .to change { [Nanoc::Int::Context.new({}).respond_to?(:e0f0c30b5e), Complex.respond_to?(:e0f0c30b5e)] }
46
46
  .from([false, false])
@@ -13,6 +13,12 @@ describe Nanoc::Int::IdentifiableCollection do
13
13
  it { is_expected.to be_a(described_class) }
14
14
  end
15
15
 
16
+ describe '#inspect' do
17
+ subject { identifiable_collection.inspect }
18
+
19
+ it { is_expected.to eq("<#{described_class}>") }
20
+ end
21
+
16
22
  describe '#[]' do
17
23
  let(:objects) do
18
24
  [
@@ -2,7 +2,7 @@
2
2
 
3
3
  describe Nanoc::Int::LazyValue do
4
4
  describe '#value' do
5
- let(:value_arg) { 'Hello world'.dup }
5
+ let(:value_arg) { +'Hello world' }
6
6
  let(:lazy_value) { described_class.new(value_arg) }
7
7
 
8
8
  subject { lazy_value.value }
@@ -8,7 +8,7 @@ describe Nanoc::Feature do
8
8
 
9
9
  before do
10
10
  Nanoc::Feature.reset_caches
11
- ENV['NANOC_FEATURES'] = String.new
11
+ ENV['NANOC_FEATURES'] = +''
12
12
  end
13
13
 
14
14
  context 'not set' do
@@ -42,7 +42,7 @@ describe Nanoc::Feature do
42
42
 
43
43
  before do
44
44
  Nanoc::Feature.reset_caches
45
- ENV['NANOC_FEATURES'] = String.new
45
+ ENV['NANOC_FEATURES'] = +''
46
46
  end
47
47
 
48
48
  context 'not set' do
@@ -328,7 +328,7 @@ describe Nanoc::Int::OutdatednessRules do
328
328
  end
329
329
  end
330
330
 
331
- describe '#{Content,Attributes}Modified' do
331
+ describe '#ContentModified, #AttributesModified' do
332
332
  subject do
333
333
  [
334
334
  Nanoc::Int::OutdatednessRules::ContentModified,
@@ -25,6 +25,33 @@ shared_examples 'a mutable document view' do
25
25
  .from('content')
26
26
  .to('donkey')
27
27
  end
28
+
29
+ context 'checksum_data set' do
30
+ before do
31
+ document.checksum_data = 'my checksum data'
32
+ document.content_checksum_data = 'my content checksum data'
33
+ document.attributes_checksum_data = 'my attributes checksum data'
34
+ end
35
+
36
+ it 'unsets checksum_data' do
37
+ expect { view.raw_content = 'donkey' }
38
+ .to change { document.checksum_data }
39
+ .from('my checksum data')
40
+ .to(nil)
41
+ end
42
+
43
+ it 'unsets content_checksum_data' do
44
+ expect { view.raw_content = 'donkey' }
45
+ .to change { document.content_checksum_data }
46
+ .from('my content checksum data')
47
+ .to(nil)
48
+ end
49
+
50
+ it 'keeps attributes_checksum_data' do
51
+ expect { view.raw_content = 'donkey' }
52
+ .not_to change { document.attributes_checksum_data }
53
+ end
54
+ end
28
55
  end
29
56
 
30
57
  describe '#[]=' do
@@ -54,6 +81,33 @@ shared_examples 'a mutable document view' do
54
81
  layout = Nanoc::LayoutView.new(Nanoc::Int::Layout.new('content', {}, '/foo.md'), nil)
55
82
  expect { view[:layout] = layout }.to raise_error(Nanoc::MutableDocumentViewMixin::DisallowedAttributeValueError)
56
83
  end
84
+
85
+ context 'checksum_data set' do
86
+ before do
87
+ document.checksum_data = 'my checksum data'
88
+ document.content_checksum_data = 'my content checksum data'
89
+ document.attributes_checksum_data = 'my attributes checksum data'
90
+ end
91
+
92
+ it 'unsets checksum_data' do
93
+ expect { view[:title] = 'Donkey' }
94
+ .to change { document.checksum_data }
95
+ .from('my checksum data')
96
+ .to(nil)
97
+ end
98
+
99
+ it 'unsets attributes_checksum_data' do
100
+ expect { view[:title] = 'Donkey' }
101
+ .to change { document.attributes_checksum_data }
102
+ .from('my attributes checksum data')
103
+ .to(nil)
104
+ end
105
+
106
+ it 'keeps content_checksum_data' do
107
+ expect { view[:title] = 'Donkey' }
108
+ .not_to change { document.content_checksum_data }
109
+ end
110
+ end
57
111
  end
58
112
 
59
113
  describe '#identifier=' do
@@ -102,5 +156,32 @@ shared_examples 'a mutable document view' do
102
156
  it 'returns self' do
103
157
  expect(subject).to equal(view)
104
158
  end
159
+
160
+ context 'checksum_data set' do
161
+ before do
162
+ document.checksum_data = 'my checksum data'
163
+ document.content_checksum_data = 'my content checksum data'
164
+ document.attributes_checksum_data = 'my attributes checksum data'
165
+ end
166
+
167
+ it 'unsets checksum_data' do
168
+ expect { subject }
169
+ .to change { document.checksum_data }
170
+ .from('my checksum data')
171
+ .to(nil)
172
+ end
173
+
174
+ it 'unsets attributes_checksum_data' do
175
+ expect { subject }
176
+ .to change { document.attributes_checksum_data }
177
+ .from('my attributes checksum data')
178
+ .to(nil)
179
+ end
180
+
181
+ it 'keeps content_checksum_data' do
182
+ expect { subject }
183
+ .not_to change { document.content_checksum_data }
184
+ end
185
+ end
105
186
  end
106
187
  end
@@ -14,8 +14,8 @@ describe Nanoc::Deploying::Deployers::Git, stdio: true do
14
14
  let(:forced_options) { {} }
15
15
 
16
16
  def run_and_get_stdout(*args)
17
- stdout = String.new
18
- stderr = String.new
17
+ stdout = +''
18
+ stderr = +''
19
19
  piper = Nanoc::Extra::Piper.new(stdout: stdout, stderr: stderr)
20
20
  piper.run(args, '')
21
21
  stdout
@@ -9,7 +9,7 @@ describe Nanoc::Helpers::Capturing, helper: true do
9
9
  end
10
10
 
11
11
  describe 'setting content' do
12
- let(:_erbout) { String.new('existing content') }
12
+ let(:_erbout) { +'existing content' }
13
13
 
14
14
  let(:params) { raise 'overwrite me' }
15
15
 
@@ -129,7 +129,7 @@ describe Nanoc::Helpers::Capturing, helper: true do
129
129
  describe 'with item + name' do
130
130
  subject { helper.content_for(item, :foo) }
131
131
 
132
- let(:_erbout) { String.new('existing content') }
132
+ let(:_erbout) { +'existing content' }
133
133
 
134
134
  context 'requesting for same item' do
135
135
  let(:item) { ctx.item }
@@ -198,7 +198,7 @@ describe Nanoc::Helpers::Capturing, helper: true do
198
198
 
199
199
  describe '#capture' do
200
200
  context 'with string' do
201
- let(:_erbout) { String.new('existing content') }
201
+ let(:_erbout) { +'existing content' }
202
202
 
203
203
  subject { helper.capture { _erbout << 'new content' } }
204
204
 
@@ -244,7 +244,7 @@ describe Nanoc::Helpers::Capturing, helper: true do
244
244
  context 'output field separator set to nothing' do
245
245
  around do |ex|
246
246
  orig_output_field_separator = $OUTPUT_FIELD_SEPARATOR
247
- $OUTPUT_FIELD_SEPARATOR = String.new
247
+ $OUTPUT_FIELD_SEPARATOR = +''
248
248
  ex.run
249
249
  $OUTPUT_FIELD_SEPARATOR = orig_output_field_separator
250
250
  end
@@ -10,7 +10,7 @@ describe Nanoc::Helpers::HTMLEscape, helper: true do
10
10
  end
11
11
 
12
12
  context 'given a block' do
13
- let!(:_erbout) { String.new('moo') }
13
+ let!(:_erbout) { +'moo' }
14
14
 
15
15
  it 'adds escaped content to _erbout' do
16
16
  helper.html_escape { _erbout << '<h1>Stuff!</h1>' }
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe 'GH-1216', site: true, stdio: true do
4
+ before do
5
+ FileUtils.mkdir_p('content/talks')
6
+ File.write('content/talks/aaa.html', 'A')
7
+ File.write('content/talks/bbb.html', 'B')
8
+ File.write('content/talks.html', '<%= @items.find_all("/talks/*").map { |i| i.raw_content + "=" + i[:status].to_s }.join(" ") %>')
9
+
10
+ File.write('Rules', <<~EOS)
11
+ compile '/**/*' do
12
+ filter :erb
13
+ write ext: 'html'
14
+ end
15
+ EOS
16
+ end
17
+
18
+ before do
19
+ Nanoc::CLI.run(%w[compile])
20
+ end
21
+
22
+ context 'attributes changed using #[]=' do
23
+ before do
24
+ File.write('Rules', <<~EOS)
25
+ preprocess do
26
+ @items['/talks/aaa.*'][:status] = 'archived'
27
+ @items['/talks/bbb.*'][:status] = 'archived'
28
+ end
29
+
30
+ compile '/**/*' do
31
+ filter :erb
32
+ write ext: 'html'
33
+ end
34
+ EOS
35
+ end
36
+
37
+ it 'changes output file' do
38
+ expect { Nanoc::CLI.run(%w[compile]) }
39
+ .to change { File.read('output/talks.html') }
40
+ .from('A= B=')
41
+ .to('A=archived B=archived')
42
+ end
43
+ end
44
+
45
+ context 'attributes changed using update_attributes' do
46
+ before do
47
+ File.write('Rules', <<~EOS)
48
+ preprocess do
49
+ @items['/talks/aaa.*'].update_attributes(status: 'archived')
50
+ @items['/talks/bbb.*'].update_attributes(status: 'archived')
51
+ end
52
+
53
+ compile '/**/*' do
54
+ filter :erb
55
+ write ext: 'html'
56
+ end
57
+ EOS
58
+ end
59
+
60
+ it 'changes output file' do
61
+ expect { Nanoc::CLI.run(%w[compile]) }
62
+ .to change { File.read('output/talks.html') }
63
+ .from('A= B=')
64
+ .to('A=archived B=archived')
65
+ end
66
+ end
67
+
68
+ context 'raw content changed' do
69
+ before do
70
+ File.write('Rules', <<~EOS)
71
+ preprocess do
72
+ @items['/talks/aaa.*'][:status] = 'archived'
73
+ @items['/talks/bbb.*'][:status] = 'current'
74
+ @items['/talks/aaa.*'].raw_content = 'AAH'
75
+ end
76
+
77
+ compile '/**/*' do
78
+ filter :erb
79
+ write ext: 'html'
80
+ end
81
+ EOS
82
+ end
83
+
84
+ it 'changes output file' do
85
+ expect { Nanoc::CLI.run(%w[compile]) }
86
+ .to change { File.read('output/talks.html') }
87
+ .from('A= B=')
88
+ .to('AAH=archived B=current')
89
+ end
90
+ end
91
+ end
@@ -3,18 +3,6 @@
3
3
  require 'helper'
4
4
 
5
5
  class Nanoc::Int::CodeSnippetTest < Nanoc::TestCase
6
- def test_load
7
- # Initialize
8
- $complete_insane_parrot = 'meow'
9
-
10
- # Create code and load it
11
- code_snippet = Nanoc::Int::CodeSnippet.new("$complete_insane_parrot = 'woof'", 'parrot.rb')
12
- code_snippet.load
13
-
14
- # Ensure code is loaded
15
- assert_equal('woof', $complete_insane_parrot)
16
- end
17
-
18
6
  def test_load_with_toplevel_binding
19
7
  # Initialize
20
8
  @foo = 'meow'
@@ -23,7 +23,7 @@ class Nanoc::Int::IdentifiableCollectionTest < Nanoc::TestCase
23
23
  end
24
24
 
25
25
  def test_enumerable
26
- assert_equal @one, @items.find { |i| i.identifier == '/one' }
26
+ assert_equal @one, (@items.find { |i| i.identifier == '/one' })
27
27
  end
28
28
 
29
29
  def test_less_than_less_than
@@ -34,7 +34,7 @@ class Nanoc::Deploying::Deployers::GitTest < Nanoc::TestCase
34
34
  git push origin master
35
35
  EOS
36
36
 
37
- assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
37
+ assert_match Regexp.new(/^#{commands.chomp}$/), (git.instance_eval { @shell_cmd_args.join("\n") })
38
38
  end
39
39
 
40
40
  def test_run_with_clean_repository
@@ -67,7 +67,7 @@ EOS
67
67
  git checkout master
68
68
  EOS
69
69
 
70
- assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
70
+ assert_match Regexp.new(/^#{commands.chomp}$/), (git.instance_eval { @shell_cmd_args.join("\n") })
71
71
  end
72
72
 
73
73
  def test_run_with_custom_options
@@ -103,7 +103,7 @@ EOS
103
103
  git push -f github gh-pages
104
104
  EOS
105
105
 
106
- assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
106
+ assert_match Regexp.new(/^#{commands.chomp}$/), (git.instance_eval { @shell_cmd_args.join("\n") })
107
107
  end
108
108
 
109
109
  def test_run_without_git_init
@@ -138,7 +138,7 @@ EOS
138
138
  git push origin master
139
139
  EOS
140
140
 
141
- assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
141
+ assert_match Regexp.new(/^#{commands.chomp}$/), (git.instance_eval { @shell_cmd_args.join("\n") })
142
142
  end
143
143
 
144
144
  def test_run_with_ssh_url
@@ -173,7 +173,7 @@ EOS
173
173
  git push git@github.com:myself/myproject.git master
174
174
  EOS
175
175
 
176
- assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
176
+ assert_match Regexp.new(/^#{commands.chomp}$/), (git.instance_eval { @shell_cmd_args.join("\n") })
177
177
  end
178
178
 
179
179
  def test_run_with_http_url
@@ -208,7 +208,7 @@ EOS
208
208
  git push https://github.com/nanoc/nanoc.git master
209
209
  EOS
210
210
 
211
- assert_match Regexp.new(/^#{commands.chomp}$/), git.instance_eval { @shell_cmd_args.join("\n") }
211
+ assert_match Regexp.new(/^#{commands.chomp}$/), (git.instance_eval { @shell_cmd_args.join("\n") })
212
212
  end
213
213
 
214
214
  def test_clean_repo_on_a_clean_repo
@@ -8,7 +8,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
8
8
  filter = ::Nanoc::Filters::ERB.new(location: 'a cheap motel')
9
9
 
10
10
  # Run filter
11
- result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>')
11
+ result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>') # rubocop:disable Lint/InterpolationCheck
12
12
  assert_equal('I was hiding in a cheap motel.', result)
13
13
  end
14
14
 
@@ -17,7 +17,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
17
17
  filter = ::Nanoc::Filters::ERB.new(location: 'a cheap motel')
18
18
 
19
19
  # Run filter
20
- result = filter.setup_and_run('<%= "I was hiding in #{location}." %>')
20
+ result = filter.setup_and_run('<%= "I was hiding in #{location}." %>') # rubocop:disable Lint/InterpolationCheck
21
21
  assert_equal('I was hiding in a cheap motel.', result)
22
22
  end
23
23
 
@@ -52,7 +52,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
52
52
  filter = ::Nanoc::Filters::ERB.new(content: 'a cheap motel')
53
53
 
54
54
  # Run filter
55
- result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
55
+ result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>') # rubocop:disable Lint/InterpolationCheck
56
56
  assert_equal('I was hiding in a cheap motel.', result)
57
57
  end
58
58
 
@@ -62,7 +62,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
62
62
 
63
63
  # Run filter
64
64
  assert_raises LocalJumpError do
65
- filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
65
+ filter.setup_and_run('<%= "I was hiding in #{yield}." %>') # rubocop:disable Lint/InterpolationCheck
66
66
  end
67
67
  end
68
68
 
@@ -9,7 +9,7 @@ class Nanoc::Filters::ErubiTest < Nanoc::TestCase
9
9
  filter = ::Nanoc::Filters::Erubi.new(location: 'a cheap motel')
10
10
 
11
11
  # Run filter
12
- result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>')
12
+ result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>') # rubocop:disable Lint/InterpolationCheck
13
13
  assert_equal('I was hiding in a cheap motel.', result)
14
14
  end
15
15
  end
@@ -20,7 +20,7 @@ class Nanoc::Filters::ErubiTest < Nanoc::TestCase
20
20
  filter = ::Nanoc::Filters::Erubi.new(location: 'a cheap motel')
21
21
 
22
22
  # Run filter
23
- result = filter.setup_and_run('<%= "I was hiding in #{location}." %>')
23
+ result = filter.setup_and_run('<%= "I was hiding in #{location}." %>') # rubocop:disable Lint/InterpolationCheck
24
24
  assert_equal('I was hiding in a cheap motel.', result)
25
25
  end
26
26
  end
@@ -48,7 +48,7 @@ class Nanoc::Filters::ErubiTest < Nanoc::TestCase
48
48
  filter = ::Nanoc::Filters::Erubi.new(content: 'a cheap motel')
49
49
 
50
50
  # Run filter
51
- result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
51
+ result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>') # rubocop:disable Lint/InterpolationCheck
52
52
  assert_equal('I was hiding in a cheap motel.', result)
53
53
  end
54
54
  end
@@ -60,7 +60,7 @@ class Nanoc::Filters::ErubiTest < Nanoc::TestCase
60
60
 
61
61
  # Run filter
62
62
  assert_raises LocalJumpError do
63
- filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
63
+ filter.setup_and_run('<%= "I was hiding in #{yield}." %>') # rubocop:disable Lint/InterpolationCheck
64
64
  end
65
65
  end
66
66
  end
@@ -9,7 +9,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
9
9
  filter = ::Nanoc::Filters::Erubis.new(location: 'a cheap motel')
10
10
 
11
11
  # Run filter
12
- result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>')
12
+ result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>') # rubocop:disable Lint/InterpolationCheck
13
13
  assert_equal('I was hiding in a cheap motel.', result)
14
14
  end
15
15
  end
@@ -20,7 +20,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
20
20
  filter = ::Nanoc::Filters::Erubis.new(location: 'a cheap motel')
21
21
 
22
22
  # Run filter
23
- result = filter.setup_and_run('<%= "I was hiding in #{location}." %>')
23
+ result = filter.setup_and_run('<%= "I was hiding in #{location}." %>') # rubocop:disable Lint/InterpolationCheck
24
24
  assert_equal('I was hiding in a cheap motel.', result)
25
25
  end
26
26
  end
@@ -49,7 +49,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
49
49
  filter = ::Nanoc::Filters::Erubis.new(content: 'a cheap motel')
50
50
 
51
51
  # Run filter
52
- result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
52
+ result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>') # rubocop:disable Lint/InterpolationCheck
53
53
  assert_equal('I was hiding in a cheap motel.', result)
54
54
  end
55
55
  end
@@ -61,7 +61,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
61
61
 
62
62
  # Run filter
63
63
  assert_raises LocalJumpError do
64
- filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
64
+ filter.setup_and_run('<%= "I was hiding in #{yield}." %>') # rubocop:disable Lint/InterpolationCheck
65
65
  end
66
66
  end
67
67
  end
@@ -312,24 +312,12 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
312
312
  # TODO: Use xpath matchers for more specific test
313
313
  result = atom_feed
314
314
  # Still should keep feed level author
315
- assert_match(
316
- /#{Regexp.escape('<name>Denis Defreyne</name>')}/, #'
317
- result,
318
- )
319
- assert_match(
320
- /#{Regexp.escape('<uri>http://stoneship.org/</uri>')}/, #'
321
- result,
322
- )
315
+ assert_includes(result, '<name>Denis Defreyne</name>')
316
+ assert_includes(result, '<uri>http://stoneship.org/</uri>')
323
317
 
324
318
  # Overrides on specific items
325
- assert_match(
326
- /#{Regexp.escape('<name>Don Alias</name>')}/, #'
327
- result,
328
- )
329
- assert_match(
330
- /#{Regexp.escape('<uri>http://don.example.com/</uri>')}/, #'
331
- result,
332
- )
319
+ assert_includes(result, '<name>Don Alias</name>')
320
+ assert_includes(result, '<uri>http://don.example.com/</uri>')
333
321
  end
334
322
  end
335
323
 
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.8.5
4
+ version: 4.8.6
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-09-07 00:00:00.000000000 Z
11
+ date: 2017-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: addressable
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.5'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.5'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -513,6 +527,7 @@ files:
513
527
  - spec/nanoc/regressions/gh_1145_spec.rb
514
528
  - spec/nanoc/regressions/gh_1171_spec.rb
515
529
  - spec/nanoc/regressions/gh_1185_spec.rb
530
+ - spec/nanoc/regressions/gh_1216_spec.rb
516
531
  - spec/nanoc/regressions/gh_761_spec.rb
517
532
  - spec/nanoc/regressions/gh_767_spec.rb
518
533
  - spec/nanoc/regressions/gh_769_spec.rb