-
-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable watch to prevent race condition between threads calling site.process #320
Changes from 2 commits
fd83a67
1203e14
9e7b78d
efd6ede
4ce5082
c43c34e
0c170bd
82aba50
a573bb5
87f8e2b
9514901
2bf85ae
3652c41
f4d94ab
1d5a49b
5a87555
e26934f
7d086f2
c8fab6c
e1af381
28c4f9c
1f8c8c2
bce59f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,7 @@ class Server < Sinatra::Base | |
end | ||
|
||
write_file(write_path, document_body) | ||
updated_document = collection.docs.find { |d| d.path == write_path } | ||
render_404 if updated_document.nil? | ||
ensure_document | ||
json updated_document.to_api(:include_content => true) | ||
end | ||
|
||
|
@@ -76,7 +75,10 @@ def relative_document_path | |
end | ||
|
||
def document | ||
collection.docs.find { |d| d.path == document_path } | ||
collection.docs.find { |d| d.path == document_path } || | ||
Jekyll::Document.new(write_path, { | ||
:collection => collection, :site => site, | ||
}).tap(&:read) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is really 🆒 You da boss 😎 |
||
end | ||
|
||
def directory_docs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,7 @@ class Server < Sinatra::Base | |
end | ||
|
||
write_file(write_path, page_body) | ||
updated_page = pages.find { |p| p.path == write_path } | ||
render_404 if updated_page.nil? | ||
ensure_page | ||
json updated_page.to_api(:include_content => true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be |
||
end | ||
|
||
|
@@ -85,7 +84,9 @@ def relative_page_path | |
end | ||
|
||
def page | ||
site.pages.find { |p| sanitized_path(p.path) == page_path } | ||
Jekyll::Page.new( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could do either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think he's asking if we want to look to the existing page first then fall back to creating a new one like we do for other content types? |
||
site, site.source, File.dirname(page_path), File.basename(page_path) | ||
) | ||
end | ||
|
||
def directory_path | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be
document
now instead ofupdated_document
.