don't compile automatically

This commit is contained in:
Sami Samhuri 2016-04-11 22:24:45 -07:00
parent fc3c00687c
commit c88590abd9

View file

@ -98,22 +98,6 @@ before do
else
@fields = {}
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
# favicon
@ -223,7 +207,6 @@ post '/posts/drafts' do
Thread.new do
blog.publish(env)
end
@wait_for_compilation = false
end
url = url_for(post.url)
status 201
@ -300,7 +283,6 @@ post '/posts/drafts/:id/publish' do |id|
if post = blog.get_draft(id)
new_post = blog.publish_post(post)
@wait_for_compilation = true
status 201
headers 'Location' => url_for(new_post.url), 'Content-Type' => 'application/json'
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)
new_post = blog.unpublish_post(post)
@wait_for_compilation = true
status 200
headers 'Location' => url_for(new_post.url), 'Content-Type' => 'application/json'
JSON.generate(post: new_post.fields)