vagrant-chef-zero 0.7.1 → 1.0.1

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: 45cde9f7c0293750b98e4631ebd925c2a6d84ddc
4
- data.tar.gz: 691e313b7ca8f08848a2f5ac61bd19f5be70786b
3
+ metadata.gz: 95b7e4ea36f583297a2632a418172672668932c9
4
+ data.tar.gz: b9a79fabb9e47bbf32588a1f6c7213c3e7656616
5
5
  SHA512:
6
- metadata.gz: bd7fc1d993303d814eadc468aed5c1f2cb36ba1b363bb295d1fc51ac76ce018b832ba1a15c2cffd785fd3e20d62999d3bea72fc5c8da17cd9dfd77da339e2f2b
7
- data.tar.gz: 0b51a18ba843b2c86dd879a19e1b6bd5d4ccb3faaea9c0fe0403a77dddca253736fab47c902bf01d41ff55e60b94d6d9069f566a94a2088893c46b1632e03604
6
+ metadata.gz: 4dc562a1fbb141e7b0518249dd3dfae3bc24704153cd984fa57c2478a4528d0893c2a3f2e8fd11e9d7933b64e9220efd70f2dfcfc691cb4deb41e6b72b0a3ee8
7
+ data.tar.gz: 5b74aa9fdb90b29604d3b25d6931946368963cb32eecfb4dde778a569111abf68d9dd7cdbddf00da21e5bbab0bf7f517ef09d3998a44fafc1269f786199cd807
data/.gitignore CHANGED
@@ -4,3 +4,6 @@
4
4
  pkg
5
5
  coverage
6
6
  Berksfile
7
+ Gemfile.lock
8
+ vagrant-chef-zero-*.gem
9
+ vendor/
@@ -1,6 +1,9 @@
1
1
  language: ruby
2
+ notifications:
3
+ email:
4
+ - int-toolkit@schubergphilis.com
5
+ sudo: false
6
+ cache: bundler
2
7
  rvm:
3
8
  - 2.1.2
