Class: Biran::Configurinator
- Inherits:
-
Object
- Object
- Biran::Configurinator
show all
- Includes:
- ConfigDefaults
- Defined in:
- lib/biran/configurinator.rb
Constant Summary
collapse
- DEFAULT_ENV =
'development'
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#app_base, #app_defaults_init, #app_root, #app_shared_dir, #bindings, #config_dir, #configuration, #db_config_override_file, #default_db_config_file, #local_config_file, #secrets_file
Constructor Details
Returns a new instance of Configurinator.
28
29
30
|
# File 'lib/biran/configurinator.rb', line 28
def initialize
@config = build_app_config
end
|
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
10
11
12
|
# File 'lib/biran/configurinator.rb', line 10
def config
@config
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7
8
9
|
# File 'lib/biran/configurinator.rb', line 7
def config
@config
end
|
#db_config ⇒ Object
Returns the value of attribute db_config.
7
8
9
|
# File 'lib/biran/configurinator.rb', line 7
def db_config
@db_config
end
|
Class Method Details
12
13
14
15
|
# File 'lib/biran/configurinator.rb', line 12
def configure
self.config ||= Config.instance
yield config
end
|
.env ⇒ Object
21
22
23
24
25
|
# File 'lib/biran/configurinator.rb', line 21
def env
return @end if @env
return Rails.env if defined? Rails
DEFAULT_ENV
end
|
.env=(env) ⇒ Object
17
18
19
|
# File 'lib/biran/configurinator.rb', line 17
def env= env
@env = env
end
|
Instance Method Details
#create(name:, extension:, output_dir: nil) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/biran/configurinator.rb', line 42
def create(name:, extension:, output_dir: nil)
output_dir ||= config_dir
generated_file = ERBConfig.new(filtered_config, name, extension, config_dir, output_dir)
generated_file.bindings = bindings
generated_file.save!
end
|
#file_tasks ⇒ Object
32
33
34
|
# File 'lib/biran/configurinator.rb', line 32
def file_tasks
files_to_generate.keys
end
|
#files_to_generate ⇒ Object
36
37
38
39
40
|
# File 'lib/biran/configurinator.rb', line 36
def files_to_generate
@files_to_generate ||= config.fetch(:app, {})
.fetch(:files_to_generate, configuration.files_to_generate)
.tap { |files_list| files_list.each(&sanitize_config_files(files_list)) }
end
|