1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

github: check repo existence before importing

This commit is contained in:
Steven Hugg 2019-08-22 12:42:48 -04:00
parent 3a2df124eb
commit 84a6c6ff61
4 changed files with 22 additions and 7 deletions

View File

@ -111,7 +111,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li><a class="dropdown-item" target="_8bws_tools" href="//8bitworkshop.com/bitmapfontgenerator/">Bitmap Font Generator</a></li>
<li><a class="dropdown-item" target="_8bws_tools" href="http://tomeko.net/online_tools/file_to_hex.php?lang=en">Binary File to Hex Converter</a></li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Atari 2600/VCS</a>
<a tabindex="-1" href="#">Atari 2600</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" target="_8bws_tools" href="https://alienbill.com/2600/playerpalnext.html">playerpal 2600</a></li>
<li><a class="dropdown-item" target="_8bws_tools" href="https://alienbill.com/2600/playfieldpal.html">playfieldpal 2600</a></li>
@ -123,7 +123,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">About</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/">8bitworkshop.com</a></li>
<!--<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/">8bitworkshop.com</a></li>-->
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/blog">Latest News</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/projects">Projects</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://twitter.com/8bitworkshop">Twitter</a></li>
@ -146,7 +146,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Game Consoles</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=vcs">Atari 2600/VCS</a></li>
<li><a class="dropdown-item" href="?platform=vcs">Atari 2600</a></li>
<li><a class="dropdown-item" href="?platform=nes">NES</a></li>
</ul>
</li>
@ -177,7 +177,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Other</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=vcs.mame">Atari 2600/VCS (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=vcs.mame">Atari 2600 (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=nes.mame">NES (MAME)</a></li>
<li><a class="dropdown-item" href="?platform=vector-ataricolor">Atari Color Vector (6502)</a></li>
<li><a class="dropdown-item" href="?platform=markdown">Markdown</a></li>
@ -207,7 +207,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<span class="dropdown pull-right">
<a class="btn dropdown-toggle hidden-xs toolbarMenuButton" id="booksMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
Books <span class="caret"></span>
Get Books <span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="booksMenuButton">
<li>

View File

@ -7,6 +7,8 @@ import { CodeProject } from "./project";
declare var exports;
declare var firebase;
// https://github.com/philschatz/octokat.js/tree/master/examples
export interface GHRepoMetadata {
url : string; // github url
platform_id : string; // e.g. "vcs"
@ -184,7 +186,10 @@ export class GithubService {
.catch( (e) => {
console.log(e);
console.log('no README.md found')
return ''; // empty README
// make user repo exists
return sess.repo.fetch().then( (_repo) => {
return ''; // empty README
})
})
.then( (readme) => {
var m;

View File

@ -454,7 +454,6 @@ function importProjectFromGithub(githuburl:string, replaceURL:boolean) {
gotoNewLocation(replaceURL);
}).catch( (e) => {
setWaitDialog(false);
if (sess) getGithubService().bind(sess, false);
console.log(e);
alertError("<p>Could not import " + githuburl + ".</p>" + e);
});

View File

@ -70,6 +70,17 @@ describe('Store', function() {
});
});
it('Should import from Github (invalid URL)', function(done) {
var store = mstore.createNewPersistentStore('_FOO', function(store) {
var gh = newGH(store, '_FOO');
gh.importAndPull('https://github.com/pzpinfo/NOEXISTSREPO').catch( (e) => {
console.log(e);
assert.deepEqual(serv.getRepos(), {});
done();
});
});
});
it('Should import from Github (subdirectory tree)', function(done) {
var store = mstore.createNewPersistentStore('nes', function(store) {
var gh = newGH(store, 'nes');