Edgewall Software

Ticket #756 (new enhancement)

Opened 4 years ago

Last modified 3 years ago

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

Reported by: eblotml@… Owned by: daniel
Priority: normal Milestone: 1.0
Component: admin/console Version: devel
Severity: normal Keywords:
Cc:

Description

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

Index: scripts/trac-admin
===================================================================
--- scripts/trac-admin	(revision 915)
+++ scripts/trac-admin	(working copy)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
 # -*- coding: iso8859-1 -*-
 __author__ = 'Daniel Lundin <daniel@edgewall.com>, Jonas Borgström <jonas@edgewall.com>'
 __copyright__ = 'Copyright (c) 2004 Edgewall Software'
@@ -427,7 +427,7 @@
 
     ## Initenv
     _help_initenv = [('initenv', 'Create and initialize a new environment interactively'),
-                     ('initenv <projectname> <repospath> <templatepath>',
+                     ('initenv <projectname> <repospath> <templatepath> <wikipath>',
                       'Create and initialize a new environment from arguments')]
 
     def do_initdb(self, line):
@@ -460,6 +460,13 @@
         dt = trac.siteconfig.__default_templates_dir__
         prompt = 'Templates directory [%s]> ' % dt
         returnvals.append(raw_input(prompt) or dt)
+        print
+        print ' Please enter location of Trac initial wiki pages.'
+        print ' Default is the location of the site-wide wiki pages installed with Trac.'
+        print
+        dw = trac.siteconfig.__default_wiki_dir__
+        prompt = 'Wiki pages directory [%s]> ' % dw
+        returnvals.append(raw_input(prompt) or dw)
         return returnvals
          
     def do_initenv(self, line):
@@ -470,18 +477,21 @@
         project_name = None
         repository_dir = None
         templates_dir = None
+        wiki_dir = None
         if len(arg) == 1:
             returnvals = self.get_initenv_args()
             project_name = returnvals[0]
             repository_dir = returnvals[1]
             templates_dir = returnvals[2]
-        elif len(arg)!= 3:
+            wiki_dir = returnvals[3]
+        elif len(arg)!= 4:
             print 'Wrong number of arguments to initenv %d' % len(arg)
             return
         else:
             project_name = arg[0]
             repository_dir = arg[1]
             templates_dir = arg[2]
+            wiki_dir = arg[3]
         from svn import util, repos, core
         core.apr_initialize()
         pool = core.svn_pool_create(None)
@@ -498,6 +508,9 @@
            or not os.access(os.path.join(templates_dir, 'ticket.cs'), os.F_OK):
             print templates_dir, "doesn't look like a Trac templates directory"
             return
+        if not os.access(os.path.join(wiki_dir, 'WikiStart'), os.F_OK):
+            print wiki_dir, "doesn't seem to contain initial Wiki pages"
+            return
         try:
             print 'Creating and Initializing Project'
             self.env_create()
@@ -516,7 +529,7 @@
             # Add a few default wiki pages
             print ' Installing wiki pages'
             cursor = cnx.cursor()
-            self._do_wiki_load(trac.siteconfig.__default_wiki_dir__,cursor)
+            self._do_wiki_load(wiki_dir,cursor)
 
             print ' Indexing repository'
             sync.sync(cnx, rep, fs_ptr, pool)

Attachments

Change History

Changed 4 years ago by vittorio

  • severity changed from minor to enhancement

Changed 3 years ago by clay@…

  • priority changed from low to normal
  • milestone set to 0.9

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

Changed 3 years ago by cmlenz

  • owner changed from jonas to daniel
  • component changed from general to trac-admin

Changed 3 years ago by cmlenz

  • milestone changed from 0.9 to 0.9.1

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

Changed 3 years ago by cmlenz

  • milestone changed from 0.9.1 to 0.9.2

Changed 3 years ago by cmlenz

  • milestone changed from 0.9.3 to 1.0

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

Add/Change #756 (trac-admin initenv might prompt for a wiki-default path)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from daniel. Next status will be 'new'
The owner will change from daniel to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.