From d151e37e2ea8936df49d95e0fff986b9c1d49f6e Mon Sep 17 00:00:00 2001 From: Godwin Date: Sat, 2 May 2015 17:41:41 -0700 Subject: [PATCH] Adding preview environment --- Gemfile | 2 +- app/helpers/application_helper.rb | 2 +- app/models/translation.rb | 3 --- config/assets_cdn.yml | 6 ++++++ config/initializers/carrierwave.rb | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) delete mode 100644 app/models/translation.rb diff --git a/Gemfile b/Gemfile index 3bce496..63afa5b 100644 --- a/Gemfile +++ b/Gemfile @@ -59,7 +59,7 @@ group :test do gem 'database_cleaner' end -group :staging, :production do +group :staging, :production, :preview do gem 'rails_12factor' gem 'capistrano' gem 'rvm-capistrano' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index eb8f473..6d4e2d1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -511,7 +511,7 @@ module ApplicationHelper end def is_production? - Rails.env == 'production' + Rails.env == 'production' || Rails.env == 'preview' end def is_test? diff --git a/app/models/translation.rb b/app/models/translation.rb deleted file mode 100644 index d8c6e87..0000000 --- a/app/models/translation.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Translation < I18n::Backend::ActiveRecord::Translation - has_paper_trail -end diff --git a/config/assets_cdn.yml b/config/assets_cdn.yml index 5638a59..a942a6c 100644 --- a/config/assets_cdn.yml +++ b/config/assets_cdn.yml @@ -2,6 +2,12 @@ development: enabled: false host: bikebike.org +preview: + enabled: true + host: preview-cdn.bikebike.org + protocol: https + fallback_protocol: http + production: enabled: true host: cdn.bikebike.org diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 9c0b098..6dc9f99 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -1,5 +1,7 @@ CarrierWave.configure do |config| if Rails.env == "production" config.asset_host = "https://cdn.bikebike.org" + elsif Rails.env == "preview" + config.asset_host = "https://preview-cdn.bikebike.org" end end