require 'astrovan/session' module Astrovan # Create a deployment session for the specified remote hosts. # # The provided block will execute within the context of the newly created session. def using(*hosts, &block) raise ArgumentError, "Missing block" unless block_given? env = hosts.last.is_a?(Hash) ? hosts.pop : {} raise ArgumentError, "Missing host" unless hosts.any? session = Session.new(hosts.flatten, env) session.instance_eval(&block) session.close end end include Astrovan