Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added the ability to edit files locally using "http://local.localhost…

…:4567" and putting files in ./local of the repo (now git ignored)
  • Loading branch information...
commit 9e498f6e9a21192e06436f1428ef68092b68933b 1 parent 846d1c1
@geelen authored
Showing with 6 additions and 1 deletion.
  1. +1 −0  .gitignore
  2. +5 −1 server.rb
View
1  .gitignore
@@ -1,3 +1,4 @@
bin
.bundle
+local
View
6 server.rb
@@ -42,7 +42,11 @@ def pull_from_gist(filename)
end
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
{}
end
Please sign in to comment.
Something went wrong with that request. Please try again.