-
-
Notifications
You must be signed in to change notification settings - Fork 26
Migrate to Fly and get READMEs working again #164
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
Conversation
build_directory.py
Outdated
# fix_repo_names = [ | ||
# row[0] | ||
# for row in db.execute( | ||
# """ | ||
# select full_name from repos | ||
# where readme_html like '%camo.githubusercontent.com%' | ||
# and readme not like '%camo.githubusercontent.com%' | ||
# limit 3 | ||
# """ | ||
# ).fetchall() | ||
# ] | ||
# print("Fixing HTML for {}".format(fix_repo_names)) | ||
# repos_to_fetch.extend(fix_repo_names) |
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 was the worst mess: because I lost the old content.db
I had to build from scratch, but somewhere our build scripts had depended on the previous DB having those readme
and readme_html
columns - without those I couldn't bootstrap a new database.
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.
Need to figure out how to rebuild those, while not getting busted by GitHub's rate limit if we need to get READMEs for hundreds of repos.
index_tutorials.py
Outdated
db["tutorials"].create({ | ||
"path": str, | ||
"title": str, | ||
"body": str, | ||
}, pk="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.
Had to explicitly create this table here, because otherwise when Datasette tried to render the /tutorials
page this template fragment would throw an error:
datasette.io/templates/_more_tutorials.html
Lines 2 to 7 in a705655
<h3>More tutorials</h3> | |
<ul> | |
{% for row in sql("select path, title from tutorials where path != ?", [path], database="content") %} | |
<li><a href="{{ row.path }}">{{ row.title }}</a></li> | |
{% endfor %} | |
</ul> |
sqlite-utils drop-table content.db plugin_repos --ignore | ||
sqlite-utils drop-table content.db tool_repos --ignore |
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.
Added --ignore
because otherwise we would be dropping a table that didn't exist yet in our fresh content.db
database.
templates/dogsheep-beta.yml
Outdated
tools.description as search_1, -- || ' ' || coalesce(repos.readme, '') as search_1, | ||
1 as is_public | ||
from tools join repos on tools.name = repos.name | ||
display_sql: |- | ||
select | ||
highlight( | ||
tools.description || ' ' || coalesce(repos.readme_html, ''), :q | ||
tools.description, -- || ' ' || coalesce(repos.readme_html, ''), | ||
:q |
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.
More hacks to deal with the missing readme
and readme_html
columns.
|
Getting closer...
|
|
Urgh I bet that was a rate limit too. |
|
Oh the problem is:
|
Because it's in a different location:
|
https://datasette.io/plugins/datasette-chronicle is now showing the full README! |
I'm using this PR to document some hacks.