revision 1.4.0 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/README.org +195 -176
- data/lib/revision/info.rb +1 -1
- data/lib/revision/releasable.rb +58 -24
- data/lib/revision/version.rb +46 -31
- data/releasables.yaml +1 -1
- data/revision.gemspec +17 -14
- metadata +103 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aeac36b67440a0670c7b89fc3602ae9bfda2bc43add4f6ac3dbb44c0d2d7a45
|
4
|
+
data.tar.gz: 4fa17d34cd367afafb0afb75343405a793ad2f732364ce36680059907d4b8f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 231c4a899d91b78bc32e160b382b160df9a3e09f0953b81f16101b981bcb350d0252140e9cf075c5daeba75b91b968e54e2b7d382d3e3c949eb2d0fbcc1d01cd
|
7
|
+
data.tar.gz: 6f63c22ed930a5a3830c89fe2902ff9ec6a9ebb01e79810bfa3690e28f25c3ae6e2f85a16d63c4c9a90a8ff6b681f1c937fd1082830381b4c9166de2f0368522
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.org
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#+TITLE: Revision management gem
|
2
2
|
#+AUTHOR: Cormac Cannon
|
3
|
-
#+EMAIL: cormac.cannon@neuromoddevices.com
|
4
3
|
#+LANGUAGE: en
|
5
4
|
|
6
5
|
# Generic properties
|
@@ -24,250 +23,270 @@
|
|
24
23
|
# or alternatively #+SETUPFILE: theme-readtheorg.setup
|
25
24
|
|
26
25
|
* Overview
|
26
|
+
This gem automates revision management for source projects. The tool is language agnostic (used for C, ruby and matlab projects, to date -- though you're probably better off using bundler for ruby projects). It supports per-project configuration using a yaml-format file called =releasables.yaml= located at the project root.
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
It currently supports the following functionality
|
29
|
+
- Manage 3-component revision IDs embedded natively in source file
|
30
|
+
- Embeds/updates/extracts changelog in source file header/footer comments
|
31
|
+
- Automatically prompts for a changelog entry each time a revision identifier is incremented
|
32
|
+
- Optionally commits and tags changes to a git repo after an update to the revision ID
|
33
|
+
- Builds and archives projects in zip format (including release notes and arbitrary release artefacts defined
|
34
|
+
- Deploys
|
31
35
|
|
32
|
-
|
33
|
-
- Manage 3-component revision IDs embedded natively in source file
|
34
|
-
- Embeds/updates/extracts changelog in source file header/footer comments
|
35
|
-
- Automatically prompts for a changelog entry each time a revision identifier is incremented
|
36
|
-
- Optionally commits and tags changes to a git repo after an update to the revision ID
|
37
|
-
- Builds and archives projects in zip format (including release notes and arbitrary release artefacts defined
|
38
|
-
- Deploys
|
36
|
+
Worked on sporadically to allow me to tag, archive and deploy projects in multiple languages in a consistent fashion.
|
39
37
|
|
40
38
|
* Installation
|
41
39
|
** Dependencies
|
42
|
-
|
40
|
+
Ruby / Rubygems installed
|
43
41
|
|
44
42
|
** From rubygems.org
|
45
43
|
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
#+BEGIN_SRC sh
|
45
|
+
gem install revision
|
46
|
+
#+END_SRC
|
49
47
|
|
50
48
|
** From source
|
51
49
|
|
52
|
-
|
53
|
-
git clone git@
|
54
|
-
|
50
|
+
#+BEGIN_SRC sh
|
51
|
+
git clone git@github.com:cormacc/revision
|
52
|
+
#+END_SRC
|
55
53
|
|
56
54
|
|
57
55
|
*** Checkout
|
58
56
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
#+BEGIN_SRC sh
|
58
|
+
gem install bundler
|
59
|
+
git clone git@github.com:cormacc/revision
|
60
|
+
cd revision
|
61
|
+
#+END_SRC
|
64
62
|
|
65
63
|
*** Install
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
65
|
+
#+BEGIN_SRC sh
|
66
|
+
bundle install
|
67
|
+
bundle exec rake install
|
68
|
+
#+END_SRC
|
69
|
+
|
70
|
+
#+RESULTS:
|
71
|
+
#+begin_example
|
72
|
+
Using rake 10.5.0
|
73
|
+
Using bundler 1.16.0
|
74
|
+
Using coderay 1.1.2
|
75
|
+
Using diff-lcs 1.3
|
76
|
+
Using git 1.3.0
|
77
|
+
Using method_source 0.9.0
|
78
|
+
Using pry 0.11.3
|
79
|
+
Using rubyzip 1.2.1
|
80
|
+
Using thor 0.19.4
|
81
|
+
Using revision 1.0.0 from source at `.`
|
82
|
+
Using rspec-support 3.7.0
|
83
|
+
Using rspec-core 3.7.0
|
84
|
+
Using rspec-expectations 3.7.0
|
85
|
+
Using rspec-mocks 3.7.0
|
86
|
+
Using rspec 3.7.0
|
87
|
+
Bundle complete! 5 Gemfile dependencies, 15 gems now installed.
|
88
|
+
Use `bundle info [gemname]` to see where a bundled gem is installed.
|
89
|
+
revision 1.0.0 built to pkg/revision-1.0.0.gem.
|
90
|
+
revision (1.0.0) installed.
|
91
|
+
#+end_example
|
94
92
|
|
95
93
|
* Usage
|
96
94
|
|
97
95
|
** Supported Commands
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
96
|
+
Run the executable with no arguments to get usage instructions in your console window...
|
97
|
+
|
98
|
+
#+BEGIN_SRC sh
|
99
|
+
revision
|
100
|
+
#+END_SRC
|
101
|
+
|
102
|
+
#+RESULTS:
|
103
|
+
#+begin_example
|
104
|
+
Loading releasable definitions from /home/cormacc/dev/gem/revision/releasables.yaml ...
|
105
|
+
Commands:
|
106
|
+
revision --version, -v # print the version
|
107
|
+
revision archive # Archive releasable(s)
|
108
|
+
revision build # Build releasable(s)
|
109
|
+
revision changelog # Display change log on stdout
|
110
|
+
revision deploy # Deploy releasable(s)
|
111
|
+
revision help [COMMAND] # Describe available commands or one specific command
|
112
|
+
revision info # Display info for all defined releasables
|
113
|
+
revision major # Increment major revision index
|
114
|
+
revision minor # Increment minor revision index
|
115
|
+
revision package # Build and archive releasables
|
116
|
+
revision patch # Increment patch revision index
|
117
|
+
revision tag # Commit the current revision to a local git repo ...
|
118
|
+
|
119
|
+
Options:
|
120
|
+
[--dryrun], [--no-dryrun]
|
121
|
+
[--id=ID]
|
122
|
+
|
123
|
+
#+end_example
|
124
|
+
|
125
|
+
#+BEGIN_NOTE
|
126
|
+
The tool can be run from any subfolder of a project root -- it will traverse the tree until it finds
|
127
|
+
an ancestor containing =releasables.yaml= OR can go no further (in which case it throws an error).
|
128
|
+
#+END_NOTE
|
127
129
|
|
128
130
|
*** Operating on multiple releasables
|
129
131
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
132
|
+
A single =releasables.yaml= file can define multiple releasables, either implicitly (via inclusion) or explicitly
|
133
|
+
(see [[Configuration]] section below for examples). In this context, the ~info~ and ~archive~ commands
|
134
|
+
will operate on all defined releasables, whereas the remaining commands will require the releasable
|
135
|
+
to be specified using the ~--id=~ option, e.g.
|
134
136
|
|
135
|
-
|
136
|
-
|
137
|
-
|
137
|
+
#+BEGIN_SRC sh
|
138
|
+
revision minor --id=firmware
|
139
|
+
#+END_SRC
|
138
140
|
|
139
141
|
** Configuration
|
140
142
|
|
141
|
-
|
142
|
-
|
143
|
-
|
143
|
+
YAML syntax is used for the configuration file. The [[Syntax]] and [[Examples]] sections below should provide sufficient
|
144
|
+
introduction to the limit subset of language features required to use this tool, however further info
|
145
|
+
may be found at the following links:
|
144
146
|
|
145
|
-
|
146
|
-
|
147
|
+
- http://docs.ansible.com/ansible/latest/YAMLSyntax.html
|
148
|
+
- http://www.yaml.org/start.html
|
147
149
|
|
148
150
|
*** Syntax
|
149
151
|
|
150
|
-
|
151
|
-
|
152
|
+
The =releasables.yaml= file should contain a top level ~:releasables~ node.
|
153
|
+
Under this, you can create a list (or YAML /sequence/) of releasable definitions.
|
152
154
|
|
153
|
-
|
154
|
-
|
155
|
+
Each sequence item begins with a ~-~ and contains either a link to a folder containing its own =releasables.yaml=
|
156
|
+
defining one or more releasables ...
|
155
157
|
|
156
|
-
|
157
|
-
|
158
|
-
|
158
|
+
#+BEGIN_SRC yaml
|
159
|
+
- :folder: relative/path/to/a/releasable/folder
|
160
|
+
#+END_SRC
|
159
161
|
|
160
|
-
|
162
|
+
... or a single inline releasable definition.
|
161
163
|
|
162
|
-
|
163
|
-
|
164
|
-
|
164
|
+
#+BEGIN_NOTE
|
165
|
+
The lines beginning with '#' are explanatory comments
|
166
|
+
#+END_NOTE
|
165
167
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
168
|
+
#+BEGIN_SRC yaml
|
169
|
+
- :id: my_releasable
|
170
|
+
:revision:
|
171
|
+
# Source file containing the revision identifier
|
172
|
+
# This will also include changelog entries, embedded as comments
|
173
|
+
:src: lib/revision/version.rb
|
174
|
+
# Regex matching the source revision identifier. Must contain the following named capture groups
|
175
|
+
# - major, minor, patch :: Numeric (uint) sequences representing the three revision ID components
|
176
|
+
# - sep1, sep2 :: the characters separating the revision components
|
177
|
+
# - prefix, postfix :: sufficient syntactic context to match the revision ID uniquely
|
178
|
+
# N.B. this regex matches the version ID from the standard bundler gem skeleton,
|
179
|
+
# e.g. VERSION = "1.1.0"
|
180
|
+
:regex: (?<prefix>VERSION = ")(?<major>\d+)(?<sep1>\.)(?<minor>\d+)(?<sep2>\.)(?<patch>\d+)(?<postfix>")
|
181
|
+
# Comment char for the project language -- prefixed to each line of changelog entries
|
182
|
+
# Quotes only necessary here to prevent # being interpreted as the beginning of a YAML comment
|
183
|
+
:comment_prefix: "#"
|
182
184
|
# Sequence of build steps -- each item should be a valid shell command, prefixed with the YAML sequence item token, '- '
|
183
185
|
:build_steps:
|
184
186
|
- bundle exec rake install
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
187
|
+
# Sequence defining the files (build artefacts) to package in the release archive.
|
188
|
+
# Each artefact definition must include a :src: key/value pair.
|
189
|
+
# An optional :dest: value may be provided to rename the file during packaging, or just (as in the first entry below)
|
190
|
+
# to flatten the folder structure.
|
191
|
+
# Any <VER> (or <REV>) in the :src: or :dest: placeholders wil be replaced with the current revision ID
|
192
|
+
# The revision archive will also include the revision history extracted as a text file
|
193
|
+
:artefacts:
|
194
|
+
# A binary artefact -- the
|
195
|
+
- :src: pkg/revision-<VER>.gem
|
196
|
+
:dest: revision-<VER>.gem
|
197
|
+
# This document -- the :dest: value defaults to duplicating :src: if not specified
|
198
|
+
- :src: README.org
|
199
|
+
#+END_SRC
|
198
200
|
|
199
201
|
**** TODO (or at least consider) add support for overridable defaults
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
202
|
+
e.g. via a =.releasables= configuration file in the user home dir.
|
203
|
+
Though this would be bad for collaborative development as the config file would live outside source control.
|
204
|
+
Possibly useful to support inclusion of a controlled configuration file instead? Primarily to define
|
205
|
+
a revision regex and comment prefix for a group of related releasables....
|
204
206
|
|
205
207
|
*** Examples
|
206
208
|
**** C project
|
207
209
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
210
|
+
#+BEGIN_NOTE
|
211
|
+
The ~:regex:~ and ~:comment_prefix:~ keys are absent in the C example below. This project started life as
|
212
|
+
managing some embedded C projects, and the default values reflect this.
|
213
|
+
#+END_NOTE
|
214
|
+
|
215
|
+
#+BEGIN_SRC yaml
|
216
|
+
:releasables:
|
217
|
+
- :id: mbt_cd_firmware
|
218
|
+
:revision:
|
219
|
+
:src: src/FirmwareRevision.c
|
220
|
+
:build_steps:
|
221
|
+
- make --jobs=8 -f Makefile CONF=bootloadable
|
220
222
|
:artefacts:
|
221
223
|
- :src: dist/bootloadable/production/firmware.production.hex
|
222
224
|
:dest: mbt_cd_firmware_v<REV>.bootloadable.hex
|
223
|
-
|
224
|
-
|
225
|
-
|
225
|
+
- :src: dist/default/production/firmware.production.hex
|
226
|
+
:dest: mbt_cd_firmware_v<REV>.standalone.hex
|
227
|
+
#+END_SRC
|
226
228
|
|
227
229
|
**** Ruby project
|
228
230
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
231
|
+
#+BEGIN_SRC yaml
|
232
|
+
:releasables:
|
233
|
+
- :id: revision
|
234
|
+
:revision:
|
235
|
+
:src: lib/revision/version.rb
|
236
|
+
:regex: (?<prefix>VERSION = ")(?<major>\d+)(?<sep1>\.)(?<minor>\d+)(?<sep2>\.)(?<patch>\d+)(?<postfix>")
|
237
|
+
:comment_prefix: "#"
|
238
|
+
:build_steps:
|
239
|
+
- bundle exec rake install
|
238
240
|
:artefacts:
|
239
241
|
- :src: pkg/revision-<VER>.gem
|
240
|
-
|
242
|
+
#+END_SRC
|
241
243
|
|
242
244
|
*** Heirarchical project
|
243
|
-
|
245
|
+
Rather than defining the releasable parameters inline, a =releasables.yaml= list entry can contain a (relative or absolute) link to another folder containing it's own =releasables.yaml=.
|
244
246
|
|
245
|
-
|
246
|
-
|
247
|
+
i.e assuming the earlier examples were in folders =examples/c= and =examples/ruby= relative to a common root, a separate =releasables.yaml=
|
248
|
+
at that root could include them as follows...
|
247
249
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
250
|
+
#+BEGIN_SRC yaml
|
251
|
+
:releasables:
|
252
|
+
- :folder: examples/c
|
253
|
+
- :folder: examples/ruby
|
254
|
+
#+END_SRC
|
253
255
|
|
254
256
|
**** TODO consider supporting a higher-level aggregate revision ID
|
255
257
|
|
256
|
-
|
257
|
-
|
258
|
-
|
258
|
+
#+BEGIN_SRC yaml
|
259
|
+
:revision:
|
260
|
+
:src: release_log.txt
|
259
261
|
:releasables:
|
260
262
|
- :folder: examples/c
|
261
|
-
|
262
|
-
|
263
|
+
- :folder: examples/ruby
|
264
|
+
#+END_SRC
|
263
265
|
|
264
266
|
* Development
|
265
267
|
|
266
|
-
|
268
|
+
** Environment
|
269
|
+
After checking out the repo, run =bin/setup= to install dependencies. Then, run =rake spec= to run the tests. You can also run =bin/console= for an interactive prompt that will allow you to experiment.
|
270
|
+
|
271
|
+
** Installation from source
|
272
|
+
To install this gem from source on your local machine, run =bundle exec rake install= from the repository root.
|
273
|
+
|
274
|
+
** Incrementing release versions
|
275
|
+
You can do this using the gem, by entering one of the following commands at the repository root
|
276
|
+
|
277
|
+
| Command | Effect |
|
278
|
+
|------------------+----------------------------------------------|
|
279
|
+
| =revision patch= | Patch version increment, e.g. 1.1.0 -> 1.1.1 |
|
280
|
+
| =revision minor= | Patch version increment, e.g. 1.1.1 -> 1.2.0 |
|
281
|
+
| =revision major= | Major version increment, e.g. 1.2.0 -> 2.0.0 |
|
282
|
+
|
283
|
+
You'll be prompted to rebuild the gem, commit changes to the git repo and add a revision tag to the commit.
|
267
284
|
|
268
|
-
|
285
|
+
Alternatively, manually update the version number in =version.rb= and rebuild/install locally using =bundle exec rake install=
|
269
286
|
|
287
|
+
** Deploying to rubygems
|
288
|
+
=bundle exec rake release=, will create a git tag for the version (if not, push git commits and tags, and push the =.gem= file to [rubygems.org](https://rubygems.org).
|
270
289
|
|
271
290
|
* Contributing
|
272
291
|
|
273
|
-
|
292
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cormacc/revision.
|
data/lib/revision/info.rb
CHANGED
@@ -121,7 +121,7 @@ class Revision::Info
|
|
121
121
|
# Prefixes the entry with an empty line, then prefixes each line with comment chars
|
122
122
|
# and converts the line entries to a single string
|
123
123
|
def format_changelog_entry(entry_lines)
|
124
|
-
entry_lines.unshift('').map { |line| "#{@comment_prefix} #{line}"}.join("\n")
|
124
|
+
entry_lines.unshift('').map { |line| "#{@comment_prefix} #{line}".rstrip()}.join("\n")
|
125
125
|
end
|
126
126
|
|
127
127
|
def get_changelog_entry
|
data/lib/revision/releasable.rb
CHANGED
@@ -95,7 +95,7 @@ module Revision
|
|
95
95
|
|
96
96
|
def exec_pipeline(type, steps, skip_steps=0)
|
97
97
|
exec_steps = steps[skip_steps..-1]
|
98
|
-
puts "{type} :: Executing steps #{skip_steps+1} to #{steps.length}..."
|
98
|
+
puts "#{type} :: Executing steps #{skip_steps+1} to #{steps.length}..."
|
99
99
|
Dir.chdir(@root) do
|
100
100
|
exec_steps.each_with_index do |step, index|
|
101
101
|
step_index = index+1+skip_steps
|
@@ -141,8 +141,12 @@ module Revision
|
|
141
141
|
"#{@git_tag_prefix}#{revision}"
|
142
142
|
end
|
143
143
|
|
144
|
+
def escape(a_string)
|
145
|
+
a_string.gsub('"',"\\\"")
|
146
|
+
end
|
147
|
+
|
144
148
|
def tag_annotation
|
145
|
-
@revision.last_changelog_entry.join("\n")
|
149
|
+
escape(@revision.last_changelog_entry.join("\n"))
|
146
150
|
end
|
147
151
|
|
148
152
|
def commit_message
|
@@ -153,7 +157,7 @@ module Revision
|
|
153
157
|
commit_lines << "Also..."
|
154
158
|
commit_lines += changelog_entry[2..-1]
|
155
159
|
end
|
156
|
-
commit_lines.join("\n")
|
160
|
+
escape(commit_lines.join("\n"))
|
157
161
|
end
|
158
162
|
|
159
163
|
def tag
|
@@ -196,22 +200,23 @@ module Revision
|
|
196
200
|
src = File.join(@root,src)
|
197
201
|
dest = dest_prefix.empty? ? dest : File.join(dest_prefix, dest)
|
198
202
|
amap[src] = dest
|
199
|
-
puts "... (#{index+1}/#{@artefacts.length}) #{src} => #{dest}"
|
200
203
|
end
|
201
204
|
amap
|
202
205
|
end
|
203
206
|
|
204
207
|
def archive
|
205
208
|
puts "Archiving #{@artefacts.length} build artefacts as #{archive_name}..."
|
206
|
-
|
209
|
+
amap = artefact_map
|
207
210
|
if File.exist?(archive_name)
|
208
211
|
puts "... deleting existing archive"
|
209
212
|
File.delete(archive_name)
|
210
213
|
end
|
211
214
|
Zip::File.open(archive_name, Zip::File::CREATE) do |zipfile|
|
212
|
-
|
215
|
+
amap.each.with_index(1) do |entry, idx|
|
216
|
+
src, dest = entry
|
213
217
|
#TODO: Add directory processing....
|
214
|
-
|
218
|
+
puts "... (#{idx}/#{amap.length}) #{src} => #{dest}"
|
219
|
+
zipfile.add(dest, src)
|
215
220
|
end
|
216
221
|
puts "... embedding revision history as #{changelog_name} "
|
217
222
|
zipfile.get_output_stream(changelog_name) { |os| output_changelog(os)}
|
@@ -226,29 +231,58 @@ module Revision
|
|
226
231
|
end
|
227
232
|
|
228
233
|
def deploy(destination='')
|
229
|
-
|
230
|
-
|
234
|
+
destinations = []
|
235
|
+
if not destination.empty?
|
236
|
+
destinations.append({dest: destination})
|
237
|
+
elsif @config.dig(:deploy)
|
238
|
+
if @config[:deploy].kind_of?(Array)
|
239
|
+
destinations.append(*@config[:deploy])
|
240
|
+
else
|
241
|
+
destinations.append(@config[:deploy])
|
242
|
+
end
|
231
243
|
end
|
232
244
|
|
233
|
-
raise Errors::NotSpecified.new(':deploy
|
234
|
-
destination = File.expand_path(destination)
|
245
|
+
raise Errors::NotSpecified.new(':deploy') if destinations.empty?
|
235
246
|
|
236
|
-
|
237
|
-
|
238
|
-
|
247
|
+
#... Eliminated global deployment pre/post functions.
|
248
|
+
#... if applicable to all dests, the logic should probably be a build step...
|
249
|
+
# if @config.dig(:deploy, :pre)
|
250
|
+
# exec_pipeline('deploy (pre)', @config[:deploy][:pre])
|
251
|
+
# end
|
239
252
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
253
|
+
destinations.each do |d|
|
254
|
+
destination = File.expand_path(d[:dest])
|
255
|
+
|
256
|
+
if d.dig(:pre)
|
257
|
+
exec_pipeline('deploy (pre / #{d[:dest]})', d[:pre])
|
258
|
+
end
|
259
|
+
|
260
|
+
puts "Deploying #{@artefacts.length} build artefacts to #{destination}..."
|
261
|
+
if not File.exist?(destination)
|
262
|
+
puts "... folder not found -> creating ... '#{destination}'"
|
263
|
+
FileUtils.mkdir_p(destination)
|
264
|
+
end
|
265
|
+
amap = artefact_map(destination)
|
266
|
+
amap.each.with_index(1) do |entry, idx|
|
267
|
+
src, dest = entry
|
268
|
+
puts "... (#{idx}/#{amap.length}) #{src} => #{dest}"
|
269
|
+
if File.exist?(dest)
|
270
|
+
puts "... deleting existing '#{dest}' ..."
|
271
|
+
FileUtils.rm_rf(dest)
|
272
|
+
end
|
273
|
+
puts "... deploying '#{src}' -> '#{dest}"
|
274
|
+
FileUtils.cp_r(src,dest)
|
275
|
+
end
|
276
|
+
File.open(File.join(destination,changelog_name),'w') { |f| output_changelog(f)}
|
277
|
+
|
278
|
+
if d.dig(:post)
|
279
|
+
exec_pipeline('deploy (post / #{d[:dest]})', d[:post])
|
245
280
|
end
|
246
|
-
FileUtils.cp_r(src,dest)
|
247
|
-
end
|
248
|
-
File.open(File.join(destination,changelog_name),'w') { |f| output_changelog(f)}
|
249
|
-
if @config.dig(:deploy, :post)
|
250
|
-
exec_pipeline('deploy (post)', @config[:deploy][:post])
|
251
281
|
end
|
282
|
+
|
283
|
+
# if @config.dig(:deploy, :post)
|
284
|
+
# exec_pipeline('deploy (post)', @config[:deploy][:post])
|
285
|
+
# end
|
252
286
|
end
|
253
287
|
|
254
288
|
def package
|
data/lib/revision/version.rb
CHANGED
@@ -1,107 +1,122 @@
|
|
1
1
|
# Defines the revision ID for the revision gem
|
2
2
|
module Revision
|
3
|
-
VERSION = "1.
|
3
|
+
VERSION = "1.5.3".freeze
|
4
4
|
end
|
5
5
|
|
6
6
|
# <BEGIN CHANGELOG>
|
7
|
-
#
|
7
|
+
#
|
8
|
+
# Version 1.5.3 (26 Oct 2021)
|
9
|
+
# - Multiple deployment destinations bugfix -- only last destination was being used.
|
10
|
+
#
|
11
|
+
# Version 1.5.2 (10 Jun 2020)
|
12
|
+
# - Uprevving around undeletable git tag
|
13
|
+
#
|
14
|
+
## Version 1.5.1 (10 Jun 2020)
|
15
|
+
# - Escape " and ' in commit message when constructing git command line (' still problematic in some shells)
|
16
|
+
#
|
17
|
+
# Version 1.5.0 (13 Feb 2020)
|
18
|
+
# - Now handles multiple deployment destinations in releasables.yaml
|
19
|
+
#
|
20
|
+
# Version 1.4.1 (18 Nov 2019)
|
21
|
+
# - Updated to strip trailing whitespace after comment char for empty line
|
22
|
+
#
|
8
23
|
# Version 1.4.0 (10 Jun 2019)
|
9
24
|
# - Now allow the definition of one or more 'secondary_revisions', where a revision ID can be updated with or without an embedded changelog
|
10
|
-
#
|
25
|
+
#
|
11
26
|
# Version 1.3.1 (20 May 2019)
|
12
27
|
# - Corrected bug when deploying changelog:w
|
13
|
-
#
|
28
|
+
#
|
14
29
|
# Version 1.3.0 (20 May 2019)
|
15
30
|
# - Added :archive: (archive root definition)
|
16
31
|
# - Added optional :pre: and :post: steps to :deploy: definition
|
17
|
-
#
|
32
|
+
#
|
18
33
|
# Version 1.2.8 (20 May 2019)
|
19
34
|
# - Updated Git tag/commit behaviour -- now commit/tag/push by default
|
20
35
|
# - Updated deploy to remove existing targets and copy entire directory trees
|
21
|
-
#
|
36
|
+
#
|
22
37
|
# Version 1.2.7 (17 May 2019)
|
23
38
|
# - 'deploy' now expands '~' in paths
|
24
|
-
#
|
39
|
+
#
|
25
40
|
# Version 1.2.6 (17 May 2019)
|
26
41
|
# - Updated deploy to use default dest from yaml (if specified)
|
27
|
-
#
|
42
|
+
#
|
28
43
|
# Version 1.2.5 (07 Nov 2018)
|
29
44
|
# - Added 'deploy' command
|
30
|
-
#
|
45
|
+
#
|
31
46
|
# Version 1.2.4 (05 Sep 2018)
|
32
47
|
# - Added commit message and tag details to `revision info`
|
33
48
|
# - Minor refactoring
|
34
|
-
#
|
49
|
+
#
|
35
50
|
# Version 1.2.3 (03 Sep 2018)
|
36
51
|
# - Tidied up `revision info` output formatting
|
37
|
-
#
|
52
|
+
#
|
38
53
|
# Version 1.2.2 (03 Sep 2018)
|
39
54
|
# - Updated CLI to provide version info
|
40
|
-
#
|
55
|
+
#
|
41
56
|
# Version 1.2.1 (03 Sep 2018)
|
42
57
|
# - Update to allow releasable without any artefacts
|
43
|
-
#
|
58
|
+
#
|
44
59
|
# Version 1.2.0 (06 Mar 2018)
|
45
60
|
# - Build definition improvements (and new yaml structure)
|
46
61
|
# - Added platform-agnostic environment variable definition (handles '~' replacement and :/; path separators)
|
47
62
|
# - Added platform-agnostic packaging of binaries (i.e. appending .exe for windows when archiving)
|
48
|
-
#
|
63
|
+
#
|
49
64
|
# Version 1.1.10 (16 Feb 2018)
|
50
65
|
# - Modified 'archive' command to just archive existing artefact -- i.e. skip build phase
|
51
66
|
# - Added 'package' command that builds AND archives
|
52
|
-
#
|
67
|
+
#
|
53
68
|
# Version 1.1.9 (16 Feb 2018)
|
54
69
|
# - Fixed bug when adding first changelog entry to file without existing placeholders
|
55
70
|
# - Added standalone build command
|
56
|
-
#
|
71
|
+
#
|
57
72
|
# Version 1.1.8 (15 Dec 2017)
|
58
73
|
# - Added .yardopts to build documentation
|
59
|
-
#
|
74
|
+
#
|
60
75
|
# Version 1.1.7 (15 Dec 2017)
|
61
76
|
# - Corrected push -- was pushing tags without commit
|
62
|
-
#
|
77
|
+
#
|
63
78
|
# Version 1.1.6 (15 Dec 2017)
|
64
79
|
# - Added full changelog entry as tag message
|
65
80
|
# - Removed ruby-git dependency from gemspec
|
66
|
-
#
|
81
|
+
#
|
67
82
|
# Version 1.1.5 (15 Dec 2017)
|
68
83
|
# - Replaced ruby-git library with shell calls, as wasn't handling submodules correctly
|
69
|
-
#
|
84
|
+
#
|
70
85
|
# Version 1.1.4 (14 Dec 2017)
|
71
86
|
# - Minor message body reformatting
|
72
|
-
#
|
87
|
+
#
|
73
88
|
# Version 1.1.3 (14 Dec 2017)
|
74
89
|
# - Eliminated duplication of version ID in commit message body
|
75
|
-
#
|
90
|
+
#
|
76
91
|
# Version 1.1.2 (14 Dec 2017)
|
77
92
|
# - Removed redundant ':: ' from commit message headline
|
78
|
-
#
|
93
|
+
#
|
79
94
|
# Version 1.1.1 (14 Dec 2017)
|
80
95
|
# - Added git connection failure handling
|
81
96
|
# - Revision commit message now includes first line of changelog entry
|
82
97
|
# - Updated configuration syntax for consistency (:revision: :file: -> :revision: :src:)
|
83
|
-
#
|
98
|
+
#
|
84
99
|
# Version 1.1.0 (13 Dec 2017)
|
85
100
|
# - Updated to optionally push tags to the repo
|
86
|
-
#
|
101
|
+
#
|
87
102
|
# Version 1.0.1 (13 Dec 2017)
|
88
103
|
# - Corrected revision placeholder handling when archiving build artefacts
|
89
104
|
# - Added proper high-level usage documentation
|
90
|
-
#
|
105
|
+
#
|
91
106
|
# Version 1.0.0 (12 Dec 2017)
|
92
107
|
# - First fully functional release with new config file
|
93
|
-
#
|
108
|
+
#
|
94
109
|
# Version 0.1.4 (12 Dec 2017)
|
95
110
|
# - boo
|
96
111
|
# - hoo
|
97
112
|
# - hoo
|
98
|
-
#
|
113
|
+
#
|
99
114
|
# Version 0.1.3 (12 Dec 2017)
|
100
115
|
# - boo
|
101
|
-
#
|
116
|
+
#
|
102
117
|
# Version 0.1.2 (12 Dec 2017)
|
103
118
|
# - wahoo!
|
104
|
-
#
|
119
|
+
#
|
105
120
|
# Version 0.1.1 (12 Dec 2017)
|
106
121
|
# - Wahey!
|
107
|
-
# <END CHANGELOG>
|
122
|
+
# <END CHANGELOG>
|
data/releasables.yaml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
- :id: revision
|
3
3
|
:revision:
|
4
4
|
:src: lib/revision/version.rb
|
5
|
-
:regex: (?<prefix>VERSION = ")(?<major>\d+)(?<sep1>\.)(?<minor>\d+)(?<sep2>\.)(?<patch>\d+)(?<postfix>")
|
5
|
+
:regex: (?<prefix>VERSION = ")(?<major>\d+)(?<sep1>\.)(?<minor>\d+)(?<sep2>\.)(?<patch>\d+)(?<postfix>".freeze)
|
6
6
|
:comment_prefix: "#"
|
7
7
|
:build_steps:
|
8
8
|
- bundle exec rake install
|
data/revision.gemspec
CHANGED
@@ -6,20 +6,12 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "revision"
|
7
7
|
spec.version = Revision::VERSION
|
8
8
|
spec.authors = ["Cormac Cannon"]
|
9
|
-
spec.
|
9
|
+
spec.licenses = ['MIT']
|
10
10
|
|
11
11
|
spec.summary = %q{Language-agnostic revision management tool}
|
12
12
|
spec.description = %q{Updates project revision identifiers in software source files and associated change log. Can also build and package project archives as a zip and optionally commit, tag and push to a Git repo.}
|
13
|
-
|
14
|
-
|
15
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
-
# if spec.respond_to?(:metadata)
|
18
|
-
# spec.metadata["allowed_push_host"] = "http://gems.nmd.ie"
|
19
|
-
# else
|
20
|
-
# raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
-
# "public gem pushes."
|
22
|
-
# end
|
13
|
+
spec.homepage = 'https://rubygems.org/gems/revision'
|
14
|
+
spec.metadata = { "source_code_uri" => "https://github.com/cormacc/revision" }
|
23
15
|
|
24
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
17
|
f.match(%r{^(test|spec|features)/})
|
@@ -29,11 +21,22 @@ Gem::Specification.new do |spec|
|
|
29
21
|
|
30
22
|
spec.require_paths = ["lib"]
|
31
23
|
|
32
|
-
spec.add_runtime_dependency 'thor', '~> 0
|
33
|
-
spec.add_runtime_dependency 'rubyzip'
|
24
|
+
spec.add_runtime_dependency 'thor', '~> 1.0'
|
25
|
+
spec.add_runtime_dependency 'rubyzip', '~> 2.0'
|
34
26
|
|
35
27
|
spec.add_development_dependency "bundler", "~> 2.0"
|
36
|
-
spec.add_development_dependency "rake", "~>
|
28
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
37
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
38
30
|
spec.add_development_dependency "pry"
|
31
|
+
#emacs ruby layer deps...
|
32
|
+
#...lsp backend
|
33
|
+
spec.add_development_dependency "steep"
|
34
|
+
spec.add_development_dependency "solargraph"
|
35
|
+
#...robe backend
|
36
|
+
#....watch this space
|
37
|
+
#...generic
|
38
|
+
spec.add_development_dependency "ruby_parser"
|
39
|
+
spec.add_development_dependency "rubocop"
|
40
|
+
spec.add_development_dependency "prettier"
|
41
|
+
spec.add_development_dependency "seeing_is_believing"
|
39
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cormac Cannon
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,11 +94,94 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: steep
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: solargraph
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: ruby_parser
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: prettier
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: seeing_is_believing
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
97
181
|
description: Updates project revision identifiers in software source files and associated
|
98
182
|
change log. Can also build and package project archives as a zip and optionally
|
99
183
|
commit, tag and push to a Git repo.
|
100
184
|
email:
|
101
|
-
- cormac.cannon@neuromoddevices.com
|
102
185
|
executables:
|
103
186
|
- revision
|
104
187
|
extensions: []
|
@@ -123,10 +206,12 @@ files:
|
|
123
206
|
- lib/revision/version.rb
|
124
207
|
- releasables.yaml
|
125
208
|
- revision.gemspec
|
126
|
-
homepage:
|
127
|
-
licenses:
|
128
|
-
|
129
|
-
|
209
|
+
homepage: https://rubygems.org/gems/revision
|
210
|
+
licenses:
|
211
|
+
- MIT
|
212
|
+
metadata:
|
213
|
+
source_code_uri: https://github.com/cormacc/revision
|
214
|
+
post_install_message:
|
130
215
|
rdoc_options: []
|
131
216
|
require_paths:
|
132
217
|
- lib
|
@@ -141,8 +226,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
226
|
- !ruby/object:Gem::Version
|
142
227
|
version: '0'
|
143
228
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
145
|
-
signing_key:
|
229
|
+
rubygems_version: 3.2.13
|
230
|
+
signing_key:
|
146
231
|
specification_version: 4
|
147
232
|
summary: Language-agnostic revision management tool
|
148
233
|
test_files: []
|