dpl 1.6.6.travis.521.1 → 1.6.6.travis.524.1
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 +8 -8
- data/lib/dpl/provider/releases.rb +16 -1
- data/spec/provider/releases_spec.rb +60 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGUxZjAyYWQwNTkxNGY4M2M0YjI3ZGIzZGI3ZjRmY2Y4OTY2NTU0ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGUwNmFlYzc4OTMwNzM5MmUxNWRkODYzYjQzOTYzNDZlZWMxMWM0MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDZiNWYxNjBiZGJjYzFmMmNiYzNiODNkOGMyZDc3YWU0Y2RiZWEwODVkZTY5
|
10
|
+
MDBlYmFjZjVkODA5NGI1OTFiZWVjZWM3MDIyNWYxNDEzZWNiZTNkY2ZmNmQ5
|
11
|
+
YzE4OGY0NDM2MjM2OThmMGY2MzNhNDllYjc2ZTk2MjQzMmQxY2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTc1N2M0OGYxMDJkNzJlODk1N2E1M2JlYzlhODRkMWY0ZjhkNzcyNjdiMjU5
|
14
|
+
YTFmOWQ4NmIzMWQ1MTAzMGM4YjBmZGNkMDc5ZmQ5MGRjNDVhYmM3NmZkYmFi
|
15
|
+
OTBmMjdlNTYxNjlkYzQzNjlkZTE3NWVjODY5OGE0ZmQ5ZTI4OTk=
|
@@ -6,8 +6,21 @@ module DPL
|
|
6
6
|
requires 'octokit'
|
7
7
|
requires 'mime-types'
|
8
8
|
|
9
|
+
def travis_tag
|
10
|
+
# Check if $TRAVIS_TAG is unset or set but empty
|
11
|
+
if ENV.fetch('TRAVIS_TAG','') == ''
|
12
|
+
nil
|
13
|
+
else
|
14
|
+
ENV['TRAVIS_TAG']
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
9
18
|
def get_tag
|
10
|
-
|
19
|
+
if travis_tag.nil?
|
20
|
+
@tag ||= `git describe --tags --exact-match 2>/dev/null`.chomp
|
21
|
+
else
|
22
|
+
@tag ||= travis_tag
|
23
|
+
end
|
11
24
|
end
|
12
25
|
|
13
26
|
def api
|
@@ -36,6 +49,8 @@ module DPL
|
|
36
49
|
|
37
50
|
def check_app
|
38
51
|
log "Deploying to repo: #{slug}"
|
52
|
+
|
53
|
+
context.shell 'git fetch --tags' if travis_tag.nil?
|
39
54
|
log "Current tag is: #{get_tag}"
|
40
55
|
end
|
41
56
|
|
@@ -7,6 +7,26 @@ describe DPL::Provider::Releases do
|
|
7
7
|
described_class.new(DummyContext.new, :api_key => '0123445789qwertyuiop0123445789qwertyuiop', :file => 'blah.txt')
|
8
8
|
end
|
9
9
|
|
10
|
+
describe "#travis_tag" do
|
11
|
+
example "When $TRAVIS_TAG is nil" do
|
12
|
+
ENV['TRAVIS_TAG'] = nil
|
13
|
+
|
14
|
+
expect(provider.travis_tag).to eq(nil)
|
15
|
+
end
|
16
|
+
|
17
|
+
example "When $TRAVIS_TAG if set but empty" do
|
18
|
+
ENV['TRAVIS_TAG'] = nil
|
19
|
+
|
20
|
+
expect(provider.travis_tag).to eq(nil)
|
21
|
+
end
|
22
|
+
|
23
|
+
example "When $TRAVIS_TAG if set" do
|
24
|
+
ENV['TRAVIS_TAG'] = "foo"
|
25
|
+
|
26
|
+
expect(provider.travis_tag).to eq("foo")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
10
30
|
describe "#api" do
|
11
31
|
example "With API key" do
|
12
32
|
api = double(:api)
|
@@ -46,6 +66,46 @@ describe DPL::Provider::Releases do
|
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
69
|
+
describe "#check_app" do
|
70
|
+
example "Without $TRAVIS_TAG" do
|
71
|
+
allow(provider).to receive(:travis_tag).and_return(nil)
|
72
|
+
allow(provider).to receive(:slug).and_return("foo/bar")
|
73
|
+
allow(provider).to receive(:get_tag).and_return("foo")
|
74
|
+
|
75
|
+
expect(provider.context).to receive(:shell).with("git fetch --tags")
|
76
|
+
expect(provider).to receive(:log).with("Deploying to repo: foo/bar")
|
77
|
+
expect(provider).to receive(:log).with("Current tag is: foo")
|
78
|
+
|
79
|
+
provider.check_app
|
80
|
+
end
|
81
|
+
|
82
|
+
example "With $TRAVIS_TAG" do
|
83
|
+
allow(provider).to receive(:travis_tag).and_return("bar")
|
84
|
+
allow(provider).to receive(:slug).and_return("foo/bar")
|
85
|
+
|
86
|
+
expect(provider.context).not_to receive(:shell).with("git fetch --tags")
|
87
|
+
expect(provider).to receive(:log).with("Deploying to repo: foo/bar")
|
88
|
+
expect(provider).to receive(:log).with("Current tag is: bar")
|
89
|
+
|
90
|
+
provider.check_app
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "#get_tag" do
|
95
|
+
example "Without $TRAVIS_TAG" do
|
96
|
+
allow(provider).to receive(:travis_tag).and_return(nil)
|
97
|
+
allow(provider).to receive(:`).and_return("bar")
|
98
|
+
|
99
|
+
expect(provider.get_tag).to eq("bar")
|
100
|
+
end
|
101
|
+
|
102
|
+
example "With $TRAVIS_TAG" do
|
103
|
+
allow(provider).to receive(:travis_tag).and_return("foo")
|
104
|
+
|
105
|
+
expect(provider.get_tag).to eq("foo")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
49
109
|
describe "#check_auth" do
|
50
110
|
example "With proper permissions" do
|
51
111
|
allow_message_expectations_on_nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.6.travis.
|
4
|
+
version: 1.6.6.travis.524.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|