def write_to_cache_without_js(self): process = CrossPlatformProcess(self.working_dir) (stdout, stderr) = process.run_sync(r'gulp -v') if process.failed or not GulpVersion(stdout).supports_tasks_simple(): raise Exception( "Gulp: Could not get the current gulp version or your gulp CLI version is lower than 3.7.0" ) (stdout, stderr) = process.run_sync(r'gulp --tasks-simple') gulpfile = self.get_gulpfile_path(self.working_dir) if not stdout: raise Exception( "Gulp: The result of `gulp --tasks-simple` was empty") CacheFile(self.working_dir).write({ gulpfile: { "sha1": Hasher.sha1(gulpfile), "tasks": dict((task, { "name": task, "dependencies": "" }) for task in stdout.split("\n") if task) } })
def write_to_cache(self): process = CrossPlatformProcess(self.working_dir) (stdout, stderr) = process.run_sync(r'node "%s/write_tasks_to_cache.js"' % self.settings.package_path()) if process.failed: try: self.write_to_cache_without_js() except: if process.returncode() == 127: raise Exception("\"node\" command not found.\nPlease be sure to have nodejs installed on your system and in your PATH (more info in the README).") elif stderr: self.log_errors(stderr) raise Exception("There was an error running gulp, make sure gulp is running correctly in your project.\nFor more info check the sublime-gulp.log file") return self.fetch_json()
def write_to_cache_without_js(self): process = CrossPlatformProcess(self.working_dir) (stdout, stderr) = process.run_sync(r'gulp -v') if process.failed or not GulpVersion(stdout).supports_tasks_simple(): raise Exception("Gulp: Could not get the current gulp version or your gulp CLI version is lower than 3.7.0") (stdout, stderr) = process.run_sync(r'gulp --tasks-simple') gulpfile = self.get_gulpfile_path(self.working_dir) if not stdout: raise Exception("Gulp: The result of `gulp --tasks-simple` was empty") CacheFile(self.working_dir).write({ gulpfile: { "sha1": Hasher.sha1(gulpfile), "tasks": dict((task, { "name": task, "dependencies": "" }) for task in stdout.split("\n") if task) } })
def write_to_cache(self): process = CrossPlatformProcess(self.working_dir) (stdout, stderr) = process.run_sync(r'node "%s/write_tasks_to_cache.js"' % self.settings.package_path()) if process.failed: try: self.write_to_cache_without_js() except: if process.returncode() == 127: raise Exception( "\"node\" command not found.\nPlease be sure to have nodejs installed on your system and in your PATH (more info in the README)." ) elif stderr: self.log_errors(stderr) raise Exception( "There was an error running gulp, make sure gulp is running correctly in your project.\nFor more info check the sublime-gulp.log file" ) return self.fetch_json()
def run_process(self, task): process = CrossPlatformProcess(self.working_dir) process.run(task) stdout, stderr = process.communicate(self.append_to_output_view_in_main_thread) defer_sync(lambda: self.finish(stdout, stderr))
def load_process_cache(): for process in ProcessCache.get_from_storage(): ProcessCache.add( CrossPlatformProcess(process['workding_dir'], process['last_command'], process['pid']))
def run_process(self, task): process = CrossPlatformProcess(self.working_dir) process.run(task) stdout, stderr = process.communicate( self.append_to_output_view_in_main_thread) defer_sync(lambda: self.finish(stdout, stderr))