s = s.replace('"', '\\"')
return s
-def generate_fp(config, fp):
+def generate_project_list_fp(config, fp):
"""
- Generate a config file and projects list for ``gitweb``.
+ Generate projects list for ``gitweb``.
:param config: configuration to read projects from
:type config: RawConfigParser
line = ' '.join([urllib.quote_plus(s) for s in response])
print >>fp, line
-def generate(config, path):
+def generate_project_list(config, path):
"""
- Generate a config file and projects list for ``gitweb``.
+ Generate projects list for ``gitweb``.
:param config: configuration to read projects from
:type config: RawConfigParser
os.path.join(export, 'gitosis.conf'),
os.path.join(export, '..', 'gitosis.conf'),
)
- gitweb.generate(
+ gitweb.generate_project_list(
config=cfg,
path=os.path.join(git_dir, 'projects.list'),
)
def test_projectsList_empty():
cfg = RawConfigParser()
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\
cfg = RawConfigParser()
cfg.add_section('repo foo/bar')
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\
cfg.add_section('repo foo/bar')
cfg.set('repo foo/bar', 'gitweb', 'yes')
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\
cfg.set('repo foo/bar', 'gitweb', 'yes')
cfg.set('repo foo/bar', 'owner', 'John Doe')
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\
cfg.add_section('repo quux')
cfg.set('repo quux', 'gitweb', 'yes')
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\
# this is still hidden
cfg.set('repo thud', 'gitweb', 'no')
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\
cfg.add_section('repo foo')
cfg.set('repo foo', 'gitweb', 'yes')
got = StringIO()
- gitweb.generate_fp(
+ gitweb.generate_project_list_fp(
config=cfg,
fp=got)
eq(got.getvalue(), '''\