poise-application-ruby 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.kitchen.yml +1 -8
- data/.travis.yml +59 -15
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -1
- data/README.md +34 -4
- data/Rakefile +1 -1
- data/chef/templates/secret_token.rb.erb +3 -0
- data/chef/templates/secrets.yml.erb +1 -1
- data/lib/poise_application_ruby.rb +1 -1
- data/lib/poise_application_ruby/app_mixin.rb +1 -1
- data/lib/poise_application_ruby/cheftie.rb +1 -1
- data/lib/poise_application_ruby/error.rb +1 -1
- data/lib/poise_application_ruby/resources.rb +2 -1
- data/lib/poise_application_ruby/resources/bundle_install.rb +1 -1
- data/lib/poise_application_ruby/resources/puma.rb +86 -0
- data/lib/poise_application_ruby/resources/rackup.rb +1 -1
- data/lib/poise_application_ruby/resources/rails.rb +40 -8
- data/lib/poise_application_ruby/resources/ruby.rb +1 -1
- data/lib/poise_application_ruby/resources/ruby_execute.rb +1 -1
- data/lib/poise_application_ruby/resources/ruby_gem.rb +1 -1
- data/lib/poise_application_ruby/resources/thin.rb +1 -1
- data/lib/poise_application_ruby/resources/unicorn.rb +1 -1
- data/lib/poise_application_ruby/service_mixin.rb +10 -2
- data/lib/poise_application_ruby/version.rb +2 -2
- data/poise-application-ruby.gemspec +5 -3
- data/test/{cookbooks/application_ruby_test → cookbook}/attributes/default.rb +1 -1
- data/test/{cookbooks/application_ruby_test → cookbook}/metadata.rb +2 -2
- data/test/{cookbooks/application_ruby_test → cookbook}/recipes/default.rb +4 -1
- data/test/{cookbooks/application_ruby_test → cookbook}/recipes/rails.rb +2 -2
- data/test/{cookbooks/application_ruby_test → cookbook}/recipes/sinatra.rb +2 -2
- data/test/gemfiles/chef-12.1.gemfile +23 -0
- data/test/gemfiles/chef-12.10.gemfile +23 -0
- data/test/gemfiles/chef-12.11.gemfile +23 -0
- data/test/gemfiles/chef-12.12.gemfile +22 -0
- data/test/gemfiles/chef-12.13.gemfile +22 -0
- data/test/gemfiles/chef-12.14.gemfile +19 -0
- data/test/gemfiles/chef-12.15.gemfile +19 -0
- data/test/gemfiles/chef-12.16.gemfile +19 -0
- data/test/gemfiles/chef-12.17.gemfile +19 -0
- data/test/gemfiles/chef-12.18.gemfile +19 -0
- data/test/gemfiles/chef-12.19.gemfile +19 -0
- data/test/gemfiles/chef-12.2.gemfile +23 -0
- data/test/gemfiles/chef-12.3.gemfile +23 -0
- data/test/gemfiles/chef-12.4.gemfile +24 -0
- data/test/gemfiles/chef-12.5.gemfile +23 -0
- data/test/gemfiles/chef-12.6.gemfile +23 -0
- data/test/gemfiles/chef-12.7.gemfile +23 -0
- data/test/gemfiles/chef-12.8.gemfile +23 -0
- data/test/gemfiles/chef-12.9.gemfile +23 -0
- data/test/gemfiles/chef-12.gemfile +2 -2
- data/test/gemfiles/chef-13.0.gemfile +19 -0
- data/test/gemfiles/chef-13.gemfile +19 -0
- data/test/gemfiles/master.gemfile +6 -1
- data/test/integration/default/serverspec/default_spec.rb +1 -1
- data/test/integration/default/serverspec/rails_spec.rb +1 -1
- data/test/integration/default/serverspec/sinatra_spec.rb +1 -1
- data/test/spec/resources/ruby_execute_spec.rb +1 -1
- data/test/spec/resources/ruby_spec.rb +1 -1
- data/test/spec/spec_helper.rb +1 -1
- metadata +94 -19
- data/.kitchen.travis.yml +0 -9
- data/Berksfile +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fba24adc4885d1dc3aa8f828e171f62eb2365feb
|
4
|
+
data.tar.gz: 357af4fcbf3037783623b73fab3d8c97f5449617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c6798bf1807c33dd1702f5cb19c02c711a024f447a8911c095c07ff0d9617338283ec9f034f88a890cd3e9e0e56bf33950beb09f8e2965daf1fb6e0508ee7b5
|
7
|
+
data.tar.gz: f19a2ee73de1675ea51ba99017d7187b9f9f2ee9783da7bdef4c7c8139b3917d02f83a518e03c9e62a5677c6058fd47c1d1675c03779d20de600f1639afa6c6c
|
data/.kitchen.yml
CHANGED
@@ -1,10 +1,3 @@
|
|
1
1
|
---
|
2
2
|
#<% require 'poise_boiler' %>
|
3
|
-
<%= PoiseBoiler.kitchen
|
4
|
-
|
5
|
-
suites:
|
6
|
-
- name: default
|
7
|
-
run_list:
|
8
|
-
- recipe[application_ruby_test]
|
9
|
-
- recipe[application_ruby_test::sinatra]
|
10
|
-
- recipe[application_ruby_test::rails]
|
3
|
+
<%= PoiseBoiler.kitchen %>
|
data/.travis.yml
CHANGED
@@ -1,21 +1,65 @@
|
|
1
1
|
sudo: false
|
2
2
|
cache: bundler
|
3
3
|
language: ruby
|
4
|
-
rvm:
|
5
|
-
- '2.2'
|
6
|
-
addons:
|
7
|
-
apt:
|
8
|
-
packages:
|
9
|
-
- libgecode-dev
|
10
4
|
env:
|
11
5
|
global:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
-
|
16
|
-
|
6
|
+
- secure: jQ+4WYd8BWSyWAvpvqbX/FXXhX/NbFmT1u/4WSTnFHi6DT+JFSE/nix6GnznGxK40/VXJaUPCN6bzgYPEK0XfYhcy+pdg9DuxYSKiKv/nsnACHI24MC6ipnHHpo3L+EsbZx2cpl9pHRiZf9sLH9X0lgIY1kNGWcu1Mdqa4+zk3s=
|
7
|
+
- secure: K3R3/mibEEGg4IdvwoZ5xWxdOghMY98bt9L6ywYfnlROyJMAzkMvqxj3fgRmDsoOKoVF1zE4tMd1OmJ2Utc4IzL+PNFOOMt7Py8DZ+BSxCj8HNvO+FbrNITYXxA1ofiy/vbLAm1Lx073Vq/KilTWr7L0i9DZmCweWHxv6SYPB9s=
|
8
|
+
before_install:
|
9
|
+
- 'if [[ $BUNDLE_GEMFILE == *master.gemfile ]]; then gem update --system; fi'
|
10
|
+
- gem --version
|
11
|
+
- gem install bundler
|
12
|
+
- bundle --version
|
13
|
+
- 'bundle config --local path ${BUNDLE_PATH:-$(dirname $BUNDLE_GEMFILE)/vendor/bundle}'
|
14
|
+
- bundle config --local bin $PWD/bin
|
15
|
+
install: bundle update --jobs=3 --retry=3
|
17
16
|
script:
|
18
|
-
-
|
19
|
-
|
20
|
-
|
21
|
-
-
|
17
|
+
- ./bin/rake travis
|
18
|
+
matrix:
|
19
|
+
include:
|
20
|
+
- rvm: 2.3.1
|
21
|
+
gemfile: test/gemfiles/chef-12.gemfile
|
22
|
+
- rvm: 2.4.1
|
23
|
+
gemfile: test/gemfiles/chef-13.gemfile
|
24
|
+
- rvm: 2.1.4
|
25
|
+
gemfile: test/gemfiles/chef-12.1.gemfile
|
26
|
+
- rvm: 2.1.4
|
27
|
+
gemfile: test/gemfiles/chef-12.2.gemfile
|
28
|
+
- rvm: 2.1.4
|
29
|
+
gemfile: test/gemfiles/chef-12.3.gemfile
|
30
|
+
- rvm: 2.1.6
|
31
|
+
gemfile: test/gemfiles/chef-12.4.gemfile
|
32
|
+
- rvm: 2.1.6
|
33
|
+
gemfile: test/gemfiles/chef-12.5.gemfile
|
34
|
+
- rvm: 2.1.6
|
35
|
+
gemfile: test/gemfiles/chef-12.6.gemfile
|
36
|
+
- rvm: 2.1.6
|
37
|
+
gemfile: test/gemfiles/chef-12.7.gemfile
|
38
|
+
- rvm: 2.1.6
|
39
|
+
gemfile: test/gemfiles/chef-12.8.gemfile
|
40
|
+
- rvm: 2.1.8
|
41
|
+
gemfile: test/gemfiles/chef-12.9.gemfile
|
42
|
+
- rvm: 2.1.8
|
43
|
+
gemfile: test/gemfiles/chef-12.10.gemfile
|
44
|
+
- rvm: 2.1.8
|
45
|
+
gemfile: test/gemfiles/chef-12.11.gemfile
|
46
|
+
- rvm: 2.1.8
|
47
|
+
gemfile: test/gemfiles/chef-12.12.gemfile
|
48
|
+
- rvm: 2.1.9
|
49
|
+
gemfile: test/gemfiles/chef-12.13.gemfile
|
50
|
+
- rvm: 2.3.1
|
51
|
+
gemfile: test/gemfiles/chef-12.14.gemfile
|
52
|
+
- rvm: 2.3.1
|
53
|
+
gemfile: test/gemfiles/chef-12.15.gemfile
|
54
|
+
- rvm: 2.3.1
|
55
|
+
gemfile: test/gemfiles/chef-12.16.gemfile
|
56
|
+
- rvm: 2.3.1
|
57
|
+
gemfile: test/gemfiles/chef-12.17.gemfile
|
58
|
+
- rvm: 2.3.1
|
59
|
+
gemfile: test/gemfiles/chef-12.18.gemfile
|
60
|
+
- rvm: 2.3.1
|
61
|
+
gemfile: test/gemfiles/chef-12.19.gemfile
|
62
|
+
- rvm: 2.4.1
|
63
|
+
gemfile: test/gemfiles/chef-13.0.gemfile
|
64
|
+
- rvm: 2.4.1
|
65
|
+
gemfile: test/gemfiles/master.gemfile
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Application_Ruby Changelog
|
2
2
|
|
3
|
+
## v4.1.0
|
4
|
+
|
5
|
+
* Add an `application_puma` resource to run a Puma application server.
|
6
|
+
* Add support for `:initializer` style secrets for the `application_rails` resource.
|
7
|
+
* Chef 13 support.
|
8
|
+
|
3
9
|
## v4.0.1
|
4
10
|
|
5
11
|
* Correct `gem_binary` results for `application_ruby`.
|
data/Gemfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2017, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -31,7 +31,11 @@ dev_gem 'halite'
|
|
31
31
|
dev_gem 'poise'
|
32
32
|
dev_gem 'poise-application', path: '../application'
|
33
33
|
dev_gem 'poise-application-git', path: '../application_git'
|
34
|
+
dev_gem 'poise-archive'
|
34
35
|
dev_gem 'poise-boiler'
|
36
|
+
dev_gem 'poise-build-essential'
|
37
|
+
dev_gem 'poise-git'
|
35
38
|
dev_gem 'poise-languages'
|
39
|
+
dev_gem 'poise-profiler'
|
36
40
|
dev_gem 'poise-ruby'
|
37
41
|
dev_gem 'poise-service'
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ end
|
|
33
33
|
|
34
34
|
## Requirements
|
35
35
|
|
36
|
-
Chef 12 or newer is required.
|
36
|
+
Chef 12.1 or newer is required.
|
37
37
|
|
38
38
|
## Resources
|
39
39
|
|
@@ -53,6 +53,34 @@ end
|
|
53
53
|
|
54
54
|
All actions and properties are the same as the [`bundle_install` resource](https://github.com/poise/poise-ruby#bundle_install).
|
55
55
|
|
56
|
+
### `application_puma`
|
57
|
+
|
58
|
+
The `application_puma` resource creates a service for `puma`.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
application '/srv/myapp' do
|
62
|
+
puma do
|
63
|
+
port 8000
|
64
|
+
end
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Actions
|
69
|
+
|
70
|
+
* `:enable` – Create, enable and start the service. *(default)*
|
71
|
+
* `:disable` – Stop, disable, and destroy the service.
|
72
|
+
* `:start` – Start the service.
|
73
|
+
* `:stop` – Stop the service.
|
74
|
+
* `:restart` – Stop and then start the service.
|
75
|
+
* `:reload` – Send the configured reload signal to the service.
|
76
|
+
|
77
|
+
#### Properties
|
78
|
+
|
79
|
+
* `path` – Base path for the application. *(name attribute)*
|
80
|
+
* `port` – Port to listen on. *(default: 80)*
|
81
|
+
* `service_name` – Name of the service to create. *(default: auto-detect)*
|
82
|
+
* `user` – User to run the service as. *(default: application owner)*
|
83
|
+
|
56
84
|
### `application_rackup`
|
57
85
|
|
58
86
|
The `application_rackup` resource creates a service for `rackup`.
|
@@ -102,6 +130,8 @@ end
|
|
102
130
|
#### Properties
|
103
131
|
|
104
132
|
* `path` – Base path for the application. *(name attribute)*
|
133
|
+
* `app_module` – Top-level application module. Only needed for the :initializer
|
134
|
+
style of secret token configuration. *(default: auto-detect)*
|
105
135
|
* `database` – Database settings for Rails. See [the database section
|
106
136
|
below](#database-parameters) for more information. *(option collector)*
|
107
137
|
* `migrate` – Run database migrations. *(default: false)*
|
@@ -218,7 +248,7 @@ end
|
|
218
248
|
* `config_path` – Path to a Thin configuration file.
|
219
249
|
* `port` – Port to listen on. *(default: 80)*
|
220
250
|
* `service_name` – Name of the service to create. *(default: auto-detect)*
|
221
|
-
|
251
|
+
* `user` – User to run the service as. *(default: application owner)*
|
222
252
|
|
223
253
|
### `application_unicorn`
|
224
254
|
|
@@ -246,7 +276,7 @@ end
|
|
246
276
|
* `path` – Base path for the application. *(name attribute)*
|
247
277
|
* `port` – Port to listen on. *(default: 80)*
|
248
278
|
* `service_name` – Name of the service to create. *(default: auto-detect)*
|
249
|
-
|
279
|
+
* `user` – User to run the service as. *(default: application owner)*
|
250
280
|
|
251
281
|
## Sponsors
|
252
282
|
|
@@ -256,7 +286,7 @@ The Poise test server infrastructure is sponsored by [Rackspace](https://rackspa
|
|
256
286
|
|
257
287
|
## License
|
258
288
|
|
259
|
-
Copyright 2015, Noah Kantrowitz
|
289
|
+
Copyright 2015-2017, Noah Kantrowitz
|
260
290
|
|
261
291
|
Licensed under the Apache License, Version 2.0 (the "License");
|
262
292
|
you may not use this file except in compliance with the License.
|
data/Rakefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2017, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require 'poise_application_ruby/resources/bundle_install'
|
18
|
+
require 'poise_application_ruby/resources/puma'
|
18
19
|
require 'poise_application_ruby/resources/rackup'
|
19
20
|
require 'poise_application_ruby/resources/rails'
|
20
21
|
require 'poise_application_ruby/resources/ruby'
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015-2017, 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 'chef/provider'
|
18
|
+
require 'chef/resource'
|
19
|
+
|
20
|
+
require 'poise_application_ruby/service_mixin'
|
21
|
+
|
22
|
+
module PoiseApplicationRuby
|
23
|
+
module Resources
|
24
|
+
# (see Puma::Resource)
|
25
|
+
# @since 4.1.0
|
26
|
+
module Puma
|
27
|
+
# An `application_puma` resource to manage a puma web application
|
28
|
+
# server.
|
29
|
+
#
|
30
|
+
# @since 4.1.0
|
31
|
+
# @provides application_puma
|
32
|
+
# @action enable
|
33
|
+
# @action disable
|
34
|
+
# @action start
|
35
|
+
# @action stop
|
36
|
+
# @action restart
|
37
|
+
# @action reload
|
38
|
+
# @example
|
39
|
+
# application '/srv/myapp' do
|
40
|
+
# git '...'
|
41
|
+
# bundle_install
|
42
|
+
# puma do
|
43
|
+
# port 8080
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
class Resource < Chef::Resource
|
47
|
+
include PoiseApplicationRuby::ServiceMixin
|
48
|
+
provides(:application_puma)
|
49
|
+
|
50
|
+
# @!attribute port
|
51
|
+
# Port to bind to.
|
52
|
+
attribute(:port, kind_of: [String, Integer], default: 80)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Provider for `application_puma`.
|
56
|
+
#
|
57
|
+
# @since 4.1.0
|
58
|
+
# @see Resource
|
59
|
+
# @provides application_puma
|
60
|
+
class Provider < Chef::Provider
|
61
|
+
include PoiseApplicationRuby::ServiceMixin
|
62
|
+
provides(:application_puma)
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
# Find the path to the config.ru. If the resource path was to a
|
67
|
+
# directory, apparent /config.ru.
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
def configru_path
|
71
|
+
@configru_path ||= if ::File.directory?(new_resource.path)
|
72
|
+
::File.join(new_resource.path, 'config.ru')
|
73
|
+
else
|
74
|
+
new_resource.path
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Set service resource options.
|
79
|
+
def service_options(resource)
|
80
|
+
super
|
81
|
+
resource.ruby_command("puma --port #{new_resource.port} #{configru_path}")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2015, Noah Kantrowitz
|
2
|
+
# Copyright 2015-2017, Noah Kantrowitz
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -18,6 +18,7 @@ require 'chef/provider'
|
|
18
18
|
require 'chef/resource'
|
19
19
|
|
20
20
|
require 'poise_application_ruby/app_mixin'
|
21
|
+
require 'poise_application_ruby/error'
|
21
22
|
|
22
23
|
|
23
24
|
module PoiseApplicationRuby
|
@@ -47,6 +48,11 @@ module PoiseApplicationRuby
|
|
47
48
|
provides(:application_rails)
|
48
49
|
actions(:deploy)
|
49
50
|
|
51
|
+
# @!attribute app_module
|
52
|
+
# Top-level application module. Only needed for the :initializer style
|
53
|
+
# of secret token configuration, and generally auto-detected.
|
54
|
+
# @return [String, false, nil]
|
55
|
+
attribute(:app_module, kind_of: [String, FalseClass, NilClass], default: lazy { default_app_module })
|
50
56
|
# @!attribute database
|
51
57
|
# Option collector attribute for Rails database configuration.
|
52
58
|
# @return [Hash]
|
@@ -84,14 +90,20 @@ module PoiseApplicationRuby
|
|
84
90
|
# Secret token for Rails session verification and other purposes. On
|
85
91
|
# Rails 4.2 this will be used for secret_key_base. If not set, no
|
86
92
|
# secrets configuration is written.
|
87
|
-
# @return [String]
|
88
|
-
attribute(:secret_token, kind_of: [String, FalseClass])
|
93
|
+
# @return [String, false, nil]
|
94
|
+
attribute(:secret_token, kind_of: [String, FalseClass, NilClass])
|
89
95
|
# @!attribute secrets_config
|
90
96
|
# Template content attribute for the contents of secrets.yml. Only
|
91
97
|
# used when secrets_mode is :yaml.
|
92
98
|
# @todo Redo this doc to cover the actual attributes created.
|
93
99
|
# @return [Poise::Helpers::TemplateContent]
|
94
100
|
attribute(:secrets_config, template: true, default_source: 'secrets.yml.erb', default_options: lazy { default_secrets_options })
|
101
|
+
# @!attribute secrets_initializer
|
102
|
+
# Template content attribute for the contents of secret_token.rb. Only
|
103
|
+
# used when secrets_mode is :initializer.
|
104
|
+
# @todo Redo this doc to cover the actual attributes created.
|
105
|
+
# @return [Poise::Helpers::TemplateContent]
|
106
|
+
attribute(:secrets_initializer, template: true, default_source: 'secret_token.rb.erb', default_options: lazy { default_secrets_options })
|
95
107
|
# @!attribute secrets_mode
|
96
108
|
# Secrets configuration mode. Set to `:yaml` to generate a Rails 4.2
|
97
109
|
# secrets.yml. Set to `:initializer` to update
|
@@ -140,21 +152,33 @@ module PoiseApplicationRuby
|
|
140
152
|
#
|
141
153
|
# @return [Symbol]
|
142
154
|
def default_secrets_mode
|
143
|
-
::File.exists?(::File.join(path, 'config', 'initializers', 'secret_token.rb')) ? :
|
155
|
+
::File.exists?(::File.join(path, 'config', 'initializers', 'secret_token.rb')) ? :initializer : :yaml
|
144
156
|
end
|
145
157
|
|
146
|
-
# Default template variables for the secrets.yml.
|
158
|
+
# Default template variables for the secrets.yml and secret_token.rb.
|
147
159
|
#
|
148
160
|
# @return [Hash<Symbol, Object>]
|
149
161
|
def default_secrets_options
|
150
162
|
{
|
151
|
-
|
163
|
+
yaml_config: {
|
152
164
|
rails_env => {
|
153
165
|
'secret_key_base' => secret_token,
|
154
166
|
}
|
155
167
|
},
|
168
|
+
secret_token: secret_token,
|
169
|
+
app_module: if secrets_mode == :initializer
|
170
|
+
raise Error.new("Unable to extract app module for #{self}, please set app_module property") if !app_module || app_module.empty?
|
171
|
+
app_module
|
172
|
+
end
|
156
173
|
}
|
157
174
|
end
|
175
|
+
|
176
|
+
# Default application module name.
|
177
|
+
#
|
178
|
+
# @return [String]
|
179
|
+
def default_app_module
|
180
|
+
IO.read(::File.join(path, 'config', 'initializers', 'secret_token.rb'))[/(\w+)::Application\.config\.secret_token/, 1]
|
181
|
+
end
|
158
182
|
end
|
159
183
|
|
160
184
|
# Provider for `application_rails`.
|
@@ -205,6 +229,8 @@ module PoiseApplicationRuby
|
|
205
229
|
write_secrets_yml
|
206
230
|
when :initializer
|
207
231
|
write_secrets_initializer
|
232
|
+
else
|
233
|
+
raise Error.new("Unknown secrets mode #{new_resource.secrets_mode.inspect}")
|
208
234
|
end
|
209
235
|
end
|
210
236
|
|
@@ -215,13 +241,19 @@ module PoiseApplicationRuby
|
|
215
241
|
group new_resource.parent.group
|
216
242
|
mode '640'
|
217
243
|
content new_resource.secrets_config_content
|
244
|
+
sensitive true
|
218
245
|
end
|
219
246
|
end
|
220
247
|
|
221
248
|
# In-place update a config/initializers/secret_token.rb file.
|
222
249
|
def write_secrets_initializer
|
223
|
-
|
224
|
-
|
250
|
+
file ::File.join(new_resource.path, 'config', 'initializers', 'secret_token.rb') do
|
251
|
+
user new_resource.parent.owner
|
252
|
+
group new_resource.parent.group
|
253
|
+
mode '640'
|
254
|
+
content new_resource.secrets_initializer_content
|
255
|
+
sensitive true
|
256
|
+
end
|
225
257
|
end
|
226
258
|
|
227
259
|
# Precompile assets using the rake task.
|