4
- branches:
5
- only:
6
- - master
9
+ script: rake
@@ -1,6 +1,21 @@
1
+ ## 1.0.0
2
+
3
+ * Allow using relative paths in plugin configuration (PR #27)
4
+ * Upload a cookbook even if it had been frozen (PR #60)
5
+ * Fix network unreacheable error when destroying VMs (PR #62)
6
+ * Fix provisioner name discovery for non standard Vagrantfile (PR #66)
7
+ * Add support for Vagrant 1.7 (PR #68)
8
+ * Include ruby windows dependencies (PR #68)
9
+ * Run the plugin with the same ruby as vagrant (PR #68)
10
+
11
+ ## License Change
12
+
13
+ * April 15, 2015 license changed to Apache License v2.0 to allow the new maintainer to work on this project during working hours.
14
+
1
15
  ## 0.7.1
2
16
 
3
17
  * Allow passing in mixed cookbook directories and absolute paths. Thanks @jesseadams
18
+ * Some minor development fixes regarding ruby
4
19
 
5
20
  ## 0.7.0
6
21
 
data/Gemfile CHANGED
@@ -6,7 +6,9 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.6.2"
9
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git", :tag => "v1.7.2"
10
+
11
+ gem 'coveralls', require: false
10
12
 
11
13
  gem "mocha"
12
14
  gem "simplecov"
@@ -15,6 +17,12 @@ group :development do
15
17
 
16
18
  end
17
19
 
20
+ # Windows platform requirements to run chef-zero
21
+ platforms :mswin, :mingw do
22
+ gem "ruby-wmi"
23
+ gem "win32-service"
24
+ end
25
+
18
26
  # Force Vagrant to load our plugin during development (assume we are running from top level)
19
27
  group :plugins do
20
28
  gem "vagrant-berkshelf", ">= 2.0.1"
@@ -1,18 +1,202 @@
1
- Copyright (c) 2013 Andrew Gross
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
- the Software, and to permit persons to whom the Software is furnished to do so,
8
- subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md CHANGED
@@ -1,12 +1,9 @@
1
-
2
- NOTE: This version (`0.5.0`) is in beta status as I have not had time to fully test it due to issues with my Vagrant environment (old versions will still be availabe in the `0.4.X` series)
3
-
4
-
5
1
  # Vagrant-Chef-Zero
6
- [![Build Status](https://travis-ci.org/andrewgross/vagrant-chef-zero.svg)](https://travis-ci.org/andrewgross/vagrant-chef-zero)
7
- [![Code Climate](https://codeclimate.com/github/andrewgross/vagrant-chef-zero.png)](https://codeclimate.com/github/andrewgross/vagrant-chef-zero)
8
- [![Dependency Status](https://gemnasium.com/andrewgross/vagrant-chef-zero.png)](https://gemnasium.com/andrewgross/vagrant-chef-zero)
9
- [![Coverage Status](https://coveralls.io/repos/andrewgross/vagrant-chef-zero/badge.png)](https://coveralls.io/r/andrewgross/vagrant-chef-zero)
2
+ [![Build Status](https://travis-ci.org/schubergphilis/vagrant-chef-zero.svg)](https://travis-ci.org/schubergphilis/vagrant-chef-zero)
3
+ [![Code Climate](https://codeclimate.com/github/schubergphilis/vagrant-chef-zero.png)](https://codeclimate.com/github/schubergphilis/vagrant-chef-zero)
4
+ [![Dependency Status](https://gemnasium.com/schubergphilis/vagrant-chef-zero.png)](https://gemnasium.com/schubergphilis/vagrant-chef-zero)
5
+ [![Coverage Status](https://coveralls.io/repos/schubergphilis/vagrant-chef-zero/badge.png)](https://coveralls.io/r/schubergphilis/vagrant-chef-zero)
6
+ [![Gem Version](https://badge.fury.io/rb/vagrant-chef-zero.svg)](http://badge.fury.io/rb/vagrant-chef-zero)
10
7
 
11
8
  This is a plugin designed to help integrate Chef-Zero into a Vagrant run, similar to Berkshelf. Chef-Zero will be started on the host machine and populated with the specified data. When the Vagrant machine is destroyed Chef-Zero will be killed.
12
9
 
@@ -57,7 +54,7 @@ config.chef_zero.chef_repo_path = "../foobar/my_repo/"
57
54
 
58
55
  As Vagrant is booting up, `vagrant-chef-zero` will search each specified location for files to upload to Chef-Zero. The upload will be done via Ridley APIs.
59
56
 
60
- Check out the included [Vagrantfile](https://github.com/andrewgross/vagrant-chef-zero/blob/master/Vagrantfile) for example usage.
57
+ Check out the included [Vagrantfile](https://github.com/schubergphilis/vagrant-chef-zero/blob/master/Vagrantfile) for example usage.
61
58
 
62
59
  ### Cookbooks
63
60
 
@@ -106,3 +103,5 @@ Not required. As `Chef-Zero` does no authentication we can fake this. If it is
106
103
  * Jesse Adams (@jesseadams)
107
104
  * Andrew Havens (@andrewhavens)
108
105
  * Bao Nguyen (@sysbot)
106
+ * Miguel Ferreira (@miguelaferreira)
107
+ * Timothy van Zadelhoff (@j00p34)
data/Rakefile CHANGED
@@ -9,9 +9,26 @@ $stderr.sync = true
9
9
  # Change to the directory of this file.
10
10
  Dir.chdir(File.expand_path("../", __FILE__))
11
11
 
12
+ if (Rake.application.top_level_tasks == ["build"] or
13
+ Rake.application.top_level_tasks.include?("install"))
14
+ module Bundler
15
+ class GemHelper
16
+ def build_gem
17
+ file_name = nil
18
+ sh("USE_GIT_VERSION=1 gem build -V '#{spec_path}'") { |out, code|
19
+ file_name = File.basename(built_gem_path)
20
+ FileUtils.mkdir_p(File.join(base, 'pkg'))
21
+ FileUtils.mv(built_gem_path, 'pkg')
22
+ Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}."
23
+ }
24
+ File.join(base, 'pkg', file_name)
25
+ end
26
+ end
27
+ end
28
+ end
29
+
12
30
  # Make testing the default task
13
31
  task :default => "rspec_test"
14
-
15
32
  task :rspec_test do |t|
16
33
  test_output = %x[ bundle exec rspec spec ]
17
34
  puts test_output
@@ -16,6 +16,15 @@ module VagrantPlugins
16
16
  unless chef_zero_enabled?(env)
17
17
  return @app.call(env)
18
18
  end
19
+ EnvHelpers.mutex.synchronize do
20
+ active = EnvHelpers.active_machines(env)
21
+ active.delete_if do |name, provider|
22
+ name == env[:machine].name
23
+ end
24
+ unless active.empty?
25
+ return @app.call(env)
26
+ end
27
+ end
19
28
  stop_chef_zero(env)
20
29
  rm_knife_config(env)
21
30
 
@@ -39,7 +39,7 @@ module VagrantPlugins
39
39
  cookbooks.each do |cookbook|
40
40
  name = File.basename(cookbook)
41
41
  env[:chef_zero].ui.info("Uploading Cookbook #{name}")
42
- @conn.cookbook.upload(cookbook, options: {name: name})
42
+ @conn.cookbook.upload(cookbook, options = { force: true })
43
43
  end
44
44
  end
45
45
 
@@ -40,7 +40,7 @@ module VagrantPlugins
40
40
  attr_reader :chef_repo_path
41
41
 
42
42
  def chef_repo_path=(path)
43
- @chef_repo_path = path
43
+ @chef_repo_path = File.expand_path(path)
44
44
  @roles = path_exists?("#{path}/roles") ? "#{path}/roles" : nil
45
45
  @environments = path_exists?("#{path}/environments") ? "#{path}/environments" : nil
46
46
  @nodes = path_exists?("#{path}/nodes") ? "#{path}/nodes" : nil
@@ -70,14 +70,28 @@ module VagrantPlugins
70
70
  def finalize!
71
71
  @enabled = true if @enabled == UNSET_VALUE
72
72
  @roles = nil if @roles == UNSET_VALUE
73
+ @roles = expand_paths(@roles) if @roles
73
74
  @environments = nil if @environments == UNSET_VALUE
75
+ @environments = expand_paths(@environments) if @environments
74
76
  @nodes = nil if @nodes == UNSET_VALUE
77
+ @nodes = expand_paths(@nodes) if @nodes
75
78
  @cookbooks = nil if @cookbooks == UNSET_VALUE
79
+ @cookbooks = expand_paths(@cookbooks) if @cookbooks
76
80
  @data_bags = nil if @data_bags == UNSET_VALUE
81
+ @data_bags = expand_paths(@data_bags) if @data_bags
77
82
  @chef_repo_path = nil if @chef_repo_path == UNSET_VALUE
78
83
  {}
79
84
  end
80
85
 
86
+ private
87
+
88
+ def expand_paths(attribute)
89
+ if attribute.kind_of?(Array)
90
+ attribute.map { |path| File.expand_path(path) }
91
+ else
92
+ File.expand_path(attribute)
93
+ end
94
+ end
81
95
  end
82
96
  end
83
97
  end
@@ -2,6 +2,15 @@ module VagrantPlugins
2
2
  module ChefZero
3
3
  module EnvHelpers
4
4
 
5
+ def self.mutex
6
+ # handle actions that may run in parallel with certain providers
7
+ @mutex ||= Mutex.new
8
+ end
9
+
10
+ def self.active_machines(env)
11
+ @active ||= env[:machine].env.active_machines
12
+ end
13
+
5
14
  def write_knife_config(env)
6
15
  File.open("#{env[:root_path]}/.zero-knife.rb", 'w') do |f|
7
16
  f.puts <<-EOF
@@ -35,7 +44,9 @@ module VagrantPlugins
35
44
  end
36
45
 
37
46
  def provisioners(name, env)
38
- env[:machine].config.vm.provisioners.select { |prov| prov.name == name }
47
+ env[:machine].config.vm.provisioners.select { |prov|
48
+ ( defined? prov.type and prov.type == name ) or prov.name == name
49
+ }
39
50
  end
40
51
 
41
52
  def get_validation_client_name(env)
@@ -21,7 +21,7 @@ module VagrantPlugins
21
21
  end
22
22
 
23
23
  def destroy(hook)
24
- hook.before(VagrantPlugins::ProviderVirtualBox::Action::DestroyUnusedNetworkInterfaces, VagrantPlugins::ChefZero::Action.chef_zero_destroy)
24
+ hook.after(::Vagrant::Action::Builtin::ConfigValidate, VagrantPlugins::ChefZero::Action.chef_zero_destroy)
25
25
  end
26
26
 
27
27
  end
@@ -52,4 +52,4 @@ module VagrantPlugins
52
52
 
53
53
  end
54
54
  end
55
- end
55
+ end
@@ -1,3 +1,5 @@
1
+ require 'vagrant/util'
2
+
1
3
  module VagrantPlugins
2
4
  module ChefZero
3
5
  module ServerHelpers
@@ -56,7 +58,10 @@ module VagrantPlugins
56
58
  end
57
59
 
58
60
  def fork_process(command, host, port, env)
59
- IO.popen("#{command} --host #{host} --port #{port} 2>&1 > /dev/null")
61
+ ruby_bin = Pathname.new(Vagrant::Util::Which.which("ruby")).to_s
62
+ pid = Process.spawn("#{ruby_bin} #{command} --host #{host} --port #{port}",
63
+ :out=>File::NULL, :err=>File::NULL)
64
+ Process.detach pid
60
65
  env[:chef_zero].ui.info("Starting Chef Zero at http://#{host}:#{port}")
61
66
  end
62
67
 
@@ -94,7 +99,7 @@ module VagrantPlugins
94
99
  begin
95
100
  TCPSocket.new(ip, port).close
96
101
  true
97
- rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
102
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ENETUNREACH
98
103
  false
99
104
  end
100
105
  end
@@ -1,5 +1,35 @@
1
1
  module VagrantPlugins
2
2
  module ChefZero
3
- VERSION = "0.7.1"
3
+ VERSION = "1.0.1"
4
+ NAME = "vagrant-chef-zero"
5
+
6
+ def self.describe(opts={})
7
+ query = 'git describe --tags --match="v*"'
8
+ args = opts.map do |k, v|
9
+ "--#{k.to_s}=#{v.to_s}"
10
+ end.join(" ")
11
+ `#{query} #{args}`
12
+ end
13
+
14
+ def self.git_version(options = {})
15
+ version = self.describe(options).chomp
16
+ version.gsub!('-', '.')
17
+ version = version[1..-1] if version.start_with?("v")
18
+ end
19
+
20
+ def self.get_version
21
+ if Gem.loaded_specs.key?(NAME)
22
+ # installed version
23
+ version = Gem.loaded_specs[NAME].version
24
+ elsif ENV['USE_GIT_VERSION'] == "1"
25
+ version = self.git_version()
26
+ if Gem::Version.new(version) < Gem::Version.new(VERSION)
27
+ version = VERSION
28
+ end
29
+ else
30
+ version = VERSION
31
+ end
32
+ version
33
+ end
4
34
  end
5
35
  end
@@ -9,7 +9,7 @@ describe "VagrantPlugins::ChefZero::Config" do
9
9
 
10
10
  describe "config object is created" do
11
11
 
12
- it "should set all paths to nil" do
12
+ it "should set all paths to nil" do
13
13
  d = DummyClass.new
14
14
  d.finalize!
15
15
  d.chef_repo_path.should eql nil
@@ -22,15 +22,15 @@ describe "VagrantPlugins::ChefZero::Config" do
22
22
 
23
23
  end
24
24
 
25
- describe "chef_repo_path is the only defined path" do
26
-
25
+ describe "chef_repo_path is the only defined path" do
26
+
27
27
  it "chef_repo_path should be set" do
28
28
  d = DummyClass.new
29
29
  d.chef_repo_path = "/foo"
30
30
  d.finalize!
31
31
  d.chef_repo_path.should eql "/foo"
32
32
  end
33
-
33
+
34
34
 
35
35
  it "should use sane defaults and prefix all fixture paths with the chef_repo_path" do
36
36
  DummyClass.any_instance.stub(:path_exists?).and_return(true)
@@ -59,7 +59,7 @@ describe "VagrantPlugins::ChefZero::Config" do
59
59
  end
60
60
  end
61
61
 
62
- describe "chef_repo_path is defined" do
62
+ describe "chef_repo_path is defined" do
63
63
 
64
64
  describe "specific fixture path is also defined" do
65
65
 
@@ -77,7 +77,24 @@ describe "VagrantPlugins::ChefZero::Config" do
77
77
  d.data_bags.should eql "/foo/data_bags"
78
78
  end
79
79
 
80
+ it "should allow using ~ in the path" do
81
+ oldhome = ENV['HOME']
82
+ ENV['HOME'] = '/home/user'
83
+ DummyClass.any_instance.stub(:path_exists?).and_return(true)
84
+ d = DummyClass.new
85
+ d.chef_repo_path = "~/foo"
86
+ d.data_bags = "~/bar/data_bags"
87
+ d.finalize!
88
+
89
+ d.roles.should eql "/home/user/foo/roles"
90
+ d.environments.should eql "/home/user/foo/environments"
91
+ d.nodes.should eql "/home/user/foo/nodes"
92
+ d.cookbooks.should eql "/home/user/foo/cookbooks"
93
+ d.data_bags.should eql "/home/user/bar/data_bags"
94
+ ENV['HOME'] = oldhome
95
+ end
96
+
80
97
  end
81
98
  end
82
-
99
+
83
100
  end
@@ -1,9 +1,15 @@
1
+ require 'json'
1
2
  require 'simplecov'
2
- SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
3
- SimpleCov.start
3
+ require 'coveralls'
4
4
 
5
5
  require_relative "../lib/vagrant-chef-zero"
6
6
  require_relative "../lib/vagrant-chef-zero/server_helpers.rb"
7
7
  require_relative "../lib/vagrant-chef-zero.rb"
8
8
 
9
- require 'json'
9
+ RSpec.configure do |c|
10
+ c.expect_with(:rspec) { |c| c.syntax = :should }
11
+ end
12
+
13
+ SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter
14
+ SimpleCov.start
15
+ Coveralls.wear!
@@ -3,7 +3,7 @@ require "vagrant-chef-zero/version"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "vagrant-chef-zero"
6
- s.version = VagrantPlugins::ChefZero::VERSION
6
+ s.version = VagrantPlugins::ChefZero.get_version()
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = "Andrew Gross"
9
9
  s.email = "andrew.w.gross@gmail.com"
@@ -13,44 +13,16 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.rubyforge_project = "vagrant-chef-zero"
16
- s.license = "MIT"
16
+ s.license = "Apache v2.0"
17
17
 
18
18
  s.add_dependency "chef-zero", "~> 2.0"
19
19
  s.add_dependency "ridley", ">= 1.0.0"
20
20
  s.add_dependency "chef", "~> 11.0"
21
21
 
22
- # The following block of code determines the files that should be included
23
- # in the gem. It does this by reading all the files in the directory where
24
- # this gemspec is, and parsing out the ignored files from the gitignore.
25
- # Note that the entire gitignore(5) syntax is not supported, specifically
26
- # the "!" syntax, but it should mostly work correctly.
27
- root_path = File.dirname(__FILE__)
28
- all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
29
- all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
30
- gitignore_path = File.join(root_path, ".gitignore")
31
- gitignore = File.readlines(gitignore_path)
32
- gitignore.map! { |line| line.chomp.strip }
33
- gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
22
+ s.add_development_dependency "bump", "~> 0.5.2"
34
23
 
35
- unignored_files = all_files.reject do |file|
36
- # Ignore any directories, the gemspec only cares about files
37
- next true if File.directory?(file)
38
-
39
- # Ignore any paths that match anything in the gitignore. We do
40
- # two tests here:
41
- #
42
- # - First, test to see if the entire path matches the gitignore.
43
- # - Second, match if the basename does, this makes it so that things
44
- # like '.DS_Store' will match sub-directories too (same behavior
45
- # as git).
46
- #
47
- gitignore.any? do |ignore|
48
- File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
49
- File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
50
- end
51
- end
52
-
53
- s.files = unignored_files
54
- s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
55
- s.require_path = 'lib'
24
+ s.files = `git ls-files -z`.split("\x0")
25
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
27
+ s.require_paths = ["lib"]
56
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Gross
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-28 00:00:00.000000000 Z
11
+ date: 2015-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-zero
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '11.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bump
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.5.2
55
69
  description: Enables Vagrant to interact with Chef Zero
56
70
  email: andrew.w.gross@gmail.com
57
71
  executables: []
@@ -63,7 +77,6 @@ files:
63
77
  - ".travis.yml"
64
78
  - CHANGELOG.md
65
79
  - Gemfile
66
- - Gemfile.lock
67
80
  - LICENSE.txt
68
81
  - Makefile
69
82
  - README.md
@@ -81,7 +94,6 @@ files:
81
94
  - lib/vagrant-chef-zero/plugin.rb
82
95
  - lib/vagrant-chef-zero/server_helpers.rb
83
96
  - lib/vagrant-chef-zero/version.rb
84
- - pkg/vagrant-chef-zero-0.7.1.gem
85
97
  - spec/lib/action/upload_spec.rb
86
98
  - spec/lib/config_spec.rb
87
99
  - spec/lib/server_helpers_spec.rb
@@ -109,7 +121,7 @@ files:
109
121
  - vagrant-chef-zero.gemspec
110
122
  homepage: http://github.com/andrewgross/vagrant-chef-zero
111
123
  licenses:
112
- - MIT
124
+ - Apache v2.0
113
125
  metadata: {}
114
126
  post_install_message:
115
127
  rdoc_options: []
@@ -127,8 +139,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
139
  version: 1.3.6
128
140
  requirements: []
129
141
  rubyforge_project: vagrant-chef-zero
130
- rubygems_version: 2.2.2
142
+ rubygems_version: 2.4.4
131
143
  signing_key:
132
144
  specification_version: 4
133
145
  summary: Enables Vagrant to interact with Chef Zero.
134
- test_files: []
146
+ test_files:
147
+ - spec/lib/action/upload_spec.rb
148
+ - spec/lib/config_spec.rb
149
+ - spec/lib/server_helpers_spec.rb
150
+ - spec/spec_helper.rb
151
+ - spec/vagrant-chef-zero/fixtures/cookbooks/blah/metadata.rb
152
+ - spec/vagrant-chef-zero/fixtures/cookbooks/blah/recipes/default.rb
153
+ - spec/vagrant-chef-zero/fixtures/cookbooks/blah/templates/default/hi
154
+ - spec/vagrant-chef-zero/fixtures/cookbooks/blork/metadata.rb
155
+ - spec/vagrant-chef-zero/fixtures/cookbooks/blork/recipes/default.rb
156
+ - spec/vagrant-chef-zero/fixtures/cookbooks/blork/templates/default/hi
157
+ - spec/vagrant-chef-zero/fixtures/data_bags/foo/bar.json
158
+ - spec/vagrant-chef-zero/fixtures/data_bags/foo/baz.json
159
+ - spec/vagrant-chef-zero/fixtures/data_bags/foo/blarghle.json
160
+ - spec/vagrant-chef-zero/fixtures/data_bags/foom/x.json
161
+ - spec/vagrant-chef-zero/fixtures/data_bags/widdle/blank.json
162
+ - spec/vagrant-chef-zero/fixtures/data_bags/widdle/wow.json
163
+ - spec/vagrant-chef-zero/fixtures/environments/desert.json
164
+ - spec/vagrant-chef-zero/fixtures/environments/rainforest.json
165
+ - spec/vagrant-chef-zero/fixtures/environments/semi_arid_plains.json
166
+ - spec/vagrant-chef-zero/fixtures/nodes/blah.json
167
+ - spec/vagrant-chef-zero/fixtures/nodes/blarrrrgh.json
168
+ - spec/vagrant-chef-zero/fixtures/nodes/boxer.json
169
+ - spec/vagrant-chef-zero/fixtures/nodes/camel.json
170
+ - spec/vagrant-chef-zero/fixtures/nodes/monkey.json
171
+ has_rdoc:
@@ -1,258 +0,0 @@
1
- GIT
2
- remote: git://github.com/mitchellh/vagrant.git
3
- revision: 970ed5068ede4f6aae4b51e2cabe872aa924cacf
4
- tag: v1.6.2
5
- specs:
6
- vagrant (1.6.2)
7
- bundler (>= 1.5.2, < 1.7.0)
8
- childprocess (~> 0.5.0)
9
- erubis (~> 2.7.0)
10
- i18n (~> 0.6.0)
11
- listen (~> 2.7.1)
12
- log4r (~> 1.1.9, < 1.1.11)
13
- net-scp (~> 1.1.0)
14
- net-ssh (>= 2.6.6, < 2.10.0)
15
- rb-kqueue (~> 0.2.0)
16
- wdm (~> 0.1.0)
17
- winrm (~> 1.1.3)
18
-
19
- PATH
20
- remote: .
21
- specs:
22
- vagrant-chef-zero (0.7.1)
23
- chef (~> 11.0)
24
- chef-zero (~> 2.0)
25
- ridley (>= 1.0.0)
26
-
27
- GEM
28
- remote: https://rubygems.org/
29
- specs:
30
- addressable (2.3.6)
31
- akami (1.2.2)
32
- gyoku (>= 0.4.0)
33
- nokogiri
34
- berkshelf (3.1.2)
35
- addressable (~> 2.3.4)
36
- berkshelf-api-client (~> 1.2)
37
- buff-config (~> 0.4)
38
- buff-extensions (~> 0.4)
39
- buff-shell_out (~> 0.1)
40
- celluloid (~> 0.16.0.pre)
41
- celluloid-io (~> 0.16.0.pre)
42
- faraday (~> 0.9.0)
43
- minitar (~> 0.5.4)
44
- octokit (~> 3.0)
45
- retryable (~> 1.3.3)
46
- ridley (~> 3.1)
47
- solve (~> 1.1)
48
- thor (~> 0.18)
49
- berkshelf-api-client (1.2.0)
50
- faraday (~> 0.9.0)
51
- buff-config (0.4.0)
52
- buff-extensions (~> 0.3)
53
- varia_model (~> 0.1)
54
- buff-extensions (0.5.0)
55
- buff-ignore (1.1.1)
56
- buff-ruby_engine (0.1.0)
57
- buff-shell_out (0.1.1)
58
- buff-ruby_engine (~> 0.1.0)
59
- builder (3.2.2)
60
- celluloid (0.16.0.pre)
61
- timers (~> 2.0.0)
62
- celluloid-io (0.16.0.pre)
63
- celluloid (>= 0.16.0.pre)
64
- nio4r (>= 1.0.0)
65
- chef (11.12.4)
66
- chef-zero (~> 2.0, >= 2.0.2)
67
- diff-lcs (~> 1.2, >= 1.2.4)
68
- erubis (~> 2.7)
69
- highline (~> 1.6, >= 1.6.9)
70
- json (>= 1.4.4, <= 1.8.1)
71
- mime-types (~> 1.16)
72
- mixlib-authentication (~> 1.3)
73
- mixlib-cli (~> 1.4)
74
- mixlib-config (~> 2.0)
75
- mixlib-log (~> 1.3)
76
- mixlib-shellout (~> 1.4)
77
- net-ssh (~> 2.6)
78
- net-ssh-multi (~> 1.1)
79
- ohai (~> 7.0.4)
80
- pry (~> 0.9)
81
- rest-client (>= 1.0.4, < 1.7.0)
82
- yajl-ruby (~> 1.1)
83
- chef-zero (2.1.4)
84
- hashie (~> 2.0)
85
- json
86
- mixlib-log (~> 1.3)
87
- rack
88
- childprocess (0.5.3)
89
- ffi (~> 1.0, >= 1.0.11)
90
- coderay (1.1.0)
91
- dep-selector-libgecode (1.0.1)
92
- dep_selector (1.0.3)
93
- dep-selector-libgecode (~> 1.0)
94
- ffi (~> 1.9)
95
- diff-lcs (1.2.5)
96
- docile (1.1.3)
97
- erubis (2.7.0)
98
- faraday (0.9.0)
99
- multipart-post (>= 1.2, < 3)
100
- ffi (1.9.3)
101
- gssapi (1.0.3)
102
- ffi (>= 1.0.1)
103
- gyoku (1.1.1)
104
- builder (>= 2.1.2)
105
- hashie (2.1.1)
106
- highline (1.6.21)
107
- hitimes (1.2.1)
108
- httpclient (2.3.4.1)
109
- httpi (0.9.7)
110
- rack
111
- i18n (0.6.9)
112
- ipaddress (0.8.0)
113
- json (1.8.1)
114
- listen (2.7.5)
115
- celluloid (>= 0.15.2)
116
- rb-fsevent (>= 0.9.3)
117
- rb-inotify (>= 0.9)
118
- little-plugger (1.1.3)
119
- log4r (1.1.10)
120
- logging (1.8.2)
121
- little-plugger (>= 1.1.3)
122
- multi_json (>= 1.8.4)
123
- metaclass (0.0.4)
124
- method_source (0.8.2)
125
- mime-types (1.25.1)
126
- mini_portile (0.6.0)
127
- minitar (0.5.4)
128
- mixlib-authentication (1.3.0)
129
- mixlib-log
130
- mixlib-cli (1.5.0)
131
- mixlib-config (2.1.0)
132
- mixlib-log (1.6.0)
133
- mixlib-shellout (1.4.0)
134
- mocha (1.1.0)
135
- metaclass (~> 0.0.1)
136
- multi_json (1.10.1)
137
- multipart-post (2.0.0)
138
- net-http-persistent (2.9.4)
139
- net-scp (1.1.2)
140
- net-ssh (>= 2.6.5)
141
- net-ssh (2.9.1)
142
- net-ssh-gateway (1.2.0)
143
- net-ssh (>= 2.6.5)
144
- net-ssh-multi (1.2.0)
145
- net-ssh (>= 2.6.5)
146
- net-ssh-gateway (>= 1.2.0)
147
- nio4r (1.0.0)
148
- nokogiri (1.6.2.1)
149
- mini_portile (= 0.6.0)
150
- nori (1.1.5)
151
- octokit (3.1.0)
152
- sawyer (~> 0.5.3)
153
- ohai (7.0.4)
154
- ipaddress
155
- mime-types (~> 1.16)
156
- mixlib-cli
157
- mixlib-config (~> 2.0)
158
- mixlib-log
159
- mixlib-shellout (~> 1.2)
160
- systemu (~> 2.5.2)
161
- yajl-ruby
162
- pry (0.9.12.6)
163
- coderay (~> 1.0)
164
- method_source (~> 0.8)
165
- slop (~> 3.4)
166
- rack (1.5.2)
167
- rake (10.3.2)
168
- rb-fsevent (0.9.4)
169
- rb-inotify (0.9.4)
170
- ffi (>= 0.5.0)
171
- rb-kqueue (0.2.2)
172
- ffi (>= 0.5.0)
173
- rest-client (1.6.7)
174
- mime-types (>= 1.16)
175
- retryable (1.3.5)
176
- ridley (3.1.0)
177
- addressable
178
- buff-config (~> 0.2)
179
- buff-extensions (~> 0.3)
180
- buff-ignore (~> 1.1)
181
- buff-shell_out (~> 0.1)
182
- celluloid (~> 0.16.0.pre)
183
- celluloid-io (~> 0.16.0.pre)
184
- erubis
185
- faraday (~> 0.9.0)
186
- hashie (>= 2.0.2)
187
- json (>= 1.7.7)
188
- mixlib-authentication (>= 1.3.0)
189
- net-http-persistent (>= 2.8)
190
- retryable
191
- semverse (~> 1.1)
192
- varia_model (~> 0.3)
193
- rspec (2.14.1)
194
- rspec-core (~> 2.14.0)
195
- rspec-expectations (~> 2.14.0)
196
- rspec-mocks (~> 2.14.0)
197
- rspec-core (2.14.8)
198
- rspec-expectations (2.14.5)
199
- diff-lcs (>= 1.1.3, < 2.0)
200
- rspec-mocks (2.14.6)
201
- rubyntlm (0.1.1)
202
- savon (0.9.5)
203
- akami (~> 1.0)
204
- builder (>= 2.1.2)
205
- gyoku (>= 0.4.0)
206
- httpi (~> 0.9)
207
- nokogiri (>= 1.4.0)
208
- nori (~> 1.0)
209
- wasabi (~> 1.0)
210
- sawyer (0.5.4)
211
- addressable (~> 2.3.5)
212
- faraday (~> 0.8, < 0.10)
213
- semverse (1.1.0)
214
- simplecov (0.8.2)
215
- docile (~> 1.1.0)
216
- multi_json
217
- simplecov-html (~> 0.8.0)
218
- simplecov-html (0.8.0)
219
- slop (3.5.0)
220
- solve (1.2.0)
221
- dep_selector (~> 1.0)
222
- semverse (~> 1.1)
223
- systemu (2.5.2)
224
- thor (0.19.1)
225
- timers (2.0.0)
226
- hitimes
227
- uuidtools (2.1.4)
228
- vagrant-berkshelf (2.0.1)
229
- berkshelf (~> 3.1)
230
- celluloid (~> 0.16.0.pre)
231
- celluloid-io (~> 0.16.0.pre)
232
- varia_model (0.3.2)
233
- buff-extensions (~> 0.2)
234
- hashie (>= 2.0.2)
235
- wasabi (1.0.0)
236
- nokogiri (>= 1.4.0)
237
- wdm (0.1.0)
238
- winrm (1.1.3)
239
- gssapi (~> 1.0.0)
240
- httpclient (~> 2.2, >= 2.2.0.2)
241
- logging (~> 1.6, >= 1.6.1)
242
- nokogiri (~> 1.5)
243
- rubyntlm (~> 0.1.1)
244
- savon (= 0.9.5)
245
- uuidtools (~> 2.1.2)
246
- yajl-ruby (1.2.0)
247
-
248
- PLATFORMS
249
- ruby
250
-
251
- DEPENDENCIES
252
- mocha
253
- rake
254
- rspec
255
- simplecov
256
- vagrant!
257
- vagrant-berkshelf (>= 2.0.1)
258
- vagrant-chef-zero!