-
Notifications
You must be signed in to change notification settings - Fork 728
Factor code to download OmniSharp out of gulpfile.js #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| 'use strict'; | ||
|
|
||
| import * as fs from 'fs-extra-promise'; | ||
| import * as tmp from 'tmp'; | ||
| import * as vfs from 'vinyl-fs'; | ||
|
|
||
| const es = require('event-stream'); | ||
| const github = require('github-releases'); | ||
|
|
||
| tmp.setGracefulCleanup(); | ||
|
|
||
| export function downloadOmnisharp(version: string) { | ||
| var result = es.through(); | ||
|
|
||
| function onError(err) { | ||
| result.emit('error', err); | ||
| } | ||
|
|
||
| var repo = new github({ | ||
| repo: 'OmniSharp/omnisharp-roslyn', | ||
| token: process.env['GITHUB_TOKEN'] | ||
| }); | ||
|
|
||
| repo.getReleases({ tag_name: version }, function (err, releases) { | ||
| if (err) { | ||
| return onError(err); | ||
| } | ||
|
|
||
| if (!releases.length) { | ||
| return onError(new Error('Release not found')); | ||
| } | ||
|
|
||
| if (!releases[0].assets.length) { | ||
| return onError(new Error('Assets not found')); | ||
| } | ||
|
|
||
| repo.downloadAsset(releases[0].assets[0], function (err, istream) { | ||
| if (err) { | ||
| return onError(err); | ||
| } | ||
|
|
||
| tmp.file(function (err, tmpPath, fd, cleanupCallback) { | ||
| if (err) { | ||
| return onError(err); | ||
| } | ||
|
|
||
| var ostream = fs.createWriteStream(null, { fd: fd }); | ||
| ostream.once('error', onError); | ||
| istream.once('error', onError); | ||
| ostream.once('finish', function () { | ||
| vfs.src(tmpPath).pipe(result); | ||
| }); | ||
|
|
||
| istream.pipe(ostream); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| return result; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Type definitions for del v2.2.0 | ||
| // Project: https://github.com/sindresorhus/del | ||
| // Definitions by: Asana <https://asana.com>, Aya Morisawa <https://github.com/AyaMorisawa> | ||
|
|
||
| // /// <reference path="../glob/glob.d.ts"/> | ||
| // /// <reference path="../es6-promise/es6-promise.d.ts" /> | ||
|
|
||
| declare module "del" { | ||
| import glob = require("glob"); | ||
|
|
||
| function Del(pattern: string): Promise<string[]>; | ||
| function Del(pattern: string, options: Del.Options): Promise<string[]>; | ||
|
|
||
| function Del(patterns: string[]): Promise<string[]>; | ||
| function Del(patterns: string[], options: Del.Options): Promise<string[]>; | ||
|
|
||
| module Del { | ||
| function sync(pattern: string, options?: Options): string[]; | ||
| function sync(patterns: string[], options?: Options): string[]; | ||
|
|
||
| interface Options extends glob.IOptions { | ||
| force?: boolean; | ||
| dryRun?: boolean; | ||
| } | ||
| } | ||
|
|
||
| export = Del; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // Type definitions for tmp v0.0.28 | ||
| // Project: https://www.npmjs.com/package/tmp | ||
| // Definitions by: Jared Klopper <https://github.com/optical> | ||
|
|
||
| declare module "tmp" { | ||
|
|
||
| module tmp { | ||
| interface Options extends SimpleOptions { | ||
| mode?: number; | ||
| } | ||
|
|
||
| interface SimpleOptions { | ||
| prefix?: string; | ||
| postfix?: string; | ||
| template?: string; | ||
| dir?: string; | ||
| tries?: number; | ||
| keep?: boolean; | ||
| unsafeCleanup?: boolean; | ||
| } | ||
|
|
||
| interface SynchrounousResult { | ||
| name: string; | ||
| fd: number; | ||
| removeCallback: () => void; | ||
| } | ||
|
|
||
| function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void; | ||
| function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void; | ||
|
|
||
| function fileSync(config?: Options): SynchrounousResult; | ||
|
|
||
| function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void; | ||
| function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void; | ||
|
|
||
| function dirSync(config?: Options): SynchrounousResult; | ||
|
|
||
| function tmpName(callback: (err: any, path: string) => void): void; | ||
| function tmpName(config: SimpleOptions, callback?: (err: any, path: string) => void): void; | ||
|
|
||
| function tmpNameSync(config?: SimpleOptions): string; | ||
|
|
||
| function setGracefulCleanup(): void; | ||
| } | ||
|
|
||
| export = tmp; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still want this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I guess this code is still using mono dnx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed until I roll us forward to the new OmniSharp.