コード例 #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
ファイル: test_template.py プロジェクト: jackqu7/Facio
    def test_update_copy_ignore_globs_empty_wrong_type(self):
        instance = Template('/foo/bar')
        del(instance.copy_ignore_globs)

        instance.update_copy_ignore_globs({'foo': 'bar'})

        self.assertEqual(instance.copy_ignore_globs, [])
コード例 #3
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')
コード例 #4
0
ファイル: test_template.py プロジェクト: jackqu7/Facio
    def test_get_render_ignore_files(self):
        instance = Template('/foo/bar')
        instance.update_copy_ignore_globs(['*.ico', ])
        files = ['setup.py', 'foo.png', 'bar.jpeg', 'index.html']

        ignores = instance.get_render_ignore_files(files)

        self.assertEqual(ignores, ['foo.png', 'bar.jpeg'])
コード例 #5
0
ファイル: test_template.py プロジェクト: jackqu7/Facio
    def test_exception_setting_copy_ignore_globs_not_iterable(self, mock_exit):

        instance = Template('/foo/bar')

        with self.assertRaises(FacioException):
            instance.update_copy_ignore_globs(1)
        self.mocked_facio_exceptions_puts.assert_any_call(
            'Error: Failed to add 1 to ignore globs list')
        self.assertTrue(mock_exit.called)
コード例 #6
0
ファイル: test_template.py プロジェクト: jackqu7/Facio
    def test_get_copy_ignore_globs(self):
        instance = Template('/foo/bar')
        instance.update_copy_ignore_globs(['*.png', '*.gif'])

        self.assertEqual(instance.get_copy_ignore_globs(), [
            '.git',
            '.hg',
            '.svn',
            '.DS_Store',
            'Thumbs.db',
            '*.png',
            '*.gif'
        ])