Only load Asset Sync when S3 is configured
I consider this a hack, it needs review so I won't push it straight to the main repo. I tried putting the same code in an initializer but that appears to be too late to properly initialize the asset_sync engine. See diaspora/diaspora#3102
This commit is contained in:
parent
f86aab3fe2
commit
39b0c2de11
2 changed files with 12 additions and 2 deletions
4
Gemfile
4
Gemfile
|
|
@ -119,7 +119,9 @@ group :assets do
|
||||||
|
|
||||||
gem 'handlebars_assets'
|
gem 'handlebars_assets'
|
||||||
gem 'uglifier'
|
gem 'uglifier'
|
||||||
gem "asset_sync"
|
|
||||||
|
# asset_sync is required as needed by application.rb
|
||||||
|
gem "asset_sync", :require => nil
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,12 @@ end
|
||||||
|
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
|
|
||||||
|
# Sanitize groups to make matching :assets easier
|
||||||
|
RAILS_GROUPS = Rails.groups(:assets => %w(development test)).map { |group| group.to_sym }
|
||||||
|
|
||||||
if defined?(Bundler)
|
if defined?(Bundler)
|
||||||
# If you precompile assets before deploying to production, use this line
|
# If you precompile assets before deploying to production, use this line
|
||||||
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
Bundler.require(*RAILS_GROUPS)
|
||||||
# If you want your assets lazily compiled in production, use this line
|
# If you want your assets lazily compiled in production, use this line
|
||||||
# Bundler.require(:default, :assets, Rails.env)
|
# Bundler.require(:default, :assets, Rails.env)
|
||||||
end
|
end
|
||||||
|
|
@ -90,3 +93,8 @@ module Diaspora
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Only load asset_sync if S3 is configured
|
||||||
|
if RAILS_GROUPS.include?(:assets) && ENV['AWS_ACCESS_KEY_ID']
|
||||||
|
require 'asset_sync'
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue