batali-tk 0.2.2 → 0.2.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54db81e5be411cd1c943f95b2bf1eac5334ea685
4
- data.tar.gz: 04c5afb6cba6959d7c2d496baea8b5cb566a8c70
3
+ metadata.gz: 86d46ac8fcec3698fa480ebcd8994a6e955608dc
4
+ data.tar.gz: c322dcd58a4ad29bcc2aca6942c0efe993f9661a
5
5
  SHA512:
6
- metadata.gz: f90ff6db2f2a6001cd1fa33d7f1a79d77a3b199a610f21f773ee604f6d72601db99053944683a2e29b643f84d8fba4580184c096dac96fd11009cab250a0f1a3
7
- data.tar.gz: 86c4c2b233293cb02419dcc9748d56600aa9652b6cd7f36e23021837c1bb63095e55c2549fcca50e835062f422002e4963a5da268ee1e7d4834f896934006496
6
+ metadata.gz: 440ece530e06205ac4495388866017980a4a3533104a7951ade18280d19c5dff7039264bb50b47b2f478325bfb4ff7e8ed1f650e191c61a0e5f9486b03750972
7
+ data.tar.gz: 9097f9fbc9bd7bd3d50e62565cdd2d5ad16b5dfec5f2ceed97d017836ea5d06ab94a76386906689e78b003f84e36cde544cb0ecd468965f62d3c5e27ddcaf097
@@ -1,3 +1,7 @@
1
+ # v0.2.4
2
+ * [fix] Relative paths for single cookbook resolution
3
+ * [fix] Use custom cache directory on ephemeral batali files in infra mode
4
+
1
5
  # v0.2.2
2
6
  * [fix] Only change working directory if providing cookbook path (#2)
3
7
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = 'Batali support injector for test kitchen'
11
11
  s.require_path = 'lib'
12
12
  s.license = 'Apache 2.0'
13
- s.add_runtime_dependency 'batali', '>= 0.2.33', '< 1'
13
+ s.add_runtime_dependency 'batali', '>= 0.2.33', '< 0.5'
14
14
  s.add_runtime_dependency 'test-kitchen', BataliTk::TK_CONSTRAINT
15
15
  s.executables << 'batali-tk'
16
16
  s.files = Dir['{lib,bin}/**/**/*'] + %w(batali-tk.gemspec README.md CHANGELOG.md CONTRIBUTING.md LICENSE)
@@ -3,16 +3,22 @@
3
3
  Signal.trap("INT") { exit 1 }
4
4
  require 'bogo'
5
5
  require 'batali'
6
+ require 'tmpdir'
6
7
 
7
8
  if(idx = ARGV.index('--batali-cookbook-path'))
9
+ cache_path = Dir.mktmpdir('batali-tk-cache')
8
10
  _, cookbook_path = ARGV.slice!(idx, 2)
9
- cookbook_info = Batali::Origin::Path.new(:name => 'metadata', :path => File.expand_path(cookbook_path))
11
+ cookbook_info = Batali::Origin::Path.new(
12
+ :name => 'metadata',
13
+ :path => File.expand_path(cookbook_path),
14
+ :cache_path => cache_path
15
+ )
10
16
  cookbook_name = cookbook_info.units.first.name
11
17
  ckbk_batali = File.join(File.expand_path(cookbook_path), 'Batali')
12
- origin_batali = Batali::BFile.new(File.expand_path('./Batali'))
18
+ origin_batali = Batali::BFile.new(File.expand_path('./Batali'), cache_path)
13
19
  origin_batali.cookbook.delete_if{|item| item.name == cookbook_name}
14
20
  if(File.exists?(ckbk_batali))
15
- ckbk_b = Batali::BFile.new(ckbk_batali)
21
+ ckbk_b = Batali::BFile.new(ckbk_batali, cache_path)
16
22
  new_batali_data = MultiJson.dump(
17
23
  MultiJson.load(
18
24
  MultiJson.dump(ckbk_b.data)
@@ -52,6 +58,7 @@ if(idx = ARGV.index('--batali-cookbook-path'))
52
58
  ENV['KITCHEN_YAML'] = File.expand_path(
53
59
  File.join('.', cookbook_path, '.kitchen.yml')
54
60
  )
61
+ FileUtils.rm_rf(cache_path)
55
62
  puts "!! Batali test-kitchen infra-repo override for `#{cookbook_name}` @ `#{cookbook_path}`"
56
63
  end
57
64
  if(idx = ARGV.index('--batali-environment'))
@@ -48,32 +48,53 @@ module Kitchen
48
48
  debug "Using Batali file located at: #{batali_file}"
49
49
  output = ''
50
50
  begin
51
- FileUtils.cp(
52
- batali_file,
53
- File.join(
54
- File.dirname(vendor_path),
55
- 'Batali'
51
+ if(ENV['KITCHEN_BATALI_FILE'])
52
+ debug 'Running Batali resolution in full vendor directory isolation'
53
+ FileUtils.cp(
54
+ batali_file,
55
+ File.join(
56
+ File.dirname(vendor_path),
57
+ 'Batali'
58
+ )
56
59
  )
57
- )
58
- Dir.chdir(File.dirname(vendor_path)) do
60
+ Dir.chdir(File.dirname(vendor_path)) do
61
+ ::Batali::Command::Update.new(
62
+ Smash.new(
63
+ :path => vendor_path,
64
+ :update => {
65
+ :install => true,
66
+ :environment => ENV['KITCHEN_BATALI_ENVIRONMENT'],
67
+ :infrastructure => false
68
+ },
69
+ :ui => Bogo::Ui.new(
70
+ :app_name => 'Batali',
71
+ :output_to => StringIO.new(output)
72
+ ),
73
+ ),
74
+ []
75
+ ).execute!
76
+ end
77
+ else
59
78
  ::Batali::Command::Update.new(
60
79
  Smash.new(
61
- :path => vendor_path,
62
- :update => {
63
- :install => true,
64
- :environment => ENV['KITCHEN_BATALI_ENVIRONMENT'],
65
- :infrastructure => false
66
- },
67
- :ui => Bogo::Ui.new(
68
- :app_name => 'Batali',
69
- :output_to => StringIO.new(output)
80
+ :file => batali_file,
81
+ :path => vendor_path,
82
+ :update => {
83
+ :install => true,
84
+ :environment => ENV['KITCHEN_BATALI_ENVIRONMENT'],
85
+ :infrastructure => false
86
+ },
87
+ :ui => Bogo::Ui.new(
88
+ :app_name => 'Batali',
89
+ :output_to => StringIO.new(output)
90
+ ),
70
91
  ),
71
- ),
72
92
  []
73
93
  ).execute!
74
94
  end
75
95
  rescue => e
76
96
  error "Batali failed to install cookbooks! #{e.class}: #{e}"
97
+ raise e
77
98
  end
78
99
  debug "Batali output:\n#{output}"
79
100
  end
@@ -1,6 +1,6 @@
1
1
  module BataliTk
2
2
  # Library version
3
- VERSION = Gem::Version.new('0.2.2')
3
+ VERSION = Gem::Version.new('0.2.4')
4
4
  # Constraint for test-kitchen dependency
5
5
  TK_CONSTRAINT = '~> 1.3'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batali-tk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-11 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: batali
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.2.33
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '1'
22
+ version: '0.5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.2.33
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '1'
32
+ version: '0.5'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: test-kitchen
35
35
  requirement: !ruby/object:Gem::Requirement