kitchen-localhost 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.kitchen.yml +17 -0
- data/.travis.yml +12 -0
- data/Berksfile +7 -0
- data/CHANGELOG.md +10 -0
- data/CODE_OF_CONDUCT.md +29 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +15 -0
- data/README.md +105 -0
- data/Rakefile +23 -0
- data/kitchen-localhost.gemspec +38 -0
- data/lib/kitchen/driver/localhost.rb +62 -0
- data/lib/kitchen/instance_patch.rb +44 -0
- data/lib/kitchen/localhost/version.rb +27 -0
- data/lib/kitchen/transport/localhost.rb +47 -0
- data/lib/kitchen/transport/localhost/connection.rb +69 -0
- metadata +215 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb83fa2e1b680a6099a28e18f2e280f00b776c41
|
4
|
+
data.tar.gz: ece39b2844d51e244a429c3693dfe20cc749049d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 12a385230f3ca212f0e79fe69c7b9767fd00ac694ca34a61fed43790936c109762a0f9c1165feb23d36858a00352a2adc580ab6d5c4e5c941e99e87146353488
|
7
|
+
data.tar.gz: 7bc41a18ff823f1786b6ce23b68173d629d924068455f75671c4909f74ce932a757e2b6cabe68afbfb877c734d0869ef487c21d980b53ac50ac7f4deeba05704
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
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
|
18
|
+
.kitchen
|
19
|
+
*.sw?
|
20
|
+
*~
|
21
|
+
.env.sh
|
22
|
+
Berksfile.lock
|
data/.kitchen.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
driver:
|
3
|
+
name: localhost
|
4
|
+
|
5
|
+
provisioner:
|
6
|
+
name: chef_zero
|
7
|
+
|
8
|
+
platforms:
|
9
|
+
- name: localhost
|
10
|
+
|
11
|
+
suites:
|
12
|
+
- name: tempfile
|
13
|
+
run_list:
|
14
|
+
- recipe[kitchen-localhost-test]
|
15
|
+
attributes:
|
16
|
+
kitchen_localhost_test:
|
17
|
+
test_file: testing_kitchen_localhost
|
data/.travis.yml
ADDED
data/Berksfile
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Contributor Code of Conduct
|
2
|
+
===========================
|
3
|
+
|
4
|
+
As contributors and maintainers of this project, we pledge to respect all
|
5
|
+
people who contribute through reporting issues, posting feature requests,
|
6
|
+
updating documentation, submitting pull requests or patches, and other
|
7
|
+
activities.
|
8
|
+
|
9
|
+
We are committed to making participation in this project a harassment-free
|
10
|
+
experience for everyone, regardless of level of experience, gender, gender
|
11
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
12
|
+
body size, race, age, or religion.
|
13
|
+
|
14
|
+
Examples of unacceptable behavior by participants include the use of sexual
|
15
|
+
language or imagery, derogatory comments or personal attacks, trolling, public
|
16
|
+
or private harassment, insults, or other unprofessional conduct.
|
17
|
+
|
18
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
19
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
20
|
+
that are not aligned to this Code of Conduct. Project maintainers who do not
|
21
|
+
follow the Code of Conduct may be removed from the project team.
|
22
|
+
|
23
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
24
|
+
reported by opening an issue or contacting one or more of the project
|
25
|
+
maintainers.
|
26
|
+
|
27
|
+
This Code of Conduct is adapted from the
|
28
|
+
[Contributor Covenant](http://contributor-covenant.org), version 1.0.0,
|
29
|
+
available [here](http://contributor-covenant.org/version/1/0/0/).
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Author:: Jonathan Hartman (<j@p4nt5.com>)
|
2
|
+
|
3
|
+
Copyright (C) 2015, Jonathan Hartman
|
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,105 @@
|
|
1
|
+
[][gem]
|
2
|
+
[][travis]
|
3
|
+
[][codeclimate]
|
4
|
+
[][coveralls]
|
5
|
+
[][gemnasium]
|
6
|
+
|
7
|
+
[gem]: https://rubygems.org/gems/kitchen-localhost
|
8
|
+
[travis]: https://travis-ci.org/RoboticCheese/kitchen-localhost
|
9
|
+
[codeclimate]: https://codeclimate.com/github/RoboticCheese/kitchen-localhost
|
10
|
+
[coveralls]: https://coveralls.io/r/RoboticCheese/kitchen-localhost
|
11
|
+
[gemnasium]: https://gemnasium.com/RoboticCheese/kitchen-localhost
|
12
|
+
|
13
|
+
Kitchen::Localhost
|
14
|
+
==================
|
15
|
+
|
16
|
+
A Test Kitchen Driver for when you just want to run Chef on localhost.
|
17
|
+
|
18
|
+
I swear, there's a reason this driver exists! Sometimes there are cases where
|
19
|
+
you want to run Test Kitchen against your CI build server (e.g. using Travis
|
20
|
+
CI's Objective-C build environments to do OS X cookbook testing). This driver
|
21
|
+
allows you to do everything from Kitchen instead of separately shelling out
|
22
|
+
for that one special platform.
|
23
|
+
|
24
|
+
Requirements
|
25
|
+
------------
|
26
|
+
|
27
|
+
Nothing other than a project you wish to test with Test Kitchen and an
|
28
|
+
understanding that this driver will be running against _your local machine_. If
|
29
|
+
you write a cookbook that formats a hard drive and run it with this driver, bad
|
30
|
+
things will happen.
|
31
|
+
|
32
|
+
Installation and Setup
|
33
|
+
----------------------
|
34
|
+
|
35
|
+
Add this line to your project's Gemfile:
|
36
|
+
|
37
|
+
gem 'kitchen-localhost'
|
38
|
+
|
39
|
+
...and then execute:
|
40
|
+
|
41
|
+
$ bundle install
|
42
|
+
|
43
|
+
...or install it yourself as:
|
44
|
+
|
45
|
+
$ gem install kitchen-localhost
|
46
|
+
|
47
|
+
Configuration
|
48
|
+
-------------
|
49
|
+
|
50
|
+
Just override one of the platforms in your Kitchen config to use this driver.
|
51
|
+
That's it!
|
52
|
+
|
53
|
+
---
|
54
|
+
driver:
|
55
|
+
name: vagrant
|
56
|
+
|
57
|
+
provisioner:
|
58
|
+
name: chef_zero
|
59
|
+
|
60
|
+
platforms:
|
61
|
+
- name: ubuntu-14.04
|
62
|
+
- name: centos-7.0
|
63
|
+
- name: macosx-10.10
|
64
|
+
driver:
|
65
|
+
name: localhost
|
66
|
+
|
67
|
+
suites:
|
68
|
+
- name: default
|
69
|
+
run_list:
|
70
|
+
- recipe[something]
|
71
|
+
|
72
|
+
Contributing
|
73
|
+
------------
|
74
|
+
|
75
|
+
Pull requests are very welcome! Make sure your patches are well tested. Ideally
|
76
|
+
create a topic branch for every separate change you make. For example:
|
77
|
+
|
78
|
+
1. Fork the repo
|
79
|
+
2. `bundle install`
|
80
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
81
|
+
4. Ensure your feature has tests and `rake` passes
|
82
|
+
5. Commit your changes (`git commit -am 'Added some feature'`)
|
83
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
84
|
+
7. Create new Pull Request
|
85
|
+
8. Keep an eye on the PR and ensure the CI build passes
|
86
|
+
|
87
|
+
_New features that have no tests and changes that cause the CI build to fail
|
88
|
+
will not be merged_
|
89
|
+
|
90
|
+
Authors
|
91
|
+
-------
|
92
|
+
|
93
|
+
Created and maintained by [Jonathan Hartman][author] (<j@p4nt5.com>)
|
94
|
+
|
95
|
+
License
|
96
|
+
-------
|
97
|
+
|
98
|
+
Apache 2.0 (see [LICENSE][license])
|
99
|
+
|
100
|
+
[author]: https://github.com/RoboticCheese
|
101
|
+
[issues]: https://github.com/RoboticCheese/kitchen-localhost/issues
|
102
|
+
[license]: https://github.com/RoboticCheese/kitchen-localhost/blob/master/LICENSE.txt
|
103
|
+
[repo]: https://github.com/RoboticCheese/kitchen-localhost
|
104
|
+
[driver_usage]: http://docs.kitchen-ci.org/drivers/usage
|
105
|
+
[chef_omnibus_dl]: http://www.getchef.com/chef/install/
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rubocop/rake_task'
|
5
|
+
require 'cane/rake_task'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'kitchen/rake_tasks'
|
8
|
+
|
9
|
+
Cane::RakeTask.new
|
10
|
+
|
11
|
+
RuboCop::RakeTask.new
|
12
|
+
|
13
|
+
desc 'Display LOC stats'
|
14
|
+
task :loc do
|
15
|
+
puts "\n## LOC Stats"
|
16
|
+
sh 'countloc -r lib'
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec::Core::RakeTask.new(:spec)
|
20
|
+
|
21
|
+
Kitchen::RakeTasks.new
|
22
|
+
|
23
|
+
task default: [:cane, :rubocop, :loc, :spec]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'kitchen/localhost/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'kitchen-localhost'
|
9
|
+
spec.version = Kitchen::Localhost::VERSION
|
10
|
+
spec.authors = ['Jonathan Hartman']
|
11
|
+
spec.email = %w(j@p4nt5.com)
|
12
|
+
spec.description = 'A Test Kitchen Driver for localhost'
|
13
|
+
spec.summary = 'Use Test Kitchen to run Chef on your local machine!'
|
14
|
+
spec.homepage = 'https://github.com/test-kitchen/kitchen-localhost'
|
15
|
+
spec.license = 'Apache 2.0'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.executables = []
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
+
spec.require_paths = %w(lib)
|
23
|
+
|
24
|
+
spec.required_ruby_version = '>= 1.9.3'
|
25
|
+
|
26
|
+
spec.add_dependency 'test-kitchen', '~> 1.4.0.rc'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 0.30'
|
31
|
+
spec.add_development_dependency 'cane', '~> 2.6'
|
32
|
+
spec.add_development_dependency 'countloc', '~> 0.4'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'simplecov', '~> 0.9'
|
35
|
+
spec.add_development_dependency 'simplecov-console', '~> 0.2'
|
36
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
37
|
+
spec.add_development_dependency 'berkshelf', '~> 3.2'
|
38
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Jonathan Hartman
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'fileutils'
|
21
|
+
require 'socket'
|
22
|
+
require 'kitchen'
|
23
|
+
require 'kitchen/driver/base'
|
24
|
+
require_relative '../localhost/version'
|
25
|
+
require_relative '../instance_patch'
|
26
|
+
|
27
|
+
module Kitchen
|
28
|
+
module Driver
|
29
|
+
# Localhost driver for Kitchen.
|
30
|
+
#
|
31
|
+
# @author Jonathan Hartman <j@p4nt5.com>
|
32
|
+
class Localhost < Kitchen::Driver::Base
|
33
|
+
kitchen_driver_api_version 2
|
34
|
+
|
35
|
+
plugin_version Kitchen::Localhost::VERSION
|
36
|
+
|
37
|
+
#
|
38
|
+
# Create the temp dirs on the local filesystem for Kitchen.
|
39
|
+
#
|
40
|
+
# (see Base#create)
|
41
|
+
def create(state)
|
42
|
+
state[:hostname] = Socket.gethostname
|
43
|
+
logger.info("[Localhost] Instance #{instance} ready.")
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Clean up the temp dirs left behind
|
48
|
+
#
|
49
|
+
# (see Base#destroy)
|
50
|
+
#
|
51
|
+
def destroy(_)
|
52
|
+
paths = [
|
53
|
+
instance.provisioner[:root_path], instance.verifier[:root_path]
|
54
|
+
]
|
55
|
+
paths.each do |p|
|
56
|
+
FileUtils.rm_rf(p)
|
57
|
+
logger.info("[Localhost] Deleted temp dir '#{p}'.")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Jonathan Hartman
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'kitchen'
|
21
|
+
require 'kitchen/instance'
|
22
|
+
require_relative 'driver/localhost'
|
23
|
+
require_relative 'transport/localhost'
|
24
|
+
|
25
|
+
module Kitchen
|
26
|
+
# Monkey patch the Kitchen::Instance class with the default configs for the
|
27
|
+
# Localhost driver/transport.
|
28
|
+
#
|
29
|
+
# @author Jonathan Hartman <j@p4nt5.com>
|
30
|
+
class Instance
|
31
|
+
alias_method :old_setup_transport, :setup_transport
|
32
|
+
|
33
|
+
# If using the Localhost driver, force usage of the Localhost transport.
|
34
|
+
#
|
35
|
+
# (see Instance#setup_transport)
|
36
|
+
#
|
37
|
+
def setup_transport
|
38
|
+
if @driver.is_a?(Kitchen::Driver::Localhost)
|
39
|
+
@transport = Kitchen::Transport::Localhost.new
|
40
|
+
end
|
41
|
+
old_setup_transport
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Jonathan Hartman
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Kitchen
|
21
|
+
# Version string for Localhost Kitchen plugins.
|
22
|
+
#
|
23
|
+
# @author Jonathan Hartman <j@p4nt5.com>
|
24
|
+
module Localhost
|
25
|
+
VERSION = '0.1.0'
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Jonathan Hartman
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'kitchen'
|
21
|
+
require 'kitchen/transport/base'
|
22
|
+
require_relative '../localhost/version'
|
23
|
+
require_relative 'localhost/connection'
|
24
|
+
|
25
|
+
module Kitchen
|
26
|
+
module Transport
|
27
|
+
# Localhost transport for Kitchen.
|
28
|
+
#
|
29
|
+
# @author Jonathan Hartman <j@p4nt5.com>
|
30
|
+
class Localhost < Kitchen::Transport::Base
|
31
|
+
kitchen_transport_api_version 1
|
32
|
+
|
33
|
+
plugin_version Kitchen::Localhost::VERSION
|
34
|
+
|
35
|
+
# (see Base#connection)
|
36
|
+
#
|
37
|
+
def connection(state, &block)
|
38
|
+
Kitchen::Transport::Localhost::Connection.new(state, &block)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# An exception class for transport errors from the Localhost plugin.
|
43
|
+
#
|
44
|
+
# @author Jonathan Hartman <j@p4nt5.com>
|
45
|
+
class LocalhostFailed < TransportFailed; end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Author:: Jonathan Hartman (<j@p4nt5.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015, Jonathan Hartman
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'bundler'
|
21
|
+
require 'fileutils'
|
22
|
+
require 'kitchen'
|
23
|
+
require 'kitchen/shell_out'
|
24
|
+
require 'kitchen/transport/base'
|
25
|
+
require_relative '../localhost'
|
26
|
+
|
27
|
+
module Kitchen
|
28
|
+
module Transport
|
29
|
+
class Localhost < Kitchen::Transport::Base
|
30
|
+
# Connection class for the Localhost transport.
|
31
|
+
#
|
32
|
+
# @author Jonathan Hartman <j@p4nt5.com>
|
33
|
+
class Connection < Kitchen::Transport::Base::Connection
|
34
|
+
include Kitchen::ShellOut
|
35
|
+
|
36
|
+
#
|
37
|
+
# Execute a given command by shelling out and just running it.
|
38
|
+
#
|
39
|
+
# (see Base::Connection#execute)
|
40
|
+
#
|
41
|
+
# @raise [Kitchen::Transport::LocalhostFailed] if shell exits non-zero
|
42
|
+
#
|
43
|
+
def execute(command)
|
44
|
+
return if command.nil?
|
45
|
+
logger.debug("[Localhost] #{self} (#{command})")
|
46
|
+
begin
|
47
|
+
Bundler.with_clean_env { run_command(command) }
|
48
|
+
rescue StandardError => err
|
49
|
+
raise(Kitchen::Transport::LocalhostFailed, err.message)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Upload a set of local files to a 'remote' (aka Kitchen temp dir)
|
55
|
+
#
|
56
|
+
# (see Base::Connection#upload)
|
57
|
+
#
|
58
|
+
def upload(locals, remote)
|
59
|
+
FileUtils.mkdir_p(remote)
|
60
|
+
Array(locals).each do |local|
|
61
|
+
FileUtils.cp_r(local, remote)
|
62
|
+
logger.debug("[Localhost] Copied '#{local}' to '#{remote}'")
|
63
|
+
end
|
64
|
+
logger.debug("[Localhost] File copying to '#{remote}' complete")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kitchen-localhost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jonathan Hartman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: test-kitchen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.4.0.rc
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.4.0.rc
|
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: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.30'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.30'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cane
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: countloc
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.9'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.9'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov-console
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: coveralls
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.8'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.8'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: berkshelf
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3.2'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3.2'
|
167
|
+
description: A Test Kitchen Driver for localhost
|
168
|
+
email:
|
169
|
+
- j@p4nt5.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- ".kitchen.yml"
|
176
|
+
- ".travis.yml"
|
177
|
+
- Berksfile
|
178
|
+
- CHANGELOG.md
|
179
|
+
- CODE_OF_CONDUCT.md
|
180
|
+
- Gemfile
|
181
|
+
- LICENSE.txt
|
182
|
+
- README.md
|
183
|
+
- Rakefile
|
184
|
+
- kitchen-localhost.gemspec
|
185
|
+
- lib/kitchen/driver/localhost.rb
|
186
|
+
- lib/kitchen/instance_patch.rb
|
187
|
+
- lib/kitchen/localhost/version.rb
|
188
|
+
- lib/kitchen/transport/localhost.rb
|
189
|
+
- lib/kitchen/transport/localhost/connection.rb
|
190
|
+
homepage: https://github.com/test-kitchen/kitchen-localhost
|
191
|
+
licenses:
|
192
|
+
- Apache 2.0
|
193
|
+
metadata: {}
|
194
|
+
post_install_message:
|
195
|
+
rdoc_options: []
|
196
|
+
require_paths:
|
197
|
+
- lib
|
198
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 1.9.3
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
requirements: []
|
209
|
+
rubyforge_project:
|
210
|
+
rubygems_version: 2.4.6
|
211
|
+
signing_key:
|
212
|
+
specification_version: 4
|
213
|
+
summary: Use Test Kitchen to run Chef on your local machine!
|
214
|
+
test_files: []
|
215
|
+
has_rdoc:
|