dpl-releases 1.9.6.travis.2794.5 → 1.9.6.travis.2795.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dpl/provider/releases.rb +17 -22
- data/spec/provider/releases_spec.rb +33 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89bd61739a7753307c00fd90a6c74d1b226f5d0796c7fa8615afa23199f30be8
|
4
|
+
data.tar.gz: 367b48bcb38ce8508a354e992a6a54820fcdb0c909b3059ba1943594110edb2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e8ee700ea94d22eb6d00a199d54ca996fe5637751339aa4053516954ad1e00a18be8139e7e965c8cabf7e1a8285fa2f9504cde6b5a03deb5ff4cde45b12181
|
7
|
+
data.tar.gz: b571da2d64187984104adeecf785c1bb4fb4c16559459953c5c7ccd985320f5667c8489856fd006200902bfc382da6dcc30809a1d5eb0c1826a0b19c7e3cbe01
|
@@ -11,27 +11,21 @@ module DPL
|
|
11
11
|
prerelease
|
12
12
|
)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
tag = options[:tag_name].tap { |tag| log green("Tag #{tag} set in .travis.yml") } || # first choice
|
22
|
-
if !context.env['TRAVIS_TAG'].to_s.empty?
|
23
|
-
context.env['TRAVIS_TAG'].to_s.tap { |tag| log green("Tag #{tag} set by TRAVIS_TAG (via this commit's tag)")}
|
24
|
-
else
|
25
|
-
log yellow("This commit is not tagged. Fetching tags")
|
26
|
-
context.shell "git fetch --tags"
|
27
|
-
`git describe --tags --exact-match 2>/dev/null`.chomp.tap { |tag| log green("Tag #{tag} fetched") }
|
28
|
-
end
|
29
|
-
|
30
|
-
if tag.empty?
|
31
|
-
log yellow("Unable to compute tag name. GitHub may assign a tag of the form 'untagged-*'.")
|
14
|
+
def travis_tag
|
15
|
+
# Check if $TRAVIS_TAG is unset or set but empty
|
16
|
+
if context.env.fetch('TRAVIS_TAG','') == ''
|
17
|
+
nil
|
18
|
+
else
|
19
|
+
context.env['TRAVIS_TAG']
|
32
20
|
end
|
21
|
+
end
|
33
22
|
|
34
|
-
|
23
|
+
def get_tag
|
24
|
+
if travis_tag.nil?
|
25
|
+
@tag ||= `git describe --tags --exact-match 2>/dev/null`.chomp
|
26
|
+
else
|
27
|
+
@tag ||= travis_tag
|
28
|
+
end
|
35
29
|
end
|
36
30
|
|
37
31
|
def api
|
@@ -71,7 +65,8 @@ module DPL
|
|
71
65
|
def check_app
|
72
66
|
log "Deploying to repo: #{slug}"
|
73
67
|
|
74
|
-
|
68
|
+
context.shell 'git fetch --tags' if travis_tag.nil?
|
69
|
+
log "Current tag is: #{get_tag}"
|
75
70
|
end
|
76
71
|
|
77
72
|
def setup_auth
|
@@ -99,7 +94,7 @@ module DPL
|
|
99
94
|
release_url = "https://api.github.com/repos/" + slug + "/releases/" + options[:release_number]
|
100
95
|
else
|
101
96
|
releases.each do |release|
|
102
|
-
if release.tag_name ==
|
97
|
+
if release.tag_name == get_tag
|
103
98
|
release_url = release.rels[:self].href
|
104
99
|
tag_matched = true
|
105
100
|
end
|
@@ -108,7 +103,7 @@ module DPL
|
|
108
103
|
|
109
104
|
#If for some reason GitHub hasn't already created a release for the tag, create one
|
110
105
|
if tag_matched == false
|
111
|
-
release_url = api.create_release(slug,
|
106
|
+
release_url = api.create_release(slug, get_tag, options.merge({:draft => true})).rels[:self].href
|
112
107
|
end
|
113
108
|
|
114
109
|
files.each do |file|
|
@@ -7,21 +7,23 @@ describe DPL::Provider::Releases do
|
|
7
7
|
described_class.new(DummyContext.new, :api_key => '0123445789qwertyuiop0123445789qwertyuiop', :file => 'blah.txt')
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
describe "#travis_tag" do
|
11
|
+
example "When $TRAVIS_TAG is nil" do
|
12
|
+
provider.context.env['TRAVIS_TAG'] = nil
|
11
13
|
|
12
|
-
|
14
|
+
expect(provider.travis_tag).to eq(nil)
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
provider.context.env['TRAVIS_TAG'] = ''
|
17
|
+
example "When $TRAVIS_TAG if set but empty" do
|
18
|
+
provider.context.env['TRAVIS_TAG'] = nil
|
17
19
|
|
18
|
-
expect(provider.
|
20
|
+
expect(provider.travis_tag).to eq(nil)
|
19
21
|
end
|
20
22
|
|
21
23
|
example "When $TRAVIS_TAG if set" do
|
22
24
|
provider.context.env['TRAVIS_TAG'] = "foo"
|
23
25
|
|
24
|
-
expect(provider.
|
26
|
+
expect(provider.travis_tag).to eq("foo")
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -92,9 +94,11 @@ describe DPL::Provider::Releases do
|
|
92
94
|
|
93
95
|
describe "#check_app" do
|
94
96
|
example "Without $TRAVIS_TAG" do
|
97
|
+
allow(provider).to receive(:travis_tag).and_return(nil)
|
95
98
|
allow(provider).to receive(:slug).and_return("foo/bar")
|
96
|
-
allow(provider).to receive(:
|
99
|
+
allow(provider).to receive(:get_tag).and_return("foo")
|
97
100
|
|
101
|
+
expect(provider.context).to receive(:shell).with("git fetch --tags")
|
98
102
|
expect(provider).to receive(:log).with("Deploying to repo: foo/bar")
|
99
103
|
expect(provider).to receive(:log).with("Current tag is: foo")
|
100
104
|
|
@@ -102,7 +106,7 @@ describe DPL::Provider::Releases do
|
|
102
106
|
end
|
103
107
|
|
104
108
|
example "With $TRAVIS_TAG" do
|
105
|
-
allow(provider).to receive(:
|
109
|
+
allow(provider).to receive(:travis_tag).and_return("bar")
|
106
110
|
allow(provider).to receive(:slug).and_return("foo/bar")
|
107
111
|
|
108
112
|
expect(provider.context).not_to receive(:shell).with("git fetch --tags")
|
@@ -113,6 +117,21 @@ describe DPL::Provider::Releases do
|
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
120
|
+
describe "#get_tag" do
|
121
|
+
example "Without $TRAVIS_TAG" do
|
122
|
+
allow(provider).to receive(:travis_tag).and_return(nil)
|
123
|
+
allow(provider).to receive(:`).and_return("bar")
|
124
|
+
|
125
|
+
expect(provider.get_tag).to eq("bar")
|
126
|
+
end
|
127
|
+
|
128
|
+
example "With $TRAVIS_TAG" do
|
129
|
+
allow(provider).to receive(:travis_tag).and_return("foo")
|
130
|
+
|
131
|
+
expect(provider.get_tag).to eq("foo")
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
116
135
|
describe "#check_auth" do
|
117
136
|
example "With proper permissions" do
|
118
137
|
allow_message_expectations_on_nil
|
@@ -140,7 +159,7 @@ describe DPL::Provider::Releases do
|
|
140
159
|
provider.options.update(:file => ["test/foo.bar", "bar.txt"])
|
141
160
|
|
142
161
|
allow(provider).to receive(:releases).and_return([""])
|
143
|
-
allow(provider).to receive(:
|
162
|
+
allow(provider).to receive(:get_tag).and_return("v0.0.0")
|
144
163
|
expect(File).to receive(:file?).with("test/foo.bar").and_return(true)
|
145
164
|
expect(File).to receive(:file?).with("bar.txt").and_return(true)
|
146
165
|
|
@@ -168,7 +187,7 @@ describe DPL::Provider::Releases do
|
|
168
187
|
provider.options.update(:file => ["test/foo.bar", "bar.txt"])
|
169
188
|
|
170
189
|
allow(provider).to receive(:releases).and_return([""])
|
171
|
-
allow(provider).to receive(:
|
190
|
+
allow(provider).to receive(:get_tag).and_return("v0.0.0")
|
172
191
|
expect(File).to receive(:file?).with("test/foo.bar").and_return(true)
|
173
192
|
expect(File).to receive(:file?).with("bar.txt").and_return(true)
|
174
193
|
|
@@ -197,7 +216,7 @@ describe DPL::Provider::Releases do
|
|
197
216
|
provider.options.update(:overwrite => true)
|
198
217
|
|
199
218
|
allow(provider).to receive(:releases).and_return([""])
|
200
|
-
allow(provider).to receive(:
|
219
|
+
allow(provider).to receive(:get_tag).and_return("v0.0.0")
|
201
220
|
expect(File).to receive(:file?).with("exists.txt").and_return(true)
|
202
221
|
|
203
222
|
provider.releases.map do |release|
|
@@ -223,12 +242,12 @@ describe DPL::Provider::Releases do
|
|
223
242
|
|
224
243
|
provider.options.update(:file => ["test/foo.bar", "bar.txt"])
|
225
244
|
|
226
|
-
allow(provider).to receive(:releases).and_return([
|
245
|
+
allow(provider).to receive(:releases).and_return([""])
|
227
246
|
expect(File).to receive(:file?).with("test/foo.bar").and_return(true)
|
228
247
|
expect(File).to receive(:file?).with("bar.txt").and_return(true)
|
229
248
|
|
230
249
|
provider.releases.map do |release|
|
231
|
-
allow(release).to receive(:
|
250
|
+
allow(release).to receive(:tag_name).and_return("foo")
|
232
251
|
allow(release).to receive(:rels).and_return({:self => nil})
|
233
252
|
allow(release.rels[:self]).to receive(:href)
|
234
253
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl-releases
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.6.travis.
|
4
|
+
version: 1.9.6.travis.2795.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.9.6.travis.
|
19
|
+
version: 1.9.6.travis.2795.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.9.6.travis.
|
26
|
+
version: 1.9.6.travis.2795.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: octokit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|