Example #1
0
def init_site():
    """ Initialize a nikola demo site. """

    from nikola.plugins.command.init import CommandInit, SAMPLE_CONF

    command = CommandInit()
    SAMPLE_CONF['SITE_URL'] = _get_site_url()
    SAMPLE_CONF.update(DATA)
    command.execute({'demo': True}, ['demo'])

    local('mv demo/* . && rmdir demo')
    local('touch files/.nojekyll')
    local('rm *.pyc')
Example #2
0
    def _init_site(self):
        from nikola.plugins.command.init import CommandInit

        command_init = CommandInit()
        command_init.execute(options={'demo': True, 'quiet': True}, args=['demo'])

        sys.path.insert(0, '')
        os.chdir('demo')
        import conf
        _reload(conf)
        sys.path.pop(0)

        self._site = nikola.Nikola(**conf.__dict__)
Example #3
0
    def _init_site(self):
        from nikola.plugins.command.init import CommandInit

        command_init = CommandInit()
        command_init.execute(options={'demo': True, 'quiet': True}, args=['demo'])

        sys.path.insert(0, '')
        os.chdir('demo')
        import conf
        _reload(conf)
        sys.path.pop(0)

        self._site = nikola.Nikola(**conf.__dict__)
        self._site.init_plugins()
    def _init_site(self, monkeypatch, tmp_path):
        from nikola.plugins.command.init import CommandInit

        monkeypatch.chdir(tmp_path)
        command_init = CommandInit()
        command_init.execute(options={
            'demo': True,
            'quiet': True
        },
                             args=['demo'])

        sys.path.insert(0, '')
        monkeypatch.chdir(tmp_path / 'demo')
        import conf  # noqa
        _reload(conf)
        sys.path.pop(0)

        self._site = nikola.Nikola(**conf.__dict__)
        self._site.init_plugins()
Example #5
0
def init_command(tmpdir, ask_questions, copy_sample_site, create_configuration,
                 create_empty_site):
    with mock.patch("nikola.plugins.command.init.CommandInit.ask_questions",
                    ask_questions):
        with mock.patch(
                "nikola.plugins.command.init.CommandInit.copy_sample_site",
                copy_sample_site):
            with mock.patch(
                    "nikola.plugins.command.init.CommandInit.create_configuration",
                    create_configuration,
            ):
                with mock.patch(
                        "nikola.plugins.command.init.CommandInit.create_empty_site",
                        create_empty_site,
                ):
                    with cd(str(tmpdir)):
                        yield CommandInit()
Example #6
0
 def _create_demo_site(self):
     from nikola.plugins.command.init import CommandInit
     command_init = CommandInit()
     command_init.execute(options={'demo': True, 'quiet': True}, args=['demo'])
     os.chdir('demo')
     sys.path.insert(0, '')