lib/dpl/provider.rb in dpl-1.4.1 vs lib/dpl/provider.rb in dpl-1.4.2
- old
+ new
@@ -8,10 +8,11 @@
autoload :Heroku, 'dpl/provider/heroku'
autoload :EngineYard, 'dpl/provider/engine_yard'
autoload :DotCloud, 'dpl/provider/dot_cloud'
autoload :Nodejitsu, 'dpl/provider/nodejitsu'
autoload :Openshift, 'dpl/provider/openshift'
+ autoload :RubyGems, 'dpl/provider/rubygems'
def self.new(context, options)
return super if self < Provider
context.fold("Installing deploy dependencies") do
@@ -62,50 +63,40 @@
options.fetch(name) do
alternatives.any? ? option(*alternatives) : raise(Error, "missing #{name}")
end
end
- def should_deploy?
- (not options[:tags_only] or has_tag?)
- end
-
- def has_tag?
- context.shell('git describe --exact-match')
- $?.success?
- end
-
def deploy
rm_rf ".dpl"
mkdir_p ".dpl"
- if should_deploy?
- context.fold("Preparing deploy") do
- check_auth
- check_app
- if needs_key?
- create_key(".dpl/id_rsa")
- setup_key(".dpl/id_rsa.pub")
- setup_git_ssh(".dpl/git-ssh", ".dpl/id_rsa")
- end
+ context.fold("Preparing deploy") do
+ check_auth
+ check_app
- cleanup
+ if needs_key?
+ create_key(".dpl/id_rsa")
+ setup_key(".dpl/id_rsa.pub")
+ setup_git_ssh(".dpl/git-ssh", ".dpl/id_rsa")
end
- context.fold("Deploying application") { push_app }
+ cleanup
+ end
- Array(options[:run]).each do |command|
- if command == 'restart'
- context.fold("Restarting application") { restart }
- else
- context.fold("Running %p" % command) { run(command) }
- end
+ context.fold("Deploying application") { push_app }
+
+ Array(options[:run]).each do |command|
+ if command == 'restart'
+ context.fold("Restarting application") { restart }
+ else
+ context.fold("Running %p" % command) { run(command) }
end
end
- ensure
- if needs_key?
- remove_key rescue nil
- end
+ ensure
+ if needs_key?
+ remove_key rescue nil
end
+ end
def sha
@sha ||= ENV['TRAVIS_COMMIT'] || `git rev-parse HEAD`.strip
end