536 if not re.match('[a-z][-a-z0-9]*$', distname): |
536 if not re.match('[a-z][-a-z0-9]*$', distname): |
537 raise BadCommandUsage("cube distname should be a valid debian package name") |
537 raise BadCommandUsage("cube distname should be a valid debian package name") |
538 longdesc = shortdesc = raw_input('Enter a short description for your cube: ') |
538 longdesc = shortdesc = raw_input('Enter a short description for your cube: ') |
539 if verbose: |
539 if verbose: |
540 longdesc = raw_input('Enter a long description (leave empty to reuse the short one): ') |
540 longdesc = raw_input('Enter a long description (leave empty to reuse the short one): ') |
|
541 dependencies = {'cubicweb': '>= %s' % cubicwebversion} |
541 if verbose: |
542 if verbose: |
542 includes = self._ask_for_dependancies() |
543 dependencies.update(self._ask_for_dependencies()) |
543 if len(includes) == 1: |
|
544 dependancies = '%r,' % includes[0] |
|
545 else: |
|
546 dependancies = ', '.join(repr(cube) for cube in includes) |
|
547 else: |
|
548 dependancies = '' |
|
549 context = {'cubename' : cubename, |
544 context = {'cubename' : cubename, |
550 'distname' : distname, |
545 'distname' : distname, |
551 'shortdesc' : shortdesc, |
546 'shortdesc' : shortdesc, |
552 'longdesc' : longdesc or shortdesc, |
547 'longdesc' : longdesc or shortdesc, |
553 'dependancies' : dependancies, |
548 'dependencies' : dependencies, |
554 'version' : cubicwebversion, |
549 'version' : cubicwebversion, |
555 'year' : str(datetime.now().year), |
550 'year' : str(datetime.now().year), |
556 'author': self['author'], |
551 'author': self['author'], |
557 'author-email': self['author-email'], |
552 'author-email': self['author-email'], |
558 'author-web-site': self['author-web-site'], |
553 'author-web-site': self['author-web-site'], |
563 if self['layout'] == 'simple': |
558 if self['layout'] == 'simple': |
564 exclude += ('sobjects.py*', 'precreate.py*', 'realdb_test*', |
559 exclude += ('sobjects.py*', 'precreate.py*', 'realdb_test*', |
565 'cubes.*', 'external_resources*') |
560 'cubes.*', 'external_resources*') |
566 copy_skeleton(skeldir, cubedir, context, exclude=exclude) |
561 copy_skeleton(skeldir, cubedir, context, exclude=exclude) |
567 |
562 |
568 def _ask_for_dependancies(self): |
563 def _ask_for_dependencies(self): |
569 from logilab.common.shellutils import ASK |
564 from logilab.common.shellutils import ASK |
570 from logilab.common.textutils import splitstrip |
565 from logilab.common.textutils import splitstrip |
571 includes = [] |
566 depcubes = [] |
572 for stdtype in ServerConfiguration.available_cubes(): |
567 for cube in ServerConfiguration.available_cubes(): |
573 answer = ASK.ask("Depends on cube %s? " % stdtype, |
568 answer = ASK.ask("Depends on cube %s? " % cube, |
574 ('N','y','skip','type'), 'N') |
569 ('N','y','skip','type'), 'N') |
575 if answer == 'y': |
570 if answer == 'y': |
576 includes.append(stdtype) |
571 depcubes.append(cube) |
577 if answer == 'type': |
572 if answer == 'type': |
578 includes = splitstrip(raw_input('type dependancies: ')) |
573 depcubes = splitstrip(raw_input('type dependencies: ')) |
579 break |
574 break |
580 elif answer == 'skip': |
575 elif answer == 'skip': |
581 break |
576 break |
582 return includes |
577 return dict(('cubicweb-' + cube, ServerConfiguration.cube_version(cube)) |
|
578 for cube in depcubes) |
583 |
579 |
584 |
580 |
585 class ExamineLogCommand(Command): |
581 class ExamineLogCommand(Command): |
586 """Examine a rql log file. |
582 """Examine a rql log file. |
587 |
583 |