You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@marvin.apache.org by GitBox <gi...@apache.org> on 2020/03/03 04:37:51 UTC

[GitHub] [incubator-marvin] Wei-1 commented on a change in pull request #44: Marvin engine delete command

Wei-1 commented on a change in pull request #44: Marvin engine delete command
URL: https://github.com/apache/incubator-marvin/pull/44#discussion_r386795354
 
 

 ##########
 File path: python-toolbox/marvin_python_toolbox/management/engine.py
 ##########
 @@ -474,6 +474,56 @@ def generate(name, description, mantainer, email, package, dest, no_env, no_git,
             shutil.rmtree(dest)
 
 
+
+@cli.command('engine-delete', help='Delete an existing marvin engine project.')
+@click.option('--name', '-n', prompt='Project name', help='Project name')
+@click.option('--dest', '-d', envvar='MARVIN_HOME', type=click.Path(exists=True), help='Root folder path for the creation')
+def delete_engine(name,dest):
+    type_ = 'python-engine'
+    # Process package name
+    package = _slugify(name)
+
+    # Make sure package name starts with "marvin"
+    if not package.startswith('marvin'):
+        package = 'marvin_{}'.format(package)
+
+    # Remove "lib" prefix from package name
+    if type_ == 'lib' and package.endswith('lib'):
+        package = package[:-3]
+    # Custom strip to remove underscores
+    package = package.strip('_')
+
+    # Append project type to services
+
+    if type_ in TEMPLATE_BASES and not package.endswith('engine'):
+        package = '{}_engine'.format(package)
+
+    # Process directory/virtualenv name
+
+    # Directory name should use '-' instead of '_'
+    dir_ = package.replace('_', '-')
 
 Review comment:
   Since we are applying the same naming process as line 410, should we make it a function so that generate and delete will always point to the same environment?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services