From 1f3a8ecd2a6ed9694a614c39428961badeba69e6 Mon Sep 17 00:00:00 2001 From: Date: Tue, 17 Feb 2015 03:43:47 +0100 Subject: [PATCH] =?UTF-8?q?[#828]=20fixes:=20Module=20names=20can=E2=80=99?= =?UTF-8?q?t=20contain=20dash=20characters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/pym/play/commands/modulesrepo.py | 8 +++++++- samples-and-tests/i-am-a-developer/tests.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) 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