git_bumper 0.1.2 → 0.1.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/lib/git_bumper/build_tag.rb +7 -4
- data/lib/git_bumper/cli.rb +3 -2
- data/lib/git_bumper/git.rb +7 -4
- data/lib/git_bumper/tag.rb +7 -3
- data/lib/git_bumper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9682904c029feef4497ed753c1873d937a667c92
|
4
|
+
data.tar.gz: bbe4c5ad8b6188d5e895fc2b336b5247cd5c7596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c107927ae9436ce86902e2cf03618e82e1ee4d223616f082ad3ebe7b6c70ff41cccc95dea33ed449df5b1315b4e1e9c9ea876dcc983173ddeb26a2b949fc801d
|
7
|
+
data.tar.gz: 7198165452a5d9e6df934cf9b97373aa394770cbc536e860e437815683f2eecf6f38e17e3ae0ccfca7a18d60d9cf9aa7b7f3d99fe6abc9da80720550ee1c0160
|
data/lib/git_bumper/build_tag.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module GitBumper
|
2
|
-
# This object represents a
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# It provides some methods to parse and increment build numbers.
|
2
|
+
# This object represents a "build" tag. These tags are expected to have the
|
3
|
+
# format PREFIX.BUILD_NUMBER (e.g. v1, v2, a1, a2).
|
4
|
+
# It provides some methods to parse, increment and compare tags.
|
6
5
|
class BuildTag
|
7
6
|
REGEX = /\A([a-z]+)([0-9]+)\z/i
|
8
7
|
|
@@ -37,5 +36,9 @@ module GitBumper
|
|
37
36
|
def increment(*)
|
38
37
|
@build += 1
|
39
38
|
end
|
39
|
+
|
40
|
+
def <=>(other)
|
41
|
+
build <=> other.build
|
42
|
+
end
|
40
43
|
end
|
41
44
|
end
|
data/lib/git_bumper/cli.rb
CHANGED
@@ -22,7 +22,7 @@ module GitBumper
|
|
22
22
|
|
23
23
|
puts "The old tag is #{old_tag}"
|
24
24
|
puts "The new tag will be #{new_tag}"
|
25
|
-
puts 'Push to origin? (
|
25
|
+
puts 'Push to origin? (Y/n)'
|
26
26
|
|
27
27
|
return error('Aborted.') unless prompt_yes
|
28
28
|
|
@@ -42,7 +42,8 @@ module GitBumper
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def prompt_yes
|
45
|
-
STDIN.gets.chomp.to_s
|
45
|
+
input = STDIN.gets.chomp.to_s
|
46
|
+
input.empty? || input =~ /\Ay(es)?\z/i
|
46
47
|
end
|
47
48
|
|
48
49
|
def greatest_tag
|
data/lib/git_bumper/git.rb
CHANGED
@@ -17,11 +17,14 @@ module GitBumper
|
|
17
17
|
|
18
18
|
# Returns the greatest tag.
|
19
19
|
def greatest_tag(prefix: 'v', klass: Tag)
|
20
|
-
output = `git tag --list
|
20
|
+
output = `git tag --list 2> /dev/null`
|
21
21
|
|
22
|
-
tags = output
|
23
|
-
|
24
|
-
|
22
|
+
tags = output
|
23
|
+
.split
|
24
|
+
.map { |t| klass.parse(t) }
|
25
|
+
.select { |t| t && t.prefix == prefix }
|
26
|
+
.sort
|
27
|
+
.reverse
|
25
28
|
|
26
29
|
tags.find do |tag|
|
27
30
|
tag
|
data/lib/git_bumper/tag.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module GitBumper
|
2
|
-
# This object represents a
|
3
|
-
#
|
4
|
-
# It provides some methods to parse and
|
2
|
+
# This object represents a common tag in the format
|
3
|
+
# PREFIX.MAJOR.MINOR.PATCH (e.g. v1.0.0, v2.1.3, v0.1.0).
|
4
|
+
# It provides some methods to parse, increment and compare tags.
|
5
5
|
class Tag
|
6
6
|
REGEX = /\A([a-z]+)([0-9]+)\.([0-9]+)\.([0-9]+)\z/i
|
7
7
|
|
@@ -50,5 +50,9 @@ module GitBumper
|
|
50
50
|
@patch += 1
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
54
|
+
def <=>(other)
|
55
|
+
[major, minor, patch] <=> [other.major, other.minor, other.patch]
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
data/lib/git_bumper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_bumper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lenon Marcel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|