Commits

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

  • Participants
  • Parent commits 84c0fa1

Comments (0)

Files changed (2)

File 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.

File 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)
+