power_stencil 0.8.14 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 953c643a9a919791eeb8dc12c8e725c2a8ab80c6
4
- data.tar.gz: 8231bae8f9f3d2fe16987b758ffcc8e22be3f295
3
+ metadata.gz: a7a7ba04e35989e29c761da1e15018121ada88a4
4
+ data.tar.gz: be2c3cfe6550a722e126d0587a5aa76273573edb
5
5
  SHA512:
6
- metadata.gz: dfede811fa8dc0efc67e158abf08e93aac47fb327c6642fff344d6caa0bb7b908443ad31bc229c9b165ab3868c1f311adb63c7d24d168e5fbef98b09495634a4
7
- data.tar.gz: 1b962bde64576cc9cb8a20f272a048289e42caf212d4fa63814c778fb672e1b0e137ff3dcedb3ecfab6a30488942f1db37e26eceb8b2e687a39156ec13419268
6
+ metadata.gz: 1f29b2f27112124935ec5b9c63222206d9ec34570154c05d02d38ad2954a74a12590ba3ab017f978ef1f9f5d71fb56d4dc75e5b2e3f48ab6d95418935d770bee
7
+ data.tar.gz: bad80333308df6484785785077046e16161188297a15eb95302024e48c882e1ceca0d3ac48c45b19c616f0b61973aab6795d99549ae9dc781eb7bd1614e0acfe
data/README.md CHANGED
@@ -15,10 +15,10 @@ See [official website][PowerStencil site].
15
15
  - [Installation](#installation)
16
16
  - [Usage](#usage)
17
17
  - [Help](#help)
18
- - [Command line auto-completion](#command-line-auto-completion)
19
- - [Creating a `PowerStencil` project](#creating-a-powerstencil-project)
20
- - [`PowerStencil` project structure](#powerstencil-project-structure)
21
18
  - [Getting started](#getting-started)
19
+ - [Creating a `PowerStencil` project](#creating-a-powerstencil-project)
20
+ - [`PowerStencil` project structure overview](#powerstencil-project-structure-overview)
21
+ - [Command line auto-completion](#command-line-auto-completion)
22
22
  - [Entities](#entities)
23
23
  - [Templates](#templates)
24
24
  - [Builds](#builds)
@@ -62,11 +62,12 @@ The `PowerStencil` gem provides the `power_stencil` executable which is a plugga
62
62
 
63
63
  **Actually `PowerStencil` is _not_ a templating engine**. It uses already existing and proven templating engines.
64
64
 
65
- Currently it uses [ERB], which is a pretty standard and very well known engine in the [Ruby] world and especially for people who already used the [Rails] framework. Virtually any templating engine existing in the Ruby ecosystem could be integrated in the `PowerStencil` framework next to [ERB] (as `PowerStencil` already comes with a mechanism to select a templating engine regarding some criteria like file extension, path etc...).
65
+ `PowerStenil` currently embeds two templating engines:
66
66
 
67
- This will probably be the case in a future release, at least to integrate the [Haml] templating engine in order to ease the generation of XML-like files, still you obviously already can do it with [ERB].
67
+ * **[ERB] is the default**. This is a pretty standard and very well known engine in the [Ruby] world and especially for people who already used the [Rails] framework. This is a generic templating engine which can handle any use-case. Each template will be processed by default using the [ERB] engine.
68
+ * When it comes to generate mark-up documents like XML or HTML, many people prefer to use [Haml], as it designed towards generating these kinds of documents and tends to end-up with much clearer templates. Any template whose names ends by `.haml` will be processed by the [Haml] engine by default instead of [ERB].
68
69
 
69
- So `PowerStencil` is definitely not a templating it is actually much more than that.
70
+ So `PowerStencil` is definitely not a templating engine, it is actually much more than that. It is a framework to manage your templates, design the relational data you can use in your templates, manage the versioning, define the way you build things etc... Read this documentation (and especially the [getting started](#getting-started) section which is a tutorial in itself).
70
71
 
71
72
 
72
73
  # Installation
@@ -134,17 +135,16 @@ The program uses the standard paradigm of sub-commands (à-la-git), and each can
134
135
 
135
136
  [Plugins] may bring extra subcommands and/or options, so depending on the project you are working in, the output of `--help` may differ...
136
137
 
137
- ## Command line auto-completion
138
138
 
139
- `PowerStencil` comes with a command-line auto-completion feature for `zsh`. It is not yet available for `bash`.
140
139
 
141
- You can install it by running:
142
140
 
143
- $ power_stencil adm --zsh-completion
144
141
 
145
- It provides a very useful auto-completion for sub-commands, options as well as parameters...
142
+ ## Getting started
143
+
144
+ See the following topics as a kind of tutorial on `PowerStencil`. You should read them in order, as each of them assumes you already read the previous one.
146
145
 
147
- ## Creating a `PowerStencil` project
146
+
147
+ ### Creating a `PowerStencil` project
148
148
 
149
149
  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 enough rights on the filesystem):
150
150
 
@@ -156,7 +156,7 @@ Once the project created, if you are anywhere within the project tree, you don't
156
156
 
157
157
  **:information_source: If you have `git` installed on your system, **the repository of the newly created project has been automatically turned into a git repository. And any action done through the `power_stencil` command-line will be automatically tracked by `git`**. Only things you will do outside of the `power_stencil` command-line (adding or modifying templates, creating or modifying entity types... any manual action) will require a user action to make `git` take it in account. You can completely de-activate this behaviour if you want to fully manage things by yourself by adding `:no-git: true` in the `.ps_project/versioned-config.yaml`, yet there is no good reason for that... Unless you know what you are doing, you should keep the default settings. See [Git integration] for further information.
158
158
 
159
- ## `PowerStencil` project structure
159
+ ### `PowerStencil` project structure overview
160
160
 
161
161
  The structure of a brand new `PowerStencil` project is the following:
162
162
 
@@ -191,9 +191,21 @@ There is the same mechanism between `.ps_project/entities` (where the project da
191
191
 
192
192
  The `plugins` directory can optionally contain project specific plugins. Plugins are a great way to extend `PowerStencil` for the needs of a project or organization.
193
193
 
194
- ## Getting started
194
+ ### Command line auto-completion
195
+
196
+ `PowerStencil` comes with a powerful command-line auto-completion feature for `zsh`. (It is not yet available for `bash`).
197
+
198
+ You can install it by running:
199
+
200
+ $ power_stencil adm --zsh-completion
201
+
202
+ It provides a very useful auto-completion for sub-commands, options as well as options parameters...
203
+
204
+ `PowerStencil` uses a _two-stages_ auto-completion mechanism:
205
+
206
+ * Project independent completion is generated in `~/.zsh/completion/_power_stencil`, whereas completion related to new commands or options, coming from plugins used in a project, is generated (and versioned) within the project itself, in `.ps_project/.zsh_project_completion`.
195
207
 
196
- See the four following topics as a kind of tutorial on `PowerStencil`. You should read them in order, as each of them assumes you already read the previous one.
208
+ * Meaning that if you want to benefit from the "_full_" completion from within a project you may have to re-run `power_stencil add --zsh-completion` from within any project where you use extra plugins, in order to generate that `.ps_project/.zsh_project_completion` file. If you don't, it is not a big deal, but then you will only have access to the "_generic_" completion, ie completion not taking in account any of the extra commands or options you are using in this project brought by plugins you may use...
197
209
 
198
210
  ### Entities
199
211
 
data/doc/faq.md CHANGED
@@ -72,12 +72,13 @@ I had the opportunity to have access to a Windows VM and tested `PowerStencil`.
72
72
 
73
73
  # What is the status of `PowerStencil` ?
74
74
 
75
- `PowerStencil` is still under development, yet **it can already be safely used**.
75
+ `PowerStencil` is still considered under development until version `1.0.0` is released, yet **it can already be safely used**, event for production.
76
+
77
+ **Since it entered the `0.9.x` version, no new feature should be added**. That branch will be used for statibilisation and anything released there should only be related to bugfixes, and plugin developement. As a bunch of official plugins should be released along with the version `1.0.0`.
76
78
 
77
79
  Regarding `PowerStencil` core:
78
80
 
79
- - 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.
80
- - New system entity types may appear.
81
+ - The plugin related features may still evole a bit along with first official plugins development, but since both local and gems plugins are supported no big change may arise in the architecture.
81
82
  - The functional documentation is evolving.
82
83
  - There is almost no technical/architectural documentation yet. Read the code...
83
84
 
@@ -85,10 +86,6 @@ Anyway `PowerStencil` follows the semantic versioning pattern and if incompatibl
85
86
 
86
87
  There are already some plugins in the pipe. See [example use cases], to get an idea of the first official plugins to come.
87
88
 
88
- :information_source: Of course, `PowerStencil` is new software and it is expected to evolve with the needs of its users...
89
-
90
-
91
-
92
89
 
93
90
  [:back:][Documentation root]
94
91
  <!-- End of Document -->
@@ -13,6 +13,7 @@ Git integration
13
13
  - [Deleting an entity](#deleting-an-entity)
14
14
  - [`PowerStencil` shell session](#powerstencil-shell-session)
15
15
  - [Plugin creation](#plugin-creation)
16
+ - [(Re)Generating `zsh` command line completion for the project](#regenerating-zsh-command-line-completion-for-the-project)
16
17
  - [Manual actions](#manual-actions)
17
18
 
18
19
  <!-- /TOC -->
@@ -36,18 +37,19 @@ Here is a summary:
36
37
 
37
38
  | `PowerStencil` sub-command | Status |
38
39
  |----------------------------|:------:|
39
- |init | creates a project
40
- |info | read-only
41
- |plugin | creates a plugin
42
- |get | read-only
43
- |shell | do anything
44
- |adm | read-only
45
- |check | read-only
46
- |create | creates entities
47
- |edit | modifies entities
48
- |delete | deletes entities
49
- |describe | read-only
50
- |build | read-only
40
+ |`init` | creates a project
41
+ |`info` | read-only
42
+ |`plugin` | creates a plugin
43
+ |`get` | read-only
44
+ |`shell` | do anything
45
+ |`adm --zsh-completion` | generates zsh command-line completion
46
+ |`check` | read-only
47
+ |`create` | creates entities
48
+ |`edit` | modifies entities
49
+ |`delete` | deletes entities
50
+ |`describe` | read-only
51
+ |`build` | read-only
52
+
51
53
 
52
54
  On top this we could add some other actions, you can obviously perform manually within the repository, like:
53
55
 
@@ -306,6 +308,30 @@ Date: Sun Nov 3 19:42:11 2019 +0100
306
308
  Cool ! Nevertheless, plugins may be one of the things you may want to track a bit differently. For example as git sub-modules, to keep a separated git history, and ease future re-useability of the plugin you are developing.
307
309
  So it's up to you and `PowerStencil` provides an easy way to keep your plugin out of your project repo. Same as for `power_stencil init`, `power_stencil plugin --create` supports the `--no-git` option...
308
310
 
311
+ ## (Re)Generating `zsh` command line completion for the project
312
+
313
+ If you generate the zsh command line completion file for the project by doing, from within the project:
314
+
315
+ $ power_stencil adm --zsh-completion
316
+
317
+ You will then generate a file that contains project-specific zsh completion directives: `.ps_project/.zsh_project_completion`.
318
+
319
+ That file is versioned too, because its content depends on the plugins (local or as gems) that you actually use in this project. **If you add a new plugin or modify the way local ones handle the command-line, you should then regenerate it**, by re-running that command if you want the completion to fully take in account your changes.
320
+
321
+ It is tracked like that:
322
+ ```
323
+ $ git log -1 --summary
324
+ commit 0c7bedb7249654873882c56bb15172c528511cff
325
+ Author: Joe <joe@outerspace.org>
326
+ Date: Sun Nov 10 11:21:10 2019 +0100
327
+
328
+ Adding project specific zsh completion file: '.ps_project/.zsh_project_completion'.
329
+
330
+ create mode 100644 .ps_project/.zsh_project_completion
331
+ ```
332
+
333
+
334
+
309
335
  # Manual actions
310
336
 
311
337
  Ok, so far we have a pretty nice git history:
@@ -72,7 +72,9 @@
72
72
  # Map to define which kind of template engine for which type of file. Be careful if you
73
73
  # overlap two definitions. Warning, it is ruby Regex not shell pattern !
74
74
  :templating_engines_map:
75
- # Currently all files are rendered using ERB engine
75
+ # Haml for .haml files
76
+ :haml: '\.haml$'
77
+ # All the rest with ERB
76
78
  :erb: '.*'
77
79
 
78
80
  # Files matching particular patterns can be changed on the fly
@@ -82,6 +84,8 @@
82
84
  ^(.+)\.zzzgitignore\.erb$: '\1.gitignore'
83
85
  # Erb files
84
86
  ^(.+)\.erb$: '\1'
87
+ # Haml files
88
+ ^(.+)\.haml$: '\1'
85
89
 
86
90
 
87
91
  # PLUGINS
@@ -2,6 +2,7 @@ require 'power_stencil/engine/entities_definitions'
2
2
  require 'power_stencil/engine/directory_processor'
3
3
 
4
4
  require 'power_stencil/engine/renderers/erb'
5
+ require 'power_stencil/engine/renderers/haml'
5
6
  require 'power_stencil/dsl/base'
6
7
  require 'power_stencil/dsl/plugin_generation'
7
8
  require 'power_stencil/dsl/completion'
@@ -18,6 +19,7 @@ module PowerStencil
18
19
  include PowerStencil::Engine::DirectoryProcessor
19
20
 
20
21
  include PowerStencil::Engine::Renderers::Erb
22
+ include PowerStencil::Engine::Renderers::Haml
21
23
 
22
24
  attr_accessor :dsl
23
25
  attr_reader :root_universe
@@ -1,5 +1,7 @@
1
1
  require 'fileutils'
2
2
  require 'erb'
3
+ require 'haml'
4
+
3
5
 
4
6
  module PowerStencil
5
7
  module Engine
@@ -0,0 +1,21 @@
1
+ module PowerStencil
2
+ module Engine
3
+ module Renderers
4
+
5
+ module Haml
6
+
7
+ private
8
+
9
+ def render_haml_template(source, context)
10
+ logger.debug "Using HAML to render file '#{source}'"
11
+ ::Haml::Engine.new(File.read source).render(context)
12
+ rescue => e
13
+ logger.debug PowerStencil::Error.report_error(e)
14
+ raise PowerStencil::Error, "Error rendering '#{source}': '#{e.message}'"
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module PowerStencil
2
- VERSION = '0.8.14'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'universe_compiler', '~> 0.5.5'
31
31
  spec.add_dependency 'pry'
32
32
  spec.add_dependency 'git' , '~> 1.5.0'
33
+ spec.add_dependency 'haml', '~> 5.1.2'
33
34
 
34
35
  source_code_uri = 'https://gitlab.com/tools4devops/power_stencil'
35
36
 
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.8.14
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Briais
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-09 00:00:00.000000000 Z
11
+ date: 2019-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.5.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: haml
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 5.1.2
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 5.1.2
125
139
  description: PowerStencil is the Swiss-army knife templating workflow for developers
126
140
  and ops.
127
141
  email:
@@ -245,6 +259,7 @@ files:
245
259
  - lib/power_stencil/engine/init_engine.rb
246
260
  - lib/power_stencil/engine/project_engine.rb
247
261
  - lib/power_stencil/engine/renderers/erb.rb
262
+ - lib/power_stencil/engine/renderers/haml.rb
248
263
  - lib/power_stencil/error.rb
249
264
  - lib/power_stencil/initializer.rb
250
265
  - lib/power_stencil/plugins/base.rb
@@ -306,13 +321,12 @@ metadata:
306
321
  documentation_uri: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md
307
322
  source_code_uri: https://gitlab.com/tools4devops/power_stencil
308
323
  homepage_uri: https://powerstencil.brizone.org/
309
- post_install_message: "\nThank you for installing PowerStencil 0.8.14 !\nFrom the
310
- command line you can run `power_stencil --help`\nIf your shell is not completing
311
- the command:\n If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial
312
- Website : https://powerstencil.brizone.org/\nFull documentation here :
313
- https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel free to
314
- report issues: https://gitlab.com/tools4devops/power_stencil/issues\n\nType 'power_stencil
315
- adm --zsh-completion' to install auto-completion for zsh.\n\n "
324
+ post_install_message: "\nThank you for installing PowerStencil 0.9.0 !\nFrom the command
325
+ line you can run `power_stencil --help`\nIf your shell is not completing the command:\n
326
+ \ If you use rbenv: `rbenv rehash`\n If you use zsh : `rehash`\n\nOfficial Website
327
+ \ : https://powerstencil.brizone.org/\nFull documentation here : https://gitlab.com/tools4devops/power_stencil/blob/master/README.md\nFeel
328
+ free to report issues: https://gitlab.com/tools4devops/power_stencil/issues\n\nType
329
+ 'power_stencil adm --zsh-completion' to install auto-completion for zsh.\n\n "
316
330
  rdoc_options: []
317
331
  require_paths:
318
332
  - lib