vagrant-configspec 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/001_httpd_spec.rb +5 -0
- data/Gemfile +8 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +22 -0
- data/README.md +8 -0
- data/Rakefile +3 -0
- data/Vagrantfile +10 -0
- data/lib/vagrant-configspec.rb +20 -0
- data/lib/vagrant-configspec/config.rb +35 -0
- data/lib/vagrant-configspec/plugin.rb +20 -0
- data/lib/vagrant-configspec/provisioner.rb +34 -0
- data/lib/vagrant-configspec/version.rb +5 -0
- data/locales/en.yml +9 -0
- data/spec_helper.rb +6 -0
- data/vagrant-configspec.gemspec +25 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c33a7243b82e58bb2705a85b6c64637973fb2901
|
4
|
+
data.tar.gz: f5423001b69c9ff0ced9f9275d95e01c63481347
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89e3c4efdde8da36d042309e97331c9a69102cc3f6635b03280e9480c9eb9cfa56c9eb939fc0f8f7ef1d22647297d57332157ad45f3d6fbaee6c34e86de44782
|
7
|
+
data.tar.gz: 9e840e872e93e632429e5b70796475e111b030a674a5763234c37caaf2b728255cf6acbffa28249f0ae6fc05020fe8a8d0513855b7af66f4cb962e79d48024e3
|
data/.gitignore
ADDED
data/001_httpd_spec.rb
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Nobuyuki Ohta
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 ohta-nobuyuki
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/Vagrantfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Vagrant.require_plugin "vagrant-configspec"
|
2
|
+
|
3
|
+
Vagrant.configure("2") do |config|
|
4
|
+
config.vm.box = "centos6.4-x86-minimal"
|
5
|
+
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box"
|
6
|
+
|
7
|
+
config.vm.provision :configspec do |spec|
|
8
|
+
spec.pattern = '*_spec.rb'
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
begin
|
2
|
+
require 'vagrant'
|
3
|
+
rescue LoadError
|
4
|
+
raise 'The Vagrant ConfigSpec plugin must be run within Vagrant.'
|
5
|
+
end
|
6
|
+
|
7
|
+
require_relative 'vagrant-configspec/version'
|
8
|
+
|
9
|
+
module VagrantPlugins
|
10
|
+
module ConfigSpec
|
11
|
+
def self.source_root
|
12
|
+
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
13
|
+
end
|
14
|
+
|
15
|
+
I18n.load_path << File.expand_path('locales/en.yml', source_root)
|
16
|
+
I18n.reload!
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require_relative 'vagrant-configspec/plugin'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ConfigSpec
|
3
|
+
class Config < Vagrant.plugin('2', :config)
|
4
|
+
attr_accessor :spec_files
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super
|
8
|
+
@spec_files = UNSET_VALUE
|
9
|
+
end
|
10
|
+
|
11
|
+
def pattern=(pat)
|
12
|
+
@spec_files = Dir.glob(pat)
|
13
|
+
end
|
14
|
+
|
15
|
+
def finalize!
|
16
|
+
@spec_files = [] if @spec_files == UNSET_VALUE
|
17
|
+
end
|
18
|
+
|
19
|
+
def validate(machine)
|
20
|
+
errors = _detected_errors
|
21
|
+
|
22
|
+
if @spec_files.nil? || @spec_files.empty?
|
23
|
+
errors << I18n.t('vagrant.config.configspec.no_spec_files')
|
24
|
+
end
|
25
|
+
|
26
|
+
missing_files = @spec_files.select { |path| !File.file?(path) }
|
27
|
+
unless missing_files.empty?
|
28
|
+
errors << I18n.t('vagrant.config.configspec.missing_spec_files', files: missing_files.join(', '))
|
29
|
+
end
|
30
|
+
|
31
|
+
{ 'configspec provisioner' => errors }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module ConfigSpec
|
3
|
+
class Plugin < Vagrant.plugin('2')
|
4
|
+
name 'configspec'
|
5
|
+
description <<-DESC
|
6
|
+
This plugin executes a configspec suite against a running Vagrant instance.
|
7
|
+
DESC
|
8
|
+
|
9
|
+
config(:configspec, :provisioner) do
|
10
|
+
require_relative 'config'
|
11
|
+
Config
|
12
|
+
end
|
13
|
+
|
14
|
+
provisioner(:configspec) do
|
15
|
+
require_relative 'provisioner'
|
16
|
+
Provisioner
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'configspec'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ConfigSpec
|
5
|
+
class Provisioner < Vagrant.plugin('2', :provisioner)
|
6
|
+
def initialize(machine, config)
|
7
|
+
super(machine, config)
|
8
|
+
|
9
|
+
@spec_files = config.spec_files
|
10
|
+
|
11
|
+
RSpec.configure do |spec|
|
12
|
+
spec.before :all do
|
13
|
+
ssh_host = machine.ssh_info[:host]
|
14
|
+
ssh_username = machine.ssh_info[:username]
|
15
|
+
ssh_opts = Net::SSH::Config.for(machine.ssh_info[:host])
|
16
|
+
ssh_opts[:port] = machine.ssh_info[:port]
|
17
|
+
ssh_opts[:forward_agent] = machine.ssh_info[:forward_agent]
|
18
|
+
ssh_opts[:keys] = machine.ssh_info[:private_key_path]
|
19
|
+
|
20
|
+
spec.ssh = Net::SSH.start(ssh_host, ssh_username, ssh_opts)
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.after :all do
|
24
|
+
spec.ssh.close if spec.ssh && !spec.ssh.closed?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def provision
|
30
|
+
RSpec::Core::Runner.run(@spec_files)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/locales/en.yml
ADDED
data/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-configspec/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-configspec"
|
8
|
+
spec.version = VagrantPlugins::ConfigSpec::VERSION
|
9
|
+
spec.authors = ["ohta-nobuyuki"]
|
10
|
+
spec.email = ["ohta-nobuyuki@kayac.com"]
|
11
|
+
spec.description = %q{Vagrant configspec provisioner}
|
12
|
+
spec.summary = %q{Vagrant configspec provisioner}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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_dependency 'configspec'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-configspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ohta-nobuyuki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: configspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
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
|
+
description: Vagrant configspec provisioner
|
56
|
+
email:
|
57
|
+
- ohta-nobuyuki@kayac.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- 001_httpd_spec.rb
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- Vagrantfile
|
70
|
+
- lib/vagrant-configspec.rb
|
71
|
+
- lib/vagrant-configspec/config.rb
|
72
|
+
- lib/vagrant-configspec/plugin.rb
|
73
|
+
- lib/vagrant-configspec/provisioner.rb
|
74
|
+
- lib/vagrant-configspec/version.rb
|
75
|
+
- locales/en.yml
|
76
|
+
- spec_helper.rb
|
77
|
+
- vagrant-configspec.gemspec
|
78
|
+
homepage: ''
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.1.11
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Vagrant configspec provisioner
|
102
|
+
test_files: []
|