dolt 0.29.0 → 0.30.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/dolt.gemspec +1 -1
  2. data/lib/dolt/sinatra/multi_repo_browser.rb +11 -31
  3. data/lib/dolt/sinatra/repo_browser.rb +47 -0
  4. data/lib/dolt/sinatra/single_repo_browser.rb +15 -29
  5. metadata +4 -75
  6. data/vendor/ui/.gitignore +0 -4
  7. data/vendor/ui/.gitmodules +0 -39
  8. data/vendor/ui/Makefile +0 -48
  9. data/vendor/ui/autolint.js +0 -13
  10. data/vendor/ui/buster.js +0 -31
  11. data/vendor/ui/css/gitorious.css +0 -660
  12. data/vendor/ui/css/syntax-highlight.css +0 -140
  13. data/vendor/ui/dist/gitorious3-capillary.min.js +0 -12
  14. data/vendor/ui/dist/gitorious3.min.css +0 -1
  15. data/vendor/ui/dist/gitorious3.min.js +0 -3
  16. data/vendor/ui/favicon.ico +0 -0
  17. data/vendor/ui/iconic/lock_stroke.svg +0 -17
  18. data/vendor/ui/images/f5f5f5-980x1.png +0 -0
  19. data/vendor/ui/images/gitorious.png +0 -0
  20. data/vendor/ui/images/gitorious2013.png +0 -0
  21. data/vendor/ui/images/powered-by.png +0 -0
  22. data/vendor/ui/images/white-980x1.png +0 -0
  23. data/vendor/ui/js/src/app.js +0 -20
  24. data/vendor/ui/js/src/cache.js +0 -27
  25. data/vendor/ui/js/src/capillary.js +0 -7
  26. data/vendor/ui/js/src/components/abbrev.js +0 -24
  27. data/vendor/ui/js/src/components/blob.js +0 -154
  28. data/vendor/ui/js/src/components/capillary.js +0 -51
  29. data/vendor/ui/js/src/components/clone-name-suggestion.js +0 -38
  30. data/vendor/ui/js/src/components/clone-url-selection.js +0 -35
  31. data/vendor/ui/js/src/components/collapse.js +0 -17
  32. data/vendor/ui/js/src/components/comments.js +0 -111
  33. data/vendor/ui/js/src/components/commit-linker.js +0 -26
  34. data/vendor/ui/js/src/components/dropdown.js +0 -74
  35. data/vendor/ui/js/src/components/ganalytics.js +0 -19
  36. data/vendor/ui/js/src/components/live-markdown-preview.js +0 -35
  37. data/vendor/ui/js/src/components/loading.js +0 -33
  38. data/vendor/ui/js/src/components/oid-ref-interpolator.js +0 -9
  39. data/vendor/ui/js/src/components/profile-menu.js +0 -36
  40. data/vendor/ui/js/src/components/rails-links.js +0 -24
  41. data/vendor/ui/js/src/components/ref-selector.js +0 -116
  42. data/vendor/ui/js/src/components/repository.js +0 -162
  43. data/vendor/ui/js/src/components/select-details.js +0 -20
  44. data/vendor/ui/js/src/components/slugify.js +0 -32
  45. data/vendor/ui/js/src/components/timeago.js +0 -38
  46. data/vendor/ui/js/src/components/tree-history.js +0 -140
  47. data/vendor/ui/js/src/components/url.js +0 -65
  48. data/vendor/ui/js/src/components/user-repo-view-state.js +0 -4
  49. data/vendor/ui/js/src/gitorious.js +0 -171
  50. data/vendor/ui/js/src/json-request.js +0 -6
  51. data/vendor/ui/js/src/logger.js +0 -84
  52. data/vendor/ui/js/src/spacer.js +0 -5
  53. data/vendor/ui/js/test-libs/jquery-1.9.1.min.js +0 -5
  54. data/vendor/ui/js/test/cache-test.js +0 -47
  55. data/vendor/ui/js/test/components/abbrev-test.js +0 -22
  56. data/vendor/ui/js/test/components/blob-test.js +0 -90
  57. data/vendor/ui/js/test/components/clone-name-suggestion-test.js +0 -37
  58. data/vendor/ui/js/test/components/clone-url-selection-test.js +0 -25
  59. data/vendor/ui/js/test/components/comments-test.js +0 -139
  60. data/vendor/ui/js/test/components/commit-linker-test.js +0 -46
  61. data/vendor/ui/js/test/components/live-markdown-preview-test.js +0 -37
  62. data/vendor/ui/js/test/components/profile-menu-test.js +0 -46
  63. data/vendor/ui/js/test/components/ref-selector-test.js +0 -140
  64. data/vendor/ui/js/test/components/repository-admin-test.js +0 -37
  65. data/vendor/ui/js/test/components/repository-watching-test.js +0 -74
  66. data/vendor/ui/js/test/components/timeago-test.js +0 -74
  67. data/vendor/ui/js/test/components/tree-history-test.js +0 -324
  68. data/vendor/ui/js/test/components/url-template-test.js +0 -65
  69. data/vendor/ui/js/test/test-helper.js +0 -2
  70. data/vendor/ui/lib/bootstrap/css/bootstrap-responsive.min.css +0 -9
  71. data/vendor/ui/lib/bootstrap/css/bootstrap.min.css +0 -9
  72. data/vendor/ui/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
  73. data/vendor/ui/lib/bootstrap/img/glyphicons-halflings.png +0 -0
  74. data/vendor/ui/lib/bootstrap/js/bootstrap.min.js +0 -6
  75. data/vendor/ui/package.json +0 -21
  76. data/vendor/ui/todo.org +0 -4
