dpl 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b60ef07c3efd10ed791e52662655bf6ae8b9f25a
4
- data.tar.gz: a03dc4e7e633af8bb810b961f88554e6e6e11b2f
3
+ metadata.gz: 89c640c930c9915969567ebf511d6fbfde5e8b29
4
+ data.tar.gz: 9f2b6981800149725197834bb4f1698f974aeb47
5
5
  SHA512:
6
- metadata.gz: ca7d8f39d87084784d1217e2fbeda9cbfb56aa7c8cfb8330e88ce4ebd6502956db4228cb6374adb614c2ecf749113b211c4bdeddf47c85843030ee2da1bd5965
7
- data.tar.gz: d9e896346cae4da0c2ce91de14f924177e49863a11b7b36cb1d1ea782cb6e88535c34a850b8b4aa09b067717c2a018bd18a4364496392f8e9e08b8ff55eaf700
6
+ metadata.gz: 4e01c0f62d71f9ff22fa98af2fdcc3dc855b5171cc52f911a8decb8a32c531228e30c868eae728f1e352fa503e15ad53187ea5cdfe0ce2c80d170694203e1bc4
7
+ data.tar.gz: c37019e0dad67e83b74301625a10120ded91e2fb4dc20400c31e86f24c9a41e88074e1854bd092be517ec4ea6560252533e9482fca4ed5c3437424986c078577
data/Gemfile CHANGED
@@ -5,3 +5,7 @@ group :heroku do
5
5
  gem 'rendezvous'
6
6
  gem 'heroku-api'
7
7
  end
8
+
9
+ group :openshift do
10
+ gem 'rhc'
11
+ end
data/README.md CHANGED
@@ -10,3 +10,4 @@ Supported providers:
10
10
  * Nodejitsu
11
11
  * Engine Yard (experimental)
12
12
  * dotCloud (experimental)
13
+ * Openshift (experimental)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DPL
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -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.2.0
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-18 00:00:00.000000000 Z
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: