Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1 from KrisShannon/patch-1
Also allow executing from files in projects on github
  • Loading branch information
moritz committed Jan 1, 2012
2 parents 8dd8ee7 + a875194 commit 7d4b9b0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/EvalbotExecuter.pm
Expand Up @@ -85,6 +85,14 @@ sub run {
my $page = `curl -s $program`;
$page =~ /href="\/raw([^"]+)"/;
if ($1) { $program = decode_utf8 `curl -s https://raw.github.com/gist$1` } else { return 'gist not found' };
} elsif ($program =~ /^https:\/\/github\.com\/([^\/]+\/[^\/]+)\/blob\/([^\/]+\/[^\/].*)$/) {
my ($project, $file) = ($1, $2);
my $page = `curl -s $program`;
if ($page =~ /href="\/$project\/raw\/$file"/) {
$program = decode_utf8 `curl -s https://raw.github.com/$project/$file`
} else {
return 'file not found'
};
}
my $response = _fork_and_eval($program, $executer, $ename);
if (!length $response){
Expand Down

0 comments on commit 7d4b9b0

Please sign in to comment.