コード例 #1
0
ファイル: run.py プロジェクト: jackqu7/Facio
    def run(self):
        """ Run the Facio processes. """

        interface = CommandLineInterface()
        interface.start()

        config = ConfigurationFile()
        parsed = config.read()

        settings = Settings(interface, parsed)
        state.update_context_variables(settings.get_variables())

        template = Template(settings.get_template_path())
        template.update_copy_ignore_globs(settings.copy_ignore_globs())
        template.update_render_ignore_globs(settings.render_ignore_globs())
        template.copy()

        pipeline = Hook()
        pipeline.load(os.path.join(
            state.get_project_root(),
            HOOKS_FILE_NAME))

        if pipeline.has_before():
            pipeline.run_before()

        template.rename()
        template.render()

        if pipeline.has_after():
            pipeline.run_after()

        self.success('Done')
コード例 #2
0
    def run(self):
        """ Run the Facio processes. """

        interface = CommandLineInterface()
        interface.start()

        config = ConfigurationFile()
        parsed = config.read()

        settings = Settings(interface, parsed)
        state.update_context_variables(settings.get_variables())

        template = Template(settings.get_template_path())
        template.update_copy_ignore_globs(settings.copy_ignore_globs())
        template.update_render_ignore_globs(settings.render_ignore_globs())
        template.copy()

        pipeline = Hook()
        pipeline.load(os.path.join(state.get_project_root(), HOOKS_FILE_NAME))

        if pipeline.has_before():
            pipeline.run_before()

        template.rename()
        template.render()

        if pipeline.has_after():
            pipeline.run_after()

        self.success('Done')
コード例 #3
0
ファイル: test_template.py プロジェクト: jackqu7/Facio
    def test_rename(self, mock_move, mock_walk):
        mock_walk.return_value = [(
            '/foo',  # Root
            ['{{PROJECT_NAME}}', 'baz'],  # Dirs
            ['bar.py', '{{PROJECT_NAME}}.png', 'baz.gif'],  # Files
        )]

        instance = Template('/foo/bar')
        instance.rename()

        self.assertEqual(self.mocked_facio_template_Template_out.call_count, 2)
        self.mocked_facio_template_Template_out.has_any_call(
            'Renaming /foo/{{PROJECT_NAME}} to /foo/foo')
        self.mocked_facio_template_Template_out.has_any_call(
            'Renaming /foo/{{PROJECT_NAME}}.png to /foo/foo.png')