Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 3 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Showing with 38 additions and 6 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 Gemfile
  3. +17 −0 Gemfile.lock
  4. +9 −5 app/uploaders/image_uploader.rb
  5. +1 −1 config/environments/production.rb
  6. +9 −0 config/initializers/carrierwave.rb
View
1 .gitignore
@@ -7,6 +7,7 @@ chromedriver.log
config/application.yml
config/database.yml
coverage/
+uploads/
log/*.log
tmp
View
1 Gemfile
@@ -17,6 +17,7 @@ gem "figaro"
gem "heroku"
gem "bcrypt-ruby", :require => "bcrypt"
gem "carrierwave"
+gem "fog"
group :development, :test do
gem "cucumber-rails", "~> 1.3", require: false
View
17 Gemfile.lock
@@ -65,6 +65,7 @@ GEM
database_cleaner (0.7.1)
diff-lcs (1.1.3)
erubis (2.7.0)
+ excon (0.13.4)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.6.1)
@@ -77,6 +78,17 @@ GEM
ffi (1.0.11)
figaro (0.2.0)
rails (~> 3.0)
+ fog (1.3.1)
+ builder
+ excon (~> 0.13.0)
+ formatador (~> 0.2.0)
+ mime-types
+ multi_json (~> 1.0)
+ net-scp (~> 1.0.4)
+ net-ssh (>= 2.1.3)
+ nokogiri (~> 1.5.0)
+ ruby-hmac
+ formatador (0.2.1)
gherkin (2.9.0)
json (>= 1.4.6)
gravtastic (3.2.6)
@@ -106,6 +118,9 @@ GEM
method_source (0.7.1)
mime-types (1.17.2)
multi_json (1.1.0)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-ssh (2.3.0)
nokogiri (1.5.0)
pg (0.13.2)
polyglot (0.3.3)
@@ -153,6 +168,7 @@ GEM
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.8.0)
+ ruby-hmac (0.4.0)
rubyzip (0.9.6.1)
sass (3.1.15)
sass-rails (3.2.4)
@@ -201,6 +217,7 @@ DEPENDENCIES
factory_girl_rails (~> 1.7)
faker (~> 1.0)
figaro
+ fog
gravtastic
guard-rspec
heroku
View
14 app/uploaders/image_uploader.rb
@@ -11,14 +11,18 @@ class ImageUploader < CarrierWave::Uploader::Base
# include Sprockets::Helpers::IsolatedHelper
# Choose what kind of storage to use for this uploader:
- storage :file
- # storage :fog
+ #storage :file
+ storage :fog
+
+ def cache_dir
+ "#{Rails.root}/tmp/uploads"
+ end
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
- def store_dir
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
- end
+ #def store_dir
+ # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ #end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
View
2 config/environments/production.rb
@@ -28,7 +28,7 @@
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
+ config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
View
9 config/initializers/carrierwave.rb
@@ -0,0 +1,9 @@
+CarrierWave.configure do |config|
+ config.fog_credentials = {
+ provider: "AWS",
+ aws_access_key_id: ENV['S3_ACCESS_ID'],
+ aws_secret_access_key: ENV['S3_ACCESS_KEY']
+ }
+
+ config.fog_directory = ENV['S3_BUCKET_NAME']
+end

No commit comments for this range

Something went wrong with that request. Please try again.