|
14 | 14 | # limitations under the License. |
15 | 15 | # |
16 | 16 |
|
17 | | -require 'chef/mash' |
18 | 17 | require 'poise/backports' |
19 | 18 | require 'poise/utils' |
20 | 19 | require 'poise_application/app_mixin' |
21 | 20 | require 'poise_python/python_command_mixin' |
22 | 21 |
|
23 | 22 |
|
24 | 23 | module PoiseApplicationPython |
| 24 | + # A helper mixin for Python application resources and providers. |
| 25 | + # |
| 26 | + # @since 4.0.0 |
25 | 27 | module AppMixin |
26 | 28 | include Poise::Utils::ResourceProviderMixin |
27 | 29 |
|
| 30 | + # A helper mixin for Python application resources. |
28 | 31 | module Resource |
29 | 32 | include PoiseApplication::AppMixin::Resource |
30 | 33 | include PoisePython::PythonCommandMixin::Resource |
31 | 34 |
|
| 35 | + # @!attribute parent_python |
| 36 | + # Override the #parent_python from PythonCommandMixin to grok the |
| 37 | + # application level parent as a default value. |
| 38 | + # @return [PoisePython::Resources::PythonRuntime::Resource, nil] |
32 | 39 | parent_attribute(:python, type: :python_runtime, optional: true, default: lazy { app_state_python.equal?(self) ? nil : app_state_python }) |
33 | 40 |
|
34 | 41 | # @attribute app_state_python |
| 42 | + # The application-level Python parent. |
| 43 | + # @return [PoisePython::Resources::PythonRuntime::Resource, nil] |
35 | 44 | def app_state_python(python=Poise::NOT_PASSED) |
36 | 45 | unless python == Poise::NOT_PASSED |
37 | 46 | app_state[:python] = python |
38 | 47 | end |
39 | 48 | app_state[:python] |
40 | 49 | end |
41 | 50 |
|
| 51 | + # A merged hash of environment variables for both the application state |
| 52 | + # and parent python. |
| 53 | + # |
| 54 | + # @return [Hash<String, String>] |
42 | 55 | def app_state_environment_python |
43 | 56 | env = app_state_environment |
44 | 57 | env = env.merge(parent_python.python_environment) if parent_python |
45 | 58 | env |
46 | 59 | end |
47 | 60 | end |
48 | 61 |
|
| 62 | + # A helper mixin for Python application providers. |
49 | 63 | module Provider |
50 | 64 | include PoiseApplication::AppMixin::Provider |
51 | 65 | end |
|
0 commit comments