コード例 #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_config.py プロジェクト: krak3n/Facio
    def test_project_name_should_be_validated(self, mock_validate,
                                              mock_docopt):
        mock_docopt.return_value = {'<project_name>': 'foo'}

        i = CommandLineInterface()
        i.start()

        mock_validate.assert_called_with('foo')
コード例 #4
0
ファイル: test_config.py プロジェクト: krak3n/Facio
    def test_valid_project_name(self):
        valid_names = ['this_is_valid', 'this1is_valid', 'Thisisvalid']

        i = CommandLineInterface()

        for name in valid_names:
            i.validate_project_name(name)
            self.assertEqual(name, self.mock_state.project_name)
            self.assertEqual({'PROJECT_NAME': name},
                             self.mock_state.context_variables)
コード例 #5
0
ファイル: test_config.py プロジェクト: jackqu7/Facio
    def test_project_name_should_be_validated(
            self,
            mock_validate,
            mock_docopt):
        mock_docopt.return_value = {
            '<project_name>': 'foo'
        }

        i = CommandLineInterface()
        i.start()

        mock_validate.assert_called_with('foo')
コード例 #6
0
ファイル: test_config.py プロジェクト: jackqu7/Facio
    def test_valid_project_name(self):
        valid_names = [
            'this_is_valid',
            'this1is_valid',
            'Thisisvalid']

        i = CommandLineInterface()

        for name in valid_names:
            i.validate_project_name(name)
            self.assertEqual(name, self.mock_state.project_name)
            self.assertEqual({'PROJECT_NAME': name},
                             self.mock_state.context_variables)
コード例 #7
0
ファイル: test_config.py プロジェクト: krak3n/Facio
    def test_invalid_project_name(self, mock_exit):
        invalid_names = [
            'this_is_not-valid', 'this_is not_valid', '*this_is_not_valid'
        ]

        i = CommandLineInterface()

        for name in invalid_names:
            with self.assertRaises(FacioException):
                i.validate_project_name(name)
            self.mocked_facio_exceptions_puts.assert_any_call(
                'Error: Project names can only contain numbers letters and '
                'underscores')
コード例 #8
0
ファイル: test_config.py プロジェクト: jackqu7/Facio
    def test_invalid_project_name(self, mock_exit):
        invalid_names = [
            'this_is_not-valid',
            'this_is not_valid',
            '*this_is_not_valid']

        i = CommandLineInterface()

        for name in invalid_names:
            with self.assertRaises(FacioException):
                i.validate_project_name(name)
            self.mocked_facio_exceptions_puts.assert_any_call(
                'Error: Project names can only contain numbers letters and '
                'underscores')