@@ -1,24 +0,0 @@
1
- /*global dome*/
2
- this.gts = this.gts || {};
3
-
4
- this.gts.railsLinks = function (csrfParam, csrfToken) {
5
- dome.on(document.body, "click", function (e) {
6
- var method = dome.data.get("method", e.target);
7
- if (!method || method === "get") { return true; }
8
- e.preventDefault();
9
- e.stopPropagation();
10
- var href = e.target.href;
11
-
12
- var form = dome.el("form", {
13
- method: "post",
14
- action: href,
15
- style: { display: "none" }
16
- }, [
17
- dome.el("input", { name: "_method", value: method, type: "hidden" }),
18
- dome.el("input", { name: csrfParam, value: csrfToken, type: "hidden" })
19
- ]);
20
-
21
- document.body.appendChild(form);
22
- form.submit();
23
- });
24
- };
@@ -1,116 +0,0 @@
1
- /*global cull, dome*/
2
- // The global, shared Gitorious namespace
3
- this.gts = this.gts || {};
4
-
5
- /**
6
- * The ref selector builds an interactive "drop-down" menu from which the
7
- * user can select a head or tag, or lookup a specific ref. The menu will
8
- * reload the current page for the chosen ref.
9
- *
10
- * gts.refSelector(refs, current, urlTemplate)
11
- *
12
- * refs is an object containing available heads and tags and the oids they
13
- * refer to, e.g.:
14
- *
15
- * { "heads": [["production", "24e9c0d4ce36fbe1dfca4029e3bd206d64e2eecc"],
16
- * ["redesign", "4c22773401aa2cdd2391bc04443ad7eea193e7b6"],
17
- * ["web-hooks", "a08053012b9aee5d9733fceb2cf3083f29d9aa7d"],
18
- * ["master", "48ac677757da7ca052c59ebec0ded6e11eef2642"]],
19
- * "tags": [["v2.4.3", "7a3cffcb3c3db89e8005962850e29a8aab2ab09b"]]
20
- *
21
- * current is the active ref on the current page, either the refname
22
- * or the actual oid.
23
- *
24
- * urlTemplate is the URL that will be loaded, where the ref exists as a
25
- * placeholder, e.g. "/gitorious/mainline/source/#{ref}:lib". A suitable
26
- * template can be created from the current page's URL using
27
- * gts.url.templatize(window.location.href, { ref: currentRef });
28
- */
29
- this.gts.refSelector = (function (e) {
30
- function tpl(template, ref) {
31
- return (template || "#{ref}").replace(/#\{ref\}/g, ref);
32
- }
33
-
34
- /**
35
- * Gets the current ref. type is {heads,tags,remotes} and
36
- * refs[type] is an array of ref tuples where each tuple contains
37
- * the object id and a ref (e.g. "master").
38
- */
39
- function getCurrent(type, refName, refs) {
40
- return cull.select(function (ref) {
41
- return ref[0] === refName || ref[1] === refName;
42
- }, refs[type] || [])[0];
43
- }
44
-
45
- function currentRefLink(refs, current) {
46
- var currentRef = getCurrent("heads", current, refs);
47
- var type = "branch";
48
-
49
- if (!currentRef) {
50
- currentRef = getCurrent("tags", current, refs);
51
- type = "tag";
52
- }
53
-
54
- if (!currentRef) {
55
- type = "ref";
56
- }
57
-
58
- return e.a({
59
- href: "#",
60
- className: "dropdown-toggle",
61
- innerHTML: "<span class=\"caret\"></span> <em>" +
62
- type + ":</em> " + ((currentRef && currentRef[0]) || current)
63
- });
64
- }
65
-
66
- function refInput(url) {
67
- var input = e.input({ type: "text", className: "gts-ref-input" });
68
- var form = e.form({
69
- className: "gts-ref-input",
70
- events: {
71
- submit: function (e) {
72
- e.preventDefault();
73
- window.location = tpl(url, input.value);
74
- }
75
- }
76
- }, [input]);
77
-
78
- return e.li({
79
- className: "gts-dropdown-input",
80
- events: { click: function (e) { e.stopPropagation(); } }
81
- }, [e.strong(["Enter ref: ", form])]);
82
- }
83
-
84
- function refItems(label, refs, urlTemplate) {
85
- var initial = [e.li({className: "dropdown-label"}, [e.strong(label)])];
86
- return cull.reduce(function (elements, ref) {
87
- var url = tpl(urlTemplate, ref[1]);
88
- elements.push(e.li(e.a({ href: url }, ref[0])));
89
- return elements;
90
- }, initial, refs.sort());
91
- }
92
-
93
- function refsList(refs, urlTemplate) {
94
- return e.ul({ className: "dropdown-menu" },
95
- [refInput(urlTemplate)].
96
- concat(refItems("Branches", refs.heads || [], urlTemplate)).
97
- concat(refItems("Tags", refs.tags || [], urlTemplate)));
98
- }
99
-
100
- function build(refs, current, urlTemplate) {
101
- return e.div({
102
- className: "dropdown gts-branch-selector pull-right"
103
- }, [currentRefLink(refs, current), refsList(refs, urlTemplate)]);
104
- }
105
-
106
- function refSelector(placeholder, refs, ref, refUrlTemplate) {
107
- var selector = build(refs, ref, refUrlTemplate);
108
- placeholder.parentNode.insertBefore(selector, placeholder);
109
- placeholder.parentNode.removeChild(placeholder);
110
- this.gts.dropdown(selector);
111
- }
112
-
113
- refSelector.build = build;
114
- refSelector.getCurrentRef = getCurrent;
115
- return refSelector;
116
- }(dome.el));
@@ -1,162 +0,0 @@
1
- /*global dome, gts*/
2
- this.gts = this.gts || {};
3
-
4
- this.gts.repository = (function (el) {
5
- /**
6
- * Build the repository admin tab into the menu if the data indicates that
7
- * the current user can admin the repository. Initialize as a dropdown
8
- * toggler if built.
9
- */
10
- function bullet(type, text) {
11
- return [el.i({ className: type }), " " + text];
12
- }
13
-
14
- function link(href, type, text) {
15
- return el.a({ href: href }, bullet(type, text));
16
- }
17
-
18
- function build(data, tagName) {
19
- return el[tagName || "li"]({ className: "pull-right dropdown" }, [
20
- el.a({
21
- href: "#",
22
- "data-toggle": "dropdown",
23
- className: "dropdown-toggle"
24
- }, bullet("icon-cog", "Admin")),
25
- el.ul({ className: "dropdown-menu" }, [
26
- el.li(link(data.editPath, "icon-pencil", "Edit repository")),
27
- el.li(link(data.destroyPath, "icon-trash", "Delete repository")),
28
- el.li({ className: "divider" }),
29
- el.li(link(data.webHooksPath, "i", "Web hooks")),
30
- el.li(link(data.ownershipPath, "i", "Transfer ownership")),
31
- el.li(link(data.committershipsPath, "i", "Manage collaborators"))
32
- ])
33
- ]);
34
- }
35
-
36
- function repositoryAdmin(placeholder, data) {
37
- var toggler = build(data, placeholder.tagName.toLowerCase());
38
- dome.replace(placeholder, toggler);
39
- this.gts.dropdown(toggler);
40
-
41
- if (dome.data.get("gts-active", toggler.parentNode) === "admin") {
42
- dome.cn.add("active", toggler);
43
- }
44
- }
45
-
46
- repositoryAdmin.build = build;
47
-
48
- /**
49
- * Generate and power the "Watch"/"Unwatch" button on repository pages. To
50
- * use this component, put a placeholder on the page, and call
51
- * repositoryWatching(placeHolder, repositoryWatch);
52
- *
53
- * The viewstate object is expected to contain at least
54
- * - watching (boolean)
55
- * - watchPath (string)
56
- * - unwatchPath (string, only required if watching is true)
57
- */
58
- function render(link, repository) {
59
- if (repository.watching) {
60
- link.innerHTML = "<i class=\"icon icon-star\"></i> Unwatch";
61
- link.href = repository.unwatchPath;
62
- } else {
63
- link.innerHTML = "<i class=\"icon icon-star-empty\"></i> Watch";
64
- link.href = repository.watchPath;
65
- }
66
- }
67
-
68
- function unwatch(link, repository) {
69
- gts.request({
70
- url: repository.unwatchPath,
71
- method: "delete",
72
- type: "js",
73
- headers: {
74
- "Accept": "application/javascript, text/javascript"
75
- },
76
- success: function (xhr) {
77
- repository.watching = false;
78
- render(link, repository);
79
- },
80
- error: function () {
81
- link.innerHTML = "Failed, try watching again";
82
- }
83
- });
84
- }
85
-
86
- function watch(link, repository) {
87
- gts.request({
88
- url: repository.watchPath,
89
- method: "post",
90
- type: "text",
91
- headers: {
92
- "Accept": "application/javascript, text/javascript"
93
- },
94
- success: function (xhr) {
95
- repository.watching = true;
96
- repository.unwatchPath = xhr.getResponseHeader("location");
97
- render(link, repository);
98
- },
99
- error: function () {
100
- link.innerHTML = "Failed, try unwatching again";
101
- }
102
- });
103
- }
104
-
105
- function toggleState(link, repository) {
106
- gts.loading(link);
107
- if (repository.watching) {
108
- unwatch(link, repository);
109
- } else {
110
- watch(link, repository);
111
- }
112
- }
113
-
114
- function repositoryWatching(ph, repositoryWatch) {
115
- var link = dome.el("a", { className: "btn" });
116
- dome.replace(ph, link);
117
- render(link, repositoryWatch);
118
- dome.on(link, "click", function (e) {
119
- e.preventDefault();
120
- e.stopPropagation();
121
- toggleState(link, repositoryWatch);
122
- });
123
- };
124
-
125
- repositoryWatching.watch = watch;
126
- repositoryWatching.unwatch = unwatch;
127
- repositoryWatching.toggleState = toggleState;
128
- repositoryWatching.render = render;
129
-
130
- /**
131
- * Display button to clone repository if the current user is
132
- * offered a clone URL
133
- */
134
- function repositoryCloning(placeholder, repository) {
135
- if (!repository.clonePath) { return; }
136
- dome.replace(placeholder, dome.el("a", {
137
- href: repository.clonePath,
138
- className: "btn"
139
- }, "Clone"));
140
- }
141
-
142
- /**
143
- * Display button to merge repository clone if the current user
144
- * is offered a request merge URL.
145
- */
146
- function mergeRequest(placeholder, repository) {
147
- if (!repository.requestMergePath) { return; }
148
- dome.replace(placeholder, dome.el("li", { className: "pull-right" }, [
149
- dome.el("a", { href: repository.requestMergePath }, [
150
- dome.el("i", { className: "icon icon-random" }),
151
- " Request merge"
152
- ])
153
- ]));
154
- }
155
-
156
- return {
157
- admin: repositoryAdmin,
158
- watching: repositoryWatching,
159
- cloning: repositoryCloning,
160
- mergeRequest: mergeRequest
161
- };
162
- }(dome.el));
@@ -1,20 +0,0 @@
1
- /*global cull, dome*/
2
- this.gts = this.gts || {};
3
-
4
- /**
5
- * Allows <select> options to have a data-description attribute that
6
- * contains details about the options that will be displayed in the
7
- * element whose id matches that of the select's data-target when
8
- * selected.
9
- */
10
- this.gts.selectDetails = function (select) {
11
- var target = document.getElementById(dome.data.get("target", select));
12
- if (!target) { return; }
13
-
14
- function updateDescription(e) {
15
- target.innerHTML = dome.data.get("description", select.options[select.selectedIndex]);
16
- }
17
-
18
- dome.on(select, "change", updateDescription);
19
- updateDescription();
20
- };
@@ -1,32 +0,0 @@
1
- /*global cull, dome, gts*/
2
- this.gts = this.gts || {};
3
-
4
- /**
5
- * Mirrors the value of one field onto another by converting it to a
6
- * slug/url-friendly string as the source is updated. If the target
7
- * has been manually edited, it is no longer automatically updated.
8
- */
9
- this.gts.slugify = (function () {
10
- function toSlug(text) {
11
- return text.toLowerCase().replace(/[^a-z0-9_\-]+/g, "-").replace(/^\-|\-$/g, "");
12
- }
13
-
14
- function safeToOverwrite(source, target) {
15
- return target === "" || toSlug(source) === target;
16
- }
17
-
18
- return function slugify(source, target) {
19
- var currentSlugSource = source.value;
20
-
21
- function attemptOverwrite() {
22
- if (safeToOverwrite(currentSlugSource, target.value)) {
23
- target.value = toSlug(source.value);
24
- currentSlugSource = source.value;
25
- }
26
- }
27
-
28
- dome.on(source, "keyup", attemptOverwrite);
29
- dome.on(source, "focus", attemptOverwrite);
30
- attemptOverwrite();
31
- };
32
- }());
@@ -1,38 +0,0 @@
1
- /*global timeago, gts*/
2
- this.gts = this.gts || {};
3
-
4
- /**
5
- * Replace content of <abbr> elements with a casual representation of the
6
- * ISO8601 date in its title attribute.
7
- */
8
- this.gts.timeago = (function (ta) {
9
- function timeago(el, time) {
10
- var date = ta.parse(time || el.title);
11
- if (isNaN(date.getTime())) { return el; }
12
- var text = el.innerHTML.trim() || el.title;
13
- el.innerHTML = ta.relative(date);
14
- el.title = text;
15
- return el;
16
- };
17
-
18
- var cache = {};
19
-
20
- timeago.periodic = function (timeout) {
21
- if (!cache[timeout]) {
22
- cache[timeout] = [];
23
- setInterval(function () {
24
- for (var i = 0, l = cache[timeout].length, item; i < l; ++i) {
25
- item = cache[timeout][i];
26
- gts.timeago(item.element, item.time);
27
- }
28
- }, timeout);
29
- }
30
-
31
- return function (el) {
32
- cache[timeout].push({ element: el, time: el.title });
33
- return timeago(el, el.title);
34
- };
35
- };
36
-
37
- return timeago;
38
- }(timeago));
@@ -1,140 +0,0 @@
1
- /*global gts, cull, dome, reqwest, Spinner*/
2
- // The global, shared Gitorious namespace
3
- this.gts = this.gts || {};
4
-
5
- /**
6
- * gts.treeHistory(tableElement, treeHistoryUrl)
7
- *
8
- * Loads the tree history JSON payload from Gitorious and annotates an
9
- * HTML table containing a Git tree with commit data. The HTML table
10
- * is expected to look like:
11
- *
12
- * <table>
13
- * <!-- Possible thead and tfoot, ignored -->
14
- * <tbody>
15
- * <tr>
16
- * <td class="gts-name">
17
- * <a href="/gitorious/gitorious/source/master:bin">
18
- * <i class="icon icon-folder-close"></i>
19
- * bin
20
- * </a>
21
- * </td>
22
- * <td class="gts-commit-date"></td>
23
- * <td class="gts-commit-oid"></td>
24
- * <td></td>
25
- * </tr>
26
- * </tbody>
27
- * </table>
28
- *
29
- * treeHistory will fill out the commit date, oid and add the last commit
30
- * message to the last cell.
31
- *
32
- * treeHistory also supports initial empty <td> elements, as created by Dolt
33
- * when directory hierarhy indentation is enabled.
34
- *
35
- * The treeHistoryUrl points to the tree history JSON resource, which
36
- * looks like
37
- *
38
- * [{ "name": "bin",
39
- * "oid": "08e37640144b900e8e876f621332b64c39c79567",
40
- * "filemode": 16384,
41
- * "type": "tree",
42
- * "history": [{
43
- * "oid": "762d5a7186850dca6b507402ca7bbec2df2dea72",
44
- * "author": {
45
- * "name": "Marius Mathiesen",
46
- * "email": "marius@gitorious.org"
47
- * },
48
- * "date": "2012-10-04T14:15:33+02:00",
49
- * "summary": "Set ENV[\"HOME\"] to make resque work with SSH keys",
50
- * "message": ""
51
- * }, { ... }]
52
- * }, { ... }]
53
- */
54
- this.gts.treeHistory = (function (c, d) {
55
- function el(element, tagName) {
56
- return element.getElementsByTagName(tagName);
57
- }
58
-
59
- var th = function (table, url) {
60
- var cell = el(el(table, "tbody")[0], "td")[2];
61
- var spinner = new Spinner({
62
- lines: 13,
63
- length: 1,
64
- width: 2,
65
- radius: 6,
66
- corners: 1,
67
- rotate: 0,
68
- color: "#000",
69
- speed: 1,
70
- trail: 60,
71
- shadow: false,
72
- hwaccel: true,
73
- className: "spinner",
74
- zIndex: 2e9,
75
- top: "auto",
76
- left: "auto"
77
- }).spin(cell);
78
-
79
- reqwest({
80
- url: url,
81
- type: "json",
82
- success: function (tree) {
83
- spinner.stop();
84
- th.annotate(table, tree);
85
- }
86
- });
87
- };
88
-
89
- var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
90
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dev"];
91
-
92
- function getFileMeta(fileName, tree) {
93
- return c.select(function (e) {
94
- return e.name === fileName;
95
- }, tree)[0];
96
- }
97
-
98
- function formatDate(dateStr) {
99
- if (!Date.parse) { return ""; }
100
- var d = new Date(Date.parse(dateStr));
101
- return months[d.getMonth()] + " " + d.getDate() + " " + d.getFullYear();
102
- }
103
-
104
- function getTreeIndent(cells) {
105
- var i, l;
106
- for (i = 0, l = cells.length; i < l; ++i) {
107
- if (dome.cn.has("gts-name", cells[i])) {
108
- return i;
109
- }
110
- }
111
-
112
- return i;
113
- }
114
-
115
- function fileName(element) {
116
- return ((element && dome.text(element)) || "").trim();
117
- }
118
-
119
- th.annotateRow = function (tree, row) {
120
- var tds = el(row, "td");
121
- var offset = getTreeIndent(tds);
122
- var entry = getFileMeta(fileName(tds[offset]), tree);
123
- if (!entry) { return; }
124
- var commit = entry.history[0];
125
- tds[offset + 1].innerHTML = formatDate(commit.date);
126
- dome.data.set({ "gts-commit-oid": commit.oid }, tds[offset + 2]);
127
- tds[offset + 2].innerHTML = "#" + commit.oid.slice(0, 7);
128
- var summary = commit.summary.trim();
129
- tds[offset + 3].innerHTML = gts.abbrev(summary, 50, " [...]") +
130
- " (" + commit.author.name + ")";
131
- };
132
-
133
- th.annotate = function (table, tree) {
134
- c.doall(c.partial(function (tree, row) {
135
- th.annotateRow(tree, row);
136
- }, tree), el(el(table, "tbody")[0], "tr"));
137
- };
138
-
139
- return th;
140
- }(cull));