Edgewall Software
Modify

Opened 20 years ago

Last modified 9 years ago

#756 new enhancement

trac-admin initenv might prompt for a wiki-default path

Reported by: eblotml@… Owned by:
Priority: normal Milestone: next-major-releases
Component: admin/console Version: devel
Severity: normal Keywords: newhelp
Cc: Thijs Triemstra Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Thijs Triemstra)

Trac-admin prompts for default template path, but not for default wiki page path.

The following patch supports wiki-default path on command line and prompts for such a path when initenv command is invoked.

Proposed patch

  • scripts/trac-admin

     
    1 #!/usr/bin/env python
     1#!/usr/bin/python
    22# -*- coding: iso8859-1 -*-
    33__author__ = 'Daniel Lundin <daniel@edgewall.com>, Jonas Borgström <jonas@edgewall.com>'
    44__copyright__ = 'Copyright (c) 2004 Edgewall Software'
     
    427427
    428428    ## Initenv
    429429    _help_initenv = [('initenv', 'Create and initialize a new environment interactively'),
    430                      ('initenv <projectname> <repospath> <templatepath>',
     430                     ('initenv <projectname> <repospath> <templatepath> <wikipath>',
    431431                      'Create and initialize a new environment from arguments')]
    432432
    433433    def do_initdb(self, line):
     
    460460        dt = trac.siteconfig.__default_templates_dir__
    461461        prompt = 'Templates directory [%s]> ' % dt
    462462        returnvals.append(raw_input(prompt) or dt)
     463        print
     464        print ' Please enter location of Trac initial wiki pages.'
     465        print ' Default is the location of the site-wide wiki pages installed with Trac.'
     466        print
     467        dw = trac.siteconfig.__default_wiki_dir__
     468        prompt = 'Wiki pages directory [%s]> ' % dw
     469        returnvals.append(raw_input(prompt) or dw)
    463470        return returnvals
    464471         
    465472    def do_initenv(self, line):
     
    470477        project_name = None
    471478        repository_dir = None
    472479        templates_dir = None
     480        wiki_dir = None
    473481        if len(arg) == 1:
    474482            returnvals = self.get_initenv_args()
    475483            project_name = returnvals[0]
    476484            repository_dir = returnvals[1]
    477485            templates_dir = returnvals[2]
    478         elif len(arg)!= 3:
     486            wiki_dir = returnvals[3]
     487        elif len(arg)!= 4:
    479488            print 'Wrong number of arguments to initenv %d' % len(arg)
    480489            return
    481490        else:
    482491            project_name = arg[0]
    483492            repository_dir = arg[1]
    484493            templates_dir = arg[2]
     494            wiki_dir = arg[3]
    485495        from svn import util, repos, core
    486496        core.apr_initialize()
    487497        pool = core.svn_pool_create(None)
     
    498508           or not os.access(os.path.join(templates_dir, 'ticket.cs'), os.F_OK):
    499509            print templates_dir, "doesn't look like a Trac templates directory"
    500510            return
     511        if not os.access(os.path.join(wiki_dir, 'WikiStart'), os.F_OK):
     512            print wiki_dir, "doesn't seem to contain initial Wiki pages"
     513            return
    501514        try:
    502515            print 'Creating and Initializing Project'
    503516            self.env_create()
     
    516529            # Add a few default wiki pages
    517530            print ' Installing wiki pages'
    518531            cursor = cnx.cursor()
    519             self._do_wiki_load(trac.siteconfig.__default_wiki_dir__,cursor)
     532            self._do_wiki_load(wiki_dir,cursor)
    520533
    521534            print ' Indexing repository'
    522535            sync.sync(cnx, rep, fs_ptr, pool)

Attachments (0)

Change History (10)

comment:1 by vittorio, 19 years ago

Severity: minorenhancement

comment:2 by clay@…, 19 years ago

Milestone: 0.9
Priority: lownormal

I would love to see this in 0.9 — any chance of that happening?

comment:3 by Christopher Lenz, 19 years ago

Component: generaltrac-admin
Owner: changed from Jonas Borgström to daniel

comment:4 by Christopher Lenz, 19 years ago

Milestone: 0.90.9.1

See also #156. We need to adopt getopt or optparse for trac-admin initenv to address this stuff, I think.

comment:5 by Christopher Lenz, 19 years ago

Milestone: 0.9.10.9.2

comment:6 by Christopher Lenz, 19 years ago

Milestone: 0.9.31.0

We should be switching to using optparse for initenv, where we could provide an option for overriding the wiki default pages directory.

comment:7 by anonymous, 16 years ago

Keywords: newhelp added

comment:8 by Christian Boos, 15 years ago

Milestone: 1.0unscheduled

Milestone 1.0 deleted

comment:9 by Thijs Triemstra, 14 years ago

Cc: Thijs Triemstra added
Description: modified (diff)
Milestone: unschedulednext-major-0.1X

comment:10 by Ryan J Ollos, 9 years ago

Owner: daniel removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.