JonyEpsilon / gorilla-repl

A rich REPL for Clojure in the notebook style.
http://gorilla-repl.org
MIT License
887 stars 104 forks source link

Added viewer implementation for Bitbucket repositories (issue #197) #210

Closed tbrx closed 9 years ago

tbrx commented 9 years ago

Hi, I also wanted to use the viewer for workbooks hosted in Bitbucket repos, and put together a small implementation.

The keys used in the view.html querystring are identical to those used for GitHub repositories, with one additional key revision, which defaults to "HEAD" (it is possible via the Bitbucket API to request a particular revision). Bitbucket repositories are served when source=bitbucket.

The main notable change is to add a new KO data-bind variable, host, reflecting where the workbook is hosted; this then is used instead of the hard-coded "GitHub" text in view.html. This value defaults to "GitHub" for the currently-supported GitHub repositories and gists, unless the source is set to bitbucket, in which case it is changed to "Bitbucket".

Thanks!

JonyEpsilon commented 9 years ago

This looks great :-) Only comment is that it looks a bit strange to just have my name in the Copyright section of a file that I haven't written any of. I suggest we change it to either $your name$, $your name$ + contributors, or if we want to be consistent across the project Jony Hudson + contributors. I'm happy with anything, and want to make sure everyone is appropriately credited.

Do you have a worksheet on bitbucket publicly accessible, for testing?

Edit: markdown failure.

tbrx commented 9 years ago

Thanks. There are a number of worksheets at https://bitbucket.org/fwood/anglican-examples, (which, incidentally, is currently mirrored by https://github.com/fwood/anglican-examples). For example (assuming running locally on port 8990):

http://127.0.0.1:8990/view.html?source=bitbucket&user=fwood&repo=anglican-examples&path=worksheets/gmm-iris.clj

That pulls the HEAD revision. You can also go look at an earlier version by referencing a (prefix of a) git commit hash, e.g.

http://127.0.0.1:8990/view.html?source=bitbucket&user=fwood&repo=anglican-examples&path=worksheets/gmm-iris.clj&revision=af1d127

As for credit, well: the Bitbucket file is not really appreciably different from the existing GitHub file =). I am certainly fine with it reading "Jony Hudson + contributors". How have you been handling this for previous pull requests and contributors?

JonyEpsilon commented 9 years ago

I've merged this and deployed to the public viewer. See:

http://viewer.gorilla-repl.org/view.html?source=bitbucket&user=fwood&repo=anglican-examples&path=worksheets/gmm-iris.clj

Regarding the copyright notices, my approach so far could probably be described as "inconsistent"! TBH, I don't think it much matters, from a legal point of view, and the git commit records attribute stuff carefully anyway. I also maintain a list of contributors on the landing page of http://gorilla-repo.org . So, I propose ignoring it at the moment, and changing to something uniform for each file like "The Gorilla REPL contributors" at some unspecified point in the future :-)

JonyEpsilon commented 9 years ago

p.s. Thanks again for the PR :-)