summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/initializers/assets.rb1
-rw-r--r--config/initializers/customization.rb3
-rw-r--r--config/initializers/twitter.rb37
3 files changed, 40 insertions, 1 deletions
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100644
index 0000000..ccb32b6
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1 @@
+Rails.application.config.assets.precompile += %w( Avatar_Pic.png )
diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb
index 9f537e9..9b3a2b9 100644
--- a/config/initializers/customization.rb
+++ b/config/initializers/customization.rb
@@ -21,7 +21,8 @@ customization_directory = APP_CONFIG["customization_directory"]
# * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise
# this initializer will never get called in production mode when the assets are precompiled.
#
-Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets"
+# Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets"
+Rails.application.config.assets.paths.unshift "#{customization_directory}/assets"
#
# Copy files to public
diff --git a/config/initializers/twitter.rb b/config/initializers/twitter.rb
new file mode 100644
index 0000000..9f537e9
--- /dev/null
+++ b/config/initializers/twitter.rb
@@ -0,0 +1,37 @@
+#
+# When deploying, common customizations can be dropped in config/customizations. This initializer makes this work.
+#
+APP_CONFIG["customization_directory"] ||= "#{Rails.root}/config/customization"
+customization_directory = APP_CONFIG["customization_directory"]
+
+#
+# Set customization views as the first view path
+#
+# Rails.application.config.paths['app/views'].unshift "config/customization/views"
+# (For some reason, this does not work here. See application.rb for where this is actually called.)
+
+#
+# Set customization stylesheets as the first asset path
+#
+# Some notes:
+#
+# * This cannot go in application.rb, as far as I can tell. In application.rb, the default paths
+# haven't been loaded yet, so the path we add will always end up at the end unless we add it here.
+#
+# * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise
+# this initializer will never get called in production mode when the assets are precompiled.
+#
+Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets"
+
+#
+# Copy files to public
+#
+if !defined?(RAKE) && Dir.exist?("#{customization_directory}/public")
+ require 'fileutils'
+ FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public", :preserve => true)
+end
+
+#
+# Add I18n path
+#
+Rails.application.config.i18n.load_path += Dir["#{customization_directory}/locales/*.{rb,yml,yaml}"]