aboutsummaryrefslogtreecommitdiffstats
path: root/install.rb
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-07-19 15:45:06 +0200
committerDavid Cabo <david@calibea.com>2011-07-19 15:45:06 +0200
commitbf3c5bca65040a617dbed55b523978d75ed118f1 (patch)
tree8ccc16b5ef8b94f68607d7d70f6fc2f143c627a7 /install.rb
parentb6f4b8045a6bfa240260482113c05f470f674351 (diff)
Improved handling of static assets in themes:
- Symbolic link created automatically during install (and removed when uninstall) - As an example, replaced the default logo with a new image
Diffstat (limited to 'install.rb')
-rw-r--r--install.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/install.rb b/install.rb
index f7732d3..d99bc70 100644
--- a/install.rb
+++ b/install.rb
@@ -1 +1,17 @@
# Install hook code here
+
+plugin_path = File.expand_path(File.join(File.dirname(__FILE__), "public"))
+main_app_path = File.join(RAILS_ROOT, 'public', 'alavetelitheme')
+
+# If the symlink to be created exists, warn the user and do nothing
+if File.exists?(main_app_path)
+ puts "WARNING: #{main_app_path} already exists, the symbolic link won't be created"
+else # Create symlink
+ begin
+ print "Creating symbolink link from #{main_app_path} to #{plugin_path}... "
+ File.symlink(plugin_path, main_app_path)
+ puts "done"
+ rescue NotImplemented
+ puts "failed: symbolic links not supported"
+ end
+end \ No newline at end of file