From c6d158bd811d6bb18c5bc059fb173f2dfd485eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Thu, 13 Jun 2013 18:36:07 +0200 Subject: [PATCH] move asset_sync require to the earliest point possible --- Changelog.md | 3 ++- config/application.rb | 3 +++ config/asset_sync.rb | 11 +++++++++++ config/initializers/asset_sync.rb | 4 +--- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 config/asset_sync.rb diff --git a/Changelog.md b/Changelog.md index c68b38c2824..0ff56320ef0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,8 +19,9 @@ * Fix posting to Twitter [#2758](https://github.com/diaspora/diaspora/issues/2758) * Don't show hovercards for current user in comments [#3999](https://github.com/diaspora/diaspora/issues/3999) * Replace mentions of out-of-aspect people with markdown links [#4161](https://github.com/diaspora/diaspora/pull/4161) -* Unify hide and ignore [#3828](https://github.com/diaspora/diaspora/issues/3828) +* Unify hide and ignore [#3827](https://github.com/diaspora/diaspora/issues/3828) * Remove alpha branding [#4196](https://github.com/diaspora/diaspora/issues/4196) +* Fix dynamic loading of asset_sync ## Features diff --git a/config/application.rb b/config/application.rb index e6c687e8877..d061da7642d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -3,6 +3,9 @@ require 'rails/all' Bundler.require(*Rails.groups(:assets => %w(development test))) if defined?(Bundler) +# Load asset_sync early +require_relative 'asset_sync' + module Diaspora class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. diff --git a/config/asset_sync.rb b/config/asset_sync.rb new file mode 100644 index 00000000000..ecfa36daedb --- /dev/null +++ b/config/asset_sync.rb @@ -0,0 +1,11 @@ +if AppConfig.environment.assets.upload? && AppConfig.environment.s3.enable? + # Monkey patch to make Rails.root available early + require 'pathname' + module Rails + def self.root + @@root ||= Pathname.new(__FILE__).dirname.join('..') + end + end + + require 'asset_sync' +end diff --git a/config/initializers/asset_sync.rb b/config/initializers/asset_sync.rb index 227cde49237..5686d12e223 100644 --- a/config/initializers/asset_sync.rb +++ b/config/initializers/asset_sync.rb @@ -1,6 +1,4 @@ - -if AppConfig.environment.assets.upload? && AppConfig.environment.s3.enable? - require 'asset_sync' +if defined? AssetSync AssetSync.configure do |config| config.enabled = true