kitchen-appbundle-updater 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 169dcc72297817ef7f1f8775acd66e65cd66291c
4
- data.tar.gz: 3e94b22a7dc3578be8207a02789690a4bdeddedb
3
+ metadata.gz: 7488673b66cb66cadc310881c0456274b1210085
4
+ data.tar.gz: 92f3263f36250ece0b18642158b678c88f9eb897
5
5
  SHA512:
6
- metadata.gz: 0ae9b53d1734d787a48172f1718f6f1bd7bcd15774c0670641b87bd250abf9943825f85adacee583057e0b79053485580cf9a130a079b7e8a59153ccff5cd484
7
- data.tar.gz: 8b785ea8891a717f03508823cd684b45ad3b25626de74e4d8dfe6a807e37691beba7457bab7597ab35a7c74fb6665ad1cfc6eee8969bcd480de0dc818ae99e05
6
+ metadata.gz: 32fed6540a8bbd24dd7f28c3f55d72547029e59a2aa396e27bf59cce4ee52803659fa788db403e388f438ab3da86f384d8fb3054fbb643d87f06226f79474d2a
7
+ data.tar.gz: a00282633f1960b67dbbe2014f673d22825ecf8811a3c2ccff8330d9f33cd27f21529be260e19d3d7c6daac81d39ef43f248d8b6fc955cab2b9660fc65717fdd
@@ -1,3 +1,3 @@
1
1
  class KitchenAppbundleUpdater
2
- VERSION = '0.0.4'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'kitchen/provisioner/chef_zero'
2
- require 'kitchen-appbundle-updater/helpers'
3
2
 
4
3
  module Kitchen
5
4
  module Provisioner
@@ -8,50 +7,33 @@ module Kitchen
8
7
  default_config :github_owner, "chef"
9
8
  default_config :github_repo, "chef"
10
9
 
11
- def create_sandbox
12
- super
13
- dna = {
14
- chef_appbundle_updater: {
15
- github_org: config[:github_owner],
16
- github_repo: config[:github_repo],
17
- refname: config[:refname]
18
- }
19
- }
20
-
21
- File.open(File.join(sandbox_path, 'dna_updater.json'), "wb") do |f|
22
- f.write(dna.to_json)
23
- end
24
- end
25
-
26
- def latest_chef_appbundle_updater
27
- url = "https://api.github.com/repos/jaym/chef-appbundle-updater/releases/latest"
28
- url += "?access_token=#{config[:github_access_token]}" if config[:github_access_token]
29
-
30
- @cookbook_url ||= open(url) do |r|
31
- j = JSON.parse(r.read)
32
- j["assets"][0]["browser_download_url"]
33
- end
34
- end
35
-
36
10
  def prepare_command
37
- [
38
- prepare_command_vars,
39
- KitchenAppbundleUpdater::Helpers.load_file("chef_base_updater", powershell_shell?)
40
- ].join("\n")
11
+ gem_bin = remote_path_join(config[:ruby_bindir], "gem").
12
+ tap { |path| path.concat(".bat") if windows_os? }
13
+ appbundle_updater_bin = remote_path_join(config[:ruby_bindir], "appbundle-updater").
14
+ tap { |path| path.concat(".bat") if windows_os? }
15
+ vars = [
16
+ shell_var("refname", config[:refname]),
17
+ shell_var("github_owner", config[:github_owner]),
18
+ shell_var("github_repo", config[:github_repo]),
19
+ shell_var("gem", sudo(gem_bin)),
20
+ shell_var("appbundle_updater", sudo(appbundle_updater_bin)),
21
+ ].join("\n").concat("\n")
22
+
23
+ my_shell_code_from_file(vars, "chef_base_updater")
41
24
  end
42
25
 
43
- def prepare_command_vars
44
- vars = [
45
- shell_var("cookbook_url", latest_chef_appbundle_updater),
46
- shell_var("json", File.join(config[:root_path], 'dna_updater.json')),
47
- shell_var("chef_omnibus_root", config[:chef_omnibus_root]),
48
- ]
26
+ private
27
+
28
+ # need to override and use __FILE__ relative to this plugin
29
+ def my_shell_code_from_file(vars, file)
30
+ src_file = File.join(
31
+ File.dirname(__FILE__),
32
+ %w[.. .. .. support],
33
+ file + (powershell_shell? ? ".ps1" : ".sh")
34
+ )
49
35
 
50
- if powershell_shell?
51
- vars.join("\n")
52
- else
53
- vars.join(";\n")
54
- end
36
+ wrap_shell_code([vars, "", IO.read(src_file)].join("\n"))
55
37
  end
56
38
 
57
39
  end
@@ -1,8 +1,4 @@
1
1
  $ErrorActionPreference = "Stop";
2
2
 
3
- Function Log($m) { Write-Host " $m`n" }
4
-
5
- Log "Finding cookbook to update chef"
6
- $env:Path = $env:Path + ";$chef_omnibus_root\bin\"
7
- Log "Running chef-client with recipe chef-appbundle-updater::default from $cookbook_url"
8
- & "$chef_omnibus_root\bin\chef-client.bat" -z --recipe-url "$cookbook_url" -j "$json" -o "recipe[chef-appbundle-updater::default]"
3
+ & "$gem" install appbundle-updater
4
+ & "$appbundle_updater" chef chef "$refname" --tarball --github "$github_owner/$github_repo"
@@ -1,12 +1,4 @@
1
1
  set -e
2
2
 
3
- # main
4
- main() {
5
- sudo "$chef_omnibus_root/bin/chef-client" -z --recipe-url "$cookbook_url" -j "$json" -o "recipe[chef-appbundle-updater::default]"
6
- }
7
-
8
- # augment path in an attempt to find a download program
9
- PATH="${PATH}:/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/sfw/bin";
10
- export PATH;
11
-
12
- main
3
+ $gem install appbundle-updater
4
+ $appbundle_updater chef chef $refname --tarball --github $github_owner/$github_repo
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-appbundle-updater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Mundrawala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-25 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,6 @@ files:
98
98
  - Rakefile
99
99
  - kitchen-appbundle-updater.gemspec
100
100
  - lib/kitchen-appbundle-updater.rb
101
- - lib/kitchen-appbundle-updater/helpers.rb
102
101
  - lib/kitchen-appbundle-updater/version.rb
103
102
  - lib/kitchen/provisioner/chef_github.rb
104
103
  - support/chef_base_updater.ps1
@@ -123,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
122
  version: '0'
124
123
  requirements: []
125
124
  rubyforge_project:
126
- rubygems_version: 2.4.5
125
+ rubygems_version: 2.4.3
127
126
  signing_key:
128
127
  specification_version: 4
129
128
  summary: A Test Kitchen Driver for Appbundle-updater
@@ -1,12 +0,0 @@
1
- class KitchenAppbundleUpdater
2
- class Helpers
3
- def self.load_file(file, is_powershell)
4
- src_file = File.join(
5
- File.dirname(__FILE__),
6
- %w[.. .. support],
7
- file + (is_powershell ? ".ps1" : ".sh")
8
- )
9
- IO.read(src_file)
10
- end
11
- end
12
- end