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')
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__)
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()
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()
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, '')