foodcritic 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWNiNzYyZTkwODc2YjJiZDdmMTVlMzk4OTQxZjQxYThhMWZhMGY1Nw==
4
+ NjUwZWIyMDVhNzYxZjg0YThkNGY5NzQzY2ZkMzA3NjEzZTE4NjNjMg==
5
5
  data.tar.gz: !binary |-
6
- MmFhODIzYTlhYWZhMjI3MDlmMGE4ZWU1NmEwNTkwNDc0NTJiMDEzOA==
6
+ ZWIwYWVlOGNhN2JjYmEzODc1ZTlkMjk3OTYxNmE3MTM3ZDE5MWUyZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YjYxNjgwOWNkYTU4ZmQ2MmU4YzRjODc4OWM0NWEyN2MzMTQwYmViNjZiZmMw
10
- OWE2MWNjOTI0ZjA3NTQyMTQyYmJhNzMwZjhlOTkxMDFiODM2YzI4ZDhkNTYx
11
- ZDhhMDI5MjY3YzQ2YmRjMGY5OTRjNTk1NTcxNmE5MzA3NjIyZGY=
9
+ N2RiYjFkOTBkNWIxNWUyNWNlYjI5ZTBmYmQ0NWQ3MTkzY2U0NGZiNjllMzA3
10
+ YzM0OWFiNjUwYzdmOThkNjJhMzgxZGQyNjhmMjUyNDY3MmM2NTBiMDNhNmM2
11
+ NWM4NjE0MDk2MmZlY2VkYmNlOWQ4NzcxM2U3NDBhOGE5MTllZmE=
12
12
  data.tar.gz: !binary |-
13
- ODlhNjFlNjBiMjc5YTRjYjgxNWFhNDgwM2Y2NmFjNDYxNTZlMzFjOTNmYzYx
14
- MTIyOGJlMDQ4NWQ5ZTNjNzNkODIwMzViNTVhMjk1MTllOWYwYWU4OWNhMGEw
15
- NjIyNDBhMGFjN2NiOTBjMGU5Y2NlNTU3OTI5ZGQ2MmM4MTMyZDk=
13
+ MTBlM2QzM2FmM2Q4ZmIxZDA1NzFhMGRlMTE5NDQ3ODU0NDFlMzc2OWNkOTdj
14
+ NjMwMTBlMTllYTYwOGUxNjZhMTY1ZjYxMTg1YzZjMzY5Y2I4NzM2YzhkNDFk
15
+ YWE4ZDdlN2ZkYWU0ZGViMWM3ZmUwZmZlYzVjMTRmNjA5NTMxZjY=
@@ -1,3 +1,13 @@
1
+ ## 3.0.3 (13th October, 2013)
2
+
3
+ Bugfixes:
4
+
5
+ - [FC051: Template partials loop indefinitely](http://foodcritic.io/#FC051)
6
+ would cause an error for partials included from a subdirectory or where the
7
+ partial did not exist
8
+ ([related issue](https://github.com/acrmp/foodcritic/issues/176)). Thanks
9
+ @claco, @michaelglass.
10
+
1
11
  ## 3.0.2 (5th October, 2013)
2
12
 
3
13
  Bugfixes:
@@ -20,6 +20,18 @@ Feature: Check for template partial includes cycle
20
20
  Then the template partials loop indefinitely warning 051 should be displayed against the templates
21
21
  And no error should have occurred
22
22
 
23
+ Scenario: Relative partial
24
+ Given a template that includes a partial with a relative subdirectory path
25
+ When I check the cookbook
26
+ Then the template partials loop indefinitely warning 051 should not be displayed against the templates
27
+ And no error should have occurred
28
+
29
+ Scenario: Missing partial
30
+ Given a template that includes a missing partial with a relative subdirectory path
31
+ When I check the cookbook
32
+ Then the template partials loop indefinitely warning 051 should not be displayed against the templates
33
+ And no error should have occurred
34
+
23
35
  Scenario Outline: Template directory contains binary files
24
36
  Given a template directory that contains a binary file <file> that is not valid UTF-8
25
37
  When I check the cookbook
@@ -1467,6 +1467,21 @@ Given /^a template that includes a partial( that includes the original template
1467
1467
  write_file 'cookbooks/example/templates/default/b.erb', content
1468
1468
  end
1469
1469
 
1470
+ Given /^a template that includes a (missing )?partial with a relative subdirectory path$/ do |missing|
1471
+ write_recipe %q{
1472
+ template "/tmp/a" do
1473
+ source "a.erb"
1474
+ variables({
1475
+ :config_var => "foo"
1476
+ })
1477
+ end
1478
+ }
1479
+ write_file 'cookbooks/example/templates/default/a.erb', '<%= render "partials/b.erb" %>'
1480
+ unless missing
1481
+ write_file 'cookbooks/example/templates/default/partials/b.erb', 'Partial content'
1482
+ end
1483
+ end
1484
+
1470
1485
  Given 'access to the man page documentation' do
1471
1486
 
1472
1487
  end
@@ -340,10 +340,13 @@ module FoodCritic
340
340
  string_literal//tstring_content/@value').map{|p| p.to_s}
341
341
  Array(template_path) + partials.map do |included_partial|
342
342
  partial_path = Array(all_templates).find do |path|
343
- File.basename(path) == included_partial.to_s
343
+ (Pathname.new(template_path).dirname + included_partial).to_s == path
344
344
  end
345
- Array(partial_path) + templates_included(all_templates, partial_path, depth + 1)
346
- end.flatten.uniq
345
+ if partial_path
346
+ Array(partial_path) +
347
+ templates_included(all_templates, partial_path, depth + 1)
348
+ end
349
+ end.flatten.uniq.compact
347
350
  end
348
351
 
349
352
  # Templates in the current cookbook
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = '3.0.2'
3
+ VERSION = '3.0.3'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foodcritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-05 00:00:00.000000000 Z
11
+ date: 2013-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gherkin
@@ -260,5 +260,5 @@ rubyforge_project:
260
260
  rubygems_version: 2.0.7
261
261
  signing_key:
262
262
  specification_version: 4
263
- summary: foodcritic-3.0.2
263
+ summary: foodcritic-3.0.3
264
264
  test_files: []