root = Pathname.new(__FILE__).dirname.parent
config_path = root + 'config'
config_file = (config_path + 'env.development.yaml').realdirpath
json_file = (config_path + 'app_config.json').realdirpath
# Overwrite the `env.development.yaml` content with
# your own specific path to `app_config.json`
if ENV['APP_ENV'] == 'development'
config_location_pattern = /(?<=APP_CONFIG_LOCATION: ')[^']+/
content = File.read(config_file).sub!(config_location_pattern, "#{json_file}")
File.open(config_file, 'w') do |file|
file.write(content)
end
end