project_releaser 0.0.3 → 0.0.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e42b85241d5de5de7ceb62b2dfcba7f47c5734c6
|
4
|
+
data.tar.gz: 621ccb9a1cda741091c825cb8ab17cb2f436384b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea7db764109f0ee52c8a228e7e34d3b5ba3d167b36a8aa214cd98a4c5f8e2fd533d0d759a950fdea09b0d1514d25107605d7d267d240c37f50e32a248fbbfda0
|
7
|
+
data.tar.gz: f4515caf266dc56251ae036fe798c4efd72497e0b86ce02e57a82915f4f6a6b3d46d21c9c6d652688c07f8edf09036b62d0307e0eb8c82540a4c5ce8a077f5d4
|
data/Gemfile.lock
CHANGED
@@ -6,7 +6,7 @@ module ProjectReleaser
|
|
6
6
|
class MissingBranch < RuntimeError; end;
|
7
7
|
|
8
8
|
VERSION_PARTS = %I(major minor patch)
|
9
|
-
DEFAULT_VERSION = [
|
9
|
+
DEFAULT_VERSION = [1, 0, 0]
|
10
10
|
|
11
11
|
def initialize(repo_path)
|
12
12
|
@git = open_repository(repo_path)
|
@@ -80,10 +80,12 @@ module ProjectReleaser
|
|
80
80
|
def versions
|
81
81
|
tags = @git.tags
|
82
82
|
return [DEFAULT_VERSION] if tags.empty?
|
83
|
+
valid_tags = tags
|
84
|
+
.map(&:name)
|
85
|
+
.select{ |n| n =~ /\Av?\d+(\.\d+){1,2}\z/ }
|
83
86
|
|
84
|
-
|
85
|
-
|
86
|
-
.select{ |n| n.start_with? 'v' }
|
87
|
+
return [DEFAULT_VERSION] if valid_tags.empty?
|
88
|
+
valid_tags
|
87
89
|
.map{ |n| n.sub('v', '').split('.').map(&:to_i) }
|
88
90
|
.map{ |a| a.fill(0, a.size..2) }
|
89
91
|
.sort
|
@@ -24,11 +24,10 @@ describe ProjectReleaser::Project::Repository do
|
|
24
24
|
expect(subject.current_version).to eq :major => 1, :minor => 2, :patch => 4
|
25
25
|
end
|
26
26
|
|
27
|
-
it '
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
expect(subject.current_version).to eq :major => 1, :minor => 2, :patch => 3
|
27
|
+
it 'supports version without v prefix' do
|
28
|
+
tag = double 'tag', :name => '1.2.8'
|
29
|
+
allow(git).to receive(:tags).and_return([tag])
|
30
|
+
expect(subject.current_version).to eq :major => 1, :minor => 2, :patch => 8
|
32
31
|
end
|
33
32
|
|
34
33
|
it 'recognizes partial versions' do
|
@@ -60,7 +59,20 @@ describe ProjectReleaser::Project::Repository do
|
|
60
59
|
|
61
60
|
it 'returns default version when there are none' do
|
62
61
|
allow(git).to receive(:tags).and_return([])
|
63
|
-
expect(subject.current_version).to eq :major =>
|
62
|
+
expect(subject.current_version).to eq :major => 1, :minor => 0, :patch => 0
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'returns default version when there are no valid tags' do
|
66
|
+
tag = double 'tag', :name => 'random tag'
|
67
|
+
allow(git).to receive(:tags).and_return([tag])
|
68
|
+
expect(subject.current_version).to eq :major => 1, :minor => 0, :patch => 0
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'ignores tags that do not match semantic versioning and returns default one' do
|
72
|
+
tag_1 = double 'tag', :name => 'g1.2.3'
|
73
|
+
tag_2 = double 'tag', :name => 'random string'
|
74
|
+
allow(git).to receive(:tags).and_return([tag_1, tag_2])
|
75
|
+
expect(subject.current_version).to eq :major => 1, :minor => 0, :patch => 0
|
64
76
|
end
|
65
77
|
end
|
66
78
|
|