rake-chef-syntax 0.0.1 → 0.0.2

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.
@@ -4,11 +4,33 @@ namespace :chef do
4
4
  desc "Run knife cookbook test to validate syntax of cookbooks"
5
5
  task :syntax_check do
6
6
  puts "Running knife cookbook test ... "
7
- if File.exists?('cookbooks')
8
- sh "knife cookbook test -a -o cookbooks/"
9
- else
10
- sh "knife cookbook test -a -o ."
7
+ with_knife_rb do |knife_rb|
8
+ if File.exists?('cookbooks')
9
+ sh "knife cookbook test -c #{knife_rb} -a -o cookbooks/"
10
+ else
11
+ sh "knife cookbook test -c #{knife_rb} -a -o ."
12
+ end
11
13
  end
12
14
  puts "knife cookbook test FINISHED."
13
15
  end
16
+
17
+ def with_knife_rb
18
+ knife_rb = "tests/knife.rb"
19
+ cachedir = "tests/knife_test_checksums"
20
+
21
+ begin
22
+ rm_rf cachedir
23
+ mkdir_p cachedir
24
+ open(knife_rb, 'w') do |f|
25
+ f.write <<-EOS
26
+ cache_type 'BasicFile'
27
+ cache_options(:path => "#{ENV['HOME']}/.chef/checksums")
28
+ EOS
29
+ end
30
+ yield knife_rb
31
+ ensure
32
+ rm_rf knife_rb
33
+ rm_rf cachedir
34
+ end
35
+ end
14
36
  end
@@ -1,7 +1,7 @@
1
1
  module Rake
2
2
  module Chef
3
3
  module Syntax
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-chef-syntax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: