
from nimp.commands._cis_command import *
from nimp.utilities.ue3         import *
from nimp.utilities.deployment  import *
from nimp.utilities.file_mapper import *

#-------------------------------------------------------------------------------
class CisTomatMining(CisCommand):
    abstract = 0
    def __init__(self):
        CisCommand.__init__(self,
                            'cis-tomat-mining',
                            'Mines UE3 content into Tomat')

    #---------------------------------------------------------------------------
    def cis_configure_arguments(self, env, parser):
        return True

    #---------------------------------------------------------------------------
    def _cis_run(self, env):
        if call_process('.', ['pacman', '-S', '--noconfirm', 'repman']) != 0:
            return False

        if call_process('.', ['repman', 'add', 'dont-nod', 'http://pacman']) != 0:
            return False

        if call_process('.', ['pacman', '-S', '--noconfirm', '--needed', 'tomat-console']) != 0:
            return False

        return call_process('.',
                            [ 'TomatConsole',
                              'ImportFromUnreal',
                              '--RepositoryUri',
                              'sql://mining@console',
                              '--UnrealEnginePath',
                              'Binaries/Win64/ExampleGame.exe' ])


from nimp.commands._cis_command import *
from nimp.utilities.ue3         import *
from nimp.utilities.deployment  import *
from nimp.utilities.file_mapper import *

import tempfile
import shutil

#-------------------------------------------------------------------------------
class CisTomatMining(CisCommand):
    abstract = 0
    def __init__(self):
        CisCommand.__init__(self,
                            'cis-tomat-mining',
                            'Mines UE3 content into Tomat')

    #---------------------------------------------------------------------------
    def cis_configure_arguments(self, env, parser):
        return True

    #---------------------------------------------------------------------------
    def _cis_run(self, env):

        if call_process('.', ['pacman', '-S', '--noconfirm', 'repman']) != 0:
            return False

        if call_process('.', ['repman', 'add', 'dont-nod', 'http://pacman/']) != 0:
            return False

        if call_process('.', ['pacman', '-Scc', '--noconfirm']) != 0:
            return False

        if call_process('.', ['pacman', '-S', '--noconfirm', '--force', 'tomat-console']) != 0:
            return False

        tmpdir = tempfile.mkdtemp()
        success = True

        if success and env.is_ue3:
            success = ue3_commandlet(env.game, 'dnetomatminingcommandlet', [ tmpdir ])

        if success:
            success = call_process('.', [ 'TomatConsole',
                                          'ImportFromUnreal',
                                          '--RepositoryUri', 'sql://mining@console',
                                          '--TmpDirectory', tmpdir ]) == 0

        # Clean up after ourselves
        shutil.rmtree(tmpdir)

        return success


Split the Tomat mining commandlet into an Unreal part and a TomatConsole part.
Split the Tomat mining commandlet into an Unreal part and a TomatConsole part.

  
  from nimp.commands._cis_command import *
  from nimp.utilities.ue3         import *
  from nimp.utilities.deployment  import *
  from nimp.utilities.file_mapper import *
+ 
+ import tempfile
+ import shutil
  
  #-------------------------------------------------------------------------------
  class CisTomatMining(CisCommand):
      abstract = 0
      def __init__(self):
          CisCommand.__init__(self,
                              'cis-tomat-mining',
                              'Mines UE3 content into Tomat')
  
      #---------------------------------------------------------------------------
      def cis_configure_arguments(self, env, parser):
          return True
  
      #---------------------------------------------------------------------------
      def _cis_run(self, env):
+ 
          if call_process('.', ['pacman', '-S', '--noconfirm', 'repman']) != 0:
              return False
  
-         if call_process('.', ['repman', 'add', 'dont-nod', 'http://pacman']) != 0:
+         if call_process('.', ['repman', 'add', 'dont-nod', 'http://pacman/']) != 0:
              return False
  
-         if call_process('.', ['pacman', '-S', '--noconfirm', '--needed', 'tomat-console']) != 0:
+         if call_process('.', ['pacman', '-Scc', '--noconfirm']) != 0:
              return False
  
