def ArgsForFirestoreEmulator(emulator_args): """Constucts an argument list for calling the Firestore emulator. Args: emulator_args: args for the emulator. Returns: An argument list to execute the Firestore emulator. """ current_os = platforms.OperatingSystem.Current() if current_os is platforms.OperatingSystem.WINDOWS: cmd = 'cloud_firestore_emulator.cmd' exe = os.path.join(util.GetEmulatorRoot(CLOUD_FIRESTORE), cmd) return execution_utils.ArgsForCMDTool(exe, *emulator_args) else: cmd = 'cloud_firestore_emulator' exe = os.path.join(util.GetEmulatorRoot(CLOUD_FIRESTORE), cmd) return execution_utils.ArgsForExecutableTool(exe, *emulator_args)
def ArgsForGCDEmulator(emulator_args): """Constructs an argument list for calling the GCD emulator. Args: emulator_args: args for the emulator. Returns: An argument list to execute the GCD emulator. """ current_os = platforms.OperatingSystem.Current() if current_os is platforms.OperatingSystem.WINDOWS: cmd = 'cloud_datastore_emulator.cmd' gcd_executable = os.path.join(util.GetEmulatorRoot(CLOUD_DATASTORE), cmd) return execution_utils.ArgsForCMDTool(gcd_executable, *emulator_args) else: cmd = 'cloud_datastore_emulator' gcd_executable = os.path.join(util.GetEmulatorRoot(CLOUD_DATASTORE), cmd) return execution_utils.ArgsForExecutableTool(gcd_executable, *emulator_args)
def BuildStartArgs(args): """Builds the command for starting the bigtable emulator. Args: args: (list of str) The arguments for the bigtable emulator, excluding the program binary. Returns: A list of command arguments. """ bigtable_dir = util.GetEmulatorRoot(BIGTABLE) bigtable_executable = os.path.join(bigtable_dir, BIGTABLE_EXECUTABLE) if platforms.OperatingSystem.Current() is platforms.OperatingSystem.WINDOWS: bigtable_executable += '.exe' return execution_utils.ArgsForExecutableTool(bigtable_executable, *args)
def BuildStartArgs(args, current_os): """Builds the command for starting the pubsub emulator. Args: args: (list of str) The arguments for the pubsub emulator, excluding the program binary. current_os: (platforms.OperatingSystem) Returns: A list of command arguments. """ pubsub_dir = util.GetEmulatorRoot(PUBSUB) if current_os is platforms.OperatingSystem.WINDOWS: pubsub_executable = os.path.join( pubsub_dir, r'bin\cloud-pubsub-emulator.bat') return execution_utils.ArgsForCMDTool(pubsub_executable, *args) pubsub_executable = os.path.join(pubsub_dir, 'bin/cloud-pubsub-emulator') return execution_utils.ArgsForExecutableTool(pubsub_executable, *args)