poise-application 5.0.0 → 5.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 +4 -4
- data/.travis.yml +5 -0
- data/CHANGELOG.md +5 -1
- data/README.md +20 -0
- data/lib/poise_application/app_file_mixin.rb +61 -0
- data/lib/poise_application/cheftie.rb +1 -1
- data/lib/poise_application/resources.rb +8 -1
- data/lib/poise_application/resources/application_cookbook_file.rb +54 -0
- data/lib/poise_application/resources/application_file.rb +54 -0
- data/lib/poise_application/resources/application_template.rb +54 -0
- data/lib/poise_application/version.rb +1 -1
- data/test/gemfiles/chef-12.0.gemfile +19 -0
- data/test/gemfiles/chef-12.1.gemfile +19 -0
- data/test/gemfiles/chef-12.2.gemfile +1 -1
- data/test/gemfiles/chef-12.4.gemfile +19 -0
- data/test/gemfiles/chef-12.5.gemfile +19 -0
- data/test/gemfiles/chef-12.6.gemfile +19 -0
- data/test/spec/resources/application_cookbook_file_spec.rb +100 -0
- data/test/spec/resources/application_file_spec.rb +100 -0
- data/test/spec/resources/application_template_spec.rb +100 -0
- metadata +22 -3
- data/.kitchen.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d527860b3c2548bf627778c5d8dda62ab5c31ddb
|
4
|
+
data.tar.gz: 0e0a8574d33f5a2ab1c0715677b267ed4afc890d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bef8b15b02bac3a823f7cc9fa99ec00fb079080610f6c0d25634fe48b46aa40564bb4ae48569e70304104980fc59b8abe1da21ddb7cb3312db1779a9e6762e08
|
7
|
+
data.tar.gz: ee61530aec8fcb862c87a9165362ad06627e0d21d5ab884c6f25bbaecec28e7a8ca1146617c683916258d9f11aaec24387eb8aae60de720eac0f10d4c5ca7b6b
|
data/.travis.yml
CHANGED
@@ -18,6 +18,11 @@ script:
|
|
18
18
|
- "./bin/rake travis"
|
19
19
|
gemfile:
|
20
20
|
- test/gemfiles/chef-12.gemfile
|
21
|
+
- test/gemfiles/chef-12.0.gemfile
|
22
|
+
- test/gemfiles/chef-12.1.gemfile
|
21
23
|
- test/gemfiles/chef-12.2.gemfile
|
22
24
|
- test/gemfiles/chef-12.3.gemfile
|
25
|
+
- test/gemfiles/chef-12.4.gemfile
|
26
|
+
- test/gemfiles/chef-12.5.gemfile
|
27
|
+
- test/gemfiles/chef-12.6.gemfile
|
23
28
|
- test/gemfiles/master.gemfile
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -137,6 +137,26 @@ end
|
|
137
137
|
* `action_on_update_immediately` – Run the `action_on_update` notification with
|
138
138
|
`:immediately`. *(default: false)*
|
139
139
|
|
140
|
+
### `application_cookbook_file`, `application_file`, `application_template`
|
141
|
+
|
142
|
+
The `application_cookbook_file`, `application_file`, and `application_template`
|
143
|
+
resources extend the core Chef resources to take some application-level
|
144
|
+
configuration in to account:
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
application '/opt/myapp' do
|
148
|
+
template 'myapp.conf' do
|
149
|
+
source 'myapp.conf.erb'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
154
|
+
If the resource name is a relative path, it will be expanded relative to the
|
155
|
+
application path. If an owner or group is declared for the application, those
|
156
|
+
will be the default user and group for the resource.
|
157
|
+
|
158
|
+
All other actions and properties are the same as the similar resource in core Chef.
|
159
|
+
|
140
160
|
## Examples
|
141
161
|
|
142
162
|
Some test recipes are available as examples for common application frameworks:
|
@@ -0,0 +1,61 @@
|
|
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/utils'
|
18
|
+
|
19
|
+
require 'poise_application/app_mixin'
|
20
|
+
|
21
|
+
|
22
|
+
module PoiseApplication
|
23
|
+
# A helper mixin for `file`-like resources to make them take application
|
24
|
+
# resource data. Relative paths are expanded against the application path and
|
25
|
+
# the app owner/group are the default user/group for the resource.
|
26
|
+
#
|
27
|
+
# @api private
|
28
|
+
# @since 5.1.0
|
29
|
+
module AppFileMixin
|
30
|
+
include Poise::Utils::ResourceProviderMixin
|
31
|
+
|
32
|
+
module Resource
|
33
|
+
include PoiseApplication::AppMixin
|
34
|
+
|
35
|
+
def initialize(*)
|
36
|
+
super
|
37
|
+
# So our lazy default below can work. Not needed on 12.7+.
|
38
|
+
remove_instance_variable(:@path) if instance_variable_defined?(:@path)
|
39
|
+
end
|
40
|
+
|
41
|
+
# @!attribute path
|
42
|
+
# Override the default path to be relative to the app path.
|
43
|
+
# @return [String]
|
44
|
+
attribute(:path, kind_of: String, default: lazy { parent ? ::File.expand_path(name, parent.path) : name })
|
45
|
+
|
46
|
+
# @!attribute group
|
47
|
+
# Override the default group to be the app group if unspecified.
|
48
|
+
# @return [String, Integer]
|
49
|
+
attribute(:group, kind_of: [String, Integer, NilClass], default: lazy { parent && parent.group })
|
50
|
+
|
51
|
+
# @!attribute user
|
52
|
+
# Override the default user to be the app owner if unspecified.
|
53
|
+
# @return [String, Integer]
|
54
|
+
attribute(:user, kind_of: [String, Integer, NilClass], default: lazy { parent && parent.owner })
|
55
|
+
end
|
56
|
+
|
57
|
+
module Provider
|
58
|
+
include PoiseApplication::AppMixin
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -14,9 +14,16 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'poise_application/resources/application'
|
18
|
+
require 'poise_application/resources/application_cookbook_file'
|
19
|
+
require 'poise_application/resources/application_file'
|
20
|
+
require 'poise_application/resources/application_template'
|
21
|
+
|
17
22
|
|
18
23
|
module PoiseApplication
|
24
|
+
# Chef resources and providers for poise-application.
|
25
|
+
#
|
26
|
+
# @since 5.0.0
|
19
27
|
module Resources
|
20
|
-
autoload :Application, 'poise_application/resources/application'
|
21
28
|
end
|
22
29
|
end
|
@@ -0,0 +1,54 @@
|
|
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_application/app_file_mixin'
|
18
|
+
|
19
|
+
|
20
|
+
module PoiseApplication
|
21
|
+
module Resources
|
22
|
+
# (see ApplicationCookbookFile::Resource)
|
23
|
+
# @since 5.1.0
|
24
|
+
module ApplicationCookbookFile
|
25
|
+
# An `application_cookbook_file` resource to manage Chef cookbook_files inside and
|
26
|
+
# Application cookbook deployment.
|
27
|
+
#
|
28
|
+
# @provides application_cookbook_file
|
29
|
+
# @action create
|
30
|
+
# @action create_if_missing
|
31
|
+
# @action delete
|
32
|
+
# @action touch
|
33
|
+
# @example
|
34
|
+
# application '/srv/myapp' do
|
35
|
+
# cookbook_file 'myapp.conf' do
|
36
|
+
# source 'myapp.conf'
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
class Resource < Chef::Resource::CookbookFile
|
40
|
+
include PoiseApplication::AppFileMixin
|
41
|
+
provides(:application_cookbook_file)
|
42
|
+
actions(:create, :create_if_missing, :delete, :touch)
|
43
|
+
subclass_providers!
|
44
|
+
|
45
|
+
def initialize(*args)
|
46
|
+
super
|
47
|
+
# For older Chef.
|
48
|
+
@resource_name = :application_cookbook_file
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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_application/app_file_mixin'
|
18
|
+
|
19
|
+
|
20
|
+
module PoiseApplication
|
21
|
+
module Resources
|
22
|
+
# (see ApplicationFile::Resource)
|
23
|
+
# @since 5.1.0
|
24
|
+
module ApplicationFile
|
25
|
+
# An `application_file` resource to manage Chef files inside and
|
26
|
+
# Application cookbook deployment.
|
27
|
+
#
|
28
|
+
# @provides application_file
|
29
|
+
# @action create
|
30
|
+
# @action create_if_missing
|
31
|
+
# @action delete
|
32
|
+
# @action touch
|
33
|
+
# @example
|
34
|
+
# application '/srv/myapp' do
|
35
|
+
# file 'myapp.conf' do
|
36
|
+
# source 'myapp.conf.erb'
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
class Resource < Chef::Resource::File
|
40
|
+
include PoiseApplication::AppFileMixin
|
41
|
+
provides(:application_file)
|
42
|
+
actions(:create, :create_if_missing, :delete, :touch)
|
43
|
+
subclass_providers!
|
44
|
+
|
45
|
+
def initialize(*args)
|
46
|
+
super
|
47
|
+
# For older Chef.
|
48
|
+
@resource_name = :application_file
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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_application/app_file_mixin'
|
18
|
+
|
19
|
+
|
20
|
+
module PoiseApplication
|
21
|
+
module Resources
|
22
|
+
# (see ApplicationTemplate::Resource)
|
23
|
+
# @since 5.1.0
|
24
|
+
module ApplicationTemplate
|
25
|
+
# An `application_template` resource to manage Chef templates inside and
|
26
|
+
# Application cookbook deployment.
|
27
|
+
#
|
28
|
+
# @provides application_template
|
29
|
+
# @action create
|
30
|
+
# @action create_if_missing
|
31
|
+
# @action delete
|
32
|
+
# @action touch
|
33
|
+
# @example
|
34
|
+
# application '/srv/myapp' do
|
35
|
+
# template 'myapp.conf' do
|
36
|
+
# source 'myapp.conf.erb'
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
class Resource < Chef::Resource::Template
|
40
|
+
include PoiseApplication::AppFileMixin
|
41
|
+
provides(:application_template)
|
42
|
+
actions(:create, :create_if_missing, :delete, :touch)
|
43
|
+
subclass_providers!
|
44
|
+
|
45
|
+
def initialize(*args)
|
46
|
+
super
|
47
|
+
# For older Chef.
|
48
|
+
@resource_name = :application_template
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,19 @@
|
|
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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.0.3'
|
@@ -0,0 +1,19 @@
|
|
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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.1.2'
|
@@ -0,0 +1,19 @@
|
|
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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.4.3'
|
@@ -0,0 +1,19 @@
|
|
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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.5.1'
|
@@ -0,0 +1,19 @@
|
|
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
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
|
19
|
+
gem 'chef', '~> 12.6.0'
|
@@ -0,0 +1,100 @@
|
|
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 PoiseApplication::Resources::ApplicationCookbookFile do
|
20
|
+
context 'with a relative path' do
|
21
|
+
recipe do
|
22
|
+
application '/home/app' do
|
23
|
+
cookbook_file 'app.conf'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it { is_expected.to create_application_cookbook_file('app.conf').with(path: '/home/app/app.conf') }
|
28
|
+
end # /context with a relative path
|
29
|
+
|
30
|
+
context 'with an absolute path' do
|
31
|
+
recipe do
|
32
|
+
application '/home/app' do
|
33
|
+
cookbook_file '/app.conf'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it { is_expected.to create_application_cookbook_file('/app.conf').with(path: '/app.conf') }
|
38
|
+
end # /context with an absolute path
|
39
|
+
|
40
|
+
context 'with an application user' do
|
41
|
+
recipe do
|
42
|
+
application '/home/app' do
|
43
|
+
owner 'myuser'
|
44
|
+
cookbook_file 'app.conf'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it { is_expected.to create_application_cookbook_file('app.conf').with(user: 'myuser') }
|
49
|
+
end # /context 'with an application user
|
50
|
+
|
51
|
+
context 'with an application user and a local user' do
|
52
|
+
recipe do
|
53
|
+
application '/home/app' do
|
54
|
+
owner 'myuser'
|
55
|
+
cookbook_file 'app.conf' do
|
56
|
+
user 'otheruser'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it { is_expected.to create_application_cookbook_file('app.conf').with(user: 'otheruser') }
|
62
|
+
end # /context 'with an application user and a local user
|
63
|
+
|
64
|
+
context 'with an application group' do
|
65
|
+
recipe do
|
66
|
+
application '/home/app' do
|
67
|
+
group 'mygroup'
|
68
|
+
cookbook_file 'app.conf'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it { is_expected.to create_application_cookbook_file('app.conf').with(group: 'mygroup') }
|
73
|
+
end # /context 'with an application group
|
74
|
+
|
75
|
+
context 'with an application user and a local group' do
|
76
|
+
recipe do
|
77
|
+
application '/home/app' do
|
78
|
+
group 'mygroup'
|
79
|
+
cookbook_file 'app.conf' do
|
80
|
+
group 'othergroup'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it { is_expected.to create_application_cookbook_file('app.conf').with(group: 'othergroup') }
|
86
|
+
end # /context 'with an application group and a local group
|
87
|
+
|
88
|
+
context 'with more properties' do
|
89
|
+
recipe do
|
90
|
+
application '/home/app' do
|
91
|
+
cookbook_file 'app.conf' do
|
92
|
+
action :create_if_missing
|
93
|
+
source 'app.conf'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it { is_expected.to create_if_missing_application_cookbook_file('app.conf').with(source: 'app.conf')}
|
99
|
+
end # /context with more properties
|
100
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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 PoiseApplication::Resources::ApplicationFile do
|
20
|
+
context 'with a relative path' do
|
21
|
+
recipe do
|
22
|
+
application '/home/app' do
|
23
|
+
file 'app.conf'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it { is_expected.to create_application_file('app.conf').with(path: '/home/app/app.conf') }
|
28
|
+
end # /context with a relative path
|
29
|
+
|
30
|
+
context 'with an absolute path' do
|
31
|
+
recipe do
|
32
|
+
application '/home/app' do
|
33
|
+
file '/app.conf'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it { is_expected.to create_application_file('/app.conf').with(path: '/app.conf') }
|
38
|
+
end # /context with an absolute path
|
39
|
+
|
40
|
+
context 'with an application user' do
|
41
|
+
recipe do
|
42
|
+
application '/home/app' do
|
43
|
+
owner 'myuser'
|
44
|
+
file 'app.conf'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it { is_expected.to create_application_file('app.conf').with(user: 'myuser') }
|
49
|
+
end # /context 'with an application user
|
50
|
+
|
51
|
+
context 'with an application user and a local user' do
|
52
|
+
recipe do
|
53
|
+
application '/home/app' do
|
54
|
+
owner 'myuser'
|
55
|
+
file 'app.conf' do
|
56
|
+
user 'otheruser'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it { is_expected.to create_application_file('app.conf').with(user: 'otheruser') }
|
62
|
+
end # /context 'with an application user and a local user
|
63
|
+
|
64
|
+
context 'with an application group' do
|
65
|
+
recipe do
|
66
|
+
application '/home/app' do
|
67
|
+
group 'mygroup'
|
68
|
+
file 'app.conf'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it { is_expected.to create_application_file('app.conf').with(group: 'mygroup') }
|
73
|
+
end # /context 'with an application group
|
74
|
+
|
75
|
+
context 'with an application user and a local group' do
|
76
|
+
recipe do
|
77
|
+
application '/home/app' do
|
78
|
+
group 'mygroup'
|
79
|
+
file 'app.conf' do
|
80
|
+
group 'othergroup'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it { is_expected.to create_application_file('app.conf').with(group: 'othergroup') }
|
86
|
+
end # /context 'with an application group and a local group
|
87
|
+
|
88
|
+
context 'with more properties' do
|
89
|
+
recipe do
|
90
|
+
application '/home/app' do
|
91
|
+
file 'app.conf' do
|
92
|
+
action :create_if_missing
|
93
|
+
content 'teapot'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it { is_expected.to create_if_missing_application_file('app.conf').with(content: 'teapot')}
|
99
|
+
end # /context with more properties
|
100
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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 PoiseApplication::Resources::ApplicationTemplate do
|
20
|
+
context 'with a relative path' do
|
21
|
+
recipe do
|
22
|
+
application '/home/app' do
|
23
|
+
template 'app.conf'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it { is_expected.to create_application_template('app.conf').with(path: '/home/app/app.conf') }
|
28
|
+
end # /context with a relative path
|
29
|
+
|
30
|
+
context 'with an absolute path' do
|
31
|
+
recipe do
|
32
|
+
application '/home/app' do
|
33
|
+
template '/app.conf'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it { is_expected.to create_application_template('/app.conf').with(path: '/app.conf') }
|
38
|
+
end # /context with an absolute path
|
39
|
+
|
40
|
+
context 'with an application user' do
|
41
|
+
recipe do
|
42
|
+
application '/home/app' do
|
43
|
+
owner 'myuser'
|
44
|
+
template 'app.conf'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it { is_expected.to create_application_template('app.conf').with(user: 'myuser') }
|
49
|
+
end # /context 'with an application user
|
50
|
+
|
51
|
+
context 'with an application user and a local user' do
|
52
|
+
recipe do
|
53
|
+
application '/home/app' do
|
54
|
+
owner 'myuser'
|
55
|
+
template 'app.conf' do
|
56
|
+
user 'otheruser'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it { is_expected.to create_application_template('app.conf').with(user: 'otheruser') }
|
62
|
+
end # /context 'with an application user and a local user
|
63
|
+
|
64
|
+
context 'with an application group' do
|
65
|
+
recipe do
|
66
|
+
application '/home/app' do
|
67
|
+
group 'mygroup'
|
68
|
+
template 'app.conf'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it { is_expected.to create_application_template('app.conf').with(group: 'mygroup') }
|
73
|
+
end # /context 'with an application group
|
74
|
+
|
75
|
+
context 'with an application user and a local group' do
|
76
|
+
recipe do
|
77
|
+
application '/home/app' do
|
78
|
+
group 'mygroup'
|
79
|
+
template 'app.conf' do
|
80
|
+
group 'othergroup'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it { is_expected.to create_application_template('app.conf').with(group: 'othergroup') }
|
86
|
+
end # /context 'with an application group and a local group
|
87
|
+
|
88
|
+
context 'with more properties' do
|
89
|
+
recipe do
|
90
|
+
application '/home/app' do
|
91
|
+
template 'app.conf' do
|
92
|
+
action :create_if_missing
|
93
|
+
source 'app.conf.erb'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it { is_expected.to create_if_missing_application_template('app.conf').with(source: 'app.conf.erb')}
|
99
|
+
end # /context with more properties
|
100
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poise-application
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Kantrowitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: halite
|
@@ -74,7 +74,6 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
|
-
- ".kitchen.travis.yml"
|
78
77
|
- ".kitchen.yml"
|
79
78
|
- ".travis.yml"
|
80
79
|
- Berksfile
|
@@ -85,11 +84,15 @@ files:
|
|
85
84
|
- Rakefile
|
86
85
|
- SUPPORTERS.md
|
87
86
|
- lib/poise_application.rb
|
87
|
+
- lib/poise_application/app_file_mixin.rb
|
88
88
|
- lib/poise_application/app_mixin.rb
|
89
89
|
- lib/poise_application/cheftie.rb
|
90
90
|
- lib/poise_application/error.rb
|
91
91
|
- lib/poise_application/resources.rb
|
92
92
|
- lib/poise_application/resources/application.rb
|
93
|
+
- lib/poise_application/resources/application_cookbook_file.rb
|
94
|
+
- lib/poise_application/resources/application_file.rb
|
95
|
+
- lib/poise_application/resources/application_template.rb
|
93
96
|
- lib/poise_application/service_mixin.rb
|
94
97
|
- lib/poise_application/utils.rb
|
95
98
|
- lib/poise_application/version.rb
|
@@ -100,13 +103,21 @@ files:
|
|
100
103
|
- test/cookbooks/application_test/resources/test_plugin.rb
|
101
104
|
- test/docker/docker.ca
|
102
105
|
- test/docker/docker.pem
|
106
|
+
- test/gemfiles/chef-12.0.gemfile
|
107
|
+
- test/gemfiles/chef-12.1.gemfile
|
103
108
|
- test/gemfiles/chef-12.2.gemfile
|
104
109
|
- test/gemfiles/chef-12.3.gemfile
|
110
|
+
- test/gemfiles/chef-12.4.gemfile
|
111
|
+
- test/gemfiles/chef-12.5.gemfile
|
112
|
+
- test/gemfiles/chef-12.6.gemfile
|
105
113
|
- test/gemfiles/chef-12.gemfile
|
106
114
|
- test/gemfiles/master.gemfile
|
107
115
|
- test/integration/default/serverspec/default_spec.rb
|
108
116
|
- test/spec/app_mixin_spec.rb
|
117
|
+
- test/spec/resources/application_cookbook_file_spec.rb
|
118
|
+
- test/spec/resources/application_file_spec.rb
|
109
119
|
- test/spec/resources/application_spec.rb
|
120
|
+
- test/spec/resources/application_template_spec.rb
|
110
121
|
- test/spec/service_mixin_spec.rb
|
111
122
|
- test/spec/spec_helper.rb
|
112
123
|
- test/spec/utils_spec.rb
|
@@ -142,13 +153,21 @@ test_files:
|
|
142
153
|
- test/cookbooks/application_test/resources/test_plugin.rb
|
143
154
|
- test/docker/docker.ca
|
144
155
|
- test/docker/docker.pem
|
156
|
+
- test/gemfiles/chef-12.0.gemfile
|
157
|
+
- test/gemfiles/chef-12.1.gemfile
|
145
158
|
- test/gemfiles/chef-12.2.gemfile
|
146
159
|
- test/gemfiles/chef-12.3.gemfile
|
160
|
+
- test/gemfiles/chef-12.4.gemfile
|
161
|
+
- test/gemfiles/chef-12.5.gemfile
|
162
|
+
- test/gemfiles/chef-12.6.gemfile
|
147
163
|
- test/gemfiles/chef-12.gemfile
|
148
164
|
- test/gemfiles/master.gemfile
|
149
165
|
- test/integration/default/serverspec/default_spec.rb
|
150
166
|
- test/spec/app_mixin_spec.rb
|
167
|
+
- test/spec/resources/application_cookbook_file_spec.rb
|
168
|
+
- test/spec/resources/application_file_spec.rb
|
151
169
|
- test/spec/resources/application_spec.rb
|
170
|
+
- test/spec/resources/application_template_spec.rb
|
152
171
|
- test/spec/service_mixin_spec.rb
|
153
172
|
- test/spec/spec_helper.rb
|
154
173
|
- test/spec/utils_spec.rb
|