poise-service 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.kitchen.travis.yml +4 -0
- data/.kitchen.yml +9 -0
- data/.travis.yml +23 -0
- data/.yardopts +6 -0
- data/Berksfile +27 -0
- data/Gemfile +33 -0
- data/LICENSE +201 -0
- data/README.md +381 -0
- data/Rakefile +17 -0
- data/chef/attributes/default.rb +19 -0
- data/chef/templates/systemd.service.erb +13 -0
- data/chef/templates/sysvinit.sh.erb +177 -0
- data/chef/templates/upstart.conf.erb +37 -0
- data/lib/poise_service.rb +25 -0
- data/lib/poise_service/cheftie.rb +18 -0
- data/lib/poise_service/error.rb +20 -0
- data/lib/poise_service/resources.rb +28 -0
- data/lib/poise_service/resources/poise_service.rb +161 -0
- data/lib/poise_service/resources/poise_service_test.rb +200 -0
- data/lib/poise_service/resources/poise_service_user.rb +136 -0
- data/lib/poise_service/service_mixin.rb +192 -0
- data/lib/poise_service/service_providers.rb +37 -0
- data/lib/poise_service/service_providers/base.rb +193 -0
- data/lib/poise_service/service_providers/dummy.rb +100 -0
- data/lib/poise_service/service_providers/systemd.rb +63 -0
- data/lib/poise_service/service_providers/sysvinit.rb +86 -0
- data/lib/poise_service/service_providers/upstart.rb +117 -0
- data/lib/poise_service/utils.rb +45 -0
- data/lib/poise_service/version.rb +19 -0
- data/poise-service.gemspec +41 -0
- data/test/cookbooks/poise-service_test/metadata.rb +18 -0
- data/test/cookbooks/poise-service_test/providers/mixin.rb +43 -0
- data/test/cookbooks/poise-service_test/recipes/default.rb +47 -0
- data/test/cookbooks/poise-service_test/recipes/mixin.rb +34 -0
- data/test/cookbooks/poise-service_test/resources/mixin.rb +26 -0
- data/test/gemfiles/chef-12.gemfile +19 -0
- data/test/gemfiles/master.gemfile +22 -0
- data/test/integration/default/serverspec/Gemfile +19 -0
- data/test/integration/default/serverspec/default_spec.rb +45 -0
- data/test/integration/default/serverspec/mixin_spec.rb +37 -0
- data/test/spec/resources/poise_service_spec.rb +235 -0
- data/test/spec/resources/poise_service_user_spec.rb +119 -0
- data/test/spec/service_mixin_spec.rb +164 -0
- data/test/spec/service_providers/base_spec.rb +231 -0
- data/test/spec/service_providers/dummy_spec.rb +91 -0
- data/test/spec/service_providers/systemd_spec.rb +98 -0
- data/test/spec/service_providers/sysvinit_spec.rb +96 -0
- data/test/spec/service_providers/upstart_spec.rb +300 -0
- data/test/spec/spec_helper.rb +50 -0
- data/test/spec/utils_spec.rb +44 -0
- metadata +172 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'poise_boiler/spec_helper'
|
18
|
+
require 'poise_service'
|
19
|
+
|
20
|
+
|
21
|
+
module PoiseServiceHelper
|
22
|
+
def service_provider(name=nil, provider, &block)
|
23
|
+
provider ||= block.call if block
|
24
|
+
before do
|
25
|
+
override_attributes['poise-service'] ||= {}
|
26
|
+
if name
|
27
|
+
override_attributes['poise-service'][name] ||= {}
|
28
|
+
override_attributes['poise-service'][name]['provider'] = provider
|
29
|
+
else
|
30
|
+
override_attributes['poise-service']['provider'] = provider
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def service_resource_hints(hints, &block)
|
36
|
+
hints ||= block.call if block
|
37
|
+
before do
|
38
|
+
begin
|
39
|
+
PoiseService::ServiceProviders::Base.remove_class_variable(:@@service_resource_hints)
|
40
|
+
rescue NameError
|
41
|
+
# This space left intentionally blank.
|
42
|
+
end
|
43
|
+
allow(Chef::Platform::ServiceHelpers).to receive(:service_resource_providers).and_return(Array(hints))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
RSpec.configure do |config|
|
49
|
+
config.extend PoiseServiceHelper
|
50
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe PoiseService::Utils do
|
20
|
+
describe '#parse_service_name' do
|
21
|
+
let(:path) { }
|
22
|
+
subject { described_class.parse_service_name(path) }
|
23
|
+
|
24
|
+
context 'with /home/myapp' do
|
25
|
+
let(:path) { '/home/myapp' }
|
26
|
+
it { is_expected.to eq 'myapp' }
|
27
|
+
end # /context with /home/myapp
|
28
|
+
|
29
|
+
context 'with /opt/myapp' do
|
30
|
+
let(:path) { '/opt/myapp' }
|
31
|
+
it { is_expected.to eq 'myapp' }
|
32
|
+
end # /context with /opt/myapp
|
33
|
+
|
34
|
+
context 'with /srv/myapp/current' do
|
35
|
+
let(:path) { '/srv/myapp/current' }
|
36
|
+
it { is_expected.to eq 'myapp' }
|
37
|
+
end # /context with /srv/myapp/current
|
38
|
+
|
39
|
+
context 'with /var/current' do
|
40
|
+
let(:path) { '/var/current' }
|
41
|
+
it { is_expected.to eq 'current' }
|
42
|
+
end # /context with /var/current
|
43
|
+
end # /describe #parse_service_name
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: poise-service
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Noah Kantrowitz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: halite
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: poise
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: kitchen-rackspace
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: poise-boiler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
description: A Chef cookbook for managing system services.
|
70
|
+
email:
|
71
|
+
- noah@coderanger.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".kitchen.travis.yml"
|
78
|
+
- ".kitchen.yml"
|
79
|
+
- ".travis.yml"
|
80
|
+
- ".yardopts"
|
81
|
+
- Berksfile
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- chef/attributes/default.rb
|
87
|
+
- chef/templates/systemd.service.erb
|
88
|
+
- chef/templates/sysvinit.sh.erb
|
89
|
+
- chef/templates/upstart.conf.erb
|
90
|
+
- lib/poise_service.rb
|
91
|
+
- lib/poise_service/cheftie.rb
|
92
|
+
- lib/poise_service/error.rb
|
93
|
+
- lib/poise_service/resources.rb
|
94
|
+
- lib/poise_service/resources/poise_service.rb
|
95
|
+
- lib/poise_service/resources/poise_service_test.rb
|
96
|
+
- lib/poise_service/resources/poise_service_user.rb
|
97
|
+
- lib/poise_service/service_mixin.rb
|
98
|
+
- lib/poise_service/service_providers.rb
|
99
|
+
- lib/poise_service/service_providers/base.rb
|
100
|
+
- lib/poise_service/service_providers/dummy.rb
|
101
|
+
- lib/poise_service/service_providers/systemd.rb
|
102
|
+
- lib/poise_service/service_providers/sysvinit.rb
|
103
|
+
- lib/poise_service/service_providers/upstart.rb
|
104
|
+
- lib/poise_service/utils.rb
|
105
|
+
- lib/poise_service/version.rb
|
106
|
+
- poise-service.gemspec
|
107
|
+
- test/cookbooks/poise-service_test/metadata.rb
|
108
|
+
- test/cookbooks/poise-service_test/providers/mixin.rb
|
109
|
+
- test/cookbooks/poise-service_test/recipes/default.rb
|
110
|
+
- test/cookbooks/poise-service_test/recipes/mixin.rb
|
111
|
+
- test/cookbooks/poise-service_test/resources/mixin.rb
|
112
|
+
- test/gemfiles/chef-12.gemfile
|
113
|
+
- test/gemfiles/master.gemfile
|
114
|
+
- test/integration/default/serverspec/Gemfile
|
115
|
+
- test/integration/default/serverspec/default_spec.rb
|
116
|
+
- test/integration/default/serverspec/mixin_spec.rb
|
117
|
+
- test/spec/resources/poise_service_spec.rb
|
118
|
+
- test/spec/resources/poise_service_user_spec.rb
|
119
|
+
- test/spec/service_mixin_spec.rb
|
120
|
+
- test/spec/service_providers/base_spec.rb
|
121
|
+
- test/spec/service_providers/dummy_spec.rb
|
122
|
+
- test/spec/service_providers/systemd_spec.rb
|
123
|
+
- test/spec/service_providers/sysvinit_spec.rb
|
124
|
+
- test/spec/service_providers/upstart_spec.rb
|
125
|
+
- test/spec/spec_helper.rb
|
126
|
+
- test/spec/utils_spec.rb
|
127
|
+
homepage: https://github.com/poise/poise-service
|
128
|
+
licenses:
|
129
|
+
- Apache 2.0
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.4.5
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: A Chef cookbook for managing system services.
|
151
|
+
test_files:
|
152
|
+
- test/cookbooks/poise-service_test/metadata.rb
|
153
|
+
- test/cookbooks/poise-service_test/providers/mixin.rb
|
154
|
+
- test/cookbooks/poise-service_test/recipes/default.rb
|
155
|
+
- test/cookbooks/poise-service_test/recipes/mixin.rb
|
156
|
+
- test/cookbooks/poise-service_test/resources/mixin.rb
|
157
|
+
- test/gemfiles/chef-12.gemfile
|
158
|
+
- test/gemfiles/master.gemfile
|
159
|
+
- test/integration/default/serverspec/Gemfile
|
160
|
+
- test/integration/default/serverspec/default_spec.rb
|
161
|
+
- test/integration/default/serverspec/mixin_spec.rb
|
162
|
+
- test/spec/resources/poise_service_spec.rb
|
163
|
+
- test/spec/resources/poise_service_user_spec.rb
|
164
|
+
- test/spec/service_mixin_spec.rb
|
165
|
+
- test/spec/service_providers/base_spec.rb
|
166
|
+
- test/spec/service_providers/dummy_spec.rb
|
167
|
+
- test/spec/service_providers/systemd_spec.rb
|
168
|
+
- test/spec/service_providers/sysvinit_spec.rb
|
169
|
+
- test/spec/service_providers/upstart_spec.rb
|
170
|
+
- test/spec/spec_helper.rb
|
171
|
+
- test/spec/utils_spec.rb
|
172
|
+
has_rdoc:
|