summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-11-14 02:19:03 -0800
committerelijah <elijah@riseup.net>2013-11-14 02:23:38 -0800
commit10be8c0073b67dcfb7925996e81c2e717f8b499e (patch)
treef96e03786c87baf2f501e34e46153cd2a64f1ef5 /config/initializers
parent8c19b447dec3982107f93ea1ae2626f844045249 (diff)
added support for easier customizations via "config/customization" directory
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/customization.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb
new file mode 100644
index 0000000..a2f6f88
--- /dev/null
+++ b/config/initializers/customization.rb
@@ -0,0 +1,31 @@
+#
+# When deploying, common customizations can be dropped in config/customizations. This initializer makes this work.
+#
+customization_directory = "#{Rails.root}/config/customization"
+
+#
+# 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
+#
+# (This cannot go in application.rb, because the default paths
+# haven't been loaded yet, as far as I can tell)
+#
+Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets"
+
+#
+# Copy files to public
+#
+if Dir.exists?("#{customization_directory}/public")
+ require 'fileutils'
+ FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public")
+end
+
+#
+# Add I18n path
+#
+Rails.application.config.i18n.load_path += Dir["#{customization_directory}/locales/*.{rb,yml,yaml}"]