@@ -0,0 +1,1511 @@
+# -*- coding: utf-8 -*-%0A#%0A# This file is part of Flask-Collect.%0A# Copyright (C) 2014 CERN.%0A#%0A# Flask-Collect is free software; you can redistribute it and/or modify it%0A# under the terms of the Revised BSD License; see LICENSE file for%0A# more details.%0A%0A%22%22%22%0ASymbolic link storage for development mode.%0A%0AIt creates symbolic links to the real files so any changes to them will be%0Areflected.%0A%22%22%22%0A%0Aimport os%0Afrom .base import BaseStorage%0A%0A%0Aclass Storage(BaseStorage):%0A%0A    %22%22%22Storage that creates symlinks to the resources.%22%22%22%0A%0A    def run(self):%0A        %22%22%22Collect static from blueprints.%0A%0A        Create the directory tree but will symlink all the files.%0A        %22%22%22%0A        self.log(%22Collect static from blueprints%22)%0A        skipped, total = 0, 0%0A        for bp, f, o in self:%0A            destination = os.path.join(self.collect.static_root, o)%0A            destination_dir = os.path.dirname(destination)%0A            if not os.path.exists(destination_dir):%0A                os.makedirs(destination_dir)%0A%0A            if not os.path.exists(destination):%0A                # the path is a link, but points to invalid location%0A                if os.path.islink(destination):%0A                    os.remove(destination)%0A                os.symlink(f, destination)%0A                self.log(%22%7B0%7D:%7B1%7D symbolink link created%22.format(bp.name, o))%0A            else:%0A                skipped += 1%0A            total += 1%0A        self.log(%22%7B0%7D of %7B1%7D files already present%22.format(skipped, total))%0A        self.log(%22Done collecting.%22)%0A

Add symbolic link storage