diff --git a/Gemfile b/Gemfile index f966887f..d5fdf861 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,8 @@ gem 'font-awesome-rails', '~> 4.3.0.0' gem 'rails-assets-growl' gem "paperclip", "~> 4.2" gem 'delayed_paperclip' +gem 'fog' +gem 'fog-aws' gem 'momentjs-rails', '>= 2.9.0' gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14' diff --git a/Gemfile.lock b/Gemfile.lock index b94af2ab..e017f831 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,7 @@ GEM remote: https://rubygems.org/ remote: https://rails-assets.org/ specs: + CFPropertyList (2.3.1) actionmailer (4.2.1) actionpack (= 4.2.1) actionview (= 4.2.1) @@ -95,6 +96,7 @@ GEM equalizer (0.0.11) erubis (2.7.0) eventmachine (1.0.7) + excon (0.45.1) execjs (2.5.2) factory_girl (4.5.0) activesupport (>= 3.0.0) @@ -107,12 +109,95 @@ GEM multipart-post (>= 1.2, < 3) faraday_middleware (0.9.1) faraday (>= 0.7.4, < 0.10) + fission (0.5.0) + CFPropertyList (~> 2.2) + fog (1.28.0) + fog-atmos + fog-aws (~> 0.0) + fog-brightbox (~> 0.4) + fog-core (~> 1.27, >= 1.27.3) + fog-ecloud + fog-json + fog-profitbricks + fog-radosgw (>= 0.0.2) + fog-riakcs + fog-sakuracloud (>= 0.0.4) + fog-serverlove + fog-softlayer + fog-storm_on_demand + fog-terremark + fog-vmfusion + fog-voxel + fog-xml (~> 0.1.1) + ipaddress (~> 0.5) + nokogiri (~> 1.5, >= 1.5.11) + fog-atmos (0.1.0) + fog-core + fog-xml + fog-aws (0.1.1) + fog-core (~> 1.27) + fog-json (~> 1.0) + fog-xml (~> 0.1) + ipaddress (~> 0.8) + fog-brightbox (0.7.1) + fog-core (~> 1.22) + fog-json + inflecto (~> 0.0.2) + fog-core (1.29.0) + builder + excon (~> 0.38) + formatador (~> 0.2) + mime-types + net-scp (~> 1.1) + net-ssh (>= 2.1.3) + fog-ecloud (0.0.2) + fog-core + fog-xml + fog-json (1.0.0) + multi_json (~> 1.0) + fog-profitbricks (0.0.2) + fog-core + fog-xml + nokogiri + fog-radosgw (0.0.3) + fog-core (>= 1.21.0) + fog-json + fog-xml (>= 0.0.1) + fog-riakcs (0.1.0) + fog-core + fog-json + fog-xml + fog-sakuracloud (1.0.0) + fog-core + fog-json + fog-serverlove (0.1.1) + fog-core + fog-json + fog-softlayer (0.4.1) + fog-core + fog-json + fog-storm_on_demand (0.1.0) + fog-core + fog-json + fog-terremark (0.0.4) + fog-core + fog-xml + fog-vmfusion (0.0.1) + fission + fog-core + fog-voxel (0.0.2) + fog-core + fog-xml + fog-xml (0.1.1) + fog-core + nokogiri (~> 1.5, >= 1.5.11) font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) font-kit-rails (1.1.0) rails foreman (0.78.0) thor (~> 0.19.1) + formatador (0.2.5) globalid (0.3.5) activesupport (>= 4.1.0) haml (4.0.6) @@ -125,6 +210,8 @@ GEM http_accept_language (2.0.5) http_parser.rb (0.6.0) i18n (0.7.0) + inflecto (0.0.2) + ipaddress (0.8.0) jbuilder (2.2.13) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) @@ -158,6 +245,9 @@ GEM mysql2 (0.3.18) naught (1.0.0) nested_form (0.3.2) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (2.9.2) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) nokogumbo (1.2.0) @@ -377,6 +467,8 @@ DEPENDENCIES devise-async factory_girl_rails faker + fog + fog-aws font-awesome-rails (~> 4.3.0.0) font-kit-rails foreman diff --git a/config/initializers/25_paperclip.rb b/config/initializers/25_paperclip.rb new file mode 100644 index 00000000..19c754db --- /dev/null +++ b/config/initializers/25_paperclip.rb @@ -0,0 +1,9 @@ +Paperclip::Attachment.default_options[:storage] = :fog +Paperclip::Attachment.default_options[:fog_credentials] = {:provider => "Local", :local_root => "#{Rails.root}/public"} +Paperclip::Attachment.default_options[:fog_directory] = "/system" +Paperclip::Attachment.default_options[:fog_host] = "/system" +unless APP_CONFIG["fog"].nil? + Paperclip::Attachment.default_options[:fog_credentials] = APP_CONFIG["fog"]["credentials"] unless APP_CONFIG["fog"]["credentials"].nil? + Paperclip::Attachment.default_options[:fog_directory] = APP_CONFIG["fog"]["directory"] unless APP_CONFIG["fog"]["directory"].nil? + Paperclip::Attachment.default_options[:fog_host] = APP_CONFIG["fog"]["host"] unless APP_CONFIG["fog"]["host"].nil? +end diff --git a/config/justask.yml.example b/config/justask.yml.example index 2fa3321b..fde5f56f 100644 --- a/config/justask.yml.example +++ b/config/justask.yml.example @@ -42,3 +42,14 @@ admins: about_text: Filippus subtext: Moderator Management & Support +# delete if using local storage +fog: + # fog credentials + credentials: + provider: 'AWS' + aws_access_key_id: 'ACCESS KEY' + aws_secret_access_key: 'SECRET KEY' + # bucket name + directory: 'retrospring-user-content' + # URL host + host: "retrospring-user-content.s3.amazonaws.com"