dpl 1.9.1.travis.2615.5 → 1.9.1.travis.2617.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dpl/provider.rb +11 -2
- data/lib/dpl/version.rb +1 -1
- data/spec/provider_spec.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee35e0bdea5d7875e3582e35045c179f15474e0bbbde47f66444cde7a2fdd6cc
|
4
|
+
data.tar.gz: 023fea2bca6ae703b7f19000fcc3edd5274427a5b6cffa700099e90ecd1cc2fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47e63a19c03adc5445b88eb2104c70d3aa99019ad7d2c2a875ea91cde6520c3380df42419f3792bd345896859c320a967fdb44272fa94bc39d9b1beee15d901
|
7
|
+
data.tar.gz: 659aaf868eb939dfec2d9eae144c98b1599f02c2266ed3a29d0dea2d02152edba4eb7c5ba36c0e29d3b3a43fa06164afc0cd1cb3701118f733cc4a0e347d24e5
|
data/lib/dpl/provider.rb
CHANGED
@@ -6,6 +6,10 @@ module DPL
|
|
6
6
|
class Provider
|
7
7
|
include FileUtils
|
8
8
|
|
9
|
+
# map of DPL provider class name constants to their corresponding
|
10
|
+
# file names. There is no simple rule to map them automatically
|
11
|
+
# (camel-cases, snake-cases, call-caps, etc.), so we need an explicit
|
12
|
+
# map.
|
9
13
|
PROVIDERS = {
|
10
14
|
'Anynines' => 'anynines',
|
11
15
|
'Appfog' => 'appfog',
|
@@ -54,6 +58,11 @@ module DPL
|
|
54
58
|
def self.new(context, options)
|
55
59
|
return super if self < Provider
|
56
60
|
|
61
|
+
# when requiring the file corresponding to the provider name
|
62
|
+
# given in the options, the general strategy is to normalize
|
63
|
+
# the option to lower-case alphanumeric, then
|
64
|
+
# use that key to find the file name using the PROVIDERS map.
|
65
|
+
|
57
66
|
context.fold("Installing deploy dependencies") do
|
58
67
|
begin
|
59
68
|
opt_lower = super.option(:provider).to_s.downcase
|
@@ -61,7 +70,7 @@ module DPL
|
|
61
70
|
name = PROVIDERS.keys.detect { |p| p.to_s.downcase == opt }
|
62
71
|
raise Error, "could not find provider %p" % opt unless name
|
63
72
|
|
64
|
-
require "dpl/provider/#{
|
73
|
+
require "dpl/provider/#{PROVIDERS[name]}"
|
65
74
|
provider = const_get(name).new(context, options)
|
66
75
|
rescue NameError, LoadError => e
|
67
76
|
if /uninitialized constant DPL::Provider::(?<provider_wanted>\S+)/ =~ e.message
|
@@ -76,7 +85,7 @@ module DPL
|
|
76
85
|
context.shell(install_cmd)
|
77
86
|
Gem.clear_paths
|
78
87
|
|
79
|
-
require "dpl/provider/#{
|
88
|
+
require "dpl/provider/#{PROVIDERS[name]}"
|
80
89
|
provider = const_get(name).new(context, options)
|
81
90
|
rescue DPL::Error
|
82
91
|
if opt_lower
|
data/lib/dpl/version.rb
CHANGED
data/spec/provider_spec.rb
CHANGED
@@ -12,6 +12,8 @@ describe DPL::Provider do
|
|
12
12
|
example { expect(described_class.new(DummyContext.new, :provider => "Example")) .to be_an(example_provider) }
|
13
13
|
example { expect(described_class.new(DummyContext.new, :provider => "exa_mple")).to be_an(example_provider) }
|
14
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) }
|
15
17
|
example "install deployment dependencies" do
|
16
18
|
expect_any_instance_of(described_class).to receive(:respond_to?).with(:install_deploy_dependencies).and_return(true)
|
17
19
|
expect_any_instance_of(described_class).to receive(:install_deploy_dependencies)
|