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