dpl 1.9.1.travis.2639.5 → 1.9.1.travis.2660.5

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
  SHA256:
3
- metadata.gz: 99069235c38eac07596815a15cb8c6a60ffb8db5fb16acd2717d8460983cb91a
4
- data.tar.gz: 6beeed06a1d6109e4cb0cef144fbc786aa547aedc2f940afa92687a436b7fc8c
3
+ metadata.gz: 7494a96a838bdb9db9a0b0042cb001e9fd1a0ac1fbdb2c7ae97fcbb19986155e
4
+ data.tar.gz: a5ab9c1124ea55f1d4af111b983896904591041bd2bb01653dfa8ce380fe2565
5
5
  SHA512:
6
- metadata.gz: a67e49c94385ea8ecb0e2ffd8f201c1bbcc907df2c72cc23df848d5dfd90c7c8430379394c5286ac2dc05decd47d163bde3c8d8121c485e8514c692ca88003bd
7
- data.tar.gz: a315fe6c0bb8eb0fa22eea54716790d8f74d75346907a26648f306f230e32a65fe8a62909120ce815b409d04537178dca90bd7d7ad5069bc23cc620652860332
6
+ metadata.gz: c1eac4ca1809c551e8a576cba99f7fffd25097bdafa187fc81be660cd15a369848b0fe714f53dfb4c55479a6e956d24c9fadedf19f9009122103d9aec85ca69d
7
+ data.tar.gz: 8e23bda53945418170fd2132c2b6d23ebf944d528d6244d4dd2cabb1938f8e8865ef339546052d73126c7c5996d7736e52228d8670015bffb83dae31150b5830
data/lib/dpl/provider.rb CHANGED
@@ -67,21 +67,20 @@ module DPL
67
67
  begin
68
68
  opt_lower = super.option(:provider).to_s.downcase
69
69
  opt = opt_lower.gsub(/[^a-z0-9]/, '')
70
- name = PROVIDERS.keys.detect { |p| p.to_s.downcase == opt }
71
- raise Error, "could not find provider %p" % opt unless name
72
-
73
- require "dpl/provider/#{PROVIDERS[name]}"
74
- provider = const_get(name).new(context, options)
70
+ class_name = PROVIDERS.keys.detect { |p| p.to_s.downcase == opt }
71
+ raise Error, "could not find provider %p" % opt unless class_name
72
+ require "dpl/provider/#{PROVIDERS[class_name]}"
73
+ provider = const_get(class_name).new(context, options)
75
74
  rescue NameError, LoadError => e
76
- if /uninitialized constant DPL::Provider::(?<provider_wanted>\S+)/ =~ e.message ||
75
+ if /uninitialized constant DPL::Provider::(?<provider_wanted>\S+)/ =~ e.message
77
76
  provider_gem_name = PROVIDERS[provider_wanted]
78
77
  elsif %r(cannot load such file -- dpl/provider/(?<provider_file_name>\S+)) =~ e.message
79
- provider_gem_name = provider_file_name
78
+ provider_gem_name = PROVIDERS[class_name]
80
79
  else
81
80
  # don't know what to do with this error
82
81
  raise e
83
82
  end
84
- install_cmd = "gem install dpl-#{PROVIDERS[provider_gem_name] || opt} -v #{ENV['DPL_VERSION'] || DPL::VERSION}"
83
+ install_cmd = "gem install dpl-#{provider_gem_name || opt} -v #{ENV['DPL_VERSION'] || DPL::VERSION}"
85
84
 
86
85
  if File.exist?(local_gem = File.join(Dir.pwd, "dpl-#{PROVIDERS[provider_gem_name] || opt_lower}-#{ENV['DPL_VERSION'] || DPL::VERSION}.gem"))
87
86
  install_cmd = "gem install #{local_gem}"
@@ -90,8 +89,8 @@ module DPL
90
89
  context.shell(install_cmd)
91
90
  Gem.clear_paths
