Make Environment#pushes its own method

This commit is contained in:
Seth Vargo 2014-10-23 16:06:25 -04:00
parent 190da26404
commit 988518a6ba
1 changed files with 13 additions and 6 deletions

View File

@ -545,21 +545,21 @@ module Vagrant
def push(name=nil)
@logger.info("Getting push: #{name}")
if vagrantfile.pushes.nil? || vagrantfile.pushes.empty?
if pushes.nil? || pushes.empty?
raise Vagrant::Errors::PushesNotDefined
end
if name.nil?
if vagrantfile.pushes.length != 1
if pushes.length != 1
raise Vagrant::Errors::PushStrategyNotProvided,
pushes: vagrantfile.pushes
pushes: pushes
end
name = vagrantfile.pushes.first
name = pushes.first
else
if !vagrantfile.pushes.include?(name.to_sym)
if !pushes.include?(name.to_sym)
raise Vagrant::Errors::PushStrategyNotDefined,
name: name,
pushes: vagrantfile.pushes
pushes: pushes
end
end
@ -584,6 +584,13 @@ module Vagrant
end
end
# The list of pushes defined in this Vagrantfile.
#
# @return [Array<Symbol>]
def pushes
vagrantfile.pushes
end
# This returns a machine with the proper provider for this environment.
# The machine named by `name` must be in this environment.
#