chef_instance 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +9 -0
- data/.kitchen.yml +26 -0
- data/.travis.yml +11 -0
- data/.yardopts +6 -0
- data/Gemfile +3 -0
- data/LICENSE +202 -0
- data/README.md +91 -0
- data/Rakefile +19 -0
- data/certs/miah_johnson.pem +21 -0
- data/chef_instance.gemspec +28 -0
- data/lib/chef_instance/install.rb +30 -0
- data/lib/chef_instance/install/existing.rb +27 -0
- data/lib/chef_instance/install/package.rb +66 -0
- data/lib/chef_instance/provider_instance.rb +82 -0
- data/lib/chef_instance/resource_instance.rb +63 -0
- data/lib/chef_instance/service.rb +64 -0
- data/lib/chef_instance/service/init.rb +23 -0
- data/lib/chef_instance/service/runit.rb +24 -0
- data/lib/chef_instance/version.rb +5 -0
- data/test/spec/install/existing_spec.rb +45 -0
- data/test/spec/install/package_spec.rb +76 -0
- data/test/spec/install_spec.rb +46 -0
- data/test/spec/provider_instance_spec.rb +80 -0
- data/test/spec/resource_instance_spec.rb +74 -0
- data/test/spec/service/init_spec.rb +54 -0
- data/test/spec/service/runit_spec.rb +54 -0
- data/test/spec/service_spec.rb +62 -0
- data/test/spec/spec_helper.rb +22 -0
- metadata +293 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
require 'chef_instance/install'
|
3
|
+
|
4
|
+
describe ChefInstance::Install, '' do
|
5
|
+
let(:node) do
|
6
|
+
node = Chef::Node.new
|
7
|
+
node.automatic[:platform] = 'ubuntu'
|
8
|
+
node.automatic[:platform_version] = '12.04'
|
9
|
+
node
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
13
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
14
|
+
let(:resource) { 'package_test' }
|
15
|
+
let(:install) do
|
16
|
+
ChefInstance::Install::Template.new(resource, run_context)
|
17
|
+
end
|
18
|
+
|
19
|
+
before do
|
20
|
+
@install_res = install
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'Object Ancestry Checks' do
|
24
|
+
it 'Is a ChefInstance::Install::Template?' do
|
25
|
+
@install_res.must_be_kind_of(ChefInstance::Install::Template)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'Is a instance of Init' do
|
29
|
+
@install_res.must_be_instance_of(ChefInstance::Install::Template)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'It adhears to the Install::Template contract.' do
|
34
|
+
describe 'It should..' do
|
35
|
+
it 'Create.' do
|
36
|
+
@install_res.must_respond_to(:install)
|
37
|
+
proc { @install_res.install }.must_raise(NotImplementedError)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'Destroy.' do
|
41
|
+
@install_res.must_respond_to(:uninstall)
|
42
|
+
proc { @install_res.uninstall }.must_raise(NotImplementedError)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# minitest spec for ChefInstance::Resource::Instance
|
2
|
+
# Uses expectations from:
|
3
|
+
# http://docs.seattlerb.org/minitest/Minitest/Expectations.html
|
4
|
+
|
5
|
+
require_relative 'spec_helper'
|
6
|
+
require 'chef_instance/resource_instance'
|
7
|
+
require 'chef_instance/provider_instance'
|
8
|
+
require 'chef_instance/service/init'
|
9
|
+
|
10
|
+
describe ChefInstance::Resource::Instance,
|
11
|
+
'Tests for ChefInstance::Resource::Instance' do
|
12
|
+
|
13
|
+
let(:node) do
|
14
|
+
node = Chef::Node.new
|
15
|
+
node.automatic['platform'] = 'ubuntu'
|
16
|
+
node.automatic['platform_version'] = '12.04'
|
17
|
+
node
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
21
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
22
|
+
let(:instance_name) { 'test_instance' }
|
23
|
+
let(:config_res) do
|
24
|
+
ChefInstance::Resource::Instance.new(
|
25
|
+
instance_name, run_context)
|
26
|
+
end
|
27
|
+
|
28
|
+
before :each do
|
29
|
+
@test_instance = ChefInstance::Provider::Instance.new(
|
30
|
+
config_res, run_context)
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'Class type checks for ChefInstance::Provider::Instance' do
|
34
|
+
it 'Is a ChefInstance::Resource::Instance' do
|
35
|
+
@test_instance.must_be_kind_of(Chef::Provider)
|
36
|
+
end
|
37
|
+
it 'Subclasses Chef::Provider' do
|
38
|
+
@test_instance.must_be_instance_of(ChefInstance::Provider::Instance)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'Why Run' do
|
43
|
+
it 'supported?' do
|
44
|
+
@test_instance.must_respond_to('whyrun_supported?')
|
45
|
+
@test_instance.whyrun_supported?.must_equal(false)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'Can lookup instances.' do
|
50
|
+
before(:each) do
|
51
|
+
class ChefInstance::Provider::Instance
|
52
|
+
public :instance
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'has a `instance` method.' do
|
57
|
+
@test_instance.must_respond_to(:instance)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'Can lookup class constants.' do
|
62
|
+
before(:each) do
|
63
|
+
class ChefInstance::Provider::Instance
|
64
|
+
public :instance_sub_class
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'has a `instance` method.' do
|
69
|
+
@test_instance.must_respond_to(:instance_sub_class)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'can lookup our init service class' do
|
73
|
+
@test_instance.instance_sub_class('service', 'init')
|
74
|
+
.must_be_instance_of(Class)
|
75
|
+
@test_instance.instance_sub_class('service', 'init')
|
76
|
+
.to_s
|
77
|
+
.must_equal('ChefInstance::Service::Init')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# minitest spec for ChefInstance::Resource::Instance
|
2
|
+
# Uses expectations from:
|
3
|
+
# http://docs.seattlerb.org/minitest/Minitest/Expectations.html
|
4
|
+
|
5
|
+
require_relative 'spec_helper'
|
6
|
+
require 'chef_instance/resource_instance'
|
7
|
+
require 'chef_instance/provider_instance'
|
8
|
+
|
9
|
+
describe ChefInstance::Resource::Instance,
|
10
|
+
'Tests for ChefInstance::Resource::Instance' do
|
11
|
+
|
12
|
+
let(:node) do
|
13
|
+
node = Chef::Node.new
|
14
|
+
node.automatic['platform'] = 'ubuntu'
|
15
|
+
node.automatic['platform_version'] = '12.04'
|
16
|
+
node
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
20
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
21
|
+
let(:instance_name) { 'test_instance' }
|
22
|
+
|
23
|
+
before :each do
|
24
|
+
@test_instance = ChefInstance::Resource::Instance.new(
|
25
|
+
instance_name, run_context)
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'Class type checks for ChefInstance::Resource::Instance' do
|
29
|
+
it 'Is a ChefInstance::Resource::Instance' do
|
30
|
+
@test_instance.must_be_kind_of(Chef::Resource)
|
31
|
+
end
|
32
|
+
it 'Subclasses Chef::Resource' do
|
33
|
+
@test_instance.must_be_instance_of(ChefInstance::Resource::Instance)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'Parameter tests for ChefInstance::Resource::Instance' do
|
38
|
+
it 'has a `install_type` parameter that can be set' do
|
39
|
+
@test_instance.must_respond_to(:install_type)
|
40
|
+
@test_instance.install_type(:package)
|
41
|
+
@test_instance.install_type.must_equal(:package)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'has a `install_options` parameter that can be set' do
|
45
|
+
test_config = {
|
46
|
+
format: 'plain',
|
47
|
+
path: %w(/var/log/httpd/*_log),
|
48
|
+
type: 'httpd'
|
49
|
+
}
|
50
|
+
|
51
|
+
@test_instance.must_respond_to(:install_options)
|
52
|
+
@test_instance.install_options(test_config)
|
53
|
+
@test_instance.install_options.must_equal(test_config)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'has a `service_type` parameter that can be set' do
|
57
|
+
@test_instance.must_respond_to(:service_type)
|
58
|
+
@test_instance.service_type(:init)
|
59
|
+
@test_instance.service_type.must_equal(:init)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'has a `service_options` parameter that can be set' do
|
63
|
+
test_config = {
|
64
|
+
format: 'plain',
|
65
|
+
path: %w(/var/log/httpd/*_log),
|
66
|
+
type: 'httpd'
|
67
|
+
}
|
68
|
+
|
69
|
+
@test_instance.must_respond_to(:service_options)
|
70
|
+
@test_instance.service_options(test_config)
|
71
|
+
@test_instance.service_options.must_equal(test_config)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'chef_instance/service/init'
|
3
|
+
|
4
|
+
describe ChefInstance::Service::Init, '' do
|
5
|
+
|
6
|
+
let(:node) do
|
7
|
+
node = Chef::Node.new
|
8
|
+
node.automatic[:platform] = 'ubuntu'
|
9
|
+
node.automatic[:platform_version] = '12.04'
|
10
|
+
node
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
14
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
15
|
+
let(:resource) { 'init_test' }
|
16
|
+
let(:service) do
|
17
|
+
ChefInstance::Service::Init.new(resource, run_context)
|
18
|
+
end
|
19
|
+
|
20
|
+
before(:each) do
|
21
|
+
@service_res = service
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'Object Ancestry Checks' do
|
25
|
+
it 'Is a ChefInstance::Service::Template?' do
|
26
|
+
@service_res.must_be_kind_of(ChefInstance::Service::Template)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'Is a instance of Init' do
|
30
|
+
@service_res.must_be_instance_of(ChefInstance::Service::Init)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'It adhears to the Service::Template contract.' do
|
35
|
+
|
36
|
+
describe 'It should..' do
|
37
|
+
it 'Create.' do
|
38
|
+
@service_res.must_respond_to(:create)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'Destroy.' do
|
42
|
+
@service_res.must_respond_to(:destroy)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'Enable.' do
|
46
|
+
@service_res.must_respond_to(:enable)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'Disable.' do
|
50
|
+
@service_res.must_respond_to(:disable)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'chef_instance/service/runit'
|
3
|
+
|
4
|
+
describe ChefInstance::Service::Runit, '' do
|
5
|
+
|
6
|
+
let(:node) do
|
7
|
+
node = Chef::Node.new
|
8
|
+
node.automatic[:platform] = 'ubuntu'
|
9
|
+
node.automatic[:platform_version] = '12.04'
|
10
|
+
node
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
14
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
15
|
+
let(:resource) { 'runit_test' }
|
16
|
+
let(:service) do
|
17
|
+
ChefInstance::Service::Runit.new(resource, run_context)
|
18
|
+
end
|
19
|
+
|
20
|
+
before do
|
21
|
+
@service_res = service
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'Object Ancestry Checks' do
|
25
|
+
it 'Is a ChefInstance::Service::Template?' do
|
26
|
+
@service_res.must_be_kind_of(ChefInstance::Service::Template)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'Is a instance of Init' do
|
30
|
+
@service_res.must_be_instance_of(ChefInstance::Service::Runit)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'It adhears to the Service::Template contract.' do
|
35
|
+
|
36
|
+
describe 'It should..' do
|
37
|
+
it 'Create.' do
|
38
|
+
@service_res.must_respond_to(:create)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'Destroy.' do
|
42
|
+
@service_res.must_respond_to(:destroy)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'Enable.' do
|
46
|
+
@service_res.must_respond_to(:enable)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'Disable.' do
|
50
|
+
@service_res.must_respond_to(:disable)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
require 'chef_instance/service'
|
3
|
+
|
4
|
+
describe ChefInstance::Service, '' do
|
5
|
+
|
6
|
+
let(:node) do
|
7
|
+
node = Chef::Node.new
|
8
|
+
node.automatic[:platform] = 'ubuntu'
|
9
|
+
node.automatic[:platform_version] = '12.04'
|
10
|
+
node
|
11
|
+
end
|
12
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
13
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
14
|
+
let(:resource) { 'runit_test' }
|
15
|
+
let(:service) do
|
16
|
+
ChefInstance::Service::Template.new(resource, run_context)
|
17
|
+
end
|
18
|
+
let(:service_options) do
|
19
|
+
{
|
20
|
+
service: {
|
21
|
+
pattern: 'test',
|
22
|
+
init_command: '/etc/init.d/test'
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
before do
|
28
|
+
@service_res = service
|
29
|
+
@service_options = service_options
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'Object Ancestry Checks' do
|
33
|
+
it 'Is a ChefInstance::Service::Template?' do
|
34
|
+
@service_res.must_be_kind_of(ChefInstance::Service::Template)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'Is a instance of Init' do
|
38
|
+
@service_res.must_be_instance_of(ChefInstance::Service::Template)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'It adhears to the Service::Template contract.' do
|
43
|
+
|
44
|
+
describe 'It should..' do
|
45
|
+
it 'Create.' do
|
46
|
+
@service_res.must_respond_to(:create)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'Destroy.' do
|
50
|
+
@service_res.must_respond_to(:destroy)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'Enable.' do
|
54
|
+
@service_res.must_respond_to(:enable)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'Disable.' do
|
58
|
+
@service_res.must_respond_to(:disable)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
unless ENV['TRAVIS']
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter '/.gems/'
|
5
|
+
add_filter '/test/'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
if ENV['CODECLIMATE_REPO_TOKEN']
|
10
|
+
require 'codeclimate-test-reporter'
|
11
|
+
CodeClimate::TestReporter.start
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'chef/event_dispatch/dispatcher'
|
15
|
+
require 'chef/platform'
|
16
|
+
require 'chef/run_context'
|
17
|
+
require 'chef/resource'
|
18
|
+
require 'chef/resource/service'
|
19
|
+
require 'chef/provider'
|
20
|
+
require 'minitest/autorun'
|
21
|
+
|
22
|
+
Minitest::Test.parallelize_me!
|
metadata
ADDED
@@ -0,0 +1,293 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef_instance
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Miah Johnson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQ0wCwYDVQQDDARtaWFo
|
14
|
+
MRgwFgYKCZImiZPyLGQBGRYIY2hpYS1wZXQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
15
|
+
HhcNMTQwODA4MjM1OTA1WhcNMTUwODA4MjM1OTA1WjA+MQ0wCwYDVQQDDARtaWFo
|
16
|
+
MRgwFgYKCZImiZPyLGQBGRYIY2hpYS1wZXQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
17
|
+
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDeeUAfEXaV/W0FlwfZtSPU
|
18
|
+
i7+ED6EzPPxPKbhOd4bvP/9OF9iVpK4KLBdSbUL0d4TQ4yxSe6+5ZDmqYxolsA0H
|
19
|
+
VWokWnSXxW3vuLKOMp57JDc6hSkymPZD0vsmUh7UsERaicgdt9FQYYAM2gTyQvDR
|
20
|
+
S/ZanDvZIrU+l1HXx3O+txYid8W8bCxDRWHUbJ8meDHHrHn8hmB6m39LXMJy1k3Y
|
21
|
+
fccDTNI7Ni7otY682ti8yuBJF4Xw9ojwhzXnH7l/E75AlCX/ggFXK3l6CppwDfys
|
22
|
+
KP8pPFAlVnuMThYaRvmnOI9IiF5qEsI7c4goZy+LrpZFdz2zlX6BN54MuFcpG/MD
|
23
|
+
AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRN/hw/
|
24
|
+
8vKHvJiYOxM1uRZ3eAfihjAcBgNVHREEFTATgRFtaWFoQGNoaWEtcGV0Lm9yZzAc
|
25
|
+
BgNVHRIEFTATgRFtaWFoQGNoaWEtcGV0Lm9yZzANBgkqhkiG9w0BAQUFAAOCAQEA
|
26
|
+
S/lmW6szMp0gb3rKtAM9j4XS0aHUCmEDiPFlkjvsKxj5aIU81rvePaJyxoulID4H
|
27
|
+
mnW4BuxKC1YaBo0R3CL7izJ9Jrw09L6NTOLiTXdLNctNLZbVc4APywspvNlijtGa
|
28
|
+
kDHXTC6ftbxcU6SGjVw70yirtFhJGj2nmA69k7vj0/XiMbj6wcg1degf4ln0+B7O
|
29
|
+
IN8npbJjudV+Gok+TaIBJF+mxUIWw0Q3X+ZbM5vku5GU41Fdyc5d8zJ38CwOGTbf
|
30
|
+
HceOUVz35kgamNj0WW4lNAHyZi7cS0MeI/0B/AGUkaG7gWvyGBAgr1gJ2+4kMmcY
|
31
|
+
vg9xNKI52TEvhr97dNRNTQ==
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2014-08-09 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: chef
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 11.12.2
|
42
|
+
type: :runtime
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 11.12.2
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: codeclimate-test-reporter
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.3.0
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.3.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: minitest
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 5.3.1
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 5.3.1
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: rake
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 10.3.0
|
84
|
+
type: :development
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 10.3.0
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rubocop
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.20.1
|
98
|
+
type: :development
|
99
|
+
prerelease: false
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.20.1
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: simplecov
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.8.2
|
112
|
+
type: :development
|
113
|
+
prerelease: false
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.8.2
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: yard
|
121
|
+
requirement: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.8.7.3
|
126
|
+
type: :development
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.8.7.3
|
133
|
+
description: |
|
134
|
+
# chef_instance
|
135
|
+
|
136
|
+
## Why
|
137
|
+
|
138
|
+
What is our goal when we install a piece of daemonized software? Why does the
|
139
|
+
minutia of configuration concern us so greatly? Do we really want to emulate
|
140
|
+
shell scripts in a recipe and end up with hundreds of random resources on our node?
|
141
|
+
Why do I even care about resources on my node?
|
142
|
+
|
143
|
+
Before I answer those questions lets get back to our goal, which was?
|
144
|
+
|
145
|
+
Goal: A unique instance of a daemon with our supplied configuration.
|
146
|
+
|
147
|
+
## Usage
|
148
|
+
|
149
|
+
```
|
150
|
+
# In this hypothetical instance we have a 'pie' daemon named 'pumpkin' that stores
|
151
|
+
# pies recieved on port 314. We may want to run another instance called 'pecan' on
|
152
|
+
# a different port that receives different types of pies.
|
153
|
+
# htce::default.rb
|
154
|
+
pie_instance 'pumpkin' do
|
155
|
+
# File owner and group.
|
156
|
+
# Daemon user and group.
|
157
|
+
user 'pumpkin'
|
158
|
+
group 'pies'
|
159
|
+
# creates `/opt/pies/pumpkins` then stores all config and runtime data.
|
160
|
+
root_path '/opt/pies'
|
161
|
+
service_options({
|
162
|
+
port: 314,
|
163
|
+
store_pies: true,
|
164
|
+
daemon_args: %w(-Tsteaming -Sdelicious)
|
165
|
+
})
|
166
|
+
end
|
167
|
+
```
|
168
|
+
|
169
|
+
## How it works
|
170
|
+
|
171
|
+
Provides resource provider super classes for building instances of software.
|
172
|
+
|
173
|
+
```
|
174
|
+
class Chef
|
175
|
+
class Resource
|
176
|
+
class Daemon < Chef::Resource::Instance
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
```
|
181
|
+
|
182
|
+
Ignores system defaults (configuration, initscripts, etc).
|
183
|
+
|
184
|
+
## Installation
|
185
|
+
|
186
|
+
Because of Ruby library load race conditions with Chef and Gems you need to ensure that `chef_instance` is
|
187
|
+
installed before you execute Chef.
|
188
|
+
|
189
|
+
This can be achieved by:
|
190
|
+
|
191
|
+
- Install the Chef (through the Omnibus, or however you do it).
|
192
|
+
- Install `chef_instance` into the Ruby system used by Chef. If you used Omnibus you'll need to use the `gem`
|
193
|
+
command provided in `/opt/chef/embedded/bin`
|
194
|
+
|
195
|
+
## Code Style
|
196
|
+
|
197
|
+
This code follows the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide) and all contributions should as well.
|
198
|
+
|
199
|
+
The code style is checked by [Rubocop](http://batsov.com/rubocop/) and can be checked by executing `rake test:rubocop` or `rubocop`.
|
200
|
+
|
201
|
+
[![Build Status](https://travis-ci.org/miah/chef_instance.png?branch=master)](https://travis-ci.org/miah/chef_instance)
|
202
|
+
[![Code Climate](https://codeclimate.com/github/miah/chef_instance.png)](https://codeclimate.com/github/miah/chef_instance)
|
203
|
+
[![Code Climate Coverage](https://codeclimate.com/github/miah/chef_instance/coverage.png)](https://codeclimate.com/github/miah/chef_instance)
|
204
|
+
[![Dependency Status](https://gemnasium.com/miah/chef_instance.svg)](https://gemnasium.com/miah/chef_instance)
|
205
|
+
|
206
|
+
# Author
|
207
|
+
|
208
|
+
Author:: Miah Johnson (<miah@chia-pet.org>)
|
209
|
+
|
210
|
+
# License
|
211
|
+
|
212
|
+
Copyright 2013 Miah Johnson
|
213
|
+
|
214
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
215
|
+
you may not use this file except in compliance with the License.
|
216
|
+
You may obtain a copy of the License at
|
217
|
+
|
218
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
219
|
+
|
220
|
+
Unless required by applicable law or agreed to in writing, software
|
221
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
222
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
223
|
+
See the License for the specific language governing permissions and
|
224
|
+
limitations under the License.
|
225
|
+
email:
|
226
|
+
- miah@chia-pet.org
|
227
|
+
executables: []
|
228
|
+
extensions: []
|
229
|
+
extra_rdoc_files: []
|
230
|
+
files:
|
231
|
+
- ".gitignore"
|
232
|
+
- ".kitchen.yml"
|
233
|
+
- ".travis.yml"
|
234
|
+
- ".yardopts"
|
235
|
+
- Gemfile
|
236
|
+
- LICENSE
|
237
|
+
- README.md
|
238
|
+
- Rakefile
|
239
|
+
- certs/miah_johnson.pem
|
240
|
+
- chef_instance.gemspec
|
241
|
+
- lib/chef_instance/install.rb
|
242
|
+
- lib/chef_instance/install/existing.rb
|
243
|
+
- lib/chef_instance/install/package.rb
|
244
|
+
- lib/chef_instance/provider_instance.rb
|
245
|
+
- lib/chef_instance/resource_instance.rb
|
246
|
+
- lib/chef_instance/service.rb
|
247
|
+
- lib/chef_instance/service/init.rb
|
248
|
+
- lib/chef_instance/service/runit.rb
|
249
|
+
- lib/chef_instance/version.rb
|
250
|
+
- test/spec/install/existing_spec.rb
|
251
|
+
- test/spec/install/package_spec.rb
|
252
|
+
- test/spec/install_spec.rb
|
253
|
+
- test/spec/provider_instance_spec.rb
|
254
|
+
- test/spec/resource_instance_spec.rb
|
255
|
+
- test/spec/service/init_spec.rb
|
256
|
+
- test/spec/service/runit_spec.rb
|
257
|
+
- test/spec/service_spec.rb
|
258
|
+
- test/spec/spec_helper.rb
|
259
|
+
homepage: https://gitlab.com/viscera/chef_instance
|
260
|
+
licenses:
|
261
|
+
- Apache-2.0
|
262
|
+
metadata: {}
|
263
|
+
post_install_message:
|
264
|
+
rdoc_options: []
|
265
|
+
require_paths:
|
266
|
+
- lib
|
267
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0'
|
272
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
|
+
requirements:
|
274
|
+
- - ">="
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: '0'
|
277
|
+
requirements: []
|
278
|
+
rubyforge_project:
|
279
|
+
rubygems_version: 2.4.1
|
280
|
+
signing_key:
|
281
|
+
specification_version: 4
|
282
|
+
summary: Chef Resource & Provider Super Classes forbuilding stand-alone instances
|
283
|
+
of software.
|
284
|
+
test_files:
|
285
|
+
- test/spec/install/existing_spec.rb
|
286
|
+
- test/spec/install/package_spec.rb
|
287
|
+
- test/spec/install_spec.rb
|
288
|
+
- test/spec/provider_instance_spec.rb
|
289
|
+
- test/spec/resource_instance_spec.rb
|
290
|
+
- test/spec/service/init_spec.rb
|
291
|
+
- test/spec/service/runit_spec.rb
|
292
|
+
- test/spec/service_spec.rb
|
293
|
+
- test/spec/spec_helper.rb
|