-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KBP-122 #time 1h 30m - Paperclip was integrated.
- Loading branch information
esref.viduslu
committed
Oct 30, 2017
1 parent
8434185
commit 8b5a94b
Showing
13 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cybele | ||
module Helpers | ||
module Paperclip | ||
def configure_paperclip | ||
# Add gems | ||
append_file('Gemfile', template_content('paperclip/paperclip_Gemfile.erb')) | ||
run_bundle | ||
|
||
create_paperclip_files | ||
end | ||
|
||
private | ||
|
||
def create_paperclip_files | ||
# Initialize file | ||
template 'paperclip/paperclip.rb.erb', | ||
'config/initializers/paperclip.rb', | ||
force: true | ||
|
||
# Add paperclip settings to the config/settings.yml file | ||
append_file 'config/settings.yml', | ||
template_content('paperclip/paperclip_settings.yml.erb') | ||
|
||
# Add paperclip env to the all env files | ||
append_file('env.sample', template_content('paperclip/paperclip_env_sample.erb')) | ||
append_file('.env.local', template_content('paperclip/paperclip_env_local.erb')) | ||
append_file('.env.staging', template_content('paperclip/paperclip_env_staging.erb')) | ||
append_file('.env.production', template_content('paperclip/paperclip_env_production.erb')) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#Remove command lines | ||
|
||
# Paperclip::Attachment.default_options[:storage] = :s3 | ||
# Paperclip::Attachment.default_options[:s3_host_name] = Settings.AWS.S3.end_point | ||
# Paperclip::Attachment.default_options[:s3_host_alias] = Settings.AWS.S3.aws_raw_url | ||
# Paperclip::Attachment.default_options[:bucket] = Settings.AWS.S3.bucket | ||
# Paperclip::Attachment.default_options[:s3_protocol] = 'https' | ||
# Paperclip::Attachment.default_options[:s3_credentials] = { | ||
# access_key_id: Settings.AWS.S3.access_key_id, | ||
# secret_access_key: Settings.AWS.S3.secret_access_key | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# Easy file attachment management for ActiveRecord. Amazon's S3 storage adapter. | ||
gem "paperclip", "~> 5.0.0" | ||
gem 'aws-sdk', '~> 2.3.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
S3_BUCKET_NAME=<%= app_name %>-development | ||
AWS_RAW_URL=<%= app_name %>-development.s3.amazonaws.com | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
S3_BUCKET_NAME=<%= app_name %> | ||
AWS_RAW_URL=<%= app_name %>.s3.amazonaws.com | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
S3_BUCKET_NAME= | ||
AWS_RAW_URL= | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
S3_BUCKET_NAME=<%= app_name %>-staging | ||
AWS_RAW_URL=<%= app_name %>-staging.s3.amazonaws.com | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
AWS: | ||
S3: | ||
bucket: <%= ENV['S3_BUCKET_NAME'] %> | ||
access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> | ||
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> | ||
aws_url: http://<%= ENV['AWS_RAW_URL'] %> | ||
aws_raw_url: <%= ENV['AWS_RAW_URL'] %> | ||
# Bucket region should be ireland for this setting | ||
end_point: s3-eu-west-1.amazonaws.com |