dpl 1.2.0 → 1.3.0
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 +4 -4
- data/Gemfile +4 -0
- data/README.md +1 -0
- data/lib/dpl/provider/openshift.rb +45 -0
- data/lib/dpl/version.rb +1 -1
- data/spec/provider/openshift_spec.rb +81 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89c640c930c9915969567ebf511d6fbfde5e8b29
|
4
|
+
data.tar.gz: 9f2b6981800149725197834bb4f1698f974aeb47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e01c0f62d71f9ff22fa98af2fdcc3dc855b5171cc52f911a8decb8a32c531228e30c868eae728f1e352fa503e15ad53187ea5cdfe0ce2c80d170694203e1bc4
|
7
|
+
data.tar.gz: c37019e0dad67e83b74301625a10120ded91e2fb4dc20400c31e86f24c9a41e88074e1854bd092be517ec4ea6560252533e9482fca4ed5c3437424986c078577
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
module DPL
|
2
|
+
class Provider
|
3
|
+
class Openshift < Provider
|
4
|
+
experimental "openshift"
|
5
|
+
requires 'rhc'
|
6
|
+
|
7
|
+
def api
|
8
|
+
@api ||= ::RHC::Rest::Client.new(:user => option(:user), :password => option(:password), :server => 'openshift.redhat.com')
|
9
|
+
end
|
10
|
+
|
11
|
+
def user
|
12
|
+
@user ||= api.user.login
|
13
|
+
end
|
14
|
+
|
15
|
+
def app
|
16
|
+
@app ||= api.find_application(option(:domain), option(:app))
|
17
|
+
end
|
18
|
+
|
19
|
+
def check_auth
|
20
|
+
log "authenticated as %s" % user
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_app
|
24
|
+
log "found app #{app.name}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup_key(file, type='ssh-rsa')
|
28
|
+
api.add_key(option(:key_name), type, File.read(file))
|
29
|
+
end
|
30
|
+
|
31
|
+
def remove_key
|
32
|
+
api.delete_key(option(:key_name))
|
33
|
+
end
|
34
|
+
|
35
|
+
def push_app
|
36
|
+
context.shell "git push #{app.git_url} -f"
|
37
|
+
end
|
38
|
+
|
39
|
+
def restart
|
40
|
+
app.restart
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/dpl/version.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rhc'
|
3
|
+
require 'dpl/provider/openshift'
|
4
|
+
|
5
|
+
describe DPL::Provider::Openshift do
|
6
|
+
subject :provider do
|
7
|
+
described_class.new(DummyContext.new, :user => 'foo', :password => 'foo', :domain => 'foo', :app => 'example', :key_name => 'key')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe :api do
|
11
|
+
it 'accepts a user and a password' do
|
12
|
+
api = stub(:api)
|
13
|
+
provider.options.update(:user => "foo", :password => "bar")
|
14
|
+
::RHC::Rest::Client.should_receive(:new).with(:user => "foo", :password => "bar", :server => "openshift.redhat.com").and_return(api)
|
15
|
+
provider.api.should be == api
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "with api" do
|
20
|
+
let :api do
|
21
|
+
stub "api",
|
22
|
+
:user => stub(:login => "foo@bar.com"),
|
23
|
+
:find_application => stub(:name => "example", :git_url => "git://something"),
|
24
|
+
:add_key => stub
|
25
|
+
end
|
26
|
+
let :app do
|
27
|
+
stub "app",
|
28
|
+
:restart => stub
|
29
|
+
end
|
30
|
+
|
31
|
+
before do
|
32
|
+
::RHC::Rest::Client.should_receive(:new).at_most(:once).and_return(api)
|
33
|
+
provider.api
|
34
|
+
end
|
35
|
+
|
36
|
+
its(:api) {should be == api}
|
37
|
+
|
38
|
+
describe :check_auth do
|
39
|
+
example do
|
40
|
+
provider.should_receive(:log).with("authenticated as foo@bar.com")
|
41
|
+
provider.check_auth
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe :check_app do
|
46
|
+
example do
|
47
|
+
provider.should_receive(:log).with("found app example")
|
48
|
+
provider.check_app
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe :setup_key do
|
53
|
+
example do
|
54
|
+
File.should_receive(:read).with("the file").and_return("foo")
|
55
|
+
api.should_receive(:add_key).with("key", "ssh-rsa", "foo")
|
56
|
+
provider.setup_key("the file")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe :remove_key do
|
61
|
+
example do
|
62
|
+
api.should_receive(:delete_key).with("key")
|
63
|
+
provider.remove_key
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe :push_app do
|
68
|
+
example do
|
69
|
+
provider.context.should_receive(:shell).with("git push git://something -f")
|
70
|
+
provider.push_app
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe :restart do
|
75
|
+
example do
|
76
|
+
provider.app.should_receive(:restart)
|
77
|
+
provider.restart
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -77,12 +77,14 @@ files:
|
|
77
77
|
- lib/dpl/provider/heroku/anvil.rb
|
78
78
|
- lib/dpl/provider/heroku/git.rb
|
79
79
|
- lib/dpl/provider/nodejitsu.rb
|
80
|
+
- lib/dpl/provider/openshift.rb
|
80
81
|
- lib/dpl/version.rb
|
81
82
|
- notes/dotcloud.md
|
82
83
|
- notes/engine_yard.md
|
83
84
|
- notes/heroku.md
|
84
85
|
- spec/cli_spec.rb
|
85
86
|
- spec/provider/heroku_spec.rb
|
87
|
+
- spec/provider/openshift_spec.rb
|
86
88
|
- spec/provider_spec.rb
|
87
89
|
- spec/spec_helper.rb
|
88
90
|
homepage: https://github.com/rkh/dpl
|
@@ -112,6 +114,7 @@ summary: deploy tool
|
|
112
114
|
test_files:
|
113
115
|
- spec/cli_spec.rb
|
114
116
|
- spec/provider/heroku_spec.rb
|
117
|
+
- spec/provider/openshift_spec.rb
|
115
118
|
- spec/provider_spec.rb
|
116
119
|
- spec/spec_helper.rb
|
117
120
|
has_rdoc:
|