Christos Trochalakis avatar Christos Trochalakis committed 7ab08a9

Introduce txcreatedirs command

`python manage.py txcreatedirs` creates all the necessary
directories specified in the settings file.

Creates:
* SCRATCH_DIR
* MSGMERGE_DIR
* REPO_PATHS

Comments (0)

Files changed (2)

docs/intro/install.txt

 Once you're done configuring, run inside the project directory::
 
     ./manage.py syncdb
+    ./manage.py txcreatedirs
     ./manage.py runserver 8088
 
 Fire up your browser at ``http://localhost:8088/`` and grab a cup of coffee.

txcommon/management/commands/txcreatedirs.py

+import os
+from django.core.management.base import NoArgsCommand
+
+def transifex_paths():
+    from django.conf import settings as s
+    # Scratch dir
+    yield s.SCRATCH_DIR
+    # Msgmerge dir
+    yield s.MSGMERGE_DIR
+    # Repo paths
+    for vcs in s.VCS_CHOICES.keys():
+        yield s.REPO_PATHS[vcs]
+
+
+class Command(NoArgsCommand):
+    help = 'Create scratchdir vcs directories'
+
+    requires_model_validation = False
+    can_import_settings = True
+    
+    def handle_noargs(self, **options):
+        for path in transifex_paths():
+            try:
+                os.makedirs(path)
+                print "Creating %s" % path
+            except OSError, e:
+                print "Error creating %s: %s" % (path, e.strerror)
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.