Skip to content

Commit

Permalink
KBP-169 #time 20m - Fix settings.yml file bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdibayhan committed Nov 21, 2017
1 parent 7769295 commit dda1fbb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 6 additions & 0 deletions lib/cybele/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ def replace_in_file(relative_path, find, replace)
def template_content(file)
File.read(File.expand_path(find_in_source_paths(file)))
end

def configure_app_name(files)
files.each do |file|
gsub_file file, /<%= app_name %>/, app_name
end
end
end
end
9 changes: 1 addition & 8 deletions lib/cybele/helpers/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def configure_paperclip
run_bundle

create_paperclip_files
configure_app_name
configure_app_name(['env.sample', '.env.local', '.env.staging', '.env.production'])
end

private
Expand All @@ -29,13 +29,6 @@ def create_paperclip_files
append_file('.env.staging', template_content('paperclip/paperclip_env_staging.erb'))
append_file('.env.production', template_content('paperclip/paperclip_env_production.erb'))
end

def configure_app_name
gsub_file 'env.sample', /<%= app_name %>/, app_name
gsub_file '.env.local', /<%= app_name %>/, app_name
gsub_file '.env.staging', /<%= app_name %>/, app_name
gsub_file '.env.production', /<%= app_name %>/, app_name
end
end
end
end
2 changes: 2 additions & 0 deletions lib/cybele/helpers/recipient_interceptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def configure_recipient_interceptor
# Add recipient_interceptor staging settings to staging environment file
append_file 'config/settings.yml',
template_content('recipient_interceptor/recipient_interceptor_settings.yml.erb')

configure_app_name(['config/settings.yml'])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion templates/mailer/mailer_settings.yml.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
root_path: <%= ENV['ROOT_PATH'] %>


smtp:
address: <%= ENV['SMTP_ADDRESS'] %>
Expand Down

0 comments on commit dda1fbb

Please sign in to comment.