revision 1.2.7 → 1.3.1

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
  SHA256:
3
- metadata.gz: 682306be7408f18b9346de0b36dc9b98b1fc104209191bbb6cba601b9cba0509
4
- data.tar.gz: 0c48f5c2952dc1a2abe7c68010d708b48a93ad3da4fc63d9d031f05846f610d0
3
+ metadata.gz: d52b5583cb4ae656d41eb5389156de53000fedd75980cda75e21b97ff9a81a4f
4
+ data.tar.gz: f2c5381a07f171f9d5bb45f09edf6465bc1a8666adaf293db0820a58282c2a49
5
5
  SHA512:
6
- metadata.gz: 55a4cefdae2b4014f90fad6c36865ad69745baa6e0b2944a41f37fc68632dc38d1487dd420210425cab22e555f01d1352d92db491dbc441206e3d2d06c4a8a8b
7
- data.tar.gz: '0369665bfdd54f97bdb1f7cf92c5f530199cd5beb80fb0b1cd7440060767786014285549f9a6bc7207ecee17ab8bdd848a11dd83fa38f1885aa88c42710189f1'
6
+ metadata.gz: 341c226a4413b6e43b49ecd073ee87431c989d209f27f3bbf5d2c0e871d9998c2fbb8f67d7cb2161260d379e74695694be0a055b9f23b8975f0d172da952ef44
7
+ data.tar.gz: f0aa801651600773e6764a51c88316920276d6ee9bf38d03351fcc534835a7d0bc167e97dcf5b8ac4c78b58234d04072f3dfe968007f8cef08693e501c42c69b
data/README.org CHANGED
@@ -49,6 +49,11 @@
49
49
 
50
50
  ** From source
51
51
 
52
+ #+BEGIN_SRC sh
53
+ git clone git@git.nmd.ie/lib/
54
+ #+END_SRC
55
+
56
+
52
57
  *** Checkout
53
58
 
54
59
  #+BEGIN_SRC sh
data/lib/revision/cli.rb CHANGED
@@ -128,7 +128,7 @@ module Revision
128
128
  if ask("Rebuild and archive any releasables (Y/n)?").upcase!='N'
129
129
  r.package
130
130
  end
131
- if ask("Commit changes to existing files and add a Git tag (y/N)?").upcase=='Y'
131
+ if ask("Commit changes to existing files and add a Git tag (Y/n)?").upcase!='N'
132
132
  r.tag
133
133
  if ask("Push changes/tag to origin (Y/n)?").upcase=='N' || !r.push
134
134
  say "To push from the command line, type 'git push --tags' at a shell prompt"
@@ -88,6 +88,20 @@ module Revision
88
88
  EOT
89
89
  end
90
90
 
91
+ def exec_pipeline(type, steps, skip_steps=0)
92
+ exec_steps = steps[skip_steps..-1]
93
+ puts "{type} :: Executing steps #{skip_steps+1} to #{steps.length}..."
94
+ Dir.chdir(@root) do
95
+ exec_steps.each_with_index do |step, index|
96
+ step_index = index+1+skip_steps
97
+ puts "... (#{step_index}/#{steps.length}) #{step}"
98
+ system(step)
99
+ puts "{type} :: WARNING: step #{step_index}: #{step} exit status #{$?.exitstatus}" unless $?.exitstatus.zero?
100
+ end
101
+ end
102
+
103
+ end
104
+
91
105
  def build(skip_steps = 0)
92
106
  if @build_def.dig(:environment, :variables)
93
107
  @build_def[:environment][:variables].each do |key, value|
@@ -105,16 +119,17 @@ module Revision
105
119
  ENV[key] = value
106
120
  end
107
121
  end
