kitchen-appbundle-updater 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4edecac847c0d47ba64b91b40a1a84ea11a5b679
4
+ data.tar.gz: 6854a9d9644a6edfc3538be24c670d04decee392
5
+ SHA512:
6
+ metadata.gz: 2f114548d308685eeed284a5d008dc2b59caca61453637a59c1ddbf79e3663e30381ad41c819321254cdf2e49fda2b75ff199b6a9688c7d33c2394451b9f9654
7
+ data.tar.gz: 0edc59609924a473c01b8a96283700b7a4b37c70c2a07c9bb1a94845344df524d7bdd2905dd5ee84f1ddfd2df03bbd042fc2400db48227c03ece8bb458246a27
data/.cane ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.tailor ADDED
@@ -0,0 +1,4 @@
1
+ Tailor.config do |config|
2
+ config.formatters "text"
3
+ config.file_set 'lib/**/*.rb'
4
+ end
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / Unreleased
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Jay Mundrawala (<jdmundrawala@gmail.com>)
2
+
3
+ Copyright (C) 2015, Jay Mundrawala
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # <a name="title"></a> kitchen-appbundle-updater
2
+
3
+ A Test Kitchen Driver that will use a version of Chef-Client from Github.
4
+ It provides a provisioner based on `Kitchen::Provisioner::ChefZero`. There
5
+ is currently no support for `chef-solo`.
6
+
7
+ ## <a name="requirements"></a> Requirements
8
+ ### Test-Kitchen
9
+ This provider requires [Test-Kitchen](https://github.com/test-kitchen/test-kitchen) `~> 1.4`.
10
+
11
+ ## <a name="installation"></a> Installation and Setup
12
+ Add the following to your Gemfile:
13
+ ```ruby
14
+ gem "test-kitchen", "~> 1.4.0.rc.1"
15
+ gem 'kitchen-appbundle-updater', git: "https://github.com/jdmundrawala/kitchen-appbundle-updater.git"
16
+ ```
17
+
18
+ You can use the provided provisioner by modifying the `provisioner` section
19
+ in your `.kitchen.yml` to look like:
20
+ ```yaml
21
+ provisioner:
22
+ name: chef_github
23
+ ```
24
+
25
+ ## <a name="config"></a> Configuration
26
+
27
+ ### <a name="config-chef-gitref"></a> chef\_gitref
28
+
29
+ The branch, tag, or SHA to use. The default value is `master`.
30
+
31
+ ### <a name="config-chef-gitorg"></a> chef\_gitorg
32
+
33
+ The Github org or user which owns the repository. The default value is `chef`.
34
+
35
+ ### <a name="config-chef-gitorg"></a> chef\_gitrepo
36
+
37
+ The name of the repository. The default value is `chef`.
38
+
39
+ ## <a name="development"></a> Development
40
+
41
+ * Source hosted at [GitHub][repo]
42
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
43
+
44
+ Pull requests are very welcome! Make sure your patches are well tested.
45
+ Ideally create a topic branch for every separate change you make. For
46
+ example:
47
+
48
+ 1. Fork the repo
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create new Pull Request
53
+
54
+ ## <a name="authors"></a> Authors
55
+
56
+ Created and maintained by [Jay Mundrawala][author] (<jdmundrawala@gmail.com>)
57
+
58
+ ## <a name="license"></a> License
59
+
60
+ Apache 2.0 (see [LICENSE][license])
61
+
62
+
63
+ [author]: https://github.com/jdmundrawala
64
+ [issues]: https://github.com/jdmundrawala/kitchen-appbundle-updater/issues
65
+ [license]: https://github.com/jdmundrawala/kitchen-appbundle-updater/blob/master/LICENSE
66
+ [repo]: https://github.com/jdmundrawala/kitchen-appbundle-updater
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen-appbundle-updater/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-appbundle-updater'
8
+ spec.version = KitchenAppbundleUpdater::VERSION
9
+ spec.authors = ['Jay Mundrawala']
10
+ spec.email = ['jdmundrawala@gmail.com']
11
+ spec.description = %q{A Test Kitchen Driver for Appbundle-updater}
12
+ spec.summary = spec.description
13
+ spec.homepage = ''
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ #spec.add_dependency 'test-kitchen', '~> 1.0.0.alpha.3'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+
26
+ spec.add_development_dependency 'cane'
27
+ spec.add_development_dependency 'tailor'
28
+ spec.add_development_dependency 'countloc'
29
+ end
File without changes
@@ -0,0 +1,12 @@
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
@@ -0,0 +1,3 @@
1
+ class KitchenAppbundleUpdater
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,48 @@
1
+ require 'kitchen/provisioner/chef_zero'
2
+ require 'kitchen-appbundle-updater/helpers'
3
+
4
+ module Kitchen
5
+ module Provisioner
6
+ class ChefGithub < Kitchen::Provisioner::ChefZero
7
+ default_config :refname, "master"
8
+ default_config :github_owner, "chef"
9
+ default_config :github_repo, "chef"
10
+
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 prepare_command
27
+ [
28
+ prepare_command_vars,
29
+ KitchenAppbundleUpdater::Helpers.load_file("chef_base_updater", powershell_shell?)
30
+ ].join("\n")
31
+ end
32
+
33
+ def prepare_command_vars
34
+ vars = [
35
+ shell_var("json", File.join(config[:root_path], 'dna_updater.json')),
36
+ shell_var("chef_omnibus_root", config[:chef_omnibus_root]),
37
+ ]
38
+
39
+ if powershell_shell?
40
+ vars.join("\n")
41
+ else
42
+ vars.join(";\n")
43
+ end
44
+ end
45
+
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,10 @@
1
+ $ErrorActionPreference = "Stop";
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
+ $response = Invoke-WebRequest "https://api.github.com/repos/jdmundrawala/chef-appbundle-updater/releases/latest"
8
+ $url = ($response.Content | ConvertFrom-Json).assets[0].browser_download_url
9
+ Log "Running chef-client with recipe chef-appbundle-updater::default from $url"
10
+ & "$chef_omnibus_root\bin\chef-client.bat" -z --recipe-url "$url" -j "$json" -o "recipe[chef-appbundle-updater::default]"
@@ -0,0 +1,14 @@
1
+ set -e
2
+
3
+ # main
4
+ main() {
5
+ url=`curl -s "https://api.github.com/repos/jdmundrawala/chef-appbundle-updater/releases/latest" | \
6
+ "$chef_omnibus_root/embedded/bin/ruby" -rjson -e 'j=JSON.parse(STDIN.read); puts j["assets"][0]["browser_download_url"]'`
7
+ sudo "$chef_omnibus_root/bin/chef-client" -z --recipe-url "$url" -j "$json" -o "recipe[chef-appbundle-updater::default]"
8
+ }
9
+
10
+ # augment path in an attempt to find a download program
11
+ PATH="${PATH}:/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/sfw/bin";
12
+ export PATH;
13
+
14
+ main
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-appbundle-updater
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jay Mundrawala
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cane
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: tailor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: countloc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A Test Kitchen Driver for Appbundle-updater
84
+ email:
85
+ - jdmundrawala@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".cane"
91
+ - ".gitignore"
92
+ - ".tailor"
93
+ - ".travis.yml"
94
+ - CHANGELOG.md
95
+ - Gemfile
96
+ - LICENSE
97
+ - README.md
98
+ - Rakefile
99
+ - kitchen-appbundle-updater.gemspec
100
+ - lib/kitchen-appbundle-updater.rb
101
+ - lib/kitchen-appbundle-updater/helpers.rb
102
+ - lib/kitchen-appbundle-updater/version.rb
103
+ - lib/kitchen/provisioner/chef_github.rb
104
+ - support/chef_base_updater.ps1
105
+ - support/chef_base_updater.sh
106
+ homepage: ''
107
+ licenses:
108
+ - Apache 2.0
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.4.4
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: A Test Kitchen Driver for Appbundle-updater
130
+ test_files: []
131
+ has_rdoc: