Sha256: b98ee90b44baee2374ebbe5234aae2b754528d033b1d8d580746e7cebdccf933

Contents?: true

Size: 1.99 KB

Versions: 6

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

module Dkdeploy
  # Global static methods
  #
  module Constants
    #####################################################
    # General constants
    #####################################################

    # Copy source path
    #
    # @return [String]
    def copy_source
      fetch :copy_source, '.'
    end

    # Local Dump Path
    #
    # @return [String]
    def local_dump_path
      fetch :local_dump_path, 'temp'
    end

    # Copy exclude pattern
    #
    # @return [Array]
    def copy_exclude
      fetch :copy_exclude, []
    end

    # Application name
    #
    # @return [String]
    def application
      fetch(:application)
    end

    # Assets path
    #
    # @return [String]
    def assets_path
      File.join shared_path, 'assets'
    end

    # File path to remote database config file
    #
    # @return [String]
    def remote_database_config_path
      File.join shared_path, 'config', "db_settings.#{fetch(:stage)}.yaml"
    end

    # File path to local database config file
    #
    # @return [String]
    def local_database_config_path
      File.join 'temp', "db_settings.#{fetch(:stage)}.yaml"
    end

    # Default timestamp format for database dump files
    #
    # @return [String]
    def datetime_format
      '%Y-%m-%d_%H-%M'
    end

    # List of table names to be ignored by default when dumping from database
    #
    # @return [String]
    def default_ignore_tables
      %w[]
    end

    # List of table names to be ignored when dumping from database defined via Capistrano variable or environment variable
    #
    # @return [Array]
    def additional_ignore_tables
      env_array_list = ENV.fetch('ADDITIONAL_IGNORE_TABLES', '').split ' '
      cap_array_list = fetch(:additional_ignore_tables, [])
      env_array_list | cap_array_list
    end

    # List of table names to be ignored when dumping from database
    #
    # @return [String]
    def ignore_tables
      default_ignore_tables | additional_ignore_tables
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dkdeploy-core-10.0.0 lib/dkdeploy/constants.rb
dkdeploy-core-9.3.1 lib/dkdeploy/constants.rb
dkdeploy-core-9.2.4 lib/dkdeploy/constants.rb
dkdeploy-core-9.3.0 lib/dkdeploy/constants.rb
dkdeploy-core-9.2.3 lib/dkdeploy/constants.rb
dkdeploy-core-9.2.2 lib/dkdeploy/constants.rb