dpl-launchpad 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: becabfcdddd6df71a98a1557c79d376666db5922
4
+ data.tar.gz: c506c47d14fd6608bd4e95bba141475e079e3aa6
5
+ SHA512:
6
+ metadata.gz: be21154c3b379591b6d63ef6bc839536fc8ac5788acf91c4d5ce82a866fad2a2fe3c776d131d77e5e494f658569b0adbe3ae3eb1d656d5f3266c5849b79016cc
7
+ data.tar.gz: 536eb2096d529d8bd09c5ad4554e8950a236ca8e58a5718acd7c0a41759ceea8cbb269cb6a1c4d9f3dea3b86e97e56a7fc1a1de58ed9d261fad7aab71cfbab2d
@@ -0,0 +1,3 @@
1
+ require './gemspec_helper'
2
+
3
+ gemspec_for 'launchpad'
@@ -0,0 +1,48 @@
1
+ require 'net/http'
2
+ require 'net/https'
3
+
4
+ module DPL
5
+ class Provider
6
+ class Launchpad < Provider
7
+
8
+ def initialize(context, options)
9
+ super
10
+ @http = Net::HTTP.new('api.launchpad.net', 443)
11
+ @http.use_ssl = true
12
+ end
13
+
14
+ def check_auth
15
+ end
16
+
17
+ def needs_key?
18
+ false
19
+ end
20
+
21
+ def push_app
22
+ response = api_call('/1.0/' + options[:slug] + '/+code-import', {'ws.op' => 'requestImport'})
23
+ error('Deploy failed! Launchpad credentials invalid. ' + response.code.to_s) if response.code == '401'
24
+ error('Error: ' + response.code.to_s + ' ' + response.body) unless response.kind_of? Net::HTTPSuccess
25
+ end
26
+
27
+ private
28
+
29
+ def api_call(path, data)
30
+ req = Net::HTTP::Post.new(path)
31
+ req.set_form_data(data)
32
+ req['Authorization'] = authorization
33
+ return @http.request(req)
34
+ end
35
+
36
+ def authorization
37
+ return 'OAuth oauth_consumer_key="Travis%20Deploy", ' +
38
+ 'oauth_nonce="' + rand(36**32).to_s(36) + '",' +
39
+ 'oauth_signature="%26' + options[:oauth_token_secret] + '",' +
40
+ 'oauth_signature_method="PLAINTEXT",' +
41
+ 'oauth_timestamp="' + Time::now().to_i.to_s + '",' +
42
+ 'oauth_token="' + options[:oauth_token] + '",' +
43
+ 'oauth_version="1.0"'
44
+ end
45
+
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ require 'dpl/provider/launchpad'
3
+
4
+ describe DPL::Provider::Launchpad do
5
+ subject :provider do
6
+ described_class.new(DummyContext.new, :slug => '~user/repo/branch', :oauth_token => 'uezinoosinmxkewhochq', :oauth_token_secret => 'dinb6fao4jh0kfdn5mich31cbikdkpjplkmadhi80h93kbbaableeeg41mm0jab9jif8ch7i2k9a80n5')
7
+ end
8
+
9
+ its(:needs_key?) { should be false }
10
+
11
+ describe '#push_app' do
12
+ it 'on api success' do
13
+ expect(provider).to receive(:api_call).with('/1.0/~user/repo/branch/+code-import', {'ws.op' => 'requestImport'}).and_return Net::HTTPSuccess.new("HTTP/1.1", 200, "Ok")
14
+ provider.push_app
15
+ end
16
+
17
+ it 'on api failure' do
18
+ expect(provider).to receive(:api_call).with('/1.0/~user/repo/branch/+code-import', {'ws.op' => 'requestImport'}).and_return double("Net::HTTPUnauthorized", code: 401, body: "", class: Net::HTTPUnauthorized)
19
+ expect { provider.push_app }.to raise_error(DPL::Error)
20
+ end
21
+ end
22
+
23
+ describe 'private method' do
24
+ describe '#authorization' do
25
+ it 'should return correct oauth' do
26
+ result = provider.instance_eval { authorization }
27
+ expect(result).to include('oauth_token="uezinoosinmxkewhochq",')
28
+ expect(result).to include('oauth_signature="%26dinb6fao4jh0kfdn5mich31cbikdkpjplkmadhi80h93kbbaableeeg41mm0jab9jif8ch7i2k9a80n5",')
29
+ end
30
+ end
31
+ end
32
+
33
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dpl-launchpad
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Konstantin Haase
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dpl
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-its
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json_pure
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tins
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: highline
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: deploy tool abstraction for clients
126
+ email: konstantin.mailinglists@googlemail.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - dpl-launchpad.gemspec
132
+ - lib/dpl/provider/launchpad.rb
133
+ - spec/provider/launchpad_spec.rb
134
+ homepage: https://github.com/travis-ci/dpl
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '2.2'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.6.13
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: deploy tool
158
+ test_files:
159
+ - spec/provider/launchpad_spec.rb