diff --git a/framework/pym/play/commands/modulesrepo.py b/framework/pym/play/commands/modulesrepo.py index a19381b201..7ab738428b 100644 --- a/framework/pym/play/commands/modulesrepo.py +++ b/framework/pym/play/commands/modulesrepo.py @@ -182,9 +182,15 @@ def new(app, args, play_env): print "~" sys.exit(-1) + application_name = os.path.basename(app.path) + groups = re.match(r'^([a-zA-Z0-9]+)([-](.*))?$', application_name) + if not groups.group(3) == None: + print "~ Oops. Module names cannot contain dash characters: '%s'" % application_name + print "~" + sys.exit(-1) + print "~ The new module will be created in %s" % os.path.normpath(app.path) print "~" - application_name = os.path.basename(app.path) copy_directory(os.path.join(play_env["basedir"], 'resources/module-skel'), app.path) # check_application() replaceAll(os.path.join(app.path, 'build.xml'), r'%MODULE%', application_name) diff --git a/samples-and-tests/i-am-a-developer/tests.py b/samples-and-tests/i-am-a-developer/tests.py index fdb5590121..d8a0091085 100755 --- a/samples-and-tests/i-am-a-developer/tests.py +++ b/samples-and-tests/i-am-a-developer/tests.py @@ -194,6 +194,21 @@ def testCreateAndRunForJobProject(self): step("done testing jobapp") + def testModuleName(self): + + # Well + step('Hello, I\'m testing module name') + + self.working_directory = bootstrapWorkingDirectory('i-am-testing-modulenames') + + # play new yop + step('Create a new module') + + self.play = callPlay(self, ['new-module', '%s/mymodule-123' % self.working_directory]) + self.assert_(waitFor(self.play, "Oops. Module names cannot contain dash characters: 'mymodule-123'")) + + step("done testing module name") + def testSimpleProjectCreation(self): # Well