def execute(printer=None, **kwargs): if printer == None: printer = PanelPrinter.get(sublime.active_window().id()) threads = [] thread = MmInstaller(True, printer=printer, **kwargs) threads.append(thread) thread.start()
def install(self): if self.printer != None: self.printer.show() self.printer.writeln(' ') self.printer.writeln(' ') self.printer.writeln('Installing MavensMate Desktop. This could take a few minutes...') self.printer.writeln('Timestamp: '+self.process_id) self.printer.writeln(' Result: ') self.calculate_process_region() PanelThreadProgress(self) download_directory = os.path.join(sublime.packages_path(),"User","MavensMate") if sys.platform == 'darwin': process = subprocess.Popen([os.path.join(sublime.packages_path(),"MavensMate","bin","install.sh"), download_directory, self.channel], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = process.communicate() if stderr != None: printer = PanelPrinter.get(sublime.active_window()) printer.show() message = '[ERROR]: Could not install MavensMate Desktop. '+stderr.decode('utf-8') printer.write('\n'+message+'\n') elif sys.platform == 'win32': download_url = 'https://mavensmate-app-auto-updater.herokuapp.com/download/channel/'+self.channel+'/'+sys.platform download_path = os.path.join(sublime.packages_path(),"User","MavensMate","mavensmate.exe") debug('attempting to download: ',download_url) # download and write mavensmate.exe to disk with urllib.request.urlopen(download_url) as response, open(download_path, 'wb') as out_file: data = response.read() # a `bytes` object out_file.write(data) # call exe (to install it) process = subprocess.Popen([download_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = process.communicate() if stderr != None: printer = PanelPrinter.get(sublime.active_window()) printer.show() message = '[ERROR]: Could not install MavensMate Desktop. '+stderr.decode('utf-8') printer.write('\n'+message+'\n') elif sys.platform == 'linux': pass #todo
def __init__(self, **kwargs): self.printer = kwargs.get('printer', None) self.channel = kwargs.get('channel', 'stable') self.process_id = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) self.status_region = None self.callback = handle_result self.window = sublime.active_window() self.view = self.window.active_view() self.result = None self.operation = 'install_mm' self.alt_callback = None self.settings = sublime.load_settings('mavensmate.sublime-settings') if self.printer == None: self.printer = PanelPrinter.get(self.window.id()) threading.Thread.__init__(self)
def __init__(self, force=False, version=None, **kwargs): self.force = force self.version = version self.printer = kwargs.get('printer', None) self.process_id = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime()) self.status_region = None self.callback = handle_result self.window = sublime.active_window() self.view = self.window.active_view() self.result = None self.operation = 'install_mm' self.alt_callback = None self.settings = sublime.load_settings('mavensmate.sublime-settings') self.beta_user = self.settings.get('mm_beta_user', False) self.release = kwargs.get('release', None) self.platform_flag = get_platform_flag() self.release_data = get_mm_releases() self.latest_release = self.get_latest_release() if self.printer == None: self.printer = PanelPrinter.get(self.window.id()) threading.Thread.__init__(self)