gitdoc 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/gitdoc.gemspec +0 -2
- data/gitdoc.rb +3 -0
- data/gitdoc/response_cache.rb +62 -0
- data/gitdoc/tasks.rb +1 -19
- metadata +11 -48
- data/pkg/gitdoc-3.10.1.gem +0 -0
- data/pkg/gitdoc-3.11.0.gem +0 -0
- data/pkg/gitdoc-3.11.1.gem +0 -0
- data/pkg/gitdoc-3.12.0.gem +0 -0
- data/pkg/gitdoc-3.13.0.gem +0 -0
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.1.0
|
data/gitdoc.gemspec
CHANGED
@@ -14,8 +14,6 @@ Gem::Specification.new do |gs|
|
|
14
14
|
gs.add_dependency 'rdiscount', '~>1.5.8'
|
15
15
|
gs.add_dependency 'haml', '~>3.0.25'
|
16
16
|
gs.add_dependency 'sinatra', '~>1.0'
|
17
|
-
gs.add_dependency 'unicorn','~>3.1.0'
|
18
17
|
gs.add_dependency 'coffee-script', '~>2.1.1'
|
19
18
|
gs.add_dependency 'json','~>1.4.6' # dependency of coffee-script
|
20
|
-
gs.add_dependency 'livereload', '~>1.5'
|
21
19
|
end
|
data/gitdoc.rb
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Shamelessly stolen from:
|
2
|
+
# https://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/response_cache.rb
|
3
|
+
require 'fileutils'
|
4
|
+
require 'rack'
|
5
|
+
|
6
|
+
# Rack::ResponseCache is a Rack middleware that caches responses for successful
|
7
|
+
# GET requests with no query string to disk or any ruby object that has an
|
8
|
+
# []= method (so it works with memcached). When caching to disk, it works similar to
|
9
|
+
# Rails' page caching, allowing you to cache dynamic pages to static files that can
|
10
|
+
# be served directly by a front end webserver.
|
11
|
+
class GitDoc::ResponseCache
|
12
|
+
|
13
|
+
# The default proc used if a block is not provided to .new
|
14
|
+
# It unescapes the PATH_INFO of the environment, and makes sure that it doesn't
|
15
|
+
# include '..'. If the Content-Type of the response is text/(html|css|xml),
|
16
|
+
# return a path with the appropriate extension (.html, .css, or .xml).
|
17
|
+
# If the path ends with a / and the Content-Type is text/html, change the basename
|
18
|
+
# of the path to index.html.
|
19
|
+
DEFAULT_PATH_PROC = proc do |env, res|
|
20
|
+
path = Rack::Utils.unescape(env['PATH_INFO'])
|
21
|
+
if !path.include?('..') and match = /text\/((?:x|ht)ml|css)/o.match(res[1]['Content-Type'])
|
22
|
+
type = match[1]
|
23
|
+
path = "#{path}.#{type}" unless /\.#{type}\z/.match(path)
|
24
|
+
path = File.join(File.dirname(path), 'index.html') if type == 'html' and File.basename(path) == '.html'
|
25
|
+
path
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Initialize a new ReponseCache object with the given arguments. Arguments:
|
30
|
+
# * app : The next middleware in the chain. This is always called.
|
31
|
+
# * cache : The place to cache responses. If a string is provided, a disk
|
32
|
+
# cache is used, and all cached files will use this directory as the root directory.
|
33
|
+
# If anything other than a string is provided, it should respond to []=, which will
|
34
|
+
# be called with a path string and a body value (the 3rd element of the response).
|
35
|
+
# * &block : If provided, it is called with the environment and the response from the next middleware.
|
36
|
+
# It should return nil or false if the path should not be cached, and should return
|
37
|
+
# the pathname to use as a string if the result should be cached.
|
38
|
+
# If not provided, the DEFAULT_PATH_PROC is used.
|
39
|
+
def initialize(app, cache, &block)
|
40
|
+
@app = app
|
41
|
+
@cache = cache
|
42
|
+
@path_proc = block || DEFAULT_PATH_PROC
|
43
|
+
end
|
44
|
+
|
45
|
+
# Call the next middleware with the environment. If the request was successful (response status 200),
|
46
|
+
# was a GET request, and had an empty query string, call the block set up in initialize to get the path.
|
47
|
+
# If the cache is a string, create any necessary middle directories, and cache the file in the appropriate
|
48
|
+
# subdirectory of cache. Otherwise, cache the body of the reponse as the value with the path as the key.
|
49
|
+
def call(env)
|
50
|
+
res = @app.call(env)
|
51
|
+
if env['REQUEST_METHOD'] == 'GET' and env['QUERY_STRING'] == '' and res[0] == 200 and path = @path_proc.call(env, res)
|
52
|
+
if @cache.is_a?(String)
|
53
|
+
path = File.join(@cache, path) if @cache
|
54
|
+
FileUtils.mkdir_p(File.dirname(path))
|
55
|
+
File.open(path, 'wb'){|f| res[2].each{|c| f.write(c)}}
|
56
|
+
else
|
57
|
+
@cache[path] = res[2]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
res
|
61
|
+
end
|
62
|
+
end
|
data/gitdoc/tasks.rb
CHANGED
@@ -1,25 +1,7 @@
|
|
1
|
-
task :server do
|
2
|
-
livereload = fork { exec "livereload" }
|
3
|
-
server = fork { exec 'unicorn' }
|
4
|
-
trap('INT') do
|
5
|
-
Process.kill('QUIT', server)
|
6
|
-
Process.kill('QUIT', livereload)
|
7
|
-
end
|
8
|
-
Process.waitall
|
9
|
-
end
|
10
|
-
|
11
|
-
task :default => :server
|
12
|
-
|
13
1
|
task :dev do
|
14
2
|
unless $LOAD_PATH.last =~ /gitdoc$/
|
15
3
|
abort "Run rake with the path to GitDocs's source to use dev mode\n"+
|
16
4
|
"Eg. rake -I ~/Projects/gitdoc dev"
|
17
5
|
end
|
18
|
-
|
19
|
-
server = fork { exec "shotgun -I #{$LOAD_PATH.last}" }
|
20
|
-
trap('INT') do
|
21
|
-
Process.kill('QUIT', server)
|
22
|
-
Process.kill('QUIT', livereload)
|
23
|
-
end
|
24
|
-
Process.waitall
|
6
|
+
exec "shotgun -I #{$LOAD_PATH.last}"
|
25
7
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 59
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 4
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 4.0.0
|
10
|
+
version: 4.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Myles Byrne
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-04-30 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rdiscount
|
@@ -65,26 +64,10 @@ dependencies:
|
|
65
64
|
version: "1.0"
|
66
65
|
type: :runtime
|
67
66
|
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: unicorn
|
70
|
-
prerelease: false
|
71
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 3
|
77
|
-
segments:
|
78
|
-
- 3
|
79
|
-
- 1
|
80
|
-
- 0
|
81
|
-
version: 3.1.0
|
82
|
-
type: :runtime
|
83
|
-
version_requirements: *id004
|
84
67
|
- !ruby/object:Gem::Dependency
|
85
68
|
name: coffee-script
|
86
69
|
prerelease: false
|
87
|
-
requirement: &
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
88
71
|
none: false
|
89
72
|
requirements:
|
90
73
|
- - ~>
|
@@ -96,11 +79,11 @@ dependencies:
|
|
96
79
|
- 1
|
97
80
|
version: 2.1.1
|
98
81
|
type: :runtime
|
99
|
-
version_requirements: *
|
82
|
+
version_requirements: *id004
|
100
83
|
- !ruby/object:Gem::Dependency
|
101
84
|
name: json
|
102
85
|
prerelease: false
|
103
|
-
requirement: &
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
104
87
|
none: false
|
105
88
|
requirements:
|
106
89
|
- - ~>
|
@@ -112,22 +95,7 @@ dependencies:
|
|
112
95
|
- 6
|
113
96
|
version: 1.4.6
|
114
97
|
type: :runtime
|
115
|
-
version_requirements: *
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
name: livereload
|
118
|
-
prerelease: false
|
119
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
|
-
requirements:
|
122
|
-
- - ~>
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
hash: 5
|
125
|
-
segments:
|
126
|
-
- 1
|
127
|
-
- 5
|
128
|
-
version: "1.5"
|
129
|
-
type: :runtime
|
130
|
-
version_requirements: *id007
|
98
|
+
version_requirements: *id005
|
131
99
|
description:
|
132
100
|
email: myles@myles.id.au
|
133
101
|
executables: []
|
@@ -141,21 +109,16 @@ files:
|
|
141
109
|
- default.sass
|
142
110
|
- doc.haml
|
143
111
|
- favicon.ico
|
112
|
+
- gitdoc/response_cache.rb
|
144
113
|
- gitdoc/tasks.rb
|
145
114
|
- gitdoc.gemspec
|
146
115
|
- gitdoc.rb
|
147
116
|
- highlight.css
|
148
|
-
- pkg/gitdoc-3.10.1.gem
|
149
|
-
- pkg/gitdoc-3.11.0.gem
|
150
|
-
- pkg/gitdoc-3.11.1.gem
|
151
|
-
- pkg/gitdoc-3.12.0.gem
|
152
|
-
- pkg/gitdoc-3.13.0.gem
|
153
117
|
- Rakefile
|
154
118
|
- README.md
|
155
119
|
- reset.sass
|
156
120
|
- TODO.md
|
157
121
|
- VERSION
|
158
|
-
has_rdoc: true
|
159
122
|
homepage: http://github.com/quackingduck/gitdoc
|
160
123
|
licenses: []
|
161
124
|
|
@@ -185,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
148
|
requirements: []
|
186
149
|
|
187
150
|
rubyforge_project:
|
188
|
-
rubygems_version: 1.
|
151
|
+
rubygems_version: 1.7.2
|
189
152
|
signing_key:
|
190
153
|
specification_version: 3
|
191
154
|
summary: A light-weight web app for serving up a folder of markdown files
|
data/pkg/gitdoc-3.10.1.gem
DELETED
Binary file
|
data/pkg/gitdoc-3.11.0.gem
DELETED
Binary file
|
data/pkg/gitdoc-3.11.1.gem
DELETED
Binary file
|
data/pkg/gitdoc-3.12.0.gem
DELETED
Binary file
|
data/pkg/gitdoc-3.13.0.gem
DELETED
Binary file
|