def main(): parser = argparse.ArgumentParser() parser.add_argument('-o', '--operation') #name of the operation being requested parser.add_argument( '-c', '--client' ) #name of the plugin client ("SUBLIME_TEXT_2", "SUBLIME_TEXT_3", "TEXTMATE", "NOTEPAD_PLUS_PLUS", "BB_EDIT", etc.) parser.add_argument('-p', '--projectname') #name of the project parser.add_argument('-d', '--projectdirectory') #name of the project parser.add_argument( '--callback' ) #some terminal script to run upon completion of a command parser.add_argument( '--ui', action='store_true', default=False, dest='ui_switch', help='Include flag to launch the default UI for the operation') parser.add_argument('--html', action='store_true', default=False, dest='respond_with_html', help='Include flag if you want the response in HTML') args = parser.parse_args() operation = args.operation try: setup_connection(args) except Exception as e: print util.generate_error_response(e.message) return #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process #example: mm -o new_project --ui if args.ui_switch == True: #os.system('killAll MavensMateWindowServer') #TODO: try/except? tmp_html_file = util.generate_ui(operation, request_payload) util.launch_ui(tmp_html_file) print util.generate_success_response('UI Generated Successfully') else: requested_function = operation_dict[operation] fspec = inspect.getargspec(requested_function) if type(fspec.args) is list and len( fspec.args) == 1 and fspec.args[0] == 'args': requested_function(eval(fspec.args[0])) elif type(fspec.args) is list and len(fspec.args) > 0: print util.generate_error_response('Invalid operation requested') else: requested_function() if args.callback != None: os.system(args.callback)
def execute(self): try: self.setup_connection() except Exception as e: return util.generate_error_response(e.message) #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process #example: mm -o new_project --ui if self.args.ui_switch == True: tmp_html_file = util.generate_ui(self.operation,self.payload) util.launch_ui(tmp_html_file) return util.generate_success_response('UI Generated Successfully') else: config.logger.debug(self.operation) if self.operation not in self.operation_dict: raise MMException('Unsupported operation') requested_function = self.operation_dict[self.operation] return requested_function()
def main(): parser = argparse.ArgumentParser() parser.add_argument('-o', '--operation') #name of the operation being requested parser.add_argument('-c', '--client') #name of the plugin client ("SUBLIME_TEXT_2", "SUBLIME_TEXT_3", "TEXTMATE", "NOTEPAD_PLUS_PLUS", "BB_EDIT", etc.) parser.add_argument('-p', '--projectname') #name of the project parser.add_argument('-d', '--projectdirectory') #name of the project parser.add_argument('--callback') #some terminal script to run upon completion of a command parser.add_argument('--ui', action='store_true', default=False, dest='ui_switch', help='Include flag to launch the default UI for the operation') parser.add_argument('--html', action='store_true', default=False, dest='respond_with_html', help='Include flag if you want the response in HTML') args = parser.parse_args() operation = args.operation try: setup_connection(args) except Exception as e: print util.generate_error_response(e.message) return #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process #example: mm -o new_project --ui if args.ui_switch == True: #os.system('killAll MavensMateWindowServer') #TODO: try/except? tmp_html_file = util.generate_ui(operation,request_payload) print tmp_html_file util.launch_ui(tmp_html_file, config.connection.chrome ) print tmp_html_file print util.generate_success_response('UI Generated Successfully') else: requested_function = operation_dict[operation] fspec = inspect.getargspec(requested_function) if type(fspec.args) is list and len(fspec.args) == 1 and fspec.args[0] == 'args': requested_function(eval(fspec.args[0])) elif type(fspec.args) is list and len(fspec.args) > 0: print util.generate_error_response('Invalid operation requested') else: requested_function() if args.callback != None: os.system(args.callback)
def main(): parser = argparse.ArgumentParser() parser.add_argument('-o', '--operation') #name of the operation being requested parser.add_argument( '-c', '--client' ) #name of the plugin client ("SUBLIME_TEXT_2", "SUBLIME_TEXT_3", "TEXTMATE", "NOTEPAD_PLUS_PLUS", "BB_EDIT", etc.) parser.add_argument('-p', '--projectname') #name of the project parser.add_argument('-d', '--projectdirectory') #name of the project parser.add_argument( '--callback' ) #some terminal script to run upon completion of a command parser.add_argument( '--ui', action='store_true', default=False, dest='ui_switch', help='Include flag to launch the default UI for the operation') parser.add_argument('--html', action='store_true', default=False, dest='respond_with_html', help='Include flag if you want the response in HTML') args = parser.parse_args() operation = args.operation try: setup_connection(args) except Exception as e: print util.generate_error_response(e.message) return #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process #example: mm -o new_project --ui if args.ui_switch == True: #os.system('killAll MavensMateWindowServer') #TODO: try/except? tmp_html_file = util.generate_ui(operation, request_payload) util.launch_ui(tmp_html_file) print util.generate_success_response('UI Generated Successfully') else: if operation == 'new_project': new_project() elif operation == 'edit_project': edit_project() elif operation == 'upgrade_project': upgrade_project() elif operation == 'checkout_project': checkout_project() elif operation == 'compile_project': compile_project() elif operation == 'new_metadata': new_metadata() elif operation == 'clean_project': clean_project() elif operation == 'synchronize': synchronize() elif operation == 'refresh': refresh() elif operation == 'refresh_properties': refresh_properties() elif operation == 'compile': compile_selected_metadata() elif operation == 'delete': delete_selected_metadata() elif operation == 'get_active_session': get_active_session() elif operation == 'update_credentials': update_credentials() elif operation == 'execute_apex': execute_apex() elif operation == 'deploy_to_server' or operation == 'deploy': deploy_to_server(args) elif operation == 'unit_test' or operation == 'test': run_unit_tests(args) elif operation == 'list_metadata': list_metadata() elif operation == 'index_metadata': index_metadata(args) elif operation == 'list_connections': list_connections() elif operation == 'new_connection': new_connection() elif operation == 'delete_connection': delete_connection() elif operation == 'index_apex_overlays': index_apex_overlays() elif operation == 'new_apex_overlay': new_apex_overlay() elif operation == 'delete_apex_overlay': delete_apex_overlay() elif operation == 'fetch_logs': fetch_logs() elif operation == 'new_project_from_existing_directory': new_project_from_existing_directory() elif operation == 'debug_log': TODO() elif operation == 'open_sfdc_url': open_sfdc_url() else: print util.generate_error_response('Invalid operation requested') if args.callback != None: os.system(args.callback)
def main(): parser = argparse.ArgumentParser() parser.add_argument('-o', '--operation') #name of the operation being requested parser.add_argument('-c', '--client') #name of the plugin client ("SUBLIME_TEXT_2", "SUBLIME_TEXT_3", "TEXTMATE", "NOTEPAD_PLUS_PLUS", "BB_EDIT", etc.) parser.add_argument('-p', '--projectname') #name of the project parser.add_argument('-d', '--projectdirectory') #name of the project parser.add_argument('--callback') #some terminal script to run upon completion of a command parser.add_argument('--ui', action='store_true', default=False, dest='ui_switch', help='Include flag to launch the default UI for the operation') parser.add_argument('--html', action='store_true', default=False, dest='respond_with_html', help='Include flag if you want the response in HTML') args = parser.parse_args() operation = args.operation try: setup_connection(args) except Exception as e: print util.generate_error_response(e.message) return #if the arg switch argument is included, the request is to launch the out of box #MavensMate UI, so we generate the HTML for the UI and launch the process #example: mm -o new_project --ui if args.ui_switch == True: #os.system('killAll MavensMateWindowServer') #TODO: try/except? tmp_html_file = util.generate_ui(operation,request_payload) util.launch_ui(tmp_html_file) print util.generate_success_response('UI Generated Successfully') else: if operation == 'new_project': new_project() elif operation == 'edit_project': edit_project() elif operation == 'upgrade_project': upgrade_project() elif operation == 'checkout_project': checkout_project() elif operation == 'compile_project': compile_project() elif operation == 'new_metadata': new_metadata() elif operation == 'clean_project': clean_project() elif operation == 'synchronize': synchronize() elif operation == 'refresh': refresh() elif operation == 'refresh_properties': refresh_properties() elif operation == 'compile': compile_selected_metadata() elif operation == 'delete': delete_selected_metadata() elif operation == 'get_active_session': get_active_session() elif operation == 'update_credentials': update_credentials() elif operation == 'execute_apex': execute_apex() elif operation == 'deploy_to_server' or operation == 'deploy': deploy_to_server(args) elif operation == 'unit_test' or operation == 'test': run_unit_tests(args) elif operation == 'list_metadata': list_metadata() elif operation == 'index_metadata': index_metadata(args) elif operation == 'list_connections': list_connections() elif operation == 'new_connection': new_connection() elif operation == 'delete_connection': delete_connection() elif operation == 'index_apex_overlays': index_apex_overlays() elif operation == 'new_apex_overlay': new_apex_overlay() elif operation == 'delete_apex_overlay': delete_apex_overlay() elif operation == 'fetch_logs': fetch_logs() elif operation == 'new_project_from_existing_directory': new_project_from_existing_directory() elif operation == 'debug_log': TODO() elif operation == 'open_sfdc_url': open_sfdc_url() else: print util.generate_error_response('Invalid operation requested') if args.callback != None: os.system(args.callback)