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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2525611ba1f6e3c98069d288fb6aecc11b300e2216ac8af1f3295194e9b6c9a2
4
- data.tar.gz: 3ad1e3aa9f53f72d7e9f704bb03d550cca7197ba5b14798e9614615e9f7ec599
3
+ metadata.gz: ee35e0bdea5d7875e3582e35045c179f15474e0bbbde47f66444cde7a2fdd6cc
4
+ data.tar.gz: 023fea2bca6ae703b7f19000fcc3edd5274427a5b6cffa700099e90ecd1cc2fe
5
5
  SHA512:
6
- metadata.gz: b2067707814bc04667839e44158080426e038dd74e5777c47d8af2719569fc165148cf11a22f89a5968e141face0b333911800c44cbc4bbd935faf51d7316a2b
7
- data.tar.gz: d0f6bf340bd0933c872befbe5cc087f18f94098313d98b6385da8341ab3f10bc10d34642f46b72f66753dafd4dccac96a90a5b00f4cf51d768c4ea6b94809a76
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/#{opt_lower}"
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/#{opt_lower}"
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
@@ -1,3 +1,3 @@
1
1
  module DPL
2
- VERSION = '1.9.1.travis.2615.5'
2
+ VERSION = '1.9.1.travis.2617.5'
3
3
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1.travis.2615.5
4
+ version: 1.9.1.travis.2617.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase