dolt 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/Gemfile.lock +21 -18
  2. data/Readme.md +3 -5
  3. data/bin/dolt +3 -6
  4. data/dolt.gemspec +5 -16
  5. data/lib/dolt/sinatra/multi_repo_browser.rb +3 -3
  6. data/lib/dolt/sinatra/single_repo_browser.rb +3 -3
  7. data/test/test_helper.rb +5 -3
  8. data/vendor/ui/css/gitorious.css +5 -0
  9. metadata +23 -239
  10. data/lib/dolt/async/when.rb +0 -128
  11. data/lib/dolt/disk_repo_resolver.rb +0 -39
  12. data/lib/dolt/git/blame.rb +0 -112
  13. data/lib/dolt/git/commit.rb +0 -73
  14. data/lib/dolt/git/repository.rb +0 -139
  15. data/lib/dolt/git/submodule.rb +0 -35
  16. data/lib/dolt/git/tree.rb +0 -42
  17. data/lib/dolt/repo_actions.rb +0 -91
  18. data/lib/dolt/template_renderer.rb +0 -67
  19. data/lib/dolt/version.rb +0 -21
  20. data/lib/dolt/view.rb +0 -23
  21. data/lib/dolt/view/binary_blob_embedder.rb +0 -41
  22. data/lib/dolt/view/blame.rb +0 -57
  23. data/lib/dolt/view/blob.rb +0 -97
  24. data/lib/dolt/view/breadcrumb.rb +0 -47
  25. data/lib/dolt/view/commit.rb +0 -27
  26. data/lib/dolt/view/gravatar.rb +0 -29
  27. data/lib/dolt/view/markup.rb +0 -107
  28. data/lib/dolt/view/multi_repository.rb +0 -27
  29. data/lib/dolt/view/object.rb +0 -44
  30. data/lib/dolt/view/single_repository.rb +0 -27
  31. data/lib/dolt/view/smart_blob_renderer.rb +0 -33
  32. data/lib/dolt/view/syntax_highlight.rb +0 -90
  33. data/lib/dolt/view/tab_width.rb +0 -30
  34. data/lib/dolt/view/tree.rb +0 -100
  35. data/test/dolt/async/when_test.rb +0 -112
  36. data/test/dolt/git/blame_test.rb +0 -128
  37. data/test/dolt/git/commit_test.rb +0 -89
  38. data/test/dolt/git/repository_test.rb +0 -186
  39. data/test/dolt/repo_actions_test.rb +0 -236
  40. data/test/dolt/template_renderer_test.rb +0 -122
  41. data/test/dolt/templates/blame_test.rb +0 -56
  42. data/test/dolt/templates/blob_test.rb +0 -118
  43. data/test/dolt/templates/commits_test.rb +0 -61
  44. data/test/dolt/templates/raw_test.rb +0 -41
  45. data/test/dolt/templates/refs_test.rb +0 -38
  46. data/test/dolt/templates/tree_history_test.rb +0 -93
  47. data/test/dolt/templates/tree_test.rb +0 -65
  48. data/test/dolt/view/binary_blob_embedder_test.rb +0 -49
  49. data/test/dolt/view/blame_test.rb +0 -122
  50. data/test/dolt/view/blob_test.rb +0 -116
  51. data/test/dolt/view/breadcrumb_test.rb +0 -46
  52. data/test/dolt/view/commit_test.rb +0 -31
  53. data/test/dolt/view/gravatar_test.rb +0 -30
  54. data/test/dolt/view/markup_test.rb +0 -94
  55. data/test/dolt/view/multi_repository_test.rb +0 -35
  56. data/test/dolt/view/object_test.rb +0 -83
  57. data/test/dolt/view/single_repository_test.rb +0 -30
  58. data/test/dolt/view/smart_blob_renderer_test.rb +0 -38
  59. data/test/dolt/view/syntax_highlight_test.rb +0 -108
  60. data/test/dolt/view/tab_width_test.rb +0 -40
  61. data/test/dolt/view/tree_test.rb +0 -199
  62. data/views/500.erb +0 -22
  63. data/views/blame.erb +0 -42
  64. data/views/blob.erb +0 -31
  65. data/views/commits.erb +0 -26
  66. data/views/index.erb +0 -25
  67. data/views/layout.erb +0 -45
  68. data/views/raw.erb +0 -19
  69. data/views/refs.erb +0 -22
  70. data/views/tree.erb +0 -50
  71. data/views/tree_history.erb +0 -19
@@ -1,116 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/single_repository"
20
- require "dolt/view/multi_repository"
21
- require "dolt/view/blob"
22
-
23
- describe Dolt::View::Blob do
24
- include Dolt::View::Blob
25
-
26
- describe "single repo mode" do
27
- include Dolt::View::SingleRepository
28
-
29
- it "returns blame url" do
30
- url = blame_url("myrepo", "master", "some/path")
31
- assert_equal "/blame/master:some/path", url
32
- end
33
-
34
- it "returns history url" do
35
- url = history_url("myrepo", "master", "some/path")
36
- assert_equal "/history/master:some/path", url
37
- end
38
-
39
- it "returns raw url" do
40
- url = raw_url("myrepo", "master", "some/path")
41
- assert_equal "/raw/master:some/path", url
42
- end
43
- end
44
-
45
- describe "multi repo mode" do
46
- include Dolt::View::MultiRepository
47
-
48
- it "returns blame url" do
49
- url = blame_url("myrepo", "master", "some/path")
50
- assert_equal "/myrepo/blame/master:some/path", url
51
- end
52
-
53
- it "returns history url" do
54
- url = history_url("myrepo", "master", "some/path")
55
- assert_equal "/myrepo/history/master:some/path", url
56
- end
57
-
58
- it "returns raw url" do
59
- url = raw_url("myrepo", "master", "some/path")
60
- assert_equal "/myrepo/raw/master:some/path", url
61
- end
62
- end
63
-
64
- describe "#multiline" do
65
- it "adds line number markup to code" do
66
- html = multiline("A few\nLines\n Here")
67
-
68
- assert_match "<pre", html
69
- assert_match "<ol class=\"linenums", html
70
- assert_match "<li class=\"L1\"><span class=\"line\">A few</span></li>", html
71
- assert_match "<li class=\"L2\"><span class=\"line\">Lines</span></li>", html
72
- assert_match "<li class=\"L3\"><span class=\"line\"> Here</span></li>", html
73
- end
74
-
75
- it "adds custom class name" do
76
- html = multiline("A few\nLines\n Here", :class_names => ["ruby"])
77
-
78
- assert_match "prettyprint", html
79
- assert_match "linenums", html
80
- assert_match "ruby", html
81
- end
82
- end
83
-
84
- describe "#format_text_blob" do
85
- it "escapes brackets" do
86
- html = format_text_blob("file.txt", "<hey>")
87
- assert_match /&lt;hey&gt;/, html
88
- end
89
- end
90
-
91
- describe "#format_binary_blob" do
92
- include Dolt::View::SingleRepository
93
-
94
- it "renders link to binary blob" do
95
- content = "GIF89aK\000 \000\367\000\000\266\270\274\335\336\337\214"
96
- html = format_binary_blob("some/file.gif", content, "gitorious", "master")
97
- assert_match /<a href="\/raw\/master:some\/file.gif"/, html
98
- assert_match "Download file.gif", html
99
- end
100
- end
101
-
102
- describe "#format_blob" do
103
- include Dolt::View::SingleRepository
104
-
105
- it "renders link to binary blob" do
106
- content = "GIF89aK\000 \000\367\000\000\266\270\274\335\336\337\214"
107
- html = format_blob("file.gif", content, "gitorious", "master")
108
- assert_match "Download file.gif", html
109
- end
110
-
111
- it "renders text blob" do
112
- html = format_blob("file.txt", "<hey>")
113
- assert_match /&lt;hey&gt;/, html
114
- end
115
- end
116
- end
@@ -1,46 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/breadcrumb"
20
-
21
- describe Dolt::View::Breadcrumb do
22
- include Dolt::Html
23
- include Dolt::View::SingleRepository
24
- include Dolt::View::Breadcrumb
25
-
26
- it "renders li element for root" do
27
- html = breadcrumb("myrepo", "master", "path.txt")
28
-
29
- assert_equal 1, select(html, "a").length
30
- assert_match /icon-file/, select(html, "li").first
31
- end
32
-
33
- it "renders li element for file" do
34
- html = breadcrumb("myrepo", "master", "path.txt")
35
-
36
- assert_match /path.txt/, select(html, "li").last
37
- end
38
-
39
- it "renders links to accumulated paths" do
40
- html = breadcrumb("myrepo", "master", "some/nested/path.txt")
41
-
42
- links = select(html, "a")
43
- assert_match /\"\/tree\/master:some"/, links[1]
44
- assert_match /\"\/tree\/master:some\/nested"/, links[2]
45
- end
46
- end
@@ -1,31 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/commit"
20
-
21
- describe Dolt::View::Commit do
22
- include Dolt::Html
23
- include Dolt::View::Commit
24
-
25
- describe "#commit_oid" do
26
- it "returns the first seven characters" do
27
- oid = "38b06b3f65a9c84ac860bf0ce0a69e43a23bc765"
28
- assert_equal "38b06b3", commit_oid(oid)
29
- end
30
- end
31
- end
@@ -1,30 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/gravatar"
20
-
21
- describe Dolt::View::Gravatar do
22
- include Dolt::View::Gravatar
23
-
24
- describe "#gravatar" do
25
- it "returns gravatar URL" do
26
- url = gravatar("christian@gitorious.com")
27
- assert_equal "http://www.gravatar.com/avatar/38b06b3f65a9c84ac860bf0ce0a69e43", url
28
- end
29
- end
30
- end
@@ -1,94 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/markup"
20
- require "dolt/view/syntax_highlight"
21
-
22
- module StubHighlighter
23
- def highlight(path, code, opt = {})
24
- return "##[#{opt[:lexer]}]#{code}##"
25
- end
26
- end
27
-
28
- describe Dolt::View::Markup do
29
- include Dolt::View::Markup
30
-
31
- describe "#render_markup" do
32
- include Dolt::View::SyntaxHighlight
33
-
34
- it "wraps markup in .gts-markup" do
35
- html = render_markup("file.md", "# Hey")
36
- assert_match "<div class=\"gts-markup\">", html
37
- end
38
-
39
- it "renders multi-line code blocks with syntax highlighting" do
40
- html = render_markup("file.md", <<-MD)
41
- ```cl
42
- (s-trim-left "trim ") ;; => "trim "
43
- (s-trim-left " this") ;; => "this"
44
- ```
45
- MD
46
-
47
- assert_match "<pre class=\"common-lisp prettyprint\">", html
48
- end
49
-
50
- it "highlights multiple separate multi-line code blocks" do
51
- html = render_markup("file.md", <<-MD)
52
- # # This stuff
53
-
54
- ```cl
55
- (s-trim-left "trim ") ;; => "trim "
56
- (s-trim-left " this") ;; => "this"
57
- ```
58
-
59
- # And this stuff
60
-
61
- ```cl
62
- (s-trim-left "trim ") ;; => "trim "
63
- (s-trim-left " this") ;; => "this"
64
- ```
65
- MD
66
-
67
- assert_equal 2, html.scan(/common-lisp/).length
68
- end
69
- end
70
-
71
- describe "#highlight_code_blocks" do
72
- include StubHighlighter
73
-
74
- it "does not touch non-markdown files" do
75
- content = "```cl\n(yup)\n```"
76
- assert_equal content, highlight_code_blocks("file.rst", content)
77
- end
78
-
79
- it "highlights one-line code block" do
80
- content = "```cl\n(yup)\n```"
81
- assert_match "##[cl](yup)##", highlight_code_blocks("file.md", content)
82
- end
83
-
84
- it "highlights multi-line code block" do
85
- content = "```cl\n(yup)\n(yessir-p t)\n```"
86
- assert_match "##[cl](yup)\n(yessir-p t)##", highlight_code_blocks("file.md", content)
87
- end
88
-
89
- it "preserves code block white-space" do
90
- content = "```cl\n(yup\n (yessir-p t))\n```"
91
- assert_match "##[cl](yup\n (yessir-p t))##", highlight_code_blocks("file.md", content)
92
- end
93
- end
94
- end
@@ -1,35 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/multi_repository"
20
-
21
- describe Dolt::View::MultiRepository do
22
- include Dolt::Html
23
- include Dolt::View::MultiRepository
24
-
25
- describe "#repo_url" do
26
- it "returns url prefixed with repository" do
27
- assert_equal "/gitorious/some/url", repo_url("gitorious", "/some/url")
28
- end
29
-
30
- it "returns url prefixed with repository name containing slashes" do
31
- url = repo_url("gitorious/mainline", "/some/url")
32
- assert_equal "/gitorious/mainline/some/url", url
33
- end
34
- end
35
- end
@@ -1,83 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/single_repository"
20
- require "dolt/view/multi_repository"
21
- require "dolt/view/object"
22
-
23
- describe Dolt::View::Object do
24
- include Dolt::View::Object
25
-
26
- describe "single repo mode" do
27
- include Dolt::View::SingleRepository
28
-
29
- it "returns blob url" do
30
- object = { :type => "blob", :name => "Gemfile" }
31
- url = object_url("myrepo", "master", "", object)
32
- assert_equal "/blob/master:Gemfile", url
33
- end
34
-
35
- it "returns tree url" do
36
- object = { :type => "tree", :name => "models" }
37
- url = object_url("myrepo", "master", "app", object)
38
- assert_equal "/tree/master:app/models", url
39
- end
40
-
41
- it "returns blob url in directory" do
42
- object = { :type => "blob", :name => "Gemfile" }
43
- url = object_url("myrepo", "master", "lib/mything", object)
44
- assert_equal "/blob/master:lib/mything/Gemfile", url
45
- end
46
- end
47
-
48
- describe "multi repo mode" do
49
- include Dolt::View::MultiRepository
50
-
51
- it "returns blob url" do
52
- object = { :type => "blob", :name => "Gemfile" }
53
- url = object_url("myrepo", "master", "", object)
54
- assert_equal "/myrepo/blob/master:Gemfile", url
55
- end
56
-
57
- it "returns blob url in directory" do
58
- object = { :type => "blob", :name => "Gemfile" }
59
- url = object_url("myrepo", "master", "lib/mything", object)
60
- assert_equal "/myrepo/blob/master:lib/mything/Gemfile", url
61
- end
62
- end
63
-
64
- describe "#object_icon_class" do
65
- it "returns blob icon type" do
66
- assert_equal "icon-file", object_icon_class({ :type => :blob })
67
- end
68
-
69
- it "returns tree icon type" do
70
- assert_equal "icon-folder-close", object_icon_class({ :type => :tree })
71
- end
72
-
73
- it "returns submodule icon type" do
74
- assert_equal "icon-hdd", object_icon_class({ :type => :submodule })
75
- end
76
- end
77
-
78
- it "links submodule object to submodule" do
79
- url = "git://gitorious.org/gitorious/ui3.git"
80
- object = { :type => :submodule, :url => url }
81
- assert_equal url, object_url("gitorious", "master", "vendor", object)
82
- end
83
- end
@@ -1,30 +0,0 @@
1
- # encoding: utf-8
2
- #--
3
- # Copyright (C) 2012 Gitorious AS
4
- #
5
- # This program is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU Affero General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Affero General Public License
16
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- #++
18
- require "test_helper"
19
- require "dolt/view/single_repository"
20
-
21
- describe Dolt::View::SingleRepository do
22
- include Dolt::Html
23
- include Dolt::View::SingleRepository
24
-
25
- describe "#repo_url" do
26
- it "returns url unmodified" do
27
- assert_equal "/some/url", repo_url("gitorious", "/some/url")
28
- end
29
- end
30
- end