power_stencil 0.3.2 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -21
- data/bin/update_plugin_template +0 -0
- data/doc/builds.md +1 -1
- data/doc/entities.md +8 -6
- data/doc/example_use_cases.md +1 -1
- data/doc/faq.md +106 -0
- data/doc/templates.md +1 -1
- data/etc/meta_templates/plugin_seed/psplugin_{entity}.gemspec +2 -2
- data/etc/templates/plugin_definition/.travis.yml +3 -1
- data/etc/templates/plugin_definition/Gemfile +0 -2
- data/etc/templates/plugin_definition/psplugin_{entity}.gemspec +2 -2
- data/etc/templates/project/.ps_project/personal-config.yaml +3 -3
- data/lib/power_stencil/command_processors/build.rb +4 -3
- data/lib/power_stencil/project/config.rb +12 -4
- data/lib/power_stencil/system_entity_definitions/entity_project_common.rb +14 -0
- data/lib/power_stencil/version.rb +1 -1
- data/power_stencil.gemspec +12 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f8a56ff0d7e95fa694edcd60cd8caf19b0ebc8
|
4
|
+
data.tar.gz: c94645bac2dcba4c3e1812c01b4441e534ff9fc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f69d9c0eab68599fc6e0acc8f2d500eed2cc4035d4c509d7a04f35cfa3cf077702c803d680a855c518947fda96190930c29174cd37de178e3a6a55ebdaf8a215
|
7
|
+
data.tar.gz: 562cb010b2c2cffa7e2d347b05a038511564637a1dba0eb2ff978fe15780ee6796a18766d0cda1e7c2ccdce36bd75c5d08da20d70e7565069f2ce199bd1b54fc
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ PowerStencil
|
|
5
5
|
|
6
6
|
<!-- TOC -->
|
7
7
|
|
8
|
-
- [
|
8
|
+
- [Overview](#overview)
|
9
9
|
- [Pfff, yet another templating engine...](#pfff-yet-another-templating-engine)
|
10
10
|
- [Installation](#installation)
|
11
11
|
- [Usage](#usage)
|
@@ -19,30 +19,28 @@ PowerStencil
|
|
19
19
|
|
20
20
|
<!-- /TOC -->
|
21
21
|
|
22
|
-
#
|
22
|
+
# Overview
|
23
23
|
|
24
24
|
`PowerStencil` proposes a radical approach on how to manage your shared configuration.
|
25
25
|
|
26
|
-
|
26
|
+
Configuration is one of the most complex things to maintain, and anyone who participated in a large scale piece of software or documentation knows how complex it is to maintain, keep consistent and avoid duplication on the long run across the various projects that may share this configuration.
|
27
27
|
|
28
|
-
|
28
|
+
From a very high level point of view, the workfow `PowerStencil` proposes looks like:
|
29
29
|
|
30
|
-
|
30
|
+
![simple-flow-image]
|
31
31
|
|
32
32
|
`PowerStencil` provides **development and operations friendly workflows to fully manage the maintenance of a complex shared config** in order to generate anything you may want like _documentation_, _static sites_, _code_, _configuration_ for multiple tools..., while **avoiding duplication, and manage it like code** !
|
33
33
|
|
34
|
-
It is a common pattern to introduce a database to manage
|
35
|
-
|
36
|
-
**With `PowerStencil` everything is maintained in a git repository**: data, templates, specific code. No more config loss, no more change applied without a full lineage.
|
34
|
+
It is a common pattern to introduce a database to manage shared configuration for CI/CD processes, and it is a very bad idea (see [F.A.Q.]) because it implies extra tooling, and specific developments that de-facto become single point of failure at the heart of your development process. Why would you do that when something as versatile and ubiquitous as Git exists that will integrate smoothly within your existing development and operations workflows, builds, CI/CD processes, while benefiting from all the goodness provided by Git, like branches, decentralization, versioning, tags, code reviews, traceability, simplified fallbacks etc... ?
|
37
35
|
|
38
|
-
|
36
|
+
A `PowerStencil` project is composed of a data repository and a pretty standard templating flow to generate whatever is needed by your project or organization and **with `PowerStencil` everything is maintained in a git repository**: data, templates, specific code **without sacrificing on data integrity and relational features**. No more config loss, no more change applied without a full lineage.
|
39
37
|
|
40
38
|
The `PowerStencil` gem provides the `power_stencil` executable which is a pluggable CLI to:
|
41
39
|
|
42
|
-
-
|
43
|
-
- Manage
|
44
|
-
- Manage
|
45
|
-
- Create and manipulate
|
40
|
+
- Manage the project data
|
41
|
+
- Manage templates
|
42
|
+
- Manage builds
|
43
|
+
- Create and manipulate plugins
|
46
44
|
|
47
45
|
# Pfff, yet another templating engine...
|
48
46
|
|
@@ -110,12 +108,20 @@ The program uses the standard paradigm of sub-commands (à-la-git), and each can
|
|
110
108
|
|
111
109
|
To create a new project, use the `init` sub-command. It works as you would expect. If you run it in an existing directory it will create the project here but you can specify the directory where you want the project to be created (the path will be created provided you have the rights on the filesystem):
|
112
110
|
|
113
|
-
$ power_stencil init
|
111
|
+
$ power_stencil init /where/you/want/your/project
|
114
112
|
|
115
|
-
|
113
|
+
Once the project created, if you are anywhere within the project tree, you don't need to specify the project path anymore (if needed, any `power_stencil` sub-command supports a `--project-path` option). If you're used to the Git command line, it works the same way, and you should not feel in uncharted territory...
|
116
114
|
|
117
115
|
:information_source: The rest of this documentation will assume you are at the root of this created project.
|
118
116
|
|
117
|
+
**:information_source: Of course, once you've been creating a new project, you should version it with Git:**
|
118
|
+
|
119
|
+
$ git init
|
120
|
+
$ git add .
|
121
|
+
$ git commit -a -m 'Initial commit'
|
122
|
+
|
123
|
+
This will allow you to track any change resulting of your interactions with `power_stencil` command line.
|
124
|
+
|
119
125
|
## `PowerStencil` project structure
|
120
126
|
|
121
127
|
The structure of a brand new `PowerStencil` project is the following:
|
@@ -135,9 +141,9 @@ The structure of a brand new `PowerStencil` project is the following:
|
|
135
141
|
│ └── README.md
|
136
142
|
└── versioned-config.yaml
|
137
143
|
```
|
138
|
-
New directories will appear once you start some [builds] or when you will define [templates].
|
144
|
+
New directories will appear once you start some [builds] or when you will define [templates], but this is the initial state.
|
139
145
|
|
140
|
-
Not all the files in this directory should be versioned, and this the reason why there is a preconfigured `.gitignore` at the root of the project.
|
146
|
+
Not all the files in this directory should be versioned, and this the reason why there is a preconfigured `.gitignore` at the root of the project. It is prefilled so that unless you want to specifically avoid a file to be versioned, you don't need any action regarding `PowerStencil` project files.
|
141
147
|
|
142
148
|
The project has two distinct config files. Keep the official project config in the `.ps_project/versioned-config.yaml` which, as its name suggest will be versioned. But any developer who wants to temporarily override some configuration should do it in the `.ps_project/personal-config.yaml` which is not be versioned. The content defined in the latter overrides the content of the official one. This is a clean way for anyone who wants to test something to safely do it locally without the risk to pollute the central repo.
|
143
149
|
|
@@ -149,19 +155,25 @@ The `plugins` directory can optionally contain project specific plugins. Plugins
|
|
149
155
|
|
150
156
|
The core of the system is the `entity`, so you should start by having a look at what entities are, how they are easily managed using the `PowerStencil` CLI and shell.
|
151
157
|
|
152
|
-
:arrow_forward: [Entities]
|
158
|
+
> :arrow_forward: [Entities]
|
153
159
|
|
154
160
|
Then it is important to understand how to use entities within `templates`. Templates are the way to generate something (doc, code, descriptors, sites, whatever...) from the data that the entities represent.
|
155
161
|
|
156
|
-
:arrow_forward: [Templates]
|
162
|
+
> :arrow_forward: [Templates]
|
157
163
|
|
158
164
|
The mechanism that combines entities and templates is called a `build`. A build is always attached to an entity (you build something). The result of a build is a set of files. Optionally an action can be triggered after the files are generated (could be as simple as calling a script that has been generated).
|
159
165
|
|
160
|
-
:arrow_forward: [Builds]
|
166
|
+
> :arrow_forward: [Builds]
|
161
167
|
|
162
168
|
`PowerStencil` could stop there, and you would be able to do whatever you want, but there is a whole world beyond. `Plugins` provide a way to completely extend `PowerStencil`, further control relations between entities, implement complex post-build actions, add CLI sub-commands and options. Plugins can be local to the project or coming in the form of standard Ruby Gems ! The icing on the cake...
|
163
169
|
|
164
|
-
:arrow_forward: [Plugins]
|
170
|
+
> :arrow_forward: [Plugins]
|
171
|
+
|
172
|
+
And course, you may:
|
173
|
+
|
174
|
+
- Read the [F.A.Q.]
|
175
|
+
- See some real world [example use cases].
|
176
|
+
|
165
177
|
|
166
178
|
# Contributing
|
167
179
|
|
@@ -183,6 +195,7 @@ Everyone interacting in the PowerStencil project’s codebases, issue trackers,
|
|
183
195
|
[builds]: doc/builds.md "Builds in PowerStencil"
|
184
196
|
[plugins]: doc/plugins.md "Plugins in PowerStencil"
|
185
197
|
[example use cases]: doc/example_use_cases.md "Example uses cases using PowerStencil"
|
198
|
+
[F.A.Q.]: doc/faq.md "PowerStencil F.A.Q."
|
186
199
|
[code of conduct]: CODE_OF_CONDUCT.md
|
187
200
|
|
188
201
|
<!-- Code links -->
|
data/bin/update_plugin_template
CHANGED
File without changes
|
data/doc/builds.md
CHANGED
@@ -255,7 +255,7 @@ If you want to do something more custom after the build process completed, this
|
|
255
255
|
[entities]: entities.md "Entities in PowerStencil"
|
256
256
|
[templates]: templates.md "Templates in PowerStencil"
|
257
257
|
[plugins]: plugins.md "Plugins in PowerStencil"
|
258
|
-
[buildable]: entities.md#buildable
|
258
|
+
[buildable]: entities.md#buildable-and-buildable_by "How to make an entity buildable ?"
|
259
259
|
[local entities]: entities.md#local-unversioned-entities "Local unversioned entities"
|
260
260
|
|
261
261
|
<!-- Code links -->
|
data/doc/entities.md
CHANGED
@@ -33,7 +33,7 @@ Entities
|
|
33
33
|
- [not_empty](#not_empty)
|
34
34
|
- [should_match](#should_match)
|
35
35
|
- [class_name](#class_name)
|
36
|
-
- [buildable
|
36
|
+
- [buildable and buildable_by](#buildable-and-buildable_by)
|
37
37
|
- [Module you could include in your entity types](#module-you-could-include-in-your-entity-types)
|
38
38
|
- [Adding functional code](#adding-functional-code)
|
39
39
|
|
@@ -191,7 +191,7 @@ RAW ENTITIES
|
|
191
191
|
|
192
192
|
The goal of this command is normally to check the validity of entities, but it brings as well extra information like if the entity is _buildable_ or even where it is stored in the repository.
|
193
193
|
|
194
|
-
:information_source: You can notice that the `project_config` entity has no storage path, the reason being [it is not persisted](#default-entity-types).
|
194
|
+
:information_source: You can notice that the `project_config` entity has no storage path, the reason being [it is not persisted](#default-entity-types) in the entities repository (its content actually comes from config files outside of the repository).
|
195
195
|
|
196
196
|
This command may show some extra information, for more complex entities. We will see that later on.
|
197
197
|
|
@@ -209,7 +209,7 @@ RAW ENTITIES
|
|
209
209
|
- Status : Valid
|
210
210
|
- Buildable : false
|
211
211
|
```
|
212
|
-
Another possibility is to check a list of objects using a regular expression by using the `--regexp` option:
|
212
|
+
Another possibility is to check a list of objects using a regular expression (applied to the ID of an entity, ie `<entity_type</<entity_name>`) by using the `--regexp` option:
|
213
213
|
|
214
214
|
```shell
|
215
215
|
$ power_stencil check base_ --regexp
|
@@ -555,7 +555,7 @@ class MyCustomEntity < PowerStencil::SystemEntityDefinitions::ProjectEntity
|
|
555
555
|
field :my_custom_field
|
556
556
|
end
|
557
557
|
```
|
558
|
-
Then it means I can access the `my_custom_field` property in
|
558
|
+
Then it means I can access the `my_custom_field` property in three different ways:
|
559
559
|
|
560
560
|
```ruby
|
561
561
|
PowerStencil DSL> e = new_custom_entity name: :test_entity
|
@@ -568,8 +568,10 @@ PowerStencil DSL> e.my_custom_field
|
|
568
568
|
=> "foo"
|
569
569
|
PowerStencil DSL> e.fields[:my_custom_field]
|
570
570
|
=> "foo"
|
571
|
+
PowerStencil DSL> e[:my_custom_field]
|
572
|
+
=> "foo"
|
571
573
|
```
|
572
|
-
:information_source: You can notice the `new_<entity_type>` DSL method which is a shortcut to create entities.
|
574
|
+
:information_source: You can notice the `new_<entity_type>` DSL method which is a shortcut to create entities (actually you have to use this DSL method and not create entities using its `<classname>.new`, because this DSL method on top of creating the entity, setup everything for persistence as well...).
|
573
575
|
|
574
576
|
So you can see the field directive will actually create accessor methods for first level properties in the `#fields` Hash.
|
575
577
|
|
@@ -906,7 +908,7 @@ PowerStencil DSL> e.valid? raise_error: true
|
|
906
908
|
|
907
909
|
:warning: Use this one with caution, as it does not test anything regarding inheritance...
|
908
910
|
|
909
|
-
### buildable
|
911
|
+
### buildable and buildable_by
|
910
912
|
|
911
913
|
One of the most important directives !
|
912
914
|
More information is provided in the [builds] documentation, but basically this defines an `entity_type` as a potential target for the build process.
|
data/doc/example_use_cases.md
CHANGED
@@ -14,7 +14,7 @@ Example use cases
|
|
14
14
|
|
15
15
|
# Overview
|
16
16
|
|
17
|
-
Considering the genericity of the `PowerStencil
|
17
|
+
Considering the genericity of the `PowerStencil` framework, it is a bit difficult to define a strict scope for its usage. It's a bit like wondering what you could do with a programming language.
|
18
18
|
|
19
19
|
Neverthless, I will give two short ideas that should open you mind to things you could do with it.
|
20
20
|
|
data/doc/faq.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
F.A.Q.
|
2
|
+
======
|
3
|
+
|
4
|
+
<!-- TOC -->
|
5
|
+
|
6
|
+
- [How does `PowerStencil` compare with a CMDB ?](#how-does-powerstencil-compare-with-a-cmdb-)
|
7
|
+
- [Why is a "real" database a bad idea as configuration store for CI/CD ?](#why-is-a-real-database-a-bad-idea-as-configuration-store-for-cicd-)
|
8
|
+
- [How does `PowerStencil` compare to environment variables + subst ?](#how-does-powerstencil-compare-to-environment-variables--subst-)
|
9
|
+
- [Why data persisted in YAML ?](#why-data-persisted-in-yaml-)
|
10
|
+
- [What are the system requirements ?](#what-are-the-system-requirements-)
|
11
|
+
- [What is the status of `PowerStencil` ?](#what-is-the-status-of-powerstencil-)
|
12
|
+
|
13
|
+
<!-- /TOC -->
|
14
|
+
[:back:][Documentation root]
|
15
|
+
|
16
|
+
# How does `PowerStencil` compare with a CMDB ?
|
17
|
+
|
18
|
+
It could sound like a strange question. `PowerStencil` is absolutelly not designed with ITIL in mind but in the end its true that its data management part looks a lot like a [CMDB].
|
19
|
+
|
20
|
+
- [Entities][entities] (and more specifically entity types) can cover most aspects (I am not ITIL expert enough to say it covers all of them) of ITIL's _Configuration Items_. Default entities provided with `PowerStencil` do not contain all necessary attributes to do be really considered as _configuration items_, but it should be very easy to achieve with custom entities. In fact it could be a good idea of [plugin][plugins]...
|
21
|
+
- Relation semantics in `PowerStencil` cover 1-1, 1-n and composition relation patterns.
|
22
|
+
- Versioning is achieved through Git. Implying on top of versioning, branching, merging
|
23
|
+
|
24
|
+
But `PowerStencil` cannot be simplified to it's "database" aspect. It goes well beyond, and is as well a pragmatic workflow for developers and operations to actually do something out of this data. A [CMDB] may be used by external processes in order to achieve what `PowerStencil` does out of the box.
|
25
|
+
|
26
|
+
|
27
|
+
# Why is a "real" database a bad idea as configuration store for CI/CD ?
|
28
|
+
|
29
|
+
There are some reasons why using a database in the scope of CI/CD is not a good idea.
|
30
|
+
|
31
|
+
Basically the CI/CD infrastructure could be built around Jenkins, containerized tools (Drone for example), Travis, GitlabCI... The goal being to provide the **easiest possible way for the developer** to perform integration tests and eventually build and deploy software.
|
32
|
+
|
33
|
+
But the easiest possible way for the developer doesn't mean that the underlying infrastructure is simple to put in place or maintain. In fact it is not !
|
34
|
+
|
35
|
+
Anything you add to this carefully crafted mechanic could turn into an infrastructure management nightmare. And a database (and its availability, maintenance) is clearly not the simplest component to inject in your infrastructure...
|
36
|
+
|
37
|
+
On top of this, a database does not not provide by default all the required features. Versioning is obviously one of them but of course not the only one (you may think about branching or others...). Meaning that **you need to have custom developments** on top of the chosen database in order to achieve all the required features. It immediately becomes a de-facto single point of failure in your CI/CD process...
|
38
|
+
|
39
|
+
Relying on Git to achieve the storage, versioning, branching, decentralization is a much easier way to achieve the same. There is no need to have specific developments as any CI/CD mechanism knows how to deal with extra git repository.
|
40
|
+
|
41
|
+
# How does `PowerStencil` compare to environment variables + subst ?
|
42
|
+
|
43
|
+
If you have very few files/templates, you may consider this as a solution, but as soon as your templates will complexify or some data need to reference some other, you will enter a loop of death that will make you regret your initial choice.
|
44
|
+
|
45
|
+
`PowerStencil` is not a templating engine, it is a framework!
|
46
|
+
|
47
|
+
Not only it [allows structured and relational data][entities], it structures your work as well, and provides mechanisms to allow developers to [easily perform tests without committing unwanted changes by mistake][overrides].
|
48
|
+
|
49
|
+
Due on how it is easy to use `PowerStencil`, even for the simplest use cases, there is no real reason not to use it.
|
50
|
+
|
51
|
+
|
52
|
+
# Why data persisted in YAML ?
|
53
|
+
|
54
|
+
Assuming Git is used for storage and versioning **we need to have a data format that is git-friendly**.
|
55
|
+
|
56
|
+
- So it discards local databases like SQLite, BerkeleyDB or others which are binary formats.
|
57
|
+
- XML is **not** a human readable format and is a real pain to _diff_. It should have been kept for what it has been designed for, ie machine to machine protocols...
|
58
|
+
|
59
|
+
So the two main remaining contenders are JSON and YAML. Although there is no real reason to take one more than the other, including the manipulating language, would I have written `PowerStencil` in JS or Go, I may probably have chosen JSON as storage format. But it is written in Ruby and therefore I went for YAML.
|
60
|
+
|
61
|
+
|
62
|
+
# What are the system requirements ?
|
63
|
+
|
64
|
+
`PowerStencil` has been developed under Linux, but it's only requiring a working Ruby installed on your machine.
|
65
|
+
|
66
|
+
As such, even if I never tested, I would expect it to probably work out of the box on MacOS, BSD or other Unices supporting Ruby 2.2+.
|
67
|
+
|
68
|
+
Regarding Windows, I stopped using spywareOS years ago so I can't really tell you. Last time I tried using Ruby on Windows (maybe 10 years ago), I did face a lot of dependency issues. Maybe things are better now, but I have no idea. As far as I understood you can now have an Ubuntu running on top of Windows 10 as a kind of blessed VM. I would probably more go this way...
|
69
|
+
|
70
|
+
|
71
|
+
# What is the status of `PowerStencil` ?
|
72
|
+
|
73
|
+
Although `PowerStencil` is still under development, **it can already be safely used**.
|
74
|
+
|
75
|
+
Regarding `PowerStencil` core:
|
76
|
+
|
77
|
+
- The part that may evolve the most is the plugin part (including documentation which is not really in par with the rest...), but it should not break anything developed now.
|
78
|
+
- New system entity types may appear.
|
79
|
+
|
80
|
+
Anyway `PowerStencil` follows the semantic versioning pattern and if incompatible changes arise it may be reflected in the version.
|
81
|
+
|
82
|
+
There are already some plugins in the pipe, especially around contenerization topics.
|
83
|
+
|
84
|
+
:information_source: Of course, `PowerStencil` is new software and it is expected to evolve with the needs of its users...
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
[:back:][Documentation root]
|
90
|
+
<!-- End of Document -->
|
91
|
+
|
92
|
+
<!-- Pages -->
|
93
|
+
[Documentation root]: ../README.md "Back to documentation root"
|
94
|
+
[entities]: entities.md "Entities in PowerStencil"
|
95
|
+
[plugins]: plugins.md "Plugins in PowerStencil"
|
96
|
+
[overrides]: builds.md#overriding-entities-and-build-scenarii "Overriding data locally"
|
97
|
+
|
98
|
+
|
99
|
+
<!-- Code links -->
|
100
|
+
|
101
|
+
|
102
|
+
<!-- Illustrations -->
|
103
|
+
|
104
|
+
|
105
|
+
<!-- External links -->
|
106
|
+
[CMDB]: https://en.wikipedia.org/wiki/Configuration_management_database "Configuration Management Database"
|
data/doc/templates.md
CHANGED
@@ -317,7 +317,7 @@ Flawless victory !!
|
|
317
317
|
[builds]: builds.md "Builds in PowerStencil"
|
318
318
|
[plugins]: plugins.md "Plugins in PowerStencil"
|
319
319
|
[example use cases]: example_use_cases.md "Example uses cases using PowerStencil"
|
320
|
-
[buildable]: entities.md#buildable
|
320
|
+
[buildable]: entities.md#buildable-and-buildable_by "How to make an entity buildable ?"
|
321
321
|
|
322
322
|
<!-- Code links -->
|
323
323
|
|
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_development_dependency 'bundler', '~>
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2.0.2'
|
33
33
|
spec.add_development_dependency 'rake', '~> 10.0'
|
34
34
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
|
-
spec.add_development_dependency 'power_stencil', "~>
|
35
|
+
spec.add_development_dependency 'power_stencil', "~> <%= PowerStencil::VERSION %>"
|
36
36
|
end
|
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_development_dependency 'bundler', '~>
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2.0.2'
|
33
33
|
spec.add_development_dependency 'rake', '~> 10.0'
|
34
34
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
|
-
spec.add_development_dependency 'power_stencil', "~>
|
35
|
+
spec.add_development_dependency 'power_stencil', "~> <%= PowerStencil::VERSION %>"
|
36
36
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# THIS FILE *IS NOT* MEANT TO BE VERSIONED (and is not by default)
|
3
3
|
# You can use it for any configuration you want to keep local
|
4
4
|
|
5
|
-
# debug
|
6
|
-
:debug: false
|
5
|
+
# :debug: true
|
7
6
|
# :log-level: 2
|
8
|
-
# :debug-on-stderr: true
|
7
|
+
# :debug-on-stderr: true
|
8
|
+
# :verbose: true
|
@@ -11,9 +11,6 @@ module PowerStencil
|
|
11
11
|
|
12
12
|
|
13
13
|
def execute
|
14
|
-
if config.command_line_layer.extra_parameters.empty?
|
15
|
-
raise PowerStencil::Error, 'Please specify something to build'
|
16
|
-
end
|
17
14
|
|
18
15
|
if config[:'supported-builds']
|
19
16
|
project.engine.available_entities_hash.select do |_, klass|
|
@@ -24,6 +21,10 @@ module PowerStencil
|
|
24
21
|
return
|
25
22
|
end
|
26
23
|
|
24
|
+
if config.command_line_layer.extra_parameters.empty?
|
25
|
+
raise PowerStencil::Error, 'Please specify something to build'
|
26
|
+
end
|
27
|
+
|
27
28
|
targets = targets_from_criteria analyse_extra_params, project.engine.root_universe
|
28
29
|
raise PowerStencil::Error, 'No valid entity specified' if targets.empty?
|
29
30
|
project.engine.build targets, fail_on_error: config[:'fail-on-error'], parallelized: config[:parallelized]
|
@@ -5,22 +5,30 @@ module PowerStencil
|
|
5
5
|
|
6
6
|
include PowerStencil::Project::Paths
|
7
7
|
|
8
|
+
PROJECT_CONFIG_PRIORITY = 990
|
9
|
+
USER_CONFIG_PRIORITY = 995
|
10
|
+
PLUGIN_CONFIG_PRIORITY_MIN = 100
|
11
|
+
|
8
12
|
attr_reader :plugin_priority_count
|
9
13
|
|
14
|
+
|
10
15
|
def load_project_specific_config
|
11
16
|
# Optional config files should have less priority than the command line layer
|
12
|
-
add_optional_config_layer project_versioned_config_file, 'versioned project config file',
|
13
|
-
add_optional_config_layer project_personal_config_file, 'personal project config file',
|
17
|
+
add_optional_config_layer project_versioned_config_file, 'versioned project config file', PROJECT_CONFIG_PRIORITY
|
18
|
+
add_optional_config_layer project_personal_config_file, 'personal project config file', USER_CONFIG_PRIORITY
|
19
|
+
Climatic.send :setup_logger
|
20
|
+
logger.debug 'Project config files loaded'
|
14
21
|
end
|
15
22
|
|
23
|
+
|
16
24
|
def add_plugin_config(plugin_name)
|
17
25
|
yaml_file = plugin_config_specific_file plugin_name
|
18
26
|
priority = if priority.nil?
|
19
|
-
|
27
|
+
PLUGIN_CONFIG_PRIORITY_MIN
|
20
28
|
else
|
21
29
|
plugin_priority_count + 1
|
22
30
|
end
|
23
|
-
|
31
|
+
raise PowerStencil::Error, 'Too many plugins !!' if priority >= PROJECT_CONFIG_PRIORITY
|
24
32
|
add_optional_config_layer yaml_file, "'#{plugin_name}' plugin specific config", priority
|
25
33
|
@plugin_priority_count ||= 0
|
26
34
|
@plugin_priority_count += 1
|
@@ -27,6 +27,20 @@ module PowerStencil
|
|
27
27
|
self.class.buildable?
|
28
28
|
end
|
29
29
|
|
30
|
+
protected
|
31
|
+
|
32
|
+
def project_engine
|
33
|
+
PowerStencil.project.engine
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_universe_entity(type, fields = {})
|
37
|
+
project_engine.new_entity project_engine.root_universe, type, fields: fields
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove_entity_from_universe(entity)
|
41
|
+
project_engine.root_universe.delete entity
|
42
|
+
end
|
43
|
+
|
30
44
|
end
|
31
45
|
|
32
46
|
end
|
data/power_stencil.gemspec
CHANGED
@@ -25,8 +25,19 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
27
|
|
28
|
-
spec.add_dependency 'climatic', '~> 0.2', '>= 0.2.
|
28
|
+
spec.add_dependency 'climatic', '~> 0.2', '>= 0.2.28'
|
29
29
|
spec.add_dependency 'dir_glob_ignore', '~> 0.3'
|
30
30
|
spec.add_dependency 'universe_compiler', '~> 0.2', '>= 0.2.11'
|
31
31
|
spec.add_dependency 'pry'
|
32
|
+
|
33
|
+
spec.post_install_message = %Q{
|
34
|
+
Thank you for installing PowerStencil #{PowerStencil::VERSION} !
|
35
|
+
From the command line you can run `power_stencil --help`
|
36
|
+
If your shell is not completing the command:
|
37
|
+
If you use rbenv: `rbenv rehash`
|
38
|
+
If you use zsh : `rehash`
|
39
|
+
|
40
|
+
Full documentation here : #{spec.homepage}/blob/master/README.md
|
41
|
+
Feel free to report issues: #{spec.homepage}/issues
|
42
|
+
}
|
32
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: power_stencil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent B.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
version: '0.2'
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.2.
|
64
|
+
version: 0.2.28
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ dependencies:
|
|
71
71
|
version: '0.2'
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.2.
|
74
|
+
version: 0.2.28
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: dir_glob_ignore
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- doc/builds.md
|
144
144
|
- doc/entities.md
|
145
145
|
- doc/example_use_cases.md
|
146
|
+
- doc/faq.md
|
146
147
|
- doc/images/power-stencil-entity-build.svg
|
147
148
|
- doc/images/power-stencil-entity-creation.svg
|
148
149
|
- doc/images/power-stencil-simple-flow.svg
|
@@ -263,7 +264,11 @@ homepage: https://gitlab.com/tools4devops/power_stencil
|
|
263
264
|
licenses:
|
264
265
|
- MIT
|
265
266
|
metadata: {}
|
266
|
-
post_install_message:
|
267
|
+
post_install_message: "\nThank you for installing PowerStencil 0.3.7 !\nFrom the command
|
268
|
+
line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
|
269
|
+
\ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nFull documentation
|
270
|
+
here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
|
271
|
+
free to report issues: https://gitlab.com/tools4devops/power_stencil/issues\n "
|
267
272
|
rdoc_options: []
|
268
273
|
require_paths:
|
269
274
|
- lib
|