Skip to content

Commit dda1fbb

Browse files
author
hamdibayhan
committed
KBP-169 #time 20m - Fix settings.yml file bug
1 parent 7769295 commit dda1fbb

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

lib/cybele/helpers.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,11 @@ def replace_in_file(relative_path, find, replace)
1616
def template_content(file)
1717
File.read(File.expand_path(find_in_source_paths(file)))
1818
end
19+
20+
def configure_app_name(files)
21+
files.each do |file|
22+
gsub_file file, /<%= app_name %>/, app_name
23+
end
24+
end
1925
end
2026
end

lib/cybele/helpers/paperclip.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def configure_paperclip
99
run_bundle
1010

1111
create_paperclip_files
12-
configure_app_name
12+
configure_app_name(['env.sample', '.env.local', '.env.staging', '.env.production'])
1313
end
1414

1515
private
@@ -29,13 +29,6 @@ def create_paperclip_files
2929
append_file('.env.staging', template_content('paperclip/paperclip_env_staging.erb'))
3030
append_file('.env.production', template_content('paperclip/paperclip_env_production.erb'))
3131
end
32-
33-
def configure_app_name
34-
gsub_file 'env.sample', /<%= app_name %>/, app_name
35-
gsub_file '.env.local', /<%= app_name %>/, app_name
36-
gsub_file '.env.staging', /<%= app_name %>/, app_name
37-
gsub_file '.env.production', /<%= app_name %>/, app_name
38-
end
3932
end
4033
end
4134
end

lib/cybele/helpers/recipient_interceptor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ def configure_recipient_interceptor
1010
# Add recipient_interceptor staging settings to staging environment file
1111
append_file 'config/settings.yml',
1212
template_content('recipient_interceptor/recipient_interceptor_settings.yml.erb')
13+
14+
configure_app_name(['config/settings.yml'])
1315
end
1416
end
1517
end

templates/mailer/mailer_settings.yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
root_path: <%= ENV['ROOT_PATH'] %>
1+
22

33
smtp:
44
address: <%= ENV['SMTP_ADDRESS'] %>

0 commit comments

Comments
 (0)