diff piecrust/processing/compass.py @ 852:4850f8c21b6e

core: Start of the big refactor for PieCrust 3.0. * Everything is a `ContentSource`, including assets directories. * Most content sources are subclasses of the base file-system source. * A source is processed by a "pipeline", and there are 2 built-in pipelines, one for assets and one for pages. The asset pipeline is vaguely functional, but the page pipeline is completely broken right now. * Rewrite the baking process as just running appropriate pipelines on each content item. This should allow for better parallelization.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 17 May 2017 00:11:48 -0700
parents c4b3a7fd2f87
children 12a1bd7af52e
line wrap: on
line diff
--- a/piecrust/processing/compass.py	Sat Apr 29 21:42:22 2017 -0700
+++ b/piecrust/processing/compass.py	Wed May 17 00:11:48 2017 -0700
@@ -28,13 +28,13 @@
     def initialize(self, app):
         super(CompassProcessor, self).initialize(app)
 
-    def onPipelineStart(self, pipeline):
-        super(CompassProcessor, self).onPipelineStart(pipeline)
-        self._maybeActivate(pipeline)
+    def onPipelineStart(self, ctx):
+        super(CompassProcessor, self).onPipelineStart(ctx)
+        self._maybeActivate(ctx)
 
-    def onPipelineEnd(self, pipeline):
-        super(CompassProcessor, self).onPipelineEnd(pipeline)
-        self._maybeRunCompass(pipeline)
+    def onPipelineEnd(self, ctx):
+        super(CompassProcessor, self).onPipelineEnd(ctx)
+        self._maybeRunCompass(ctx)
 
     def matches(self, path):
         if self._state != self.STATE_ACTIVE:
@@ -62,7 +62,7 @@
                              "is done.")
                 self._runInSite = True
 
-    def _maybeActivate(self, pipeline):
+    def _maybeActivate(self, ctx):
         if self._state != self.STATE_UNKNOWN:
             return
 
@@ -95,17 +95,17 @@
         if custom_args:
             self._args += ' ' + custom_args
 
-        out_dir = pipeline.out_dir
-        tmp_dir = os.path.join(pipeline.tmp_dir, 'compass')
+        out_dir = ctx.out_dir
+        tmp_dir = os.path.join(ctx.tmp_dir, 'compass')
         self._args = multi_replace(
-                self._args,
-                {'%out_dir%': out_dir,
-                    '%tmp_dir%': tmp_dir})
+            self._args,
+            {'%out_dir%': out_dir,
+             '%tmp_dir%': tmp_dir})
 
         self._runInSite = False
         self._runInTheme = False
 
-    def _maybeRunCompass(self, pipeline):
+    def _maybeRunCompass(self, ctx):
         if self._state != self.STATE_ACTIVE:
             return