Module: BranchDb

Defined in:
lib/branch_db.rb,
lib/branch_db/cloner.rb,
lib/branch_db/naming.rb,
lib/branch_db/cleaner.rb,
lib/branch_db/logging.rb,
lib/branch_db/railtie.rb,
lib/branch_db/version.rb,
lib/branch_db/pg_utils.rb,
lib/branch_db/preparer.rb,
lib/branch_db/git_utils.rb,
lib/branch_db/configuration.rb,
lib/generators/branch_db/install_generator.rb

Defined Under Namespace

Modules: GitUtils, Logging, Naming, PgUtils Classes: Cleaner, Cloner, Configuration, Error, InstallGenerator, Preparer, Railtie

Constant Summary collapse

VERSION =
"0.2.0".freeze

Class Method Summary collapse

Class Method Details

.configurationObject



16
# File 'lib/branch_db.rb', line 16

def configuration = @configuration ||= Configuration.new

.configure {|configuration| ... } ⇒ Object

Yields:



18
# File 'lib/branch_db.rb', line 18

def configure = yield(configuration)

.database_name(base_name) ⇒ Object



20
# File 'lib/branch_db.rb', line 20

def database_name(base_name) = Naming.database_name(base_name)

.database_override_for_env(env) ⇒ Object



33
34
35
36
# File 'lib/branch_db.rb', line 33

def database_override_for_env(env)
  value = ENV.fetch("BRANCH_DB_DATABASE_#{env.to_s.upcase}", nil)
  value if value && !value.empty?
end

.main_database_name(base_name) ⇒ Object



22
# File 'lib/branch_db.rb', line 22

def main_database_name(base_name) = Naming.main_database_name(base_name)

.overridden_for_env?(env) ⇒ Boolean

Returns:

  • (Boolean)


31
# File 'lib/branch_db.rb', line 31

def overridden_for_env?(env) = !database_override_for_env(env).nil?

.skip_for_env?(env, output: $stdout) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/branch_db.rb', line 24

def skip_for_env?(env, output: $stdout)
  return false unless overridden_for_env?(env)

  output.puts "⏭️  Skipping — BRANCH_DB_DATABASE_#{env.to_s.upcase} override in effect."
  true
end