Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion framework/pym/play/commands/modulesrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions samples-and-tests/i-am-a-developer/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down