class Serverkit::Actions::Base
Constants
- DEFAULT_LOG_LEVEL
Public Class Methods
Source
# File lib/serverkit/actions/base.rb, line 22 def initialize(hosts: nil, log_level: nil, recipe_path: nil, ssh_options: nil, variables_path: nil) @hosts = hosts @log_level = log_level @recipe_path = recipe_path @ssh_options = ssh_options @variables_path = variables_path end
@param [String, nil] hosts @param [Fixnum] log_level @param [String] recipe_path @param [Hash, nil] ssh_options For override default ssh options @param [Stirng, nil] variables_path
Public Instance Methods
Private Instance Methods
Source
# File lib/serverkit/actions/base.rb, line 37 def abort_with_errors abort recipe.errors.map { |error| "Error: #{error}" }.join("\n") end
Source
# File lib/serverkit/actions/base.rb, line 42 def backends if has_hosts? hosts.map do |host| Backends::SshBackend.new( host: host, log_level: @log_level, ssh_options: @ssh_options, ) end else [Backends::LocalBackend.new(log_level: @log_level)] end end
@return [Array<Serverkit::Backends::Base>]
Source
# File lib/serverkit/actions/base.rb, line 56 def bundle Bundler.require(:default) rescue Bundler::GemfileNotFound end
Source
# File lib/serverkit/actions/base.rb, line 66 def hosts if has_hosts? @hosts.split(",") end end
@return [Array<String>, nil]
Source
# File lib/serverkit/actions/base.rb, line 78 def recipe @recipe ||= Loaders::RecipeLoader.new(@recipe_path, variables_path: @variables_path).load end
@return [Serverkit::Recipe]
Source
# File lib/serverkit/actions/base.rb, line 72 def setup bundle abort_with_errors unless recipe.valid? end