Skip to content

Commit

Permalink
#110 paperclip amazon s3 settings added to initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
hamitturkukaya committed Dec 25, 2013
1 parent 8d41713 commit 05948c9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def add_disable_xml_params
copy_file 'config/initializers/disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
end

def add_paperclip_aws
copy_file 'config/initializers/paperclip.rb', 'config/initializers/paperclip.rb'
end

def replace_erb_with_haml
remove_file 'app/views/layouts/application.html.erb'
template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', force: true
Expand Down
6 changes: 6 additions & 0 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def customization
invoke :setup_editorconfig
invoke :setup_ruby_version
invoke :setup_add_disable_xml_params
invoke :setup_add_paperclip_aws
invoke :setup_database
invoke :remove_files_we_dont_need
invoke :replace_files
Expand Down Expand Up @@ -62,6 +63,11 @@ def setup_add_disable_xml_params
build :add_disable_xml_params
end

def setup_add_paperclip_aws
say 'Add paperclip.rb file to initilizers'
build :add_paperclip_aws
end

def remove_files_we_dont_need
say 'Remove files we don\'t need'
build :remove_readme_rdoc
Expand Down
8 changes: 8 additions & 0 deletions templates/config/initializers/paperclip.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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_credentials] = {
access_key_id: Settings.AWS.S3.access_key_id,
secret_access_key: Settings.AWS.S3.secret_access_key
}
3 changes: 2 additions & 1 deletion templates/config/settings/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Aws:
access_key_id: XXXXXXXXXXXXXXXX
secret_access_key: YYYYYYYYYYYYYYYYYY
aws_url: http://projectname-production.s3.amazonaws.com/
aws_raw_url: projectname-production.s3.amazonaws.com
aws_raw_url: projectname-production.s3.amazonaws.com
end_point: s3-eu-west-1.amazonaws.com
3 changes: 2 additions & 1 deletion templates/config/settings/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Aws:
access_key_id: XXXXXXXXXXXXXXXX
secret_access_key: YYYYYYYYYYYYYYYYYY
aws_url: http://projectname-production.s3.amazonaws.com/
aws_raw_url: projectname-production.s3.amazonaws.com
aws_raw_url: projectname-production.s3.amazonaws.com
end_point: s3-eu-west-1.amazonaws.com
2 changes: 1 addition & 1 deletion templates/cybele_Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem 'jquery-rails', '~> 3.0.4'
gem 'turbolinks', '~> 1.3.0'
gem 'haml', '~> 4.0.2'
gem 'haml-rails'
gem 'bootstrap-sass', '~> 3.0.3.0
gem 'bootstrap-sass', '~> 3.0.3.0'
gem 'responders', '~> 1.0.0.rc'
gem 'exception_notification', '~> 4.0.1'
gem 'simple_form', '~> 3.0.0.rc'
Expand Down

0 comments on commit 05948c9

Please sign in to comment.