422 cubename, = args |
422 cubename, = args |
423 #if ServerConfiguration.mode != "dev": |
423 #if ServerConfiguration.mode != "dev": |
424 # self.fail("you can only create new cubes in development mode") |
424 # self.fail("you can only create new cubes in development mode") |
425 verbose = self.get('verbose') |
425 verbose = self.get('verbose') |
426 cubesdir = self.get('directory') |
426 cubesdir = self.get('directory') |
427 if not cubedir: |
427 if not cubesdir: |
428 cubespath = ServerConfiguration.cubes_path() |
428 cubespath = ServerConfiguration.cubes_search_path() |
429 if len(cubespath) > 1: |
429 if len(cubespath) > 1: |
430 raise BadCommandUsage("can't guess directory where to put the new cube." |
430 raise BadCommandUsage("can't guess directory where to put the new cube." |
431 " Please specify it using the --directory option") |
431 " Please specify it using the --directory option") |
432 cubesdir = cubespath[0] |
432 cubesdir = cubespath[0] |
433 if not isdir(cubesdir): |
433 if not isdir(cubesdir): |
434 print "creating cubes directory", cubesdir |
434 print "creating cubes directory", cubesdir |
435 try: |
435 try: |
436 mkdir(cubesdir) |
436 mkdir(cubesdir) |
437 except OSError, err: |
437 except OSError, err: |
438 self.fail("failed to create directory %r\n(%s)" % (cubedir, err)) |
438 self.fail("failed to create directory %r\n(%s)" % (cubesdir, err)) |
439 cubedir = join(cubesdir, cubename) |
439 cubedir = join(cubesdir, cubename) |
440 if exists(cubedir): |
440 if exists(cubedir): |
441 self.fail("%s already exists !" % (cubedir)) |
441 self.fail("%s already exists !" % (cubedir)) |
442 skeldir = join(BASEDIR, 'skeleton') |
442 skeldir = join(BASEDIR, 'skeleton') |
443 if verbose: |
443 if verbose: |