Module: Biran::ConfigDefaults

Included in:
Configurinator
Defined in:
lib/biran/config_defaults.rb

Instance Method Summary collapse

Instance Method Details

#app_baseObject



22
23
24
# File 'lib/biran/config_defaults.rb', line 22

def app_base
  @app_base ||= ENV['BIRAN_APP_BASE_PATH'] || app_config_defaults[:app][:base_path] || app_config_defaults[:app][:root_path]
end

#app_defaults_initObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/biran/config_defaults.rb', line 7

def app_defaults_init
  {
    app: {
      base_path: configuration.base_path,
      shared_dir: configuration.shared_dir,
      base_dir: configuration.base_dir,
      use_capistrano: configuration.use_capistrano,
      files_to_generate: configuration.files_to_generate,
      db_config: configuration.db_config,
      secrets: configuration.secrets,
      bindings: configuration.bindings
    }
  }
end

#app_rootObject



26
27
28
29
# File 'lib/biran/config_defaults.rb', line 26

def app_root
  return File.join(app_base, 'current') if use_capistrano?
  app_base
end

#app_shared_dirObject



31
32
33
34
# File 'lib/biran/config_defaults.rb', line 31

def app_shared_dir
  return File.join(app_base, 'shared') if use_capistrano?
  app_base
end

#bindingsObject



36
37
38
# File 'lib/biran/config_defaults.rb', line 36

def bindings
  app_config_defaults[:app][:bindings]
end

#config_dirObject



40
41
42
# File 'lib/biran/config_defaults.rb', line 40

def config_dir
  File.join configuration.root_path, configuration.config_dirname
end

#configurationObject



3
4
5
# File 'lib/biran/config_defaults.rb', line 3

def configuration
  Config.instance
end

#db_config_override_fileObject



49
50
51
# File 'lib/biran/config_defaults.rb', line 49

def db_config_override_file
  File.join(app_shared_dir, configuration.config_dirname, configuration.db_config_filename)
end

#default_db_config_fileObject



57
58
59
# File 'lib/biran/config_defaults.rb', line 57

def default_db_config_file
  Rails.root.join(configuration.config_dirname, configuration.db_config_filename)
end

#local_config_fileObject



44
45
46
47
# File 'lib/biran/config_defaults.rb', line 44

def local_config_file
  ENV['BIRAN_LOCAL_CONFIG_FILE'] ||
    File.join(app_shared_dir, configuration.config_dirname, configuration.local_config_filename)
end

#secrets_fileObject



53
54
55
# File 'lib/biran/config_defaults.rb', line 53

def secrets_file
  File.join(configuration.root_path, configuration.config_dirname, configuration.secrets_filename)
end

#use_capistrano?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/biran/config_defaults.rb', line 61

def use_capistrano?
  # Implement in consumer class
end