108
- steps = @build_def[:steps][skip_steps..-1]
109
- puts "Executing #{steps.length} of #{@build_def[:steps].length} build steps..."
110
- Dir.chdir(@root) do
111
- steps.each_with_index do |step, index|
112
- step_index = index+1+skip_steps
113
- puts "... (#{step_index}/#{@build_def[:steps].length}) #{step}"
114
- system(step)
115
- puts "WARNING: build step #{step_index}: #{step} exit status #{$?.exitstatus}" unless $?.exitstatus.zero?
116
- end
117
- end
122
+ exec_pipeline('build', @build_def[:steps], skip_steps)
123
+ # steps = @build_def[:steps][skip_steps..-1]
124
+ # puts "Executing #{steps.length} of #{@build_def[:steps].length} build steps..."
125
+ # Dir.chdir(@root) do
126
+ # steps.each_with_index do |step, index|
127
+ # step_index = index+1+skip_steps
128
+ # puts "... (#{step_index}/#{@build_def[:steps].length}) #{step}"
129
+ # system(step)
130
+ # puts "WARNING: build step #{step_index}: #{step} exit status #{$?.exitstatus}" unless $?.exitstatus.zero?
131
+ # end
132
+ # end
118
133
  end
119
134
 
120
135
  def tag_id
@@ -189,13 +204,22 @@ module Revision
189
204
  File.delete(archive_name)
190
205
  end
191
206
  Zip::File.open(archive_name, Zip::File::CREATE) do |zipfile|
192
- artefact_map.each { |src, dest| zipfile.add(dest,src) }
207
+ artefact_map.each do |src, dest|
208
+ #TODO: Add directory processing....
209
+ zipfile.add(dest,src)
210
+ end
193
211
  puts "... embedding revision history as #{changelog_name} "
194
212
  zipfile.get_output_stream(changelog_name) { |os| output_changelog(os)}
195
213
  end
214
+
215
+ if @config.dig(:archive)
216
+ archive_root = File.expand_path(@config[:archive])
217
+ puts "... moving #{archive_name} to #{archive_root}"
218
+ FileUtils.mkdir_p(archive_root)
219
+ FileUtils.mv(archive_name, archive_root)
220
+ end
196
221
  end
197
222
 
198
- # def deploy(destination)
199
223
  def deploy(destination='')
200
224
  if destination=='' and @config.dig(:deploy, :dest)
201
225
  destination = @config[:deploy][:dest]
@@ -204,9 +228,22 @@ module Revision
204
228
  raise Errors::NotSpecified.new(':deploy/:dest') if destination==''
205
229
  destination = File.expand_path(destination)
206
230
 
231
+ if @config.dig(:deploy, :pre)
232
+ exec_pipeline('deploy (pre)', @config[:deploy][:pre])
233
+ end
234
+
207
235
  puts "Deploying #{@artefacts.length} build artefacts to #{destination}..."
208
- artefact_map(destination).each { |src, dest| FileUtils.cp(src,dest) }
209
- #TODO Add changelog
236
+ artefact_map(destination).each do |src, dest|
237
+ if File.exist?(dest)
238
+ puts "... deleting existing '#{dest}'"
239
+ FileUtils.rm_rf(dest)
240
+ end
241
+ FileUtils.cp_r(src,dest)
242
+ end
243
+ File.open(File.join(destination,changelog_name),'w') { |f| output_changelog(f)}
244
+ if @config.dig(:deploy, :post)
245
+ exec_pipeline('deploy (post)', @config[:deploy][:post])
246
+ end
210
247
  end
211
248
 
212
249
  def package
@@ -1,10 +1,21 @@
1
1
  # Defines the revision ID for the revision gem
2
2
  module Revision
3
- VERSION = "1.2.7"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
 
6
6
  # <BEGIN CHANGELOG>
7
7
  #
8
+ # Version 1.3.1 (20 May 2019)
9
+ # - Corrected bug when deploying changelog:w
10
+ #
11
+ # Version 1.3.0 (20 May 2019)
12
+ # - Added :archive: (archive root definition)
13
+ # - Added optional :pre: and :post: steps to :deploy: definition
14
+ #
15
+ # Version 1.2.8 (20 May 2019)
16
+ # - Updated Git tag/commit behaviour -- now commit/tag/push by default
17
+ # - Updated deploy to remove existing targets and copy entire directory trees
18
+ #
8
19
  # Version 1.2.7 (17 May 2019)
9
20
  # - 'deploy' now expands '~' in paths
10
21
  #
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.2.7
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cormac Cannon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-17 00:00:00.000000000 Z
11
+ date: 2019-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor