vagrant-dsc 0.0.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.travis.yml +19 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +67 -0
- data/Rakefile +13 -0
- data/development/Vagrantfile +86 -0
- data/development/manifests/ContosoWebsite.ps1 +17 -0
- data/lib/vagrant-dsc/config.rb +108 -0
- data/lib/vagrant-dsc/locales/en.yml +32 -0
- data/lib/vagrant-dsc/plugin.rb +23 -0
- data/lib/vagrant-dsc/powershell/configure_dsc.ps1 +13 -0
- data/lib/vagrant-dsc/provisioner.rb +192 -0
- data/lib/vagrant-dsc/templates/runner.ps1.erb +27 -0
- data/lib/vagrant-dsc/version.rb +5 -0
- data/lib/vagrant-dsc.rb +18 -0
- data/spec/base.rb +57 -0
- data/spec/command_builder_spec.rb +105 -0
- data/spec/provisioner/base_test.rb.bak +49 -0
- data/spec/provisioner/config_spec.rb +289 -0
- data/spec/provisioner/provisioner_spec.rb +46 -0
- data/spec/spec_helper.rb +23 -0
- data/vagrant-dsc.gemspec +28 -0
- metadata +214 -0
data/lib/vagrant-dsc.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
require "vagrant-dsc/plugin"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module DSC
|
7
|
+
lib_path = Pathname.new(File.expand_path("../vagrant-dsc", __FILE__))
|
8
|
+
autoload :Action, lib_path.join("action")
|
9
|
+
autoload :Errors, lib_path.join("errors")
|
10
|
+
|
11
|
+
# This returns the path to the source of this plugin.
|
12
|
+
#
|
13
|
+
# @return [Pathname]
|
14
|
+
def self.source_root
|
15
|
+
@source_root ||= Pathname.new(File.expand_path("../lib", __FILE__))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/base.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require "tmpdir"
|
2
|
+
require "rubygems"
|
3
|
+
|
4
|
+
# Gems
|
5
|
+
require "checkpoint"
|
6
|
+
require "rspec/autorun"
|
7
|
+
|
8
|
+
# Require Vagrant itself so we can reference the proper
|
9
|
+
# classes to test.
|
10
|
+
require "vagrant"
|
11
|
+
require "vagrant/util/platform"
|
12
|
+
|
13
|
+
# Add the test directory to the load path
|
14
|
+
$:.unshift File.expand_path("../../", __FILE__)
|
15
|
+
|
16
|
+
# Load in helpers
|
17
|
+
require "vagrant/unit/support/dummy_communicator"
|
18
|
+
require "vagrant/unit/support/dummy_provider"
|
19
|
+
require "vagrant/unit/support/shared/base_context"
|
20
|
+
require "vagrant/unit/support/shared/action_synced_folders_context"
|
21
|
+
require "vagrant/unit/support/shared/capability_helpers_context"
|
22
|
+
require "vagrant/unit/support/shared/plugin_command_context"
|
23
|
+
require "vagrant/unit/support/shared/virtualbox_context"
|
24
|
+
|
25
|
+
# Do not buffer output
|
26
|
+
$stdout.sync = true
|
27
|
+
$stderr.sync = true
|
28
|
+
|
29
|
+
# Configure RSpec
|
30
|
+
RSpec.configure do |c|
|
31
|
+
c.expect_with :rspec, :stdlib
|
32
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
33
|
+
|
34
|
+
if Vagrant::Util::Platform.windows?
|
35
|
+
c.filter_run_excluding :skip_windows
|
36
|
+
else
|
37
|
+
c.filter_run_excluding :windows
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Configure VAGRANT_CWD so that the tests never find an actual
|
42
|
+
# Vagrantfile anywhere, or at least this minimizes those chances.
|
43
|
+
ENV["VAGRANT_CWD"] = Dir.mktmpdir("vagrant")
|
44
|
+
|
45
|
+
# Set the dummy provider to the default for tests
|
46
|
+
ENV["VAGRANT_DEFAULT_PROVIDER"] = "dummy"
|
47
|
+
|
48
|
+
# Unset all host plugins so that we aren't executing subprocess things
|
49
|
+
# to detect a host for every test.
|
50
|
+
Vagrant.plugin("2").manager.registered.dup.each do |plugin|
|
51
|
+
if plugin.components.hosts.to_hash.length > 0
|
52
|
+
Vagrant.plugin("2").manager.unregister(plugin)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Disable checkpoint
|
57
|
+
Checkpoint.disable!
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# require_relative "../../../base"
|
2
|
+
|
3
|
+
# require Vagrant.source_root.join("plugins/provisioners/chef/command_builder")
|
4
|
+
|
5
|
+
# describe VagrantPlugins::Chef::CommandBuilder do
|
6
|
+
|
7
|
+
# let(:machine) { double("machine") }
|
8
|
+
# let(:chef_config) { double("chef_config") }
|
9
|
+
|
10
|
+
# before(:each) do
|
11
|
+
# allow(chef_config).to receive(:provisioning_path).and_return('/tmp/vagrant-chef-1')
|
12
|
+
# allow(chef_config).to receive(:arguments).and_return(nil)
|
13
|
+
# allow(chef_config).to receive(:binary_env).and_return(nil)
|
14
|
+
# allow(chef_config).to receive(:binary_path).and_return(nil)
|
15
|
+
# allow(chef_config).to receive(:binary_env).and_return(nil)
|
16
|
+
# end
|
17
|
+
|
18
|
+
# describe '.initialize' do
|
19
|
+
# it 'should raise when chef type is not client or solo' do
|
20
|
+
# expect { VagrantPlugins::Chef::CommandBuilder.new(chef_config, :client_bad) }.
|
21
|
+
# to raise_error
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
|
25
|
+
# describe 'build_command' do
|
26
|
+
# describe 'windows' do
|
27
|
+
# subject do
|
28
|
+
# VagrantPlugins::Chef::CommandBuilder.new(chef_config, :client, true)
|
29
|
+
# end
|
30
|
+
|
31
|
+
# it "executes the chef-client in PATH by default" do
|
32
|
+
# expect(subject.build_command()).to match(/^chef-client/)
|
33
|
+
# end
|
34
|
+
|
35
|
+
# it "executes the chef-client using full path if binary_path is specified" do
|
36
|
+
# allow(chef_config).to receive(:binary_path).and_return(
|
37
|
+
# "c:\\opscode\\chef\\bin\\chef-client")
|
38
|
+
# expect(subject.build_command()).to match(/^c:\\opscode\\chef\\bin\\chef-client\\chef-client/)
|
39
|
+
# end
|
40
|
+
|
41
|
+
# it "builds a guest friendly client.rb path" do
|
42
|
+
# expect(subject.build_command()).to include(
|
43
|
+
# '-c c:\\tmp\\vagrant-chef-1\\client.rb')
|
44
|
+
# end
|
45
|
+
|
46
|
+
# it "builds a guest friendly solo.json path" do
|
47
|
+
# expect(subject.build_command()).to include(
|
48
|
+
# '-j c:\\tmp\\vagrant-chef-1\\dna.json')
|
49
|
+
# end
|
50
|
+
|
51
|
+
# it 'includes Chef arguments if specified' do
|
52
|
+
# allow(chef_config).to receive(:arguments).and_return("-l DEBUG")
|
53
|
+
# expect(subject.build_command()).to include(
|
54
|
+
# '-l DEBUG')
|
55
|
+
# end
|
56
|
+
|
57
|
+
# it 'includes --no-color if UI is not colored' do
|
58
|
+
# expect(subject.build_command()).to include(
|
59
|
+
# ' --no-color')
|
60
|
+
# end
|
61
|
+
# end
|
62
|
+
|
63
|
+
# describe 'linux' do
|
64
|
+
# subject do
|
65
|
+
# VagrantPlugins::Chef::CommandBuilder.new(chef_config, :client, false)
|
66
|
+
# end
|
67
|
+
|
68
|
+
# it "executes the chef-client in PATH by default" do
|
69
|
+
# expect(subject.build_command()).to match(/^chef-client/)
|
70
|
+
# end
|
71
|
+
|
72
|
+
# it "executes the chef-client using full path if binary_path is specified" do
|
73
|
+
# allow(chef_config).to receive(:binary_path).and_return(
|
74
|
+
# "/opt/chef/chef-client")
|
75
|
+
# expect(subject.build_command()).to match(/^\/opt\/chef\/chef-client/)
|
76
|
+
# end
|
77
|
+
|
78
|
+
# it "builds a guest friendly client.rb path" do
|
79
|
+
# expect(subject.build_command()).to include(
|
80
|
+
# '-c /tmp/vagrant-chef-1/client.rb')
|
81
|
+
# end
|
82
|
+
|
83
|
+
# it "builds a guest friendly solo.json path" do
|
84
|
+
# expect(subject.build_command()).to include(
|
85
|
+
# '-j /tmp/vagrant-chef-1/dna.json')
|
86
|
+
# end
|
87
|
+
|
88
|
+
# it 'includes Chef arguments if specified' do
|
89
|
+
# allow(chef_config).to receive(:arguments).and_return("-l DEBUG")
|
90
|
+
# expect(subject.build_command()).to include(
|
91
|
+
# '-l DEBUG')
|
92
|
+
# end
|
93
|
+
|
94
|
+
# it 'includes --no-color if UI is not colored' do
|
95
|
+
# expect(subject.build_command()).to include(
|
96
|
+
# ' --no-color')
|
97
|
+
# end
|
98
|
+
|
99
|
+
# it 'includes environment variables if specified' do
|
100
|
+
# allow(chef_config).to receive(:binary_env).and_return("ENVVAR=VAL")
|
101
|
+
# expect(subject.build_command()).to match(/^ENVVAR=VAL /)
|
102
|
+
# end
|
103
|
+
# end
|
104
|
+
# end
|
105
|
+
# end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative "../../../../base"
|
2
|
+
|
3
|
+
require Vagrant.source_root.join("plugins/provisioners/chef/provisioner/base")
|
4
|
+
|
5
|
+
describe VagrantPlugins::Chef::Provisioner::Base do
|
6
|
+
include_context "unit"
|
7
|
+
|
8
|
+
let(:machine) { double("machine") }
|
9
|
+
let(:config) { double("config") }
|
10
|
+
|
11
|
+
subject { described_class.new(machine, config) }
|
12
|
+
|
13
|
+
describe "#encrypted_data_bag_secret_key_path" do
|
14
|
+
let(:env) { double("env") }
|
15
|
+
let(:root_path) { "/my/root" }
|
16
|
+
|
17
|
+
before do
|
18
|
+
allow(machine).to receive(:env).and_return(env)
|
19
|
+
allow(env).to receive(:root_path).and_return(root_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns absolute path as is" do
|
23
|
+
expect(config).to receive(:encrypted_data_bag_secret_key_path).
|
24
|
+
and_return("/foo/bar")
|
25
|
+
expect(subject.encrypted_data_bag_secret_key_path).to eq "/foo/bar"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns relative path joined to root_path" do
|
29
|
+
expect(config).to receive(:encrypted_data_bag_secret_key_path).
|
30
|
+
and_return("secret")
|
31
|
+
expect(subject.encrypted_data_bag_secret_key_path).to eq "/my/root/secret"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#guest_encrypted_data_bag_secret_key_path" do
|
36
|
+
it "returns nil if host path is not configured" do
|
37
|
+
allow(config).to receive(:encrypted_data_bag_secret_key_path).and_return(nil)
|
38
|
+
allow(config).to receive(:provisioning_path).and_return("/tmp/foo")
|
39
|
+
expect(subject.guest_encrypted_data_bag_secret_key_path).to be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns path under config.provisioning_path" do
|
43
|
+
allow(config).to receive(:encrypted_data_bag_secret_key_path).and_return("secret")
|
44
|
+
allow(config).to receive(:provisioning_path).and_return("/tmp/foo")
|
45
|
+
expect(File.dirname(subject.guest_encrypted_data_bag_secret_key_path)).
|
46
|
+
to eq "/tmp/foo"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,289 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-dsc/provisioner'
|
3
|
+
require 'vagrant-dsc/config'
|
4
|
+
require 'rspec/its'
|
5
|
+
|
6
|
+
describe VagrantPlugins::DSC::Config do
|
7
|
+
# include_context "unit"
|
8
|
+
let(:instance) { described_class.new }
|
9
|
+
|
10
|
+
before { subject.finalize! }
|
11
|
+
|
12
|
+
def assert_invalid
|
13
|
+
errors = subject.validate(machine)
|
14
|
+
if !errors.values.any? { |v| !v.empty? }
|
15
|
+
raise "No errors: #{errors.inspect}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def assert_valid
|
20
|
+
errors = subject.validate(machine)
|
21
|
+
if !errors.values.all? { |v| v.empty? }
|
22
|
+
raise "Errors: #{errors.inspect}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def valid_defaults
|
27
|
+
subject.image = "foo"
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
describe "defaults" do
|
32
|
+
|
33
|
+
# before do
|
34
|
+
# # By default lets be Linux for validations
|
35
|
+
# Vagrant::Util::Platform.stub(linux: true)
|
36
|
+
# end
|
37
|
+
|
38
|
+
subject do
|
39
|
+
instance.tap do |o|
|
40
|
+
o.finalize!
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
its("manifest_file") { expect = "default.ps1" }
|
45
|
+
its("manifests_path") { expect = "." }
|
46
|
+
its("configuration_name") { expect = "default" }
|
47
|
+
its("mof_file") { expect be_nil }
|
48
|
+
its("module_path") { expect be_nil }
|
49
|
+
its("options") { expect = [] }
|
50
|
+
its("facter") { expect = {} }
|
51
|
+
its("synced_folder_type") { expect be_nil }
|
52
|
+
its("temp_dir") { expect match /^\/tmp\/vagrant-dsc-*/ }
|
53
|
+
its("working_directory") { expect be_nil }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# require_relative "../base"
|
59
|
+
|
60
|
+
# require "vagrant/util/platform"
|
61
|
+
|
62
|
+
# require Vagrant.source_root.join("plugins/providers/docker/config")
|
63
|
+
|
64
|
+
# describe VagrantPlugins::DockerProvider::Config do
|
65
|
+
# include_context "unit"
|
66
|
+
|
67
|
+
# let(:machine) { double("machine") }
|
68
|
+
|
69
|
+
# let(:build_dir) do
|
70
|
+
# temporary_dir.tap do |dir|
|
71
|
+
# dir.join("Dockerfile").open("w") do |f|
|
72
|
+
# f.write("Hello")
|
73
|
+
# end
|
74
|
+
# end
|
75
|
+
# end
|
76
|
+
|
77
|
+
# def assert_invalid
|
78
|
+
# errors = subject.validate(machine)
|
79
|
+
# if !errors.values.any? { |v| !v.empty? }
|
80
|
+
# raise "No errors: #{errors.inspect}"
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
|
84
|
+
# def assert_valid
|
85
|
+
# errors = subject.validate(machine)
|
86
|
+
# if !errors.values.all? { |v| v.empty? }
|
87
|
+
# raise "Errors: #{errors.inspect}"
|
88
|
+
# end
|
89
|
+
# end
|
90
|
+
|
91
|
+
# def valid_defaults
|
92
|
+
# subject.image = "foo"
|
93
|
+
# end
|
94
|
+
|
95
|
+
# describe "defaults" do
|
96
|
+
# before { subject.finalize! }
|
97
|
+
|
98
|
+
# its(:build_dir) { should be_nil }
|
99
|
+
# its(:expose) { should eq([]) }
|
100
|
+
# its(:cmd) { should eq([]) }
|
101
|
+
# its(:env) { should eq({}) }
|
102
|
+
# its(:force_host_vm) { should be_false }
|
103
|
+
# its(:host_vm_build_dir_options) { should be_nil }
|
104
|
+
# its(:image) { should be_nil }
|
105
|
+
# its(:name) { should be_nil }
|
106
|
+
# its(:privileged) { should be_false }
|
107
|
+
# its(:vagrant_machine) { should be_nil }
|
108
|
+
# its(:vagrant_vagrantfile) { should be_nil }
|
109
|
+
# end
|
110
|
+
|
111
|
+
# before do
|
112
|
+
# # By default lets be Linux for validations
|
113
|
+
# Vagrant::Util::Platform.stub(linux: true)
|
114
|
+
# end
|
115
|
+
|
116
|
+
# it "should be invalid if both build dir and image are set" do
|
117
|
+
# subject.build_dir = build_dir
|
118
|
+
# subject.image = "foo"
|
119
|
+
# subject.finalize!
|
120
|
+
# assert_invalid
|
121
|
+
# end
|
122
|
+
|
123
|
+
# describe "#build_dir" do
|
124
|
+
# it "should be valid if not set with image" do
|
125
|
+
# subject.build_dir = nil
|
126
|
+
# subject.image = "foo"
|
127
|
+
# subject.finalize!
|
128
|
+
# assert_valid
|
129
|
+
# end
|
130
|
+
|
131
|
+
# it "should be valid with a valid directory" do
|
132
|
+
# subject.build_dir = build_dir
|
133
|
+
# subject.finalize!
|
134
|
+
# assert_valid
|
135
|
+
# end
|
136
|
+
|
137
|
+
# it "should be invalid with a directory that doesn't have a Dockerfile" do
|
138
|
+
# subject.build_dir = temporary_dir.to_s
|
139
|
+
# subject.finalize!
|
140
|
+
# assert_invalid
|
141
|
+
# end
|
142
|
+
# end
|
143
|
+
|
144
|
+
# describe "#expose" do
|
145
|
+
# before do
|
146
|
+
# valid_defaults
|
147
|
+
# end
|
148
|
+
|
149
|
+
# it "uniqs the ports" do
|
150
|
+
# subject.expose = [1, 1, 4, 5]
|
151
|
+
# subject.finalize!
|
152
|
+
# assert_valid
|
153
|
+
|
154
|
+
# expect(subject.expose).to eq([1, 4, 5])
|
155
|
+
# end
|
156
|
+
# end
|
157
|
+
|
158
|
+
# describe "#image" do
|
159
|
+
# it "should be valid if set" do
|
160
|
+
# subject.image = "foo"
|
161
|
+
# subject.finalize!
|
162
|
+
# assert_valid
|
163
|
+
# end
|
164
|
+
|
165
|
+
# it "should be invalid if not set" do
|
166
|
+
# subject.image = nil
|
167
|
+
# subject.finalize!
|
168
|
+
# assert_invalid
|
169
|
+
# end
|
170
|
+
# end
|
171
|
+
|
172
|
+
# describe "#link" do
|
173
|
+
# before do
|
174
|
+
# valid_defaults
|
175
|
+
# end
|
176
|
+
|
177
|
+
# it "should be valid with good links" do
|
178
|
+
# subject.link "foo:bar"
|
179
|
+
# subject.link "db:blah"
|
180
|
+
# subject.finalize!
|
181
|
+
# assert_valid
|
182
|
+
# end
|
183
|
+
|
184
|
+
# it "should be invalid if not name:alias" do
|
185
|
+
# subject.link "foo"
|
186
|
+
# subject.finalize!
|
187
|
+
# assert_invalid
|
188
|
+
# end
|
189
|
+
|
190
|
+
# it "should be invalid if too many colons" do
|
191
|
+
# subject.link "foo:bar:baz"
|
192
|
+
# subject.finalize!
|
193
|
+
# assert_invalid
|
194
|
+
# end
|
195
|
+
# end
|
196
|
+
|
197
|
+
# describe "#merge" do
|
198
|
+
# let(:one) { described_class.new }
|
199
|
+
# let(:two) { described_class.new }
|
200
|
+
|
201
|
+
# subject { one.merge(two) }
|
202
|
+
|
203
|
+
# context "#build_dir and #image" do
|
204
|
+
# it "overrides image if build_dir is set previously" do
|
205
|
+
# one.build_dir = "foo"
|
206
|
+
# two.image = "bar"
|
207
|
+
|
208
|
+
# expect(subject.build_dir).to be_nil
|
209
|
+
# expect(subject.image).to eq("bar")
|
210
|
+
# end
|
211
|
+
|
212
|
+
# it "overrides image if build_dir is set previously" do
|
213
|
+
# one.image = "foo"
|
214
|
+
# two.build_dir = "bar"
|
215
|
+
|
216
|
+
# expect(subject.image).to be_nil
|
217
|
+
# expect(subject.build_dir).to eq("bar")
|
218
|
+
# end
|
219
|
+
|
220
|
+
# it "preserves if both set" do
|
221
|
+
# one.image = "foo"
|
222
|
+
# two.image = "baz"
|
223
|
+
# two.build_dir = "bar"
|
224
|
+
|
225
|
+
# expect(subject.image).to eq("baz")
|
226
|
+
# expect(subject.build_dir).to eq("bar")
|
227
|
+
# end
|
228
|
+
# end
|
229
|
+
|
230
|
+
# context "env vars" do
|
231
|
+
# it "should merge the values" do
|
232
|
+
# one.env["foo"] = "bar"
|
233
|
+
# two.env["bar"] = "baz"
|
234
|
+
|
235
|
+
# expect(subject.env).to eq({
|
236
|
+
# "foo" => "bar",
|
237
|
+
# "bar" => "baz",
|
238
|
+
# })
|
239
|
+
# end
|
240
|
+
# end
|
241
|
+
|
242
|
+
# context "exposed ports" do
|
243
|
+
# it "merges the exposed ports" do
|
244
|
+
# one.expose << 1234
|
245
|
+
# two.expose = [42, 54]
|
246
|
+
|
247
|
+
# expect(subject.expose).to eq([
|
248
|
+
# 1234, 42, 54])
|
249
|
+
# end
|
250
|
+
# end
|
251
|
+
|
252
|
+
# context "links" do
|
253
|
+
# it "should merge the links" do
|
254
|
+
# one.link "foo"
|
255
|
+
# two.link "bar"
|
256
|
+
|
257
|
+
# expect(subject._links).to eq([
|
258
|
+
# "foo", "bar"])
|
259
|
+
# end
|
260
|
+
# end
|
261
|
+
# end
|
262
|
+
|
263
|
+
# describe "#vagrant_machine" do
|
264
|
+
# before { valid_defaults }
|
265
|
+
|
266
|
+
# it "should convert to a symbol" do
|
267
|
+
# subject.vagrant_machine = "foo"
|
268
|
+
# subject.finalize!
|
269
|
+
# assert_valid
|
270
|
+
# expect(subject.vagrant_machine).to eq(:foo)
|
271
|
+
# end
|
272
|
+
# end
|
273
|
+
|
274
|
+
# describe "#vagrant_vagrantfile" do
|
275
|
+
# before { valid_defaults }
|
276
|
+
|
277
|
+
# it "should be valid if set to a file" do
|
278
|
+
# subject.vagrant_vagrantfile = temporary_file.to_s
|
279
|
+
# subject.finalize!
|
280
|
+
# assert_valid
|
281
|
+
# end
|
282
|
+
|
283
|
+
# it "should not be valid if set to a non-existent place" do
|
284
|
+
# subject.vagrant_vagrantfile = "/i/shouldnt/exist"
|
285
|
+
# subject.finalize!
|
286
|
+
# assert_invalid
|
287
|
+
# end
|
288
|
+
# end
|
289
|
+
# end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-dsc/provisioner'
|
3
|
+
require 'rspec/its'
|
4
|
+
|
5
|
+
describe VagrantPlugins::DSC::Provisioner do
|
6
|
+
let(:instance) { described_class.new }
|
7
|
+
|
8
|
+
before { subject.finalize! }
|
9
|
+
|
10
|
+
describe "defaults" do
|
11
|
+
subject do
|
12
|
+
instance.tap do |o|
|
13
|
+
o.finalize!
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
its("manifest_file") { expect = "default.ps1" }
|
18
|
+
its("manifests_path") { expect = "." }
|
19
|
+
its("configuration_name") { expect = "default" }
|
20
|
+
its("mof_file") { expect be_nil }
|
21
|
+
its("module_path") { expect be_nil }
|
22
|
+
its("options") { expect = [] }
|
23
|
+
its("facter") { expect = {} }
|
24
|
+
its("synced_folder_type") { expect be_nil }
|
25
|
+
its("temp_dir") { expect match /^\/tmp\/vagrant-dsc-*/ }
|
26
|
+
its("working_directory") { expect be_nil }
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# describe "#vagrant_vagrantfile" do
|
32
|
+
# before { valid_defaults }
|
33
|
+
|
34
|
+
# it "should be valid if set to a file" do
|
35
|
+
# subject.vagrant_vagrantfile = temporary_file.to_s
|
36
|
+
# subject.finalize!
|
37
|
+
# assert_valid
|
38
|
+
# end
|
39
|
+
|
40
|
+
# it "should not be valid if set to a non-existent place" do
|
41
|
+
# subject.vagrant_vagrantfile = "/i/shouldnt/exist"
|
42
|
+
# subject.finalize!
|
43
|
+
# assert_invalid
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
require 'vagrant-dsc/version'
|
5
|
+
require 'vagrant-dsc/plugin'
|
6
|
+
require 'rspec/its'
|
7
|
+
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
Coveralls::SimpleCov::Formatter
|
11
|
+
]
|
12
|
+
SimpleCov.start do
|
13
|
+
coverage_dir('tmp/coverage')
|
14
|
+
add_filter '/spec/'
|
15
|
+
end
|
16
|
+
RSpec.configure do |config|
|
17
|
+
config.expect_with :rspec do |c|
|
18
|
+
c.syntax = :expect
|
19
|
+
end
|
20
|
+
config.color = true
|
21
|
+
config.tty = true
|
22
|
+
config.raise_errors_for_deprecations!
|
23
|
+
end
|
data/vagrant-dsc.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-dsc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-dsc"
|
8
|
+
spec.version = Vagrant::Dsc::VERSION
|
9
|
+
spec.authors = ["Matt Fellows"]
|
10
|
+
spec.email = ["matt.fellows@onegeek.com.au"]
|
11
|
+
spec.summary = "DSC Provisioner for Vagrant"
|
12
|
+
spec.description = "Desired State Configuration (http://technet.microsoft.com/en-au/library/dn249912.aspx) provisioning plugin for Vagrant."
|
13
|
+
spec.homepage = "https://github.com/mefellows/vagrant-dsc"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "rake", '~> 10.3', '>= 10.3.0'
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6", '>= 1.6.0'
|
23
|
+
spec.add_development_dependency "coveralls", "~> 0.7.1", '>= 0.7.1'
|
24
|
+
spec.add_development_dependency "rspec-core", '~> 3.1', '>= 3.1.0'
|
25
|
+
spec.add_development_dependency "rspec-expectations", '~> 3.1', '>= 3.1.0'
|
26
|
+
spec.add_development_dependency "rspec-mocks", '~> 3.1', '>= 3.1.0'
|
27
|
+
spec.add_development_dependency "rspec-its", "~> 1.0.1", '>= 1.0.0'
|
28
|
+
end
|