Skip to content

Commit

Permalink
added the ability to edit files locally using "http://local.localhost…
Browse files Browse the repository at this point in the history
…:4567" and putting files in ./local of the repo (now git ignored)
  • Loading branch information
geelen committed Jun 12, 2012
1 parent 846d1c1 commit 9e498f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
bin bin
.bundle .bundle


local
6 changes: 5 additions & 1 deletion server.rb
Expand Up @@ -42,7 +42,11 @@ def pull_from_gist(filename)
end end


def files def files
@files ||= JSON.parse(fetch("https://api.github.com/gists/#{gist_id}")).fetch('files') @files ||= if gist_id == 'local'
Hash[*Dir.glob(File.dirname(__FILE__) + "/local/*").map { |f| [File.basename(f),{'content' => File.read(f)}] }.flatten]
else
JSON.parse(fetch("https://api.github.com/gists/#{gist_id}")).fetch('files')
end
rescue KeyError rescue KeyError
{} {}
end end
Expand Down

0 comments on commit 9e498f6

Please sign in to comment.