Exemplo n.º 1
0
    def _initPipeline(self):
        # Create the app and pipeline.
        self.app = PieCrust(root_dir=self.root_dir, debug=self.debug)
        if self.sub_cache_dir:
            self.app._useSubCacheDir(self.sub_cache_dir)
        self.pipeline = ProcessorPipeline(self.app, self.out_dir)

        # Get the list of assets directories.
        self._roots = list(self.pipeline.mounts.keys())

        # The 'assets' folder may not be in the mounts list if it doesn't
        # exist yet, but we want to monitor for when the user creates it.
        default_root = os.path.join(self.app.root_dir, 'assets')
        self._monitor_assets_root = (default_root not in self._roots)

        # Build the list of initial asset files.
        self._paths = set()
        for root in self._roots:
            for dirpath, dirnames, filenames in os.walk(root):
                self._paths |= set([os.path.join(dirpath, f)
                                    for f in filenames])
Exemplo n.º 2
0
    def runtest(self):
        fs = self._prepareMockFs()

        from piecrust.processing.pipeline import ProcessorPipeline
        with mock_fs_scope(fs):
            out_dir = fs.path('kitchen/_counter')
            app = fs.getApp()
            pipeline = ProcessorPipeline(app, out_dir)

            proc_names = self.spec.get('processors')
            if proc_names:
                pipeline.enabled_processors = proc_names

            record = pipeline.run()

            if not record.success:
                errors = []
                for e in record.entries:
                    errors += e.errors
                raise PipelineError(errors)

            check_expected_outputs(self.spec, fs, ExpectedPipelineOutputError)
Exemplo n.º 3
0
 def _bakeAssets(self, ctx, out_dir):
     proc = ProcessorPipeline(ctx.app, out_dir, force=ctx.args.force)
     record = proc.run()
     _merge_timers(record.timers, ctx.timers)
     return record.success
Exemplo n.º 4
0
def _get_pipeline(fs, app=None):
    app = app or fs.getApp()
    return ProcessorPipeline(app, fs.path('counter'))