+         if call_process('.', ['pacman', '-S', '--noconfirm', '--force', 'tomat-console']) != 0:
+             return False
-         return call_process('.',
-                             [ 'TomatConsole',
-                               'ImportFromUnreal',
-                               '--RepositoryUri',
-                               'sql://mining@console',
-                               '--UnrealEnginePath',
-                               'Binaries/Win64/ExampleGame.exe' ])
  
+         tmpdir = tempfile.mkdtemp()
+         success = True
+ 
+         if success and env.is_ue3:
+             success = ue3_commandlet(env.game, 'dnetomatminingcommandlet', [ tmpdir ])
+ 
+         if success:
+             success = call_process('.', [ 'TomatConsole',
+                                           'ImportFromUnreal',
+                                           '--RepositoryUri', 'sql://mining@console',
+                                           '--TmpDirectory', tmpdir ]) == 0
+ 
+         # Clean up after ourselves
+         shutil.rmtree(tmpdir)
+ 
+         return success
+ 
+ 
Split the Tomat mining commandlet into an Unreal part and a TomatConsole part.
## Code Before:

from nimp.commands._cis_command import *
from nimp.utilities.ue3         import *
from nimp.utilities.deployment  import *
from nimp.utilities.file_mapper import *

#-------------------------------------------------------------------------------
class CisTomatMining(CisCommand):
    abstract = 0
    def __init__(self):
        CisCommand.__init__(self,
                            'cis-tomat-mining',
                            'Mines UE3 content into Tomat')

    #---------------------------------------------------------------------------
    def cis_configure_arguments(self, env, parser):
        return True

    #---------------------------------------------------------------------------
    def _cis_run(self, env):
        if call_process('.', ['pacman', '-S', '--noconfirm', 'repman']) != 0:
            return False

        if call_process('.', ['repman', 'add', 'dont-nod', 'http://pacman']) != 0:
            return False

        if call_process('.', ['pacman', '-S', '--noconfirm', '--needed', 'tomat-console']) != 0:
            return False

        return call_process('.',
                            [ 'TomatConsole',
                              'ImportFromUnreal',
                              '--RepositoryUri',
                              'sql://mining@console',
                              '--UnrealEnginePath',
                              'Binaries/Win64/ExampleGame.exe' ])

## Instruction:
Split the Tomat mining commandlet into an Unreal part and a TomatConsole part.
## Code After:

from nimp.commands._cis_command import *
from nimp.utilities.ue3         import *
from nimp.utilities.deployment  import *
from nimp.utilities.file_mapper import *

import tempfile
import shutil

#-------------------------------------------------------------------------------
class CisTomatMining(CisCommand):
    abstract = 0
    def __init__(self):
        CisCommand.__init__(self,
                            'cis-tomat-mining',
                            'Mines UE3 content into Tomat')

    #---------------------------------------------------------------------------
    def cis_configure_arguments(self, env, parser):
        return True

    #---------------------------------------------------------------------------
    def _cis_run(self, env):

        if call_process('.', ['pacman', '-S', '--noconfirm', 'repman']) != 0:
            return False

        if call_process('.', ['repman', 'add', 'dont-nod', 'http://pacman/']) != 0:
            return False

        if call_process('.', ['pacman', '-Scc', '--noconfirm']) != 0:
            return False

        if call_process('.', ['pacman', '-S', '--noconfirm', '--force', 'tomat-console']) != 0:
            return False

        tmpdir = tempfile.mkdtemp()
        success = True

        if success and env.is_ue3:
            success = ue3_commandlet(env.game, 'dnetomatminingcommandlet', [ tmpdir ])

        if success:
            success = call_process('.', [ 'TomatConsole',
                                          'ImportFromUnreal',
                                          '--RepositoryUri', 'sql://mining@console',
                                          '--TmpDirectory', tmpdir ]) == 0

        # Clean up after ourselves
        shutil.rmtree(tmpdir)

        return success