92
91
 
93
- require "dpl/provider/#{PROVIDERS[name]}"
94
- provider = const_get(name).new(context, options)
92
+ require "dpl/provider/#{PROVIDERS[class_name]}"
93
+ provider = const_get(class_name).new(context, options)
95
94
  rescue DPL::Error
96
95
  if opt_lower
97
96
  provider = const_get(opt.capitalize).new(context, options)
data/lib/dpl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DPL
2
- VERSION = '1.9.1.travis.2639.5'
2
+ VERSION = '1.9.1.travis.2660.5'
3
3
  end
@@ -3,22 +3,32 @@ require 'dpl/provider'
3
3
 
4
4
  describe DPL::Provider do
5
5
  let(:example_provider) { Class.new(described_class)}
6
- subject(:provider) { example_provider.new(DummyContext.new, :app => 'example', :key_name => 'foo', :run => ["foo", "bar"]) }
6
+ let(:context) { DummyContext.new }
7
+ subject(:provider) { example_provider.new(context, :app => 'example', :key_name => 'foo', :run => ["foo", "bar"]) }
7
8
 
8
9
  before { stub_const "DPL::Provider::Example", example_provider }
9
10
 
10
11
  describe "#new" do
11
- example { expect(described_class.new(DummyContext.new, :provider => "example")) .to be_an(example_provider) }
12
- example { expect(described_class.new(DummyContext.new, :provider => "Example")) .to be_an(example_provider) }
13
- example { expect(described_class.new(DummyContext.new, :provider => "exa_mple")).to be_an(example_provider) }
14
- example { expect(described_class.new(DummyContext.new, :provider => "exa-mple")).to be_an(example_provider) }
15
- example { expect(described_class.new(DummyContext.new, :provider => "scri_pt")).to be_an(DPL::Provider::Script) }
16
- example { expect(described_class.new(DummyContext.new, :provider => "scri _pt")).to be_an(DPL::Provider::Script) }
12
+ example { expect(described_class.new(context, :provider => "example")) .to be_an(example_provider) }
13
+ example { expect(described_class.new(context, :provider => "Example")) .to be_an(example_provider) }
14
+ example { expect(described_class.new(context, :provider => "exa_mple")).to be_an(example_provider) }
15
+ example { expect(described_class.new(context, :provider => "exa-mple")).to be_an(example_provider) }
16
+ example { expect(described_class.new(context, :provider => "scri_pt")).to be_an(DPL::Provider::Script) }
17
+ example { expect(described_class.new(context, :provider => "scri _pt")).to be_an(DPL::Provider::Script) }
18
+ example { expect(described_class.new(context, :provider => "cloudfoundry")).to be_an(DPL::Provider::CloudFoundry) }
17
19
  example "install deployment dependencies" do
18
20
  expect_any_instance_of(described_class).to receive(:respond_to?).with(:install_deploy_dependencies).and_return(true)
19
21
  expect_any_instance_of(described_class).to receive(:install_deploy_dependencies)
20
- described_class.new(DummyContext.new, :provider => "example")
22
+ described_class.new(context, :provider => "example")
21
23
  end
24
+
25
+ it "installs correct gem when provider name does not match" do
26
+ expect(context).to receive(:shell).with("gem install dpl-cloud_foundry -v #{ENV['DPL_VERSION'] || DPL::VERSION}")
27
+ expect(described_class).to receive(:require).with("dpl/provider/cloud_foundry").and_raise LoadError.new("cannot load such file -- dpl/provider/cloud_foundry")
28
+ expect(described_class).to receive(:require).with("dpl/provider/cloud_foundry").and_call_original
29
+ described_class.new(context, :provider => 'cloudfoundry')
30
+ end
31
+
22
32
  end
23
33
 
24
34
  describe "#pip" do
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.9.1.travis.2639.5
4
+ version: 1.9.1.travis.2660.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-01 00:00:00.000000000 Z
11
+ date: 2018-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec