Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
33c5b428
Commit
33c5b428
authored
Sep 15, 2016
by
chriseth
Committed by
GitHub
Sep 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #233 from ethereum/github-import
Do GitHub imports properly
parents
62fb4713
50aac904
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
app.js
src/app.js
+12
-1
compiler.js
src/app/compiler.js
+11
-11
No files found.
src/app.js
View file @
33c5b428
...
...
@@ -2,6 +2,7 @@
var
$
=
require
(
'jquery'
);
var
semver
=
require
(
'semver'
);
var
base64
=
require
(
'js-base64'
).
Base64
;
var
utils
=
require
(
'./app/utils'
);
var
QueryParams
=
require
(
'./app/query-params'
);
...
...
@@ -403,7 +404,17 @@ var run = function () {
function
handleGithubCall
(
root
,
path
,
cb
)
{
$
(
'#output'
).
append
(
$
(
'<div/>'
).
append
(
$
(
'<pre/>'
).
text
(
'Loading github.com/'
+
root
+
'/'
+
path
+
' ...'
)));
return
$
.
getJSON
(
'https://api.github.com/repos/'
+
root
+
'/contents/'
+
path
,
cb
);
return
$
.
getJSON
(
'https://api.github.com/repos/'
+
root
+
'/contents/'
+
path
)
.
done
(
function
(
data
)
{
if
(
'content'
in
data
)
{
cb
(
null
,
base64
.
decode
(
data
.
content
));
}
else
{
cb
(
'Content not received'
);
}
})
.
fail
(
function
(
xhr
,
text
,
err
)
{
cb
(
err
);
});
}
var
executionContext
=
new
ExecutionContext
();
...
...
src/app/compiler.js
View file @
33c5b428
...
...
@@ -3,8 +3,6 @@ var solc = require('solc/wrapper');
var
webworkify
=
require
(
'webworkify'
);
var
utils
=
require
(
'./utils'
);
var
Base64
=
require
(
'js-base64'
).
Base64
;
var
EventManager
=
require
(
'../lib/eventManager'
);
/*
...
...
@@ -237,21 +235,23 @@ function Compiler (editor, handleGithubCall) {
files
[
m
]
=
cachedRemoteFiles
[
m
];
reloop
=
true
;
}
else
if
((
githubMatch
=
/^
(
https
?
:
\/\/)?(
www.
)?
github.com
\/([^\/]
*
\/[^\/]
*
)\/(
.*
)
/
.
exec
(
m
)))
{
handleGithubCall
(
githubMatch
[
3
],
githubMatch
[
4
],
function
(
result
)
{
if
(
'content'
in
result
)
{
var
content
=
Base64
.
decode
(
result
.
content
);
handleGithubCall
(
githubMatch
[
3
],
githubMatch
[
4
],
function
(
err
,
content
)
{
if
(
err
)
{
cb
(
null
,
'Unable to import "'
+
m
+
'": '
+
err
);
return
;
}
cachedRemoteFiles
[
m
]
=
content
;
files
[
m
]
=
content
;
gatherImports
(
files
,
importHints
,
cb
);
}
else
{
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
}
}).
fail
(
function
()
{
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
});
return
;
}
else
if
(
/^
[^
:
]
*:
\/\/
/
.
exec
(
m
))
{
cb
(
null
,
'Unable to import "'
+
m
+
'": Unsupported URL'
);
return
;
}
else
{
cb
(
null
,
'Unable to import "'
+
m
+
'"'
);
cb
(
null
,
'Unable to import "'
+
m
+
'"
: File not found
'
);
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment