Instead of having to have commit access to the server so you can add a view/endpoint and then commit it into the repo and push it to the host, just to add material, we would like something less obtrusive and less coupled to the content.
The plan is to make a "manifest", an index of all the content. Currently it looks like this, basically an "array" of endpoints. An endpoint looks like this, basically a hash containing:
repopath a git url where the content is located
ref a SHA/tag/branch to find the file in, in the git repo (I'd like users to be able to override this from the url)
main_filename the file that will be served when someone hits the url
owner name of the person who entered it (note we have no auth at present), this will be used as a namespace in the url.
webpath What the user types into the url to see the content
datadir and localpath Combine to make the absolute_path, the location on the server where the repo gets cloned to.
Example:
Given this endpoint:
Endpoint.new repopath: 'https://gist.github.com/a1b2c3fakegist.git', # <-- doesn't have real content
ref: 'a23d29',
main_filename: 'lesson1.md',
owner: 'josh-cheek',
webpath: 'lesson1',
localpath: 'josh-cheek/a1b2c3fakegist', # <-- autogenerated unless we override it https://github.com/JoshCheek/miniature-octo-ironman/blob/094508b3048a89520ba169c6066799be3e6af027/lib/moi/manifest/endpoint.rb#L50-52
datadir: '/Users/josh/code/miniature-octo-ironman/tmp'
With this example endpoint, the flow would look like this:
user visits /josh-cheek/lesson1
our code will find this endpoint in the manifest
we clone https://gist.github.com/a1b2c3fakegist.git into /Users/josh/code/miniature-octo-ironman/tmp/josh-cheek/a1b2c3fakegist
we serve the file lesson1.md from the commit a23d29 (approdimately, equivalent to git show a23d29:lesson1.md)
Notes
This work is mostly being done in the lessons-in-manifest branch. Not merged into master, because it depends on cmake, which I spent an absurd amount of time trying to get available on Heroku, but is going nowhere so far. Might check out DigitalOcean, might try EC2.
Tasks
[ ] refactor tests/helpers. Here is the file, there is a lot of redundancy in it, and its really unclear how the tests work or why they say what they say (some stuff should get pushed down into the FsHelper, some should get pulled up -- e.g. if I assert against a file, test should make it explicit where this file came from / why this is the assertion)
[x] perform renamings in Endpoint
[ ] more helpful tests on WatsGoinOnHere stuffs (ie better names, several errors all use this class, should each get their own class)
[ ] Reference should be overridable from the url (param, probably)
[x] Provide the SHA in a header
[x] Get hosted somewhere:
Heroku buildpacks are in a bad state, but might still be able to get them to work
Steve and Kori were both into DigitalOcean
EC2 can definitely do it, but I'm really ignorant about such things
Part of the Endpoints milestone.
High level explanation
Instead of having to have commit access to the server so you can add a view/endpoint and then commit it into the repo and push it to the host, just to add material, we would like something less obtrusive and less coupled to the content.
The plan is to make a "manifest", an index of all the content. Currently it looks like this, basically an "array" of endpoints. An endpoint looks like this, basically a hash containing:
Example:
Given this endpoint:
With this example endpoint, the flow would look like this:
/josh-cheek/lesson1
https://gist.github.com/a1b2c3fakegist.git
into/Users/josh/code/miniature-octo-ironman/tmp/josh-cheek/a1b2c3fakegist
lesson1.md
from the commita23d29
(approdimately, equivalent togit show a23d29:lesson1.md
)Notes
This work is mostly being done in the lessons-in-manifest branch. Not merged into master, because it depends on cmake, which I spent an absurd amount of time trying to get available on Heroku, but is going nowhere so far. Might check out DigitalOcean, might try EC2.
Tasks