mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
don't compile automatically
This commit is contained in:
parent
fc3c00687c
commit
c88590abd9
1 changed files with 0 additions and 19 deletions
|
|
@ -98,22 +98,6 @@ before do
|
||||||
else
|
else
|
||||||
@fields = {}
|
@fields = {}
|
||||||
end
|
end
|
||||||
@wait_for_compilation = @fields['wait']
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
compile = -> {
|
|
||||||
start = Time.now
|
|
||||||
if blog.compile_if_mutated
|
|
||||||
duration = Time.now.to_f - start.to_f
|
|
||||||
puts "Compiled blog in #{duration.round(2)}s"
|
|
||||||
end
|
|
||||||
}
|
|
||||||
if @wait_for_compilation
|
|
||||||
compile.call
|
|
||||||
else
|
|
||||||
Thread.new(&compile)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# favicon
|
# favicon
|
||||||
|
|
@ -223,7 +207,6 @@ post '/posts/drafts' do
|
||||||
Thread.new do
|
Thread.new do
|
||||||
blog.publish(env)
|
blog.publish(env)
|
||||||
end
|
end
|
||||||
@wait_for_compilation = false
|
|
||||||
end
|
end
|
||||||
url = url_for(post.url)
|
url = url_for(post.url)
|
||||||
status 201
|
status 201
|
||||||
|
|
@ -300,7 +283,6 @@ post '/posts/drafts/:id/publish' do |id|
|
||||||
|
|
||||||
if post = blog.get_draft(id)
|
if post = blog.get_draft(id)
|
||||||
new_post = blog.publish_post(post)
|
new_post = blog.publish_post(post)
|
||||||
@wait_for_compilation = true
|
|
||||||
status 201
|
status 201
|
||||||
headers 'Location' => url_for(new_post.url), 'Content-Type' => 'application/json'
|
headers 'Location' => url_for(new_post.url), 'Content-Type' => 'application/json'
|
||||||
JSON.generate(post: new_post.fields)
|
JSON.generate(post: new_post.fields)
|
||||||
|
|
@ -417,7 +399,6 @@ post '/posts/:year/:month/:id/unpublish' do |year, month, id|
|
||||||
|
|
||||||
if post = blog.get_post(year, month, id)
|
if post = blog.get_post(year, month, id)
|
||||||
new_post = blog.unpublish_post(post)
|
new_post = blog.unpublish_post(post)
|
||||||
@wait_for_compilation = true
|
|
||||||
status 200
|
status 200
|
||||||
headers 'Location' => url_for(new_post.url), 'Content-Type' => 'application/json'
|
headers 'Location' => url_for(new_post.url), 'Content-Type' => 'application/json'
|
||||||
JSON.generate(post: new_post.fields)
|
JSON.generate(post: new_post.fields)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue