psplugin_releases 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +150 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/etc/command_line.yaml +9 -0
- data/etc/plugin_capabilities.yaml +32 -0
- data/etc/templates/.git_keep +1 -0
- data/etc/templates/releases_entity/.copy_ignore +2 -0
- data/etc/templates/releases_entity/.subst_ignore +1 -0
- data/etc/templates/releases_entity/message.txt +7 -0
- data/lib/releases/dsl/releases_dsl.rb +27 -0
- data/lib/releases/entity_definitions/release_entity.rb +101 -0
- data/lib/releases/plugin_helper.rb +17 -0
- data/lib/releases/version.rb +3 -0
- data/lib/releases.rb +18 -0
- data/psplugin_releases.gemspec +48 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 22e3ab67fed0b34ee0ae66ed54ed7f01da963633
|
4
|
+
data.tar.gz: 19d0e294ed6971940c5139d15a9638662c734a9f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71c8bc0b0af3c3e26114beaef1cb96d823e0156906dad54bf58a0e7b8813ef46e9f6422b02961edc224cedd7e1892dd970369e8ec13e5608fdab7c2e7223ff10
|
7
|
+
data.tar.gz: 898b806e77b9dc3dda6a472ff79b5dbc950e65d0a75db06ad433a0555e8ee9e453648ccbb3fb340cd55f66c268f0fb699d4c9de325cbd07764116df20d7ce48b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at lbnetid+rb@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Laurent B.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
Releases
|
2
|
+
========
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/psplugin_releases.svg)](https://rubygems.org/gems/psplugin_releases) [![Pipeline status](https://gitlab.com/tools4devops/psplugins/psplugin_releases/badges/master/pipeline.svg)](https://gitlab.com/tools4devops/psplugins/psplugin_releases/commits/master)
|
5
|
+
|
6
|
+
[PowerStencil] is the Swiss-army knife templating workflow for developers and ops.
|
7
|
+
|
8
|
+
`Releases` is a [PowerStencil] plugin.
|
9
|
+
|
10
|
+
See [official website][PowerStencil site].
|
11
|
+
|
12
|
+
|
13
|
+
<!-- TOC -->
|
14
|
+
|
15
|
+
- [What is a PowerStencil plugin ?](#what-is-a-powerstencil-plugin-)
|
16
|
+
- [Using this plugin in your `PowerStencil` projects](#using-this-plugin-in-your-powerstencil-projects)
|
17
|
+
- [Goal of this plugin](#goal-of-this-plugin)
|
18
|
+
- [Plugin dependencies](#plugin-dependencies)
|
19
|
+
- [Plugin capabilities](#plugin-capabilities)
|
20
|
+
- [Subcommands and options](#subcommands-and-options)
|
21
|
+
- [DSL in templates and in `power_stencil shell`](#dsl-in-templates-and-in-power_stencil-shell)
|
22
|
+
- [Entity types](#entity-types)
|
23
|
+
- [`release`](#release)
|
24
|
+
- [Contributing](#contributing)
|
25
|
+
- [License](#license)
|
26
|
+
- [Code of Conduct](#code-of-conduct)
|
27
|
+
|
28
|
+
<!-- /TOC -->
|
29
|
+
|
30
|
+
# What is a PowerStencil plugin ?
|
31
|
+
|
32
|
+
A `PowerStencil` plugin can be used in the context of a `PowerStencil` project and bring extra features to a standard project.
|
33
|
+
|
34
|
+
If you don't know what `PowerStencil` is made for, you may read [the documentation][PowerStencil] first.
|
35
|
+
|
36
|
+
Features provided by a plugin can be:
|
37
|
+
|
38
|
+
* Extra config.
|
39
|
+
* Extra subcommands or options added to the `power_stencil` command-line.
|
40
|
+
* Extra post-build actions.
|
41
|
+
* Extra DSL methods available in templates and in `power_stencil shell`.
|
42
|
+
* Extra entity types.
|
43
|
+
* Extra templates-templates.
|
44
|
+
|
45
|
+
# Using this plugin in your `PowerStencil` projects
|
46
|
+
|
47
|
+
To use this plugin within your `PowerStencil` project, you need to:
|
48
|
+
|
49
|
+
* be within a `PowerStencil` project :wink:.
|
50
|
+
* declare this plugin in the project configuration (from the root of your project in the `.ps_project/versioned-config.yaml` file).
|
51
|
+
|
52
|
+
In this yaml configuration file, you just have to add a new entry in the `:project_plugins` array or simply create it if it is not yet existing:
|
53
|
+
|
54
|
+
```yaml
|
55
|
+
:project_plugins:
|
56
|
+
- psplugin_releases
|
57
|
+
```
|
58
|
+
If this plugin is not already present on your machine, you may have to download it:
|
59
|
+
|
60
|
+
$ power_stencil plugin --install
|
61
|
+
|
62
|
+
And then you may see information about the plugin by running:
|
63
|
+
|
64
|
+
* `power_stencil info` in the plugins section.
|
65
|
+
* `power_stencil plugin --list -v`
|
66
|
+
|
67
|
+
# Goal of this plugin
|
68
|
+
|
69
|
+
The goal of this plugin is to be able to build anything you can already build within your `PowerStencil` project but in the context of a `release`.
|
70
|
+
You can then use the information provided by the `release` within your build templates.
|
71
|
+
|
72
|
+
# Plugin dependencies
|
73
|
+
|
74
|
+
There is no external dependency for this plugin.
|
75
|
+
|
76
|
+
# Plugin capabilities
|
77
|
+
|
78
|
+
This plugin provides the following features:
|
79
|
+
|
80
|
+
## Subcommands and options
|
81
|
+
|
82
|
+
This does not bring any new subcommand. It just adds an option to the `power_stencil build` subcommand:
|
83
|
+
|
84
|
+
* `--release`
|
85
|
+
|
86
|
+
which expects a entity ID of the type `release` to be provided.
|
87
|
+
|
88
|
+
For example:
|
89
|
+
|
90
|
+
$ power_stencil build a_buildable_entity_type/an_entity --release release/my_release
|
91
|
+
|
92
|
+
## DSL in templates and in `power_stencil shell`
|
93
|
+
|
94
|
+
This plugin brings release-related methods to the `PowerStencil` DSL, available in both templates and in the `power_stencil shell`:
|
95
|
+
|
96
|
+
* `target_release(raise_error: true)` returns the release passed on the command line to the `build` sub-command, or `nil` if no release was provided [on the command line](#subcommands-and-options) (or raise an error).
|
97
|
+
* `target_release?` will simply say if a release was provided on the command-line, without raising any error.
|
98
|
+
|
99
|
+
|
100
|
+
## Entity types
|
101
|
+
|
102
|
+
|
103
|
+
### `release`
|
104
|
+
|
105
|
+
The idea is that a `release` has a `version` (following semantic versioning principles) and a `content`.
|
106
|
+
|
107
|
+
`content` is a hash which keys are entities and values are versions (following semantic versioning principles). `content` represents obviously the content of a `release`.
|
108
|
+
|
109
|
+
On top of this it brings:
|
110
|
+
* `bump(level: :patch)` will bump the version of the release, following semantic versioning rules. `:patch` is the default, but could be `:minor`, or `:major` (see `PowerStencil::Utils::SemanticVersion::MANDATORY_LEVELS`).
|
111
|
+
* `bump_content(*content_key, content_increment: :patch, release_increment: :patch)`, a convenient methods to manage the version of each of the content entities version as well as the global release version. By default, it will bump the versions of all entities "_passed_" to the method (ie found from `content_key`), and them bump the version of the release itself.
|
112
|
+
* `content_key`, can be an entity ID, a type and a name, or even an entity or an array of entities.
|
113
|
+
* `content_increment` and `release_increment` define how to increase versions.
|
114
|
+
* inheritance between releases themself. Each release being able to have one upstream and multiple downstream releases.
|
115
|
+
* One release can have a `parent` release.
|
116
|
+
* One release can have multiple `children` releases.
|
117
|
+
|
118
|
+
:information_source: Use `release` to keep consistency between an arbitrary number of entities which may have version requirements on each others.
|
119
|
+
|
120
|
+
# Contributing
|
121
|
+
|
122
|
+
Bug reports and pull requests are welcome on Gitlab at https://gitlab.com/tools4devops/psplugins/releases/issues. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
123
|
+
|
124
|
+
## License
|
125
|
+
|
126
|
+
The gem is available as open source under the terms of the [MIT License].
|
127
|
+
|
128
|
+
## Code of Conduct
|
129
|
+
|
130
|
+
Everyone interacting in the PowerStencil project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct].
|
131
|
+
|
132
|
+
<!-- End of Document -->
|
133
|
+
|
134
|
+
<!-- Pages -->
|
135
|
+
[code of conduct]: CODE_OF_CONDUCT.md
|
136
|
+
|
137
|
+
<!-- Code links -->
|
138
|
+
|
139
|
+
<!-- Illustrations -->
|
140
|
+
[simple-flow-image]: doc/images/power-stencil-simple-flow.svg
|
141
|
+
|
142
|
+
<!-- External links -->
|
143
|
+
[MIT License]: http://opensource.org/licenses/MIT "The MIT license"
|
144
|
+
[ERB]: https://ruby-doc.org/stdlib-2.6.3/libdoc/erb/rdoc/ERB.html "Quick ERB description"
|
145
|
+
[Haml]: http://haml.info/ "The templating engine for XML-like documents"
|
146
|
+
[Ruby]: https://www.ruby-lang.org "The powerful Ruby language"
|
147
|
+
[Rails]: https://rubyonrails.org/ "The Ruby on Rails framework"
|
148
|
+
[PowerStencil site]: https://powerstencil.brizone.org "Official PowerStencil website"
|
149
|
+
[PowerStencil]: https://gitlab.com/tools4devops/power_stencil/blob/master/README.md "PowerStencil documentation"
|
150
|
+
[PowerStencil plugins]: https://gitlab.com/tools4devops/power_stencil/blob/master/doc/plugins.md "PowerStencil plugins documentation"
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "Releases"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
# This file defines the capabilities exposed by the plugin. This file is mandatory
|
3
|
+
# for a plugin to be considered as valid.
|
4
|
+
|
5
|
+
# Define the main module of the plugin. In this module you can define the build method
|
6
|
+
# if the plugin exposes a build (actually a post build hook occurring after the files
|
7
|
+
# are "detemplatized")
|
8
|
+
:plugin_module: Releases
|
9
|
+
|
10
|
+
# In the processors defined in the hereunder hash you map a subcommand with the processor
|
11
|
+
# that will handle it. A plugin can define as many subcommands as needed, or none...
|
12
|
+
# Hash keys should match sub-commands declared in the `command_line.yaml` file and processor
|
13
|
+
# classes should expose an `execute` method.
|
14
|
+
:processors: null
|
15
|
+
|
16
|
+
# This is the name of the method called after the files are detemplatized. This method has
|
17
|
+
# to be a module method in the `plugin_module` module.
|
18
|
+
:build: null
|
19
|
+
|
20
|
+
# If a dsl module is declared it will be injected in the DSL available in the shell or templates
|
21
|
+
:dsl:
|
22
|
+
- Releases::Dsl::ReleasesDsl
|
23
|
+
|
24
|
+
# These are the files (array) defining entity types. These files should not be already
|
25
|
+
# required by the plugin as they will be required by the framework when needed.
|
26
|
+
:entity_definitions:
|
27
|
+
- releases/entity_definitions/release_entity
|
28
|
+
|
29
|
+
# A list of root directories where you can find templates in directories named from the
|
30
|
+
# entity types they are attached to.
|
31
|
+
:templates: null
|
32
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
**
|
@@ -0,0 +1,7 @@
|
|
1
|
+
|
2
|
+
This message has been generated on the <%= Time.now %>
|
3
|
+
This is an example of what you can do, and how much PowerStencil is customizable ! Check the plugin generated code and
|
4
|
+
taylor it to your needs...
|
5
|
+
|
6
|
+
This text is the result of a full build process of the entity '<%= build_target.as_path %>' by the plugin '<%= build_target.buildable_by %>'.
|
7
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Releases
|
2
|
+
module Dsl
|
3
|
+
|
4
|
+
module ReleasesDsl
|
5
|
+
|
6
|
+
def target_release?
|
7
|
+
return false if project.config[:release].nil?
|
8
|
+
return false if target_release(raise_error: false).nil?
|
9
|
+
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def target_release(raise_error: true)
|
14
|
+
if project.config[:release].nil?
|
15
|
+
project.logger.warn "Call to DSL method 'target_release', but no target release specified in the config."
|
16
|
+
return nil
|
17
|
+
end
|
18
|
+
rel = entity PowerStencil.config[:release]
|
19
|
+
false_or_raise "Invalid release '#{project.config[:release]}' !", raise_error: raise_error if rel.nil?
|
20
|
+
false_or_raise "'#{project.config[:release]}' is not a release (this is a '#{rel.type}') !", raise_error: raise_error unless rel.type == :release
|
21
|
+
rel
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module Releases
|
2
|
+
module EntityDefinitions
|
3
|
+
|
4
|
+
class ReleaseEntity < PowerStencil::SystemEntityDefinitions::ProjectEntity
|
5
|
+
|
6
|
+
DEFAULT_VERSION = '0.0.1'
|
7
|
+
|
8
|
+
entity_type :release
|
9
|
+
|
10
|
+
field :version
|
11
|
+
field :content, :is_hash
|
12
|
+
has_one :release, name: :parent, with_reverse_method: :children
|
13
|
+
|
14
|
+
def initialize(fields: {}, universe: nil, user: false)
|
15
|
+
super
|
16
|
+
self.version = DEFAULT_VERSION if version.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def full_name
|
20
|
+
'%s v%s' % [name, version]
|
21
|
+
end
|
22
|
+
|
23
|
+
def bump_content(*content_key, content_increment: :patch, release_increment: :patch)
|
24
|
+
get_entity(*content_key) do |entity|
|
25
|
+
content[entity] = bump_version content[entity], content_increment
|
26
|
+
end
|
27
|
+
self.version = bump_version version, release_increment
|
28
|
+
rescue => e
|
29
|
+
raise PowerStencil::Error, "Cannot bump_content because '#{e.message}'"
|
30
|
+
end
|
31
|
+
|
32
|
+
def bump(level: :patch)
|
33
|
+
self.version = bump_version version, level
|
34
|
+
end
|
35
|
+
|
36
|
+
def specifically_valid?(raise_error: false)
|
37
|
+
content.each do |entity, version|
|
38
|
+
unless entity.is_a? UniverseCompiler::Entity::Base
|
39
|
+
return false_or_raise"Invalid hash in release content of #{as_path} ! Key should be an entity !", raise_error: raise_error
|
40
|
+
end
|
41
|
+
unless PowerStencil::Utils::SemanticVersion.valid_version?(version, raise_error: false)
|
42
|
+
return false_or_raise"Invalid version '#{version}' defined for #{entity.as_path} in release #{as_path} !", raise_error: raise_error
|
43
|
+
end
|
44
|
+
end
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
def save(uri = source_uri, raise_error: true, force_save: false, force_files_generation: false )
|
49
|
+
self.content = content.map { |entity, version| [entity, version.to_s] }.to_h
|
50
|
+
super
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def get_entity(*entity_criteria, &block)
|
56
|
+
case entity_criteria.size
|
57
|
+
when 1
|
58
|
+
case entity_criteria.first
|
59
|
+
when UniverseCompiler::Entity::Base
|
60
|
+
entity = entity_criteria.first
|
61
|
+
yield entity
|
62
|
+
|
63
|
+
when Array
|
64
|
+
entity_criteria.first.each do |entity|
|
65
|
+
yield entity
|
66
|
+
end
|
67
|
+
|
68
|
+
when String
|
69
|
+
if md = entity_criteria.first.match(/^\s*(?<type>[^\/]+)\/(?<name>.+)\s*$/)
|
70
|
+
search_type = md[:type].to_sym
|
71
|
+
search_name = md[:name]
|
72
|
+
entity = project_engine.entity search_type, search_name, project_engine.root_universe
|
73
|
+
yield entity
|
74
|
+
else
|
75
|
+
raise PowerStencil::Error, 'Invalid entity search ID'
|
76
|
+
end
|
77
|
+
|
78
|
+
else
|
79
|
+
raise PowerStencil::Error, 'Invalid entity search_criteria'
|
80
|
+
end
|
81
|
+
|
82
|
+
when 2
|
83
|
+
entity = project_engine.entity *entity_criteria, project_engine.root_universe
|
84
|
+
yield entity
|
85
|
+
|
86
|
+
else
|
87
|
+
raise PowerStencil::Error, 'Invalid entity search_criteria number'
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
def bump_version(a_version, level)
|
93
|
+
cur_version = PowerStencil::Utils::SemanticVersion.new a_version
|
94
|
+
cur_version.increment(level).to_s
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Releases
|
2
|
+
module PluginHelper
|
3
|
+
|
4
|
+
def plugin_templates_path
|
5
|
+
File.join plugin_root_path, 'etc', 'templates'
|
6
|
+
end
|
7
|
+
|
8
|
+
def command_line_definition_file_path
|
9
|
+
File.join plugin_root_path, 'etc', 'command_line.yaml'
|
10
|
+
end
|
11
|
+
|
12
|
+
def plugin_root_path
|
13
|
+
File.expand_path File.join('..', '..', '..'), __FILE__
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/lib/releases.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'releases/version'
|
2
|
+
require 'releases/plugin_helper'
|
3
|
+
require 'releases/dsl/releases_dsl'
|
4
|
+
|
5
|
+
module Releases
|
6
|
+
|
7
|
+
def self.post_build_hook(built_entity, generated_files_path)
|
8
|
+
# This is an example of what you could do after files are generated, ie pretty much anything...
|
9
|
+
case built_entity.type
|
10
|
+
when :releases_entity
|
11
|
+
generated_file = File.join generated_files_path, 'message.txt'
|
12
|
+
puts File.readlines(generated_file)
|
13
|
+
else
|
14
|
+
raise PowerStencil::Error, 'Plugin releases doesnt know how handle the build of a releases_entity entity type !'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'releases/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'psplugin_releases'
|
8
|
+
spec.version = Releases::VERSION
|
9
|
+
spec.authors = ['Laurent Briais']
|
10
|
+
spec.email = ['powerstencil-contact@brizone.org']
|
11
|
+
|
12
|
+
spec.summary = %q{releases is a plugin for the power_stencil framework.}
|
13
|
+
spec.description = %q{Release provides entities to manage releases, ie consistent sets of ... something.}
|
14
|
+
spec.homepage = 'https://gitlab.com/tools4devops/psplugins/releases'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Change this and following metadata if you don't want your plugin to be an "official" PowerStencil plugin.
|
18
|
+
# ie deployed to https://gitlab.com/tools4devops/psplugins
|
19
|
+
source_code_uri = 'https://gitlab.com/tools4devops/psplugins/releases'
|
20
|
+
|
21
|
+
# Gem metadata
|
22
|
+
if spec.respond_to?(:metadata)
|
23
|
+
# Nice link to your home page on rubygems.org
|
24
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
25
|
+
|
26
|
+
# You have to probably change this if you don't deploy to gitlab
|
27
|
+
spec.metadata['bug_tracker_uri'] = "#{source_code_uri}/issues"
|
28
|
+
spec.metadata['documentation_uri'] = "#{source_code_uri}/blob/master/README.md"
|
29
|
+
spec.metadata['source_code_uri'] = source_code_uri
|
30
|
+
|
31
|
+
# This metadata is mandatory for a PowerStencil plugin !!
|
32
|
+
spec.metadata['plugin_name'] = 'releases'
|
33
|
+
else
|
34
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes and PowerStencil plugin mechanism !'
|
35
|
+
end
|
36
|
+
|
37
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
38
|
+
f.match(%r{^(test|spec|features)/})
|
39
|
+
end
|
40
|
+
spec.bindir = 'exe'
|
41
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
42
|
+
spec.require_paths = ['lib']
|
43
|
+
|
44
|
+
spec.add_development_dependency 'bundler'
|
45
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
46
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
47
|
+
spec.add_development_dependency 'power_stencil', '~> 0.9.0'
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: psplugin_releases
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Laurent Briais
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: power_stencil
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.0
|
69
|
+
description: Release provides entities to manage releases, ie consistent sets of ...
|
70
|
+
something.
|
71
|
+
email:
|
72
|
+
- powerstencil-contact@brizone.org
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- CODE_OF_CONDUCT.md
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- etc/command_line.yaml
|
88
|
+
- etc/plugin_capabilities.yaml
|
89
|
+
- etc/templates/.git_keep
|
90
|
+
- etc/templates/releases_entity/.copy_ignore
|
91
|
+
- etc/templates/releases_entity/.subst_ignore
|
92
|
+
- etc/templates/releases_entity/message.txt
|
93
|
+
- lib/releases.rb
|
94
|
+
- lib/releases/dsl/releases_dsl.rb
|
95
|
+
- lib/releases/entity_definitions/release_entity.rb
|
96
|
+
- lib/releases/plugin_helper.rb
|
97
|
+
- lib/releases/version.rb
|
98
|
+
- psplugin_releases.gemspec
|
99
|
+
homepage: https://gitlab.com/tools4devops/psplugins/releases
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata:
|
103
|
+
homepage_uri: https://gitlab.com/tools4devops/psplugins/releases
|
104
|
+
bug_tracker_uri: https://gitlab.com/tools4devops/psplugins/releases/issues
|
105
|
+
documentation_uri: https://gitlab.com/tools4devops/psplugins/releases/blob/master/README.md
|
106
|
+
source_code_uri: https://gitlab.com/tools4devops/psplugins/releases
|
107
|
+
plugin_name: releases
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.5.1
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: releases is a plugin for the power_stencil framework.
|
128
|
+
test_files: []
|