revision 1.2.2 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/revision/cli.rb +5 -1
- data/lib/revision/releasable.rb +33 -19
- data/lib/revision/version.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06454aa0fe518877aa5506845e96d39e0d8e2ce7db5339a9b1ee71364c8b673e
|
4
|
+
data.tar.gz: 9aedcfc26333c5e7e8ab2c5704e9c5f18269b4eacf36dc81fafc5a78ca85f88c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be25f3b19f88933a0cf26c5afc36e8b339715c876b10ce3f3dd9737441660fd02a4791f88c070c2a920f604f5008dcbf501d6f122ee401a08b4a7ecc7e7998b8
|
7
|
+
data.tar.gz: 30ef34a8ea5fac05318ee0a426595425af05d7a68ae647339efe5be2f76954906426cc680f80ae3555c285be9d1f767cb8ad26210f4440a6519e9a0518606c5a
|
data/lib/revision/cli.rb
CHANGED
@@ -97,8 +97,12 @@ module Revision
|
|
97
97
|
|
98
98
|
private
|
99
99
|
|
100
|
+
def id_options
|
101
|
+
@releasables.keys.map { |id| "'-id #{id}'"}.join(', ')
|
102
|
+
end
|
103
|
+
|
100
104
|
def select_one
|
101
|
-
raise "Please specify one of #{
|
105
|
+
raise "Please specify one of #{id_options}" if options[:id].nil? && @releasables.keys.length > 1
|
102
106
|
@releasables[@id]
|
103
107
|
end
|
104
108
|
|
data/lib/revision/releasable.rb
CHANGED
@@ -17,7 +17,7 @@ module Revision
|
|
17
17
|
|
18
18
|
REVISION_PLACEHOLDER = /<REV>|<VER>/
|
19
19
|
|
20
|
-
attr_reader :root, :id, :revision, :build_steps, :artefacts
|
20
|
+
attr_reader :root, :id, :revision, :build_steps, :artefacts, :git_tag_prefix
|
21
21
|
|
22
22
|
# Load a file in yaml format containing one or more releasable definitions
|
23
23
|
# @param root [String] An optional root directory argument
|
@@ -59,10 +59,11 @@ module Revision
|
|
59
59
|
@root = Pathname.new(root).realpath
|
60
60
|
@id = config[:id] || File.basename(@root)
|
61
61
|
@revision = Info.new(File.join(@root,config[:revision][:src]), regex: config[:revision][:regex], comment_prefix: config[:revision][:comment_prefix])
|
62
|
+
@git_tag_prefix = config[:revision][:git_tag_prefix].nil? ? 'v' : "#{config[:revision][:git_tag_prefix]}_v"
|
63
|
+
# Legacy definition syntax compatibility
|
62
64
|
@build_def = config[:build] ? config[:build] : { environment: { variables: {}}, steps: config[:build_steps]}
|
63
|
-
@artefacts = config[:artefacts]
|
64
|
-
|
65
|
-
@artefacts.each { |a| a[:dest] ||= a[:src] } unless @artefacts.empty?
|
65
|
+
@artefacts = config[:artefacts] || []
|
66
|
+
@artefacts.each { |a| a[:dest] ||= a[:src] } unless @artefacts.nil? || @artefacts.empty?
|
66
67
|
end
|
67
68
|
|
68
69
|
def to_s
|
@@ -73,10 +74,15 @@ module Revision
|
|
73
74
|
#{@build_def[:environment]}
|
74
75
|
|
75
76
|
Build pipeline:
|
76
|
-
- #{@build_def[:steps].join("\n - ")}
|
77
|
+
- #{@build_def[:steps].nil? ? 'empty' : @build_def[:steps].join("\n - ")}
|
77
78
|
|
78
79
|
Build artefacts:
|
79
|
-
#{artefacts.map{ |a| "- #{a[:src]}\n => #{a[:dest]}" }.join("\n")}
|
80
|
+
#{@artefacts.empty? ? '- None defined' : @artefacts.map{ |a| "- #{a[:src]}\n => #{a[:dest]}" }.join("\n") }
|
81
|
+
|
82
|
+
Git commit details:
|
83
|
+
- log entry: #{commit_message}
|
84
|
+
Git tag id #{tag_id} / annotation:
|
85
|
+
#{tag_annotation.gsub("\n","\n ")}
|
80
86
|
|
81
87
|
EOT
|
82
88
|
end
|
@@ -89,11 +95,9 @@ module Revision
|
|
89
95
|
value.gsub!(':', ';')
|
90
96
|
value.gsub!('/', '\\')
|
91
97
|
else
|
92
|
-
value.gsub!('
|
98
|
+
value.gsub!(';', ':')
|
93
99
|
value.gsub!('\\', '/')
|
94
100
|
end
|
95
|
-
# value.gsub!('/',Gem.win_platform? ? '\' : '/')
|
96
|
-
# value.gsub!('\',Gem.win_platform? ? '\' : '/')
|
97
101
|
value.gsub!('~', Dir.home)
|
98
102
|
end
|
99
103
|
puts "Setting environment variable '#{key}' to '#{value}'"
|
@@ -112,22 +116,32 @@ module Revision
|
|
112
116
|
end
|
113
117
|
end
|
114
118
|
|
119
|
+
def tag_id
|
120
|
+
"#{@git_tag_prefix}#{revision}"
|
121
|
+
end
|
122
|
+
|
123
|
+
def tag_annotation
|
124
|
+
@revision.last_changelog_entry.join("\n")
|
125
|
+
end
|
126
|
+
|
127
|
+
def commit_message
|
128
|
+
changelog_entry = @revision.last_changelog_entry
|
129
|
+
#Insert a blank line between the revision header and release notes, as per git commit best practice
|
130
|
+
commit_lines = ["#{tag_id} #{changelog_entry[1]}", '']
|
131
|
+
if changelog_entry.length > 2
|
132
|
+
commit_lines << "Also..."
|
133
|
+
commit_lines += changelog_entry[2..-1]
|
134
|
+
end
|
135
|
+
commit_lines.join("\n")
|
136
|
+
end
|
137
|
+
|
115
138
|
def tag
|
116
139
|
Dir.chdir(@root) do
|
117
|
-
tag_id = "v#{revision}"
|
118
|
-
changelog_entry = @revision.last_changelog_entry
|
119
|
-
#Insert a blank line between the revision header and release notes, as per git commit best practice
|
120
|
-
commit_lines = ["#{tag_id} #{changelog_entry[1]}", '']
|
121
|
-
if changelog_entry.length > 2
|
122
|
-
commit_lines << "Also..."
|
123
|
-
commit_lines += changelog_entry[2..-1]
|
124
|
-
end
|
125
|
-
commit_message = commit_lines.join("\n")
|
126
140
|
puts "Committing..."
|
127
141
|
puts commit_message
|
128
142
|
system("git commit -a -m \"#{commit_message}\"")
|
129
143
|
puts "Tagging as #{tag_id}"
|
130
|
-
system("git tag -a #{tag_id} -m \"#{
|
144
|
+
system("git tag -a #{tag_id} -m \"#{tag_annotation}\"")
|
131
145
|
end
|
132
146
|
end
|
133
147
|
|
data/lib/revision/version.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
# Defines the revision ID for the revision gem
|
2
2
|
module Revision
|
3
|
-
VERSION = "1.2.
|
3
|
+
VERSION = "1.2.4"
|
4
4
|
end
|
5
5
|
|
6
6
|
# <BEGIN CHANGELOG>
|
7
7
|
#
|
8
|
+
# Version 1.2.4 (05 Sep 2018)
|
9
|
+
# - Added commit message and tag details to `revision info`
|
10
|
+
# - Minor refactoring
|
11
|
+
#
|
12
|
+
# Version 1.2.3 (03 Sep 2018)
|
13
|
+
# - Tidied up `revision info` output formatting
|
14
|
+
#
|
8
15
|
# Version 1.2.2 (03 Sep 2018)
|
9
16
|
# - Updated CLI to provide version info
|
10
17
|
#
|
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.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cormac Cannon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|