def deploy_to_server(args): deploy_result = config.connection.project.deploy_to_server(request_payload) if args.respond_with_html == True: html = util.generate_html_response(args.operation, deploy_result, request_payload) print util.generate_success_response(html, "html") else: print deploy_result
def index_metadata(args): index_result = config.connection.project.index_metadata() if args.respond_with_html == True: html = util.generate_html_response(args.operation, index_result, request_payload) print util.generate_success_response(html, "html") else: print util.generate_success_response(index_result)
def run_unit_tests(args): test_result = config.connection.project.run_unit_tests(request_payload) if args.respond_with_html == True: html = util.generate_html_response(args.operation, test_result, request_payload) print util.generate_success_response(html, "html") else: print test_result
def run_unit_tests(args): test_result = config.connection.project.run_unit_tests(request_payload) if args.respond_with_html == True: html = util.generate_html_response(args.operation, test_result, request_payload) print util.generate_success_response(html, "html") else: print test_result
def index_metadata(args): index_result = config.connection.project.index_metadata() if args.respond_with_html == True: html = util.generate_html_response(args.operation, index_result, request_payload) print util.generate_success_response(html, "html") else: print util.generate_success_response(index_result)
def project_health_check(self): if self.args.respond_with_html == True: health_check_dict = config.connection.project.run_health_check(); html = util.generate_html_response(self.operation, health_check_dict) print util.generate_success_response(html, "html") else: print json.dumps(config.connection.project.run_health_check(),indent=4);
def update_credentials(): try: config.connection.project.username = request_payload['username'] config.connection.project.password = request_payload['password'] config.connection.project.org_type = request_payload['org_type'] config.connection.project.update_credentials() print util.generate_success_response('Your credentials were updated successfully') except BaseException, e: print util.generate_error_response(e.message)
def update_credentials(): try: config.connection.project.username = request_payload['username'] config.connection.project.password = request_payload['password'] config.connection.project.org_type = request_payload['org_type'] config.connection.project.update_credentials() print util.generate_success_response('Your credentials were updated successfully') except BaseException, e: print util.generate_error_response(e.message)
def index_metadata(self): if 'metadata_type' in self.payload: index_result = config.connection.project.index_metadata(self.payload['metadata_type']) else: index_result = config.connection.project.index_metadata() if self.args.respond_with_html == True: html = util.generate_html_response(self.args.operation, index_result, self.payload) print util.generate_success_response(html, "html") else: print util.generate_success_response("Project metadata indexed successfully")
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 run_unit_tests(self): test_result = config.connection.project.run_unit_tests(self.payload) if self.args.respond_with_html == True: html = util.generate_html_response(self.operation, test_result, self.payload) return util.generate_success_response(html, "html") else: return test_result
def update_credentials(self): try: config.connection.project.username = self.payload['username'] config.connection.project.password = self.payload['password'] config.connection.project.org_type = self.payload['org_type'] config.connection.project.org_url = self.payload.get('org_url', None) config.connection.project.update_credentials() return util.generate_success_response('Your credentials were updated successfully') except BaseException, e: return util.generate_error_response(e.message)
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 execute(self): try: self.setup_connection() 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 self.args.ui_switch == True: tmp_html_file = util.generate_ui(self.operation,self.payload) util.launch_ui(tmp_html_file) print 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] requested_function()
def deploy_to_server(args): deploy_result = config.connection.project.deploy_to_server(request_payload) if args.respond_with_html == True: html = util.generate_html_response(args.operation, deploy_result, request_payload) response = json.loads(util.generate_success_response(html, "html")) response['deploy_success'] = True # if deployment to one org fails, the entire deploy was not successful for result in deploy_result: if result['success'] == False: response['deploy_success'] = False break print json.dumps(response) else: print deploy_result
def refresh_properties(): config.connection.project.refresh_selected_properties(request_payload) print util.generate_success_response("Refreshed Apex file properties.")
def refresh_metadata_index(self): config.connection.project.index_metadata(self.payload['metadata_types']) print util.generate_success_response("Metadata refreshed successfully.")
def refresh_properties(): config.connection.project.refresh_selected_properties(request_payload) print util.generate_success_response("Refreshed Apex file properties.")
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)