dpl 1.8.46.travis.2449.5 → 1.8.46.travis.2451.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/code_deploy.rb +9 -9
- data/lib/dpl/provider/pages.rb +7 -1
- data/lib/dpl/provider/pypi.rb +8 -16
- data/spec/provider/code_deploy_spec.rb +4 -4
- data/spec/provider/pypi_spec.rb +30 -28
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe1e104969a8f068c502defed535a17fb25ac80d88186a7e648d37cbee0048e
|
4
|
+
data.tar.gz: 821067b53910c92bcf8550d2d4b2a8eca2bbb16d4f76158c7341c165ced56e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7da9c646e3561b2949ee681093ad5df68c6c22e05271204f22ef48381a17373c821b8bf335dfb0875cf4a37e394ce5e8de08df4c16c8a21f8ff12de77b54a98
|
7
|
+
data.tar.gz: fe0e32e92dec23b229fbe0f3a84a93e00b64afc59ce19cc10eae6cc137a3d303d42a4ee6d714f8890477bf5fc941e0087d0f4ddfb8dff771175eff932768232e
|
@@ -44,10 +44,10 @@ module DPL
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def revision_version_info
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
s3obj = s3api.head_object({
|
48
|
+
bucket: option(:bucket),
|
49
|
+
key: s3_key
|
50
|
+
})
|
51
51
|
end
|
52
52
|
|
53
53
|
def s3_revision
|
@@ -77,13 +77,13 @@ module DPL
|
|
77
77
|
def push_app
|
78
78
|
rev = revision()
|
79
79
|
if rev[:s3_location]
|
80
|
-
|
81
|
-
|
80
|
+
rev_info = rev[:s3_location]
|
81
|
+
log "Registering app revision with version=#{rev_info[:version]}, etag=#{rev_info[:e_tag]}"
|
82
82
|
end
|
83
83
|
code_deploy.register_application_revision({
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
revision: rev,
|
85
|
+
application_name: options[:application] || option(:application_name),
|
86
|
+
description: options[:description] || default_description
|
87
87
|
})
|
88
88
|
data = code_deploy.create_deployment({
|
89
89
|
revision: revision,
|
data/lib/dpl/provider/pages.rb
CHANGED
@@ -32,7 +32,9 @@ module DPL
|
|
32
32
|
def initialize(context, options)
|
33
33
|
super
|
34
34
|
|
35
|
-
@build_dir = File.join(
|
35
|
+
@build_dir = File.join(src_dir, options[:local_dir] || '.')
|
36
|
+
print_step "The target dir for deployment is '#{@build_dir}'."
|
37
|
+
|
36
38
|
@project_name = options[:project_name] || fqdn || slug
|
37
39
|
@target_branch = options[:target_branch] || 'gh-pages'
|
38
40
|
|
@@ -63,6 +65,10 @@ module DPL
|
|
63
65
|
options.fetch(:repo) { context.env['TRAVIS_REPO_SLUG'] }
|
64
66
|
end
|
65
67
|
|
68
|
+
def src_dir
|
69
|
+
context.env['TRAVIS_BUILD_DIR'] or Dir.pwd
|
70
|
+
end
|
71
|
+
|
66
72
|
def keep_history
|
67
73
|
options.fetch(:keep_history, false)
|
68
74
|
end
|
data/lib/dpl/provider/pypi.rb
CHANGED
@@ -32,23 +32,13 @@ module DPL
|
|
32
32
|
(options.has_key?(:skip_upload_docs) && options[:skip_upload_docs])
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
shell
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
def self.install_twine
|
41
|
-
shell("pip install twine", retry: true) if `which twine`.chop.empty?
|
42
|
-
end
|
43
|
-
|
44
|
-
def initialize(*args)
|
45
|
-
super(*args)
|
46
|
-
self.class.pip 'wheel' if pypi_distributions.to_s.include? 'bdist_wheel'
|
35
|
+
def install_deploy_dependencies
|
36
|
+
unless context.shell "wget -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && " \
|
37
|
+
"pip install --upgrade setuptools twine wheel"
|
38
|
+
error "Couldn't install pip, setuptools, twine or wheel."
|
39
|
+
end
|
47
40
|
end
|
48
41
|
|
49
|
-
install_setuptools
|
50
|
-
install_twine
|
51
|
-
|
52
42
|
def config
|
53
43
|
{
|
54
44
|
:header => '[distutils]',
|
@@ -99,7 +89,9 @@ module DPL
|
|
99
89
|
|
100
90
|
def push_app
|
101
91
|
context.shell "python setup.py #{pypi_distributions}"
|
102
|
-
context.shell "twine upload -r pypi dist/*"
|
92
|
+
unless context.shell "twine upload -r pypi dist/*"
|
93
|
+
error 'PyPI upload failed.'
|
94
|
+
end
|
103
95
|
context.shell "rm -rf dist/*"
|
104
96
|
unless skip_upload_docs?
|
105
97
|
log "Uploading documentation (skip with \"skip_upload_docs: true\")"
|
@@ -165,8 +165,8 @@ describe DPL::Provider::CodeDeploy do
|
|
165
165
|
|
166
166
|
before(:each) do
|
167
167
|
head_data = provider.s3api.stub_data(:head_object, {
|
168
|
-
|
169
|
-
|
168
|
+
version_id: 'object_version_id',
|
169
|
+
etag: 'etag'
|
170
170
|
})
|
171
171
|
provider.s3api.stub_responses(:head_object, head_data)
|
172
172
|
expect(provider).to receive(:option).with(:bucket).and_return(bucket).twice
|
@@ -181,8 +181,8 @@ describe DPL::Provider::CodeDeploy do
|
|
181
181
|
bucket: bucket,
|
182
182
|
bundle_type: bundle_type,
|
183
183
|
key: key,
|
184
|
-
|
185
|
-
|
184
|
+
version: 'object_version_id',
|
185
|
+
e_tag: 'etag'
|
186
186
|
}
|
187
187
|
})
|
188
188
|
end
|
data/spec/provider/pypi_spec.rb
CHANGED
@@ -6,6 +6,15 @@ describe DPL::Provider::PyPI do
|
|
6
6
|
described_class.new(DummyContext.new, :user => 'foo', :password => 'bar')
|
7
7
|
end
|
8
8
|
|
9
|
+
describe "#install_deploy_dependencies" do
|
10
|
+
example do
|
11
|
+
expect(provider.context).to receive(:shell).with(
|
12
|
+
"wget -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && pip install --upgrade setuptools twine wheel"
|
13
|
+
).and_return(true)
|
14
|
+
provider.install_deploy_dependencies
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
9
18
|
describe "#config" do
|
10
19
|
it 'accepts a user and a password' do
|
11
20
|
expect(provider.config[:servers]['pypi']).to include 'username: foo'
|
@@ -13,13 +22,6 @@ describe DPL::Provider::PyPI do
|
|
13
22
|
end
|
14
23
|
end
|
15
24
|
|
16
|
-
describe "#initialize" do
|
17
|
-
example "with :distributions option containing 'bdist_wheel'" do
|
18
|
-
expect(described_class).to receive(:pip).with("wheel")
|
19
|
-
described_class.new(DummyContext.new, :user => 'foo', :password => 'bar', :distributions => 'bdist_wheel sdist')
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
25
|
describe "#check_auth" do
|
24
26
|
example do
|
25
27
|
expect(provider).to receive(:log).with("Authenticated as foo")
|
@@ -28,37 +30,37 @@ describe DPL::Provider::PyPI do
|
|
28
30
|
end
|
29
31
|
|
30
32
|
describe "#push_app" do
|
31
|
-
example do
|
32
|
-
expect(provider.context).to receive(:shell).with("python setup.py sdist")
|
33
|
-
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
|
34
|
-
expect(provider.context).to receive(:shell).with("rm -rf dist/*")
|
33
|
+
example "default" do
|
34
|
+
expect(provider.context).to receive(:shell).with("python setup.py sdist").and_return(true)
|
35
|
+
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*").and_return(true)
|
36
|
+
expect(provider.context).to receive(:shell).with("rm -rf dist/*").and_return(true)
|
35
37
|
expect(provider.context).not_to receive(:shell).with("python setup.py upload_docs -r https://upload.pypi.org/legacy/")
|
36
38
|
provider.push_app
|
37
39
|
end
|
38
40
|
|
39
41
|
example "with :distributions option" do
|
40
42
|
provider.options.update(:distributions => 'sdist bdist')
|
41
|
-
expect(provider.context).to receive(:shell).with("python setup.py sdist bdist")
|
42
|
-
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
|
43
|
-
expect(provider.context).to receive(:shell).with("rm -rf dist/*")
|
43
|
+
expect(provider.context).to receive(:shell).with("python setup.py sdist bdist").and_return(true)
|
44
|
+
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*").and_return(true)
|
45
|
+
expect(provider.context).to receive(:shell).with("rm -rf dist/*").and_return(true)
|
44
46
|
expect(provider.context).not_to receive(:shell).with("python setup.py upload_docs -r https://upload.pypi.org/legacy/")
|
45
47
|
provider.push_app
|
46
48
|
end
|
47
49
|
|
48
50
|
example "with :server option" do
|
49
51
|
provider.options.update(:server => 'http://blah.com')
|
50
|
-
expect(provider.context).to receive(:shell).with("python setup.py sdist")
|
51
|
-
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
|
52
|
-
expect(provider.context).to receive(:shell).with("rm -rf dist/*")
|
52
|
+
expect(provider.context).to receive(:shell).with("python setup.py sdist").and_return(true)
|
53
|
+
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*").and_return(true)
|
54
|
+
expect(provider.context).to receive(:shell).with("rm -rf dist/*").and_return(true)
|
53
55
|
expect(provider.context).not_to receive(:shell).with("python setup.py upload_docs -r http://blah.com")
|
54
56
|
provider.push_app
|
55
57
|
end
|
56
58
|
|
57
59
|
example "with :skip_upload_docs option" do
|
58
60
|
provider.options.update(:skip_upload_docs => true)
|
59
|
-
expect(provider.context).to receive(:shell).with("python setup.py sdist")
|
60
|
-
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
|
61
|
-
expect(provider.context).to receive(:shell).with("rm -rf dist/*")
|
61
|
+
expect(provider.context).to receive(:shell).with("python setup.py sdist").and_return(true)
|
62
|
+
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*").and_return(true)
|
63
|
+
expect(provider.context).to receive(:shell).with("rm -rf dist/*").and_return(true)
|
62
64
|
expect(provider.context).not_to receive(:shell).with("python setup.py upload_docs -r https://upload.pypi.org/legacy/")
|
63
65
|
provider.push_app
|
64
66
|
end
|
@@ -69,19 +71,19 @@ describe DPL::Provider::PyPI do
|
|
69
71
|
end
|
70
72
|
|
71
73
|
it "runs upload_docs" do
|
72
|
-
expect(provider.context).to receive(:shell).with("python setup.py sdist")
|
73
|
-
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
|
74
|
-
expect(provider.context).to receive(:shell).with("rm -rf dist/*")
|
75
|
-
expect(provider.context).to receive(:shell).with("python setup.py upload_docs -r https://upload.pypi.org/legacy/")
|
74
|
+
expect(provider.context).to receive(:shell).with("python setup.py sdist").and_return(true)
|
75
|
+
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*").and_return(true)
|
76
|
+
expect(provider.context).to receive(:shell).with("rm -rf dist/*").and_return(true)
|
77
|
+
expect(provider.context).to receive(:shell).with("python setup.py upload_docs -r https://upload.pypi.org/legacy/").and_return(true)
|
76
78
|
provider.push_app
|
77
79
|
end
|
78
80
|
|
79
81
|
example "with :docs_dir option" do
|
80
82
|
provider.options.update(:docs_dir => 'some/dir')
|
81
|
-
expect(provider.context).to receive(:shell).with("python setup.py sdist")
|
82
|
-
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
|
83
|
-
expect(provider.context).to receive(:shell).with("rm -rf dist/*")
|
84
|
-
expect(provider.context).to receive(:shell).with("python setup.py upload_docs --upload-dir some/dir -r https://upload.pypi.org/legacy/")
|
83
|
+
expect(provider.context).to receive(:shell).with("python setup.py sdist").and_return(true)
|
84
|
+
expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*").and_return(true)
|
85
|
+
expect(provider.context).to receive(:shell).with("rm -rf dist/*").and_return(true)
|
86
|
+
expect(provider.context).to receive(:shell).with("python setup.py upload_docs --upload-dir some/dir -r https://upload.pypi.org/legacy/").and_return(true)
|
85
87
|
provider.push_app
|
86
88
|
end
|
87
89
|
end
|