crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.42k stars 1.62k forks source link

More recent API docs needed. #1513

Closed technorama closed 8 years ago

technorama commented 9 years ago

Users are confused when reading API documentation that doesn't match HEAD. An extra link to the current (development, unstable, or other name) API vs released API would be helpful.

jhass commented 9 years ago

Maybe we can find a way to make more clear that it's for the current release (and which that is)? And that you can build local docs with make doc?

asterite commented 9 years ago

It's been 13 days since the last release :-)

technorama commented 9 years ago

@jhass Ease of use should be a goal of ours. More steps == more friction == more frustration == fewer users.

@asterite There are already people on irc asking where TimeThis went. CGI and HTTP is in the process of being refactored. Think about how much of the API naming has changed in 13 days and what it will look like after 20.

One additional link on the website wouldn't hurt anyone but would help those new to crystal. Actually it would help everyone using the project and save them the extra steps in generating their own docs.

ysbaddaden commented 9 years ago

I tend to agree here. Since Crystal changes so fast sometimes, it would be convenient to have an edge version of the API. I have no idea how complicated it would be to put in place, thought.

jhass commented 9 years ago

We already automatically generate the gitbook, we probably could add a Travis build that regenerates docs and pushes any changes to it, shouldn't be too hard. If that sounds like a good idea to everybody I can look into it.

vyp commented 9 years ago

@jhass Sounds good to me. :+1:

asterite commented 9 years ago

@jhass If you want to try this, please do it :-)

I guess this will go into the github pages branch, right? Wouldn't that produce a huge commit history for that branch? For every commit, the docs will be regenerated. All doc pages have embedded a commit hash in every link, so all pages change. I think that would be devastating.

Maybe we should find a way to host this in a non-revisioned place. The same would go for the regular API docs.

jhass commented 9 years ago

Mmmh, true we would probably need to host it somewhere else or force push gh-pages all the time, let me think about it for a while.

jhass commented 9 years ago

Okay after looking through the deployment docs of Travis I see the following opportunities:

In any case an easier first iteration should be keeping the gh-pages branch for the website and the docs and using any of the above methods to provide http:/api.crystal-lang.org and http://api.crystal-lang.org/edge (essentially mirroring what Rails does with api.rubyonrails.org and api.rubyonrails.org/edge).

My personal preference would tend to go to the last option mentioned, followed by S3. But I don't think I should decide this :)

refi64 commented 9 years ago

Ok...so I'm not sure how you guys feel about stuff like this...

But have you ever tried ReadTheDocs? It has Markdown support. The server automatically rebuilds your docs every time a commit is made and manages the versions for you. I've used it plenty of times, and it's really freaking awesome. You can use redirects and all that stuff, so all the links could stay the same.

Only real issue is that I'm not sure how you guys would feel about using a doc system written in Python that is scripted via Python...

jhass commented 9 years ago

@kirbyfan64 this is not about http://crystal-lang.org/docs, which is rebuild on every commit to it automatically already and we have no issue with it. This is about http://crystal-lang.org/api

refi64 commented 9 years ago

@jhass Still the sane response. :)

bcardiff commented 9 years ago

Maybe we could handle this with a http://www.docrystal.org/ approach (or even with the code, although it's not crystal...) supporting edge + tags (+ branch ?) for either crystal and any other shard. There are some details regarding which version of crystal use to build the docs, but that can be pushed after 1.0 ;-)

jhass commented 9 years ago

@waj agreed on IRC to go for the S3 route. So after creating the bucket and pointing http://api.crystal-lang.org to it, something like

diff --git a/.travis.yml b/.travis.yml
index 6bb746a..a53dba6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ matrix:
 before_install: bin/ci prepare_system
 install: bin/ci prepare_build
 script:
-  - bin/ci with_build_env 'make crystal spec'
+  - bin/ci with_build_env 'make crystal spec doc'
   - bin/ci with_build_env 'find samples -name "*.cr" | xargs -L 1 ./bin/crystal build --no-codegen'
 branches:
   only:
@@ -28,3 +28,14 @@ notifications:
       - "%{repository_slug}#%{commit} (%{branch} - %{commit_subject}): %{message} %{build_url}"
   slack:
     secure: Ng3nTqGWY+9p1pS6yjGqDhmRvdgbIZgTNpMWbO/ngwpCyicmD3jafZkShqqXbULZTJJr3OxIGzi6GHGusT0Ic/Pi9JCM3X3v/xuBruKIR+EnNyPo7IL4ZYAlwnXyJHlCHHDBq0gSHGvGJwsXn6IgZBPRfeIq+CCyQHVPyvc9EHE=
+deploy:
+  provider: s3
+  access_key_id: foo
+  secret_access_key: bar
+  bucket: crystal_api
+  local-dir: doc/
+  upload-dir: edge/
+  acl: public_read
+  on:
+    repo: manastech/crystal
+    condition: $ARCH = x86_64

should be enough for now. The secret should be encrypted with help of the travis gem. An example ACL for the keys can be found at http://docs.travis-ci.com/user/deployment/s3/#S3-ACL-via-option

Then initially upload the current api/ folder of the gh-pages branch to the root of the bucket. On future releases copy the contents of the edge/ folder into the bucket root.

will commented 9 years ago

A bit of a derail, but if we're uploading things to s3 from travis, can we also upload a tgz of crystal-head? Then we could let people test their projects with the last released versions and head on the community travis support.

jhass commented 8 years ago

Given this extremely low hanging fruit is still open, I added rebuilding API docs to the nightly buildjob for now: http://nightly.crystal-lang.org/api/

pkorotkov commented 8 years ago

@jhass Oh, great news! Would you please explicitly indicate somewhere the repo revision this documentation is built for?

jhass commented 8 years ago

@pkorotkov I'd say that should be implemented by the documentation browser in general, feel free to open a distinct issue. For now you can infer it from the "View source" links.

asterite commented 8 years ago

This is fixed now, thanks to efforts by @bcardiff and @waj:

will commented 8 years ago

Something is going weird with the redirects @asterite @bcardiff @waj

~ ➤ curl -sLI https://crystal-lang.org/api/current | grep Location
Location: https://crystal-lang.org/api/latest/current
Location: https://crystal-lang.org/api/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/0.18.6/current
asterite commented 8 years ago

Yes, this is a known issue if you hit an unknown path, you'll get an error. But you'll get an error in any case for not found, 404 in this case. There's no way to correctly implement this with S3 buckets.

bcardiff commented 8 years ago

I finally get rid of them, not in the cleanest way.

$ curl -sLI https://crystal-lang.org/api/current | grep Location
Location: https://crystal-lang.org/api/latest/current
Location: https://crystal-lang.org/api/0.18.6/current
Location: https://crystal-lang.org/api/latest/0.18.6/current
Location: https://crystal-lang.org/404

Someday we could do a nice 404, but at least it stops the redirection loop. "Fixed" at https://github.com/crystal-lang/crystal/commit/2f157a6eb69ab109ddfebc0fcda6056ef6da32fa