lib/dpl/provider.rb in dpl-1.7.8.travis.651.1 vs lib/dpl/provider.rb in dpl-1.7.8.travis.653.1

- old
+ new

@@ -40,11 +40,13 @@ return super if self < Provider context.fold("Installing deploy dependencies") do name = super.option(:provider).to_s.downcase.gsub(/[^a-z0-9]/, '') raise Error, 'could not find provider %p' % options[:provider] unless name = constants.detect { |c| c.to_s.downcase == name } - const_get(name).new(context, options) + provider = const_get(name).new(context, options) + provider.install_deploy_dependencies if provider.respond_to?(:install_deploy_dependencies) + provider end end def self.experimental(name) puts "", "!!! #{name} support is experimental !!!", "" @@ -71,11 +73,18 @@ def self.apt_get(name, command = name) context.shell("sudo apt-get -qq install #{name}", retry: true) if `which #{command}`.chop.empty? end - def self.pip(name, command = name) - context.shell("sudo pip install #{name}", retry: true) if `which #{command}`.chop.empty? + def self.pip(name, command = name, version = nil) + if version + puts "sudo pip install #{name}==#{version}" + context.shell("sudo pip uninstall -y #{name}") unless `which #{command}`.chop.empty? + context.shell("sudo pip install #{name}==#{version}", retry: true) + else + puts "sudo pip install #{name}" + context.shell("sudo pip install #{name}", retry: true) if `which #{command}`.chop.empty? + end end def self.npm_g(name, command = name) context.shell("npm install -g #{name}", retry: true) if `which #{command}`.chop.empty? end