class SozoMagento2::Info::Info

Class to out key information at the end of the deploy:check command

Constants

WHITELIST

Attributes

env[R]

Public Class Methods

new(env=Capistrano::Configuration.env) click to toggle source

Initialize the class with access to env data

# File lib/capistrano/sozo_magento2/info.rb, line 23
def initialize(env=Capistrano::Configuration.env)
    @env = env
end

Public Instance Methods

call() click to toggle source

Output the key information in the CLI

# File lib/capistrano/sozo_magento2/info.rb, line 28
def call
    title("Deployment Info")

    values = inspect_all_values

    table(values.keys.sort_by(&:to_s)) do |key, row|
        row.yellow if values[key] == "\"production\""
        row << key.inspect
        row << ''
        row << values[key]
    end
    
    puts("")
    warning("Make sure you check these values before deploying!")
    puts("")
end

Private Instance Methods

inspect_all_values() click to toggle source

Only include variables in the whitelist

# File lib/capistrano/sozo_magento2/info.rb, line 55
def inspect_all_values
    variables.keys.each_with_object({}) do |key, inspected|
        if WHITELIST.include?(key)
            inspected[key] = variables.peek(key).inspect
        end
    end
end
variables() click to toggle source

Read all variables in

# File lib/capistrano/sozo_magento2/info.rb, line 50
def variables
    env.variables
end