git-bump 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/git_bump.rb +28 -5
  3. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5a25a12af0749f43938f0f73f72058606826ccb
4
- data.tar.gz: 3e33b5cc7c489af869f1f9948658fd8678252cc3
3
+ metadata.gz: ce5e88c9cc833c7b655ee2e4d58c5e22f6b325e0
4
+ data.tar.gz: 19c2063ab2836d98a9c74b15c9560c590fd3e944
5
5
  SHA512:
6
- metadata.gz: 5d6c775156eb71ab824bd7a2185359cfaf4d84555a921fa7d1e21b1182b5a281bea751e465925d3690573a854bf45222de30ca6f22db1e7018cdeb5d9343e906
7
- data.tar.gz: 0e1968dd66dfab8357336e102977e3d3f697d4915f3bb38d207098b0c684e9135d254ad6054cbd42b1d6156540c2b648c599ba53f1c6c0a44b07d293c8868b47
6
+ metadata.gz: c81a9bec98422b00d4a9910858e6855ceabf80d8bd1547f306f3ae944e2c816f4d13b6389281fd44aca5e57c7fc780783c65b1217c9862f7b62fa47574d5c9cf
7
+ data.tar.gz: 91d194b0d78809e025febcd4d25253f93826bb87ed4c141bc043a34f8c67536312a737a657122d459a4cf39fdad4725b9b9b90b9424a12546fc916d8a2821039
@@ -26,6 +26,24 @@ git bump can find it:
26
26
  @tag, @sha1, @name, @version = tag, sha1, name, Version.new(version)
27
27
  end
28
28
 
29
+ def tag_type
30
+ @tag_type ||= %x{git cat-file -t #{tag}}.chomp
31
+ end
32
+
33
+ def tag_message
34
+ if tag_type == 'tag'
35
+ @tag_message ||= %x{git cat-file tag #{tag}}.split("\n\n", 2).last
36
+ end
37
+ end
38
+
39
+ def tag_signed?
40
+ tag_message.to_s.include?("\n-----BEGIN PGP")
41
+ end
42
+
43
+ def tag_body?
44
+ tag_message.to_s.sub(/\n-----BEGIN PGP.*/m, '').include?("\n\n")
45
+ end
46
+
29
47
  def body
30
48
  @body ||= %x{git log -1 --pretty=format:%b #{sha1}}
31
49
  end
@@ -140,14 +158,19 @@ git bump can find it:
140
158
  end
141
159
 
142
160
  def tag!(name)
143
- subject = %x{git log -1 --pretty=format:%s}.chomp
144
- system!('git', 'tag', '-f', '-s', name, '-m', subject)
145
- puts <<-EOS
161
+ annote = if latest && !latest.tag_signed? then '-a' else '-s' end
162
+ format = if releases.size < 2 || latest.tag_body? then '%B' else '%s' end
163
+ body = %x{git log -1 --pretty=format:#{format}}
164
+ if system('git', 'tag', '-f', annote, name, '-m', body)
165
+ puts <<-EOS
146
166
  Successfully created #{name}. If you made a mistake, use `git bump redo` to
147
167
  try again. Once you are satisfied with the result, run
148
168
 
149
169
  git push origin master #{name}
150
- EOS
170
+ EOS
171
+ else
172
+ abort "Tag failed. Create it by hand or use git reset --soft HEAD^ to try again."
173
+ end
151
174
  end
152
175
 
153
176
  def system!(*args)
@@ -203,7 +226,7 @@ try again. Once you are satisfied with the result, run
203
226
  unless %x{git diff}.empty?
204
227
  abort "Discard or stage your changes."
205
228
  end
206
- unless latest.sha1 == %x{git rev-parse HEAD}.chomp
229
+ unless latest && latest.sha1 == %x{git rev-parse HEAD}.chomp
207
230
  abort "Can only amend the top-most commit."
208
231
  end
209
232
  system!('git', 'commit', '--amend', '--verbose', '--reset-author')
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-bump
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2015-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Git based release management
@@ -72,17 +72,17 @@ require_paths:
72
72
  - lib
73
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.0.3
85
+ rubygems_version: 2.4.5
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Create Git release commits and tags with changelogs