dpl-rubygems 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/dpl-rubygems.gemspec +3 -0
- data/lib/dpl/provider/rubygems.rb +55 -0
- data/spec/provider/rubygems_spec.rb +113 -0
- metadata +173 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: efb4bab678c21568ea8585876b39045f3a1f93da
|
4
|
+
data.tar.gz: 5ef58bbe4c2e2458017bb8cdd64a12b7ebaf889e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60bcd27b0bdff6af52ea50b5f042fc3371a7e5b3803c89c4162bc04d3e729b54e187601d217b61da1aa8b59b327ab07ac30ff79a06b12e656eaf66680a322367
|
7
|
+
data.tar.gz: 30877af5aa02bcd06777d34eb0f9bd218a1c9cc1a06b4c13826d92fed65010da4bfc7ee54400c350b6fcdc78f62fcc32d9f97b1cd1a3523069a859b3af8bdfe7
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'gems'
|
2
|
+
|
3
|
+
module DPL
|
4
|
+
class Provider
|
5
|
+
class RubyGems < Provider
|
6
|
+
def setup_auth
|
7
|
+
::Gems.key = option(:api_key) if options[:api_key]
|
8
|
+
::Gems.username = option(:user) unless options[:api_key]
|
9
|
+
::Gems.password = option(:password) unless options[:api_key]
|
10
|
+
end
|
11
|
+
|
12
|
+
def needs_key?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup_gem
|
17
|
+
options[:gem] ||= options[:app]
|
18
|
+
end
|
19
|
+
|
20
|
+
def gemspec
|
21
|
+
options[:gemspec].gsub('.gemspec', '') if options[:gemspec]
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_app
|
25
|
+
setup_auth
|
26
|
+
setup_gem
|
27
|
+
log "Looking up gem #{options[:gem]}"
|
28
|
+
info = ::Gems.info(options[:gem])
|
29
|
+
log "Found gem #{info['name']}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def check_auth
|
33
|
+
setup_auth
|
34
|
+
log "Authenticated with username #{::Gems.username}" if ::Gems.username
|
35
|
+
end
|
36
|
+
|
37
|
+
def push_app
|
38
|
+
setup_auth
|
39
|
+
setup_gem
|
40
|
+
context.shell "for f in #{gemspec_glob}; do gem build $f; done"
|
41
|
+
Dir.glob("#{gemspec || option(:gem)}-*.gem") do |f|
|
42
|
+
if options[:host]
|
43
|
+
log ::Gems.push(File.new(f), options[:host])
|
44
|
+
else
|
45
|
+
log ::Gems.push(File.new f)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def gemspec_glob
|
51
|
+
options[:gemspec_glob] || "#{gemspec || option(:gem)}.gemspec"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'gems'
|
4
|
+
require 'dpl/provider/rubygems'
|
5
|
+
|
6
|
+
describe DPL::Provider::RubyGems do
|
7
|
+
subject :provider do
|
8
|
+
described_class.new(DummyContext.new, :app => 'example', :api_key => 'foo')
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#api" do
|
12
|
+
example "with an api key" do
|
13
|
+
expect(::Gems).to receive(:key=).with('foo')
|
14
|
+
provider.setup_auth
|
15
|
+
end
|
16
|
+
|
17
|
+
example "with a username and password" do
|
18
|
+
provider.options.update(:user => 'test', :password => 'blah')
|
19
|
+
provider.options.delete(:api_key)
|
20
|
+
expect(::Gems).to receive(:username=).with('test')
|
21
|
+
expect(::Gems).to receive(:password=).with('blah')
|
22
|
+
provider.setup_auth
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#check_auth" do
|
27
|
+
example do
|
28
|
+
provider.options.update(:user => 'test', :password => 'blah')
|
29
|
+
provider.options.delete(:api_key)
|
30
|
+
expect(provider).to receive(:log).with("Authenticated with username test")
|
31
|
+
provider.check_auth
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#check_app" do
|
36
|
+
example do
|
37
|
+
expect(::Gems).to receive(:info).with('example').and_return({'name' => 'example'})
|
38
|
+
expect(provider).to receive(:log).with("Looking up gem example")
|
39
|
+
expect(provider).to receive(:log).with("Found gem example")
|
40
|
+
provider.check_app
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#push_app" do
|
45
|
+
after(:each) do
|
46
|
+
expect(File).to receive(:new).with('File').and_return('Test file')
|
47
|
+
expect(provider).to receive(:log).with('Yes!')
|
48
|
+
provider.push_app
|
49
|
+
end
|
50
|
+
|
51
|
+
example "with options[:app]" do
|
52
|
+
provider.options.update(:app => 'example')
|
53
|
+
expect(provider.context).to receive(:shell).with("for f in example.gemspec; do gem build $f; done")
|
54
|
+
expect(Dir).to receive(:glob).with('example-*.gem').and_yield('File')
|
55
|
+
expect(::Gems).to receive(:push).with('Test file').and_return('Yes!')
|
56
|
+
end
|
57
|
+
|
58
|
+
example "with options[:gem]" do
|
59
|
+
provider.options.update(:gem => 'example-gem')
|
60
|
+
expect(provider.context).to receive(:shell).with("for f in example-gem.gemspec; do gem build $f; done")
|
61
|
+
expect(Dir).to receive(:glob).with('example-gem-*.gem').and_yield('File')
|
62
|
+
expect(::Gems).to receive(:push).with('Test file').and_return('Yes!')
|
63
|
+
end
|
64
|
+
|
65
|
+
example "with options[:gemspec]" do
|
66
|
+
provider.options.update(:gemspec => 'blah.gemspec')
|
67
|
+
expect(provider.context).to receive(:shell).with("for f in blah.gemspec; do gem build $f; done")
|
68
|
+
expect(Dir).to receive(:glob).with('blah-*.gem').and_yield('File')
|
69
|
+
expect(::Gems).to receive(:push).with('Test file').and_return('Yes!')
|
70
|
+
end
|
71
|
+
|
72
|
+
example "with options[:host]" do
|
73
|
+
provider.options.update(:host => 'http://example.com')
|
74
|
+
expect(provider.context).to receive(:shell).with("for f in example.gemspec; do gem build $f; done")
|
75
|
+
expect(Dir).to receive(:glob).with('example-*.gem').and_yield('File')
|
76
|
+
expect(::Gems).to receive(:push).with('Test file', host='http://example.com').and_return('Yes!')
|
77
|
+
end
|
78
|
+
|
79
|
+
example "with options[:gemspec_glob]" do
|
80
|
+
provider.options.update(:gemspec_glob => 'example-*.gemspec')
|
81
|
+
expect(provider.context).to receive(:shell).with("for f in example-*.gemspec; do gem build $f; done")
|
82
|
+
expect(Dir).to receive(:glob).with('example-*.gem').and_yield('File')
|
83
|
+
expect(::Gems).to receive(:push).with('Test file').and_return('Yes!')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#setup_gem" do
|
88
|
+
example "with options[:gem] and options[:app] set" do
|
89
|
+
provider.options.update(:gem => 'test', :app => 'blah')
|
90
|
+
provider.setup_gem
|
91
|
+
expect(provider.options[:gem]).to eq('test')
|
92
|
+
end
|
93
|
+
|
94
|
+
example "with options[:app] set" do
|
95
|
+
provider.options.update(:app => 'foo')
|
96
|
+
provider.setup_gem
|
97
|
+
expect(provider.options[:gem]).to eq('foo')
|
98
|
+
end
|
99
|
+
|
100
|
+
example "with options[:gem] set" do
|
101
|
+
provider.options.update(:gem => 'bar')
|
102
|
+
provider.setup_gem
|
103
|
+
expect(provider.options[:gem]).to eq('bar')
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#gemspec" do
|
108
|
+
example do
|
109
|
+
provider.options.update(:gemspec => 'test.gemspec')
|
110
|
+
expect(provider.gemspec).to eq('test')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dpl-rubygems
|
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: gems
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
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: rspec-its
|
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: rake
|
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: json_pure
|
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: tins
|
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: coveralls
|
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
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: highline
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: deploy tool abstraction for clients
|
140
|
+
email: konstantin.mailinglists@googlemail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- dpl-rubygems.gemspec
|
146
|
+
- lib/dpl/provider/rubygems.rb
|
147
|
+
- spec/provider/rubygems_spec.rb
|
148
|
+
homepage: https://github.com/travis-ci/dpl
|
149
|
+
licenses:
|
150
|
+
- MIT
|
151
|
+
metadata: {}
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
require_paths:
|
155
|
+
- lib
|
156
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '2.2'
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
requirements: []
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 2.6.13
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: deploy tool
|
172
|
+
test_files:
|
173
|
+
- spec/provider/rubygems_spec.rb
|