Start a "base" recipe
This probably needs to have a "pages" templates too.
This commit is contained in:
parent
1162aa2fd7
commit
32d7b53e63
3 changed files with 36 additions and 3 deletions
|
|
@ -88,13 +88,15 @@ class BaseRecipe(Recipe):
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
self.write('__init__.py', self.template('init'))
|
self.write('__init__.py', self.template('init'))
|
||||||
|
self.write('backend.py', self.template('base_backend'))
|
||||||
|
self.write('browser.py', self.template('base_browser'))
|
||||||
|
|
||||||
|
|
||||||
class ComicRecipe(BaseRecipe):
|
class ComicRecipe(Recipe):
|
||||||
NAME = 'comic'
|
NAME = 'comic'
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
super(ComicRecipe, self).generate()
|
self.write('__init__.py', self.template('init'))
|
||||||
self.write('backend.py', self.template('comic_backend'))
|
self.write('backend.py', self.template('comic_backend'))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -125,7 +127,7 @@ def main():
|
||||||
default=gitconfig('user.email'))
|
default=gitconfig('user.email'))
|
||||||
subparsers = parser.add_subparsers()
|
subparsers = parser.add_subparsers()
|
||||||
|
|
||||||
recipes = [ComicRecipe, ComicTestRecipe]
|
recipes = [BaseRecipe, ComicRecipe, ComicTestRecipe]
|
||||||
for recipe in recipes:
|
for recipe in recipes:
|
||||||
recipe.configure_subparser(subparsers)
|
recipe.configure_subparser(subparsers)
|
||||||
|
|
||||||
|
|
|
||||||
18
tools/boilerplate_data/base_backend.py
Normal file
18
tools/boilerplate_data/base_backend.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<%inherit file="layout.py"/>
|
||||||
|
from weboob.tools.backend import BaseBackend
|
||||||
|
|
||||||
|
from .browser import ${r.classname}Browser
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['${r.classname}Backend']
|
||||||
|
|
||||||
|
|
||||||
|
class ${r.classname}Backend(BaseBackend):
|
||||||
|
NAME = '${r.name}'
|
||||||
|
DESCRIPTION = '${r.name} website'
|
||||||
|
MAINTAINER = '${r.author}'
|
||||||
|
EMAIL = '${r.email}'
|
||||||
|
VERSION = '${r.version}'
|
||||||
|
|
||||||
|
DOMAIN = 'www.${r.name}.com'
|
||||||
|
BROWSER = ${r.classname}Browser
|
||||||
13
tools/boilerplate_data/base_browser.py
Normal file
13
tools/boilerplate_data/base_browser.py
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<%inherit file="layout.py"/>
|
||||||
|
from weboob.tools.browser import BaseBrowser
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['${r.classname}Browser']
|
||||||
|
|
||||||
|
|
||||||
|
class ${r.classname}Browser(BaseBrowser):
|
||||||
|
PROTOCOL = 'http'
|
||||||
|
DOMAIN = 'www.${r.name}.com'
|
||||||
|
ENCODING = None
|
||||||
|
|
||||||
|
PAGES = {}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue