git-bro 0.1.0 → 0.2.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 (66) hide show
  1. data/LICENSE +7 -0
  2. data/README.rdoc +37 -0
  3. data/bin/git-bro +85 -85
  4. data/docs/created.rid +1 -0
  5. data/docs/files/LICENSE.html +129 -0
  6. data/docs/files/README_rdoc.html +178 -0
  7. data/docs/fr_class_index.html +26 -0
  8. data/docs/fr_file_index.html +28 -0
  9. data/docs/fr_method_index.html +26 -0
  10. data/docs/index.html +24 -0
  11. data/docs/rdoc-style.css +208 -0
  12. data/lib/git-bro.rb +2 -1
  13. data/lib/git-bro/commands/serve.rb +2 -2
  14. data/lib/git-bro/core_extensions.rb +22 -0
  15. data/lib/git-bro/repository.rb +74 -40
  16. data/lib/git-bro/sinatra/helpers.rb +11 -0
  17. data/sinatra/app.rb +113 -0
  18. data/{bin → sinatra}/public/images/file.png +0 -0
  19. data/{bin → sinatra}/public/images/folder.png +0 -0
  20. data/sinatra/public/js/application.js +10 -0
  21. data/sinatra/public/js/jquery-1.4.2.js +6240 -0
  22. data/sinatra/views/application.sass +180 -0
  23. data/sinatra/views/coderay.sass +42 -0
  24. data/sinatra/views/commit.haml +5 -0
  25. data/sinatra/views/commit_details.haml +13 -0
  26. data/sinatra/views/commits.haml +31 -0
  27. data/sinatra/views/dir.haml +40 -0
  28. data/sinatra/views/file_content.haml +5 -0
  29. data/{bin → sinatra}/views/index.haml +0 -0
  30. data/{bin → sinatra}/views/layout.haml +5 -1
  31. data/sinatra/views/menu.haml +23 -0
  32. data/sinatra/views/tree.haml +5 -0
  33. data/test/git-bro.git/HEAD +1 -0
  34. data/test/git-bro.git/config +4 -0
  35. data/test/git-bro.git/description +1 -0
  36. data/test/git-bro.git/hooks/applypatch-msg.sample +15 -0
  37. data/test/git-bro.git/hooks/commit-msg.sample +24 -0
  38. data/test/git-bro.git/hooks/post-commit.sample +8 -0
  39. data/test/git-bro.git/hooks/post-receive.sample +15 -0
  40. data/test/git-bro.git/hooks/post-update.sample +8 -0
  41. data/test/git-bro.git/hooks/pre-applypatch.sample +14 -0
  42. data/test/git-bro.git/hooks/pre-commit.sample +18 -0
  43. data/test/git-bro.git/hooks/pre-rebase.sample +169 -0
  44. data/test/git-bro.git/hooks/prepare-commit-msg.sample +36 -0
  45. data/test/git-bro.git/hooks/update.sample +118 -0
  46. data/test/git-bro.git/info/exclude +6 -0
  47. data/test/git-bro.git/objects/pack/pack-668e7a3976d53d070420e5877925f8472aaf569d.idx +0 -0
  48. data/test/git-bro.git/objects/pack/pack-668e7a3976d53d070420e5877925f8472aaf569d.pack +0 -0
  49. data/test/git-bro.git/objects/pack/pack-6f8375d1e612aff7cf5777d6fb1d0ca463f8e49d.idx +0 -0
  50. data/test/git-bro.git/objects/pack/pack-6f8375d1e612aff7cf5777d6fb1d0ca463f8e49d.pack +0 -0
  51. data/test/git-bro.git/refs/heads/develop +1 -0
  52. data/test/git-bro.git/refs/heads/master +1 -0
  53. data/test/git-bro/test_repository.rb +46 -0
  54. data/test/helper.rb +6 -0
  55. metadata +113 -30
  56. data/README +0 -18
  57. data/bin/server.rb +0 -52
  58. data/bin/short_help.txt +0 -4
  59. data/bin/views/application.sass +0 -69
  60. data/bin/views/dir.haml +0 -23
  61. data/bin/views/dir_listing.haml +0 -3
  62. data/bin/views/file_content.haml +0 -3
  63. data/git-bro-0.0.1.gem +0 -0
  64. data/git-bro.gemspec +0 -65
  65. data/lib/git-bro/process.rb +0 -28
  66. data/rakefile.rb +0 -29
@@ -0,0 +1,180 @@
1
+ body
2
+ width: 1000px
3
+ margin: auto
4
+
5
+ !blue_clr= #227CE8
6
+
7
+ h2
8
+ :color= !blue_clr
9
+
10
+ a
11
+ :color= !blue_clr
12
+ text-decoration: none
13
+ a:hover
14
+ text-decoration: underline
15
+
16
+ #header
17
+ padding: 5px 25px
18
+ border-bottom: 2px solid #66A3D2
19
+ background-color: #66A3D2
20
+ margin-top: 10px
21
+ color: #FFF
22
+ #header p
23
+ padding: 0
24
+ margin: 0
25
+ #header h1
26
+ padding: 0
27
+ margin: 0
28
+ #header a
29
+ color: white
30
+ #header a:hover
31
+ text-decoration: none
32
+
33
+ #path
34
+ font-size: 1.3em
35
+ padding: 10px 0
36
+ #repo-name
37
+ font-weight: bold
38
+
39
+ #content h2
40
+ font-size: 1.2em
41
+
42
+ /* FILES TABLE STYLES */
43
+
44
+ table
45
+ width: 100%
46
+ border-collapse: collapse
47
+ table th
48
+ text-align: left
49
+ padding: 2px 5px
50
+ background-color: #66A3D2
51
+ color: #2A2829
52
+ font-size: 0.8em
53
+ table tr
54
+ border: 1px solid #66A3D2
55
+ table td
56
+ padding: 2px 5px
57
+ font-size: 0.8em
58
+ #files td.icon
59
+ width: 16px
60
+ #files td.name
61
+ width: 20%
62
+ #files td.age
63
+ width: 20%
64
+ table td a
65
+ text-decoration: none
66
+ table td a:hover
67
+ text-decoration: underline
68
+ color= !blue_clr
69
+
70
+ #commits td.sha
71
+ font-family: monospace
72
+ width: 5%
73
+ #commits td.age
74
+ width: 15%
75
+
76
+ .pagination
77
+ padding: 10px 0
78
+ font-size: 0.8em
79
+ .pagination span
80
+ padding: 3px 5px
81
+ border: 1px solid gray
82
+ color: gray
83
+ margin-right: 1px
84
+ font-weight: bold
85
+ -moz-border-radius: 4px
86
+ -webkit-border-radius: 4px
87
+ .pagination a
88
+ padding: 3px 5px
89
+ border: 1px solid
90
+ border-color= !blue_clr
91
+ font-weight: bold
92
+ .pagination a:hover
93
+ text-decoration: none
94
+
95
+ .commit_details
96
+ margin: 30px 0
97
+ border: 1px solid #CCC
98
+ padding: 10px
99
+ font-family: 'DejaVu Sans Mono', 'Bitstream Sans Mono', 'Courier New'
100
+ font-size: 12px
101
+ background: #EAF2F5
102
+ .commit_details .sha
103
+ margin-bottom: 10px
104
+ font-size: 1.5em
105
+ color: #66A3D2
106
+ .commit_details .message
107
+ margin-bottom: 10px
108
+
109
+ #menu
110
+ margin-top: 20px
111
+ margin-bottom: 10px
112
+ font-size: 12px
113
+ text-align: right
114
+ #menu #top a
115
+ background-color: #66A3D2
116
+ padding: 5px 7px
117
+ color: white
118
+ font-weight: bold
119
+ -moz-border-radius: 4px
120
+ -webkit-border-radius: 4px
121
+ #menu #top a.active
122
+ background-color: white
123
+ color: #66A3D2
124
+ border: 1px solid #66A3D2
125
+ #menu #top a:hover
126
+ text-decoration: none
127
+ #menu #branch_span
128
+ display: inline
129
+ background-color: #66A3D2
130
+ color: white
131
+ padding: 5px 0px 5px 5px
132
+ margin-left: 10px
133
+ #menu #top span
134
+ border: 1px solid #66A3D2
135
+ margin: 0
136
+ font-weight: bold
137
+ #menu #top span#branch
138
+ padding: 4px 7px
139
+ background-color: white
140
+ color: black
141
+ cursor: pointer
142
+ #menu #top
143
+ margin-bottom: 5px
144
+
145
+ .clear
146
+ clear: both
147
+
148
+ #switch_branch
149
+ font-family: 'DejaVu Sans Mono', 'Bitstream Sans Mono', 'Courier New'
150
+ margin-top: 10px
151
+ #dropdown, #dropdown li ul
152
+ list-style-type: none
153
+ margin: 0
154
+ padding: 0
155
+ #dropdown li.headlink
156
+ border: 1px solid #66A3D2
157
+ #dropdown li.headlink
158
+ float: right
159
+ padding: 5px 7px 5px 7px
160
+ #dropdown li.headlink ul
161
+ margin-top: 5px
162
+ margin-left: -8px
163
+ position: absolute
164
+ display: none
165
+ #dropdown li.headlink ul li
166
+ background-color: #FFF
167
+ float: none
168
+ padding: 5px 7px
169
+ border-right: 1px solid #66A3D2
170
+ border-top: 1px solid #66A3D2
171
+ border-left: 1px solid #66A3D2
172
+ #dropdown li.headlink:hover ul
173
+ display: block
174
+ #dropdown li a:hover
175
+ text-decoration: none
176
+
177
+ #footer
178
+ margin-top: 20px
179
+ text-align: right
180
+ font-size: 0.7em
@@ -0,0 +1,42 @@
1
+ div.Coderay
2
+ border: 1px solid #CCC
3
+ font-size: 12px
4
+ font-family: 'Courier New', 'Tahoma', monospace
5
+ overflow: auto
6
+ margin-bottom: 30px
7
+
8
+ span.Coderay span
9
+ padding-left: 10px
10
+
11
+ /* Diff styles */
12
+ .Coderay .head
13
+ font-weight: bold
14
+ padding: 5px
15
+ background-color: #EEE
16
+ border-bottom: solid 1px #CCC
17
+ .Coderay span.head
18
+ font-weight: normal
19
+ .Coderay .chg, .Coderay .c
20
+ color: gray
21
+ padding-left: 0
22
+ .Coderay .del
23
+ background-color: #FDD
24
+ .Coderay .ins
25
+ background-color: #DFD
26
+
27
+ /* Ruby styles */
28
+ .Coderay .code
29
+ color: #333
30
+ .Coderay .r
31
+ font-weight: bold
32
+ color: #A40031
33
+ .Coderay .co, .Coderay .pc
34
+ font-weight: bold
35
+ color: #7A9A06
36
+ .Coderay .k, .Coderay .sy
37
+ color: #AE8DCE
38
+ .Coderay .iv
39
+ color: #76A5E0
40
+ .Coderay .no
41
+ padding-right: 25px
42
+ background-color: #EEE
@@ -0,0 +1,5 @@
1
+ = partial :menu, :locals => {:branch => @branch, :active => nil}
2
+ = partial :commit_details, :locals => {:commit => @commit, :link_sha => false}
3
+ - @commit.diffs.each do |diff|
4
+ %div.Coderay
5
+ = highlight(diff.diff, :diff, :tag => :span)
@@ -0,0 +1,13 @@
1
+ %div.commit_details
2
+ %div.sha
3
+ - if link_sha
4
+ %a{:href => "/commit/#{commit.sha}"}
5
+ = commit.sha
6
+ - else
7
+ = commit.sha
8
+ %div.message
9
+ = commit.message
10
+ %div.author
11
+ = commit.author.name
12
+ %div.age
13
+ = commit.date.relative_to(Time.now)
@@ -0,0 +1,31 @@
1
+ = partial :menu, :locals => {:branch => @branch, :active => :commits}
2
+ - current_time = Time.now
3
+ %table#commits
4
+ %tr
5
+ %th SHA
6
+ %th Age
7
+ %th Author
8
+ %th Message
9
+ - @commits.each do |commit|
10
+ %tr
11
+ %td.sha
12
+ %a{:href => "/commit/#{commit.sha}"}
13
+ = commit.sha[0..7]
14
+ %td.age
15
+ = commit.date.relative_to(current_time)
16
+ %td.name
17
+ = commit.author.name
18
+ %td.message
19
+ = commit.message.shortify(80)
20
+ %div.pagination
21
+ - if @page == 0
22
+ %span Newer
23
+ - else
24
+ - if @page == 1
25
+ %a{:href => "/commits/#{@branch}"} Newer
26
+ -else
27
+ %a{:href => "/commits/#{@branch}?page=#{@page - 1}"} Newer
28
+ - if @commits.size == @per_page
29
+ %a{:href => "/commits/#{@branch}?page=#{@page + 1}"} Older
30
+ - else
31
+ %span Older
@@ -0,0 +1,40 @@
1
+ :plain
2
+ <script>
3
+ GitBro.currentBranch = "#{@git_state[:branch]}";
4
+ GitBro.currentPath = "#{@git_state[:path]}"
5
+ </script>
6
+
7
+ :javascript
8
+ $(function(){
9
+ $("#files tr:nth-child(2) td:last").text("Loading commit data...");
10
+
11
+ $.getJSON("/commits?branch=" + GitBro.currentBranch + "&path=" + GitBro.currentPath,
12
+ function(data){
13
+ $.each(data, function(sha){
14
+ tr = $("#" + sha).parent().parent();
15
+ tr.children()[2].textContent = this.age;
16
+ tr.children()[3].textContent = this.message + "(" + this.author + ")"
17
+ });
18
+ });
19
+ });
20
+
21
+ %table#files
22
+ %tr
23
+ %th
24
+ %th name
25
+ %th age
26
+ %th message
27
+ - objs.each do |obj|
28
+ %tr
29
+ %td.icon
30
+ - if obj[:type] == 'file'
31
+ %img{:src => '/images/file.png'}
32
+ - else
33
+ %img{:src => '/images/folder.png'}
34
+ %td.name
35
+ %a{:href => "#{@url_prefix}/#{obj[:name]}", :id => obj[:sha]}
36
+ = obj[:name]
37
+ %td.age
38
+ = obj[:commit_info][:age] if obj[:commit_info]
39
+ %td.message
40
+ = obj[:commit_info][:message] if obj[:commit_info]
@@ -0,0 +1,5 @@
1
+ = partial :menu, :locals => {:branch => @branch, :active => nil}
2
+ %div#path
3
+ - render_path(@path, @branch)
4
+ :plain
5
+ #{highlight(@content, @lang, :line_numbers => @lang ? :inline : nil)}
File without changes
@@ -5,10 +5,14 @@
5
5
  %head
6
6
  %title Git-Bro - browse your repositories
7
7
  %link{:rel => 'stylesheet', :type => 'text/css', :href => '/application.css'}
8
+ %link{:rel => 'stylesheet', :type => 'text/css', :href => '/coderay.css'}
9
+ %script{:type => 'text/javascript', :src => '/js/jquery-1.4.2.js'}
10
+ %script{:type => 'text/javascript', :src => '/js/application.js'}
8
11
  %body
9
12
  #wrapper
10
13
  #header
11
- %h1 Git-Bro
14
+ %h1
15
+ %a{:href => "/"} Git-Bro
12
16
  %p browse your Git repositories
13
17
  #content
14
18
  = yield
@@ -0,0 +1,23 @@
1
+ #menu
2
+ #top
3
+ %a{:href => "/tree/#{branch}", :class => active == :browse ? "active" : ""} Browse
4
+ %a{:href => "/commits/#{branch}", :class => active == :commits ? "active" : ""} Commits
5
+ #branch_span
6
+ %span Branch:
7
+ %span#branch #{branch}
8
+ #switch_branch
9
+ - branches = settings.branches
10
+ %ul#dropdown
11
+ %li.headlink
12
+ %a{:href => "#"}
13
+ = "Switch Branches (#{branches.size})" + "&#9662;"
14
+ %ul
15
+ - branches.each do |b|
16
+ %li
17
+ - fbn = b.ljust(20).gsub(/\s/,"&nbsp;")
18
+ - if b == branch
19
+ = "&nbsp;&#10003;" + fbn
20
+ - else
21
+ %a{:href => "/tree/#{b}"}
22
+ = "&nbsp;&nbsp;" + fbn
23
+ .clear
@@ -0,0 +1,5 @@
1
+ = partial :menu, :locals => {:branch => @branch, :active => :browse}
2
+ = partial :commit_details, :locals => {:commit => @top_commit, :link_sha => true}
3
+ %div#path
4
+ - render_path(@path, @branch)
5
+ = partial :dir, :locals => {:path_prefix => @url_prefix, :objs => @objs}
@@ -0,0 +1 @@
1
+ ref: refs/heads/master
@@ -0,0 +1,4 @@
1
+ [core]
2
+ repositoryformatversion = 0
3
+ filemode = true
4
+ bare = true
@@ -0,0 +1 @@
1
+ Unnamed repository; edit this file 'description' to name the repository.
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to check the commit log message taken by
4
+ # applypatch from an e-mail message.
5
+ #
6
+ # The hook should exit with non-zero status after issuing an
7
+ # appropriate message if it wants to stop the commit. The hook is
8
+ # allowed to edit the commit message file.
9
+ #
10
+ # To enable this hook, rename this file to "applypatch-msg".
11
+
12
+ . git-sh-setup
13
+ test -x "$GIT_DIR/hooks/commit-msg" &&
14
+ exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
15
+ :
@@ -0,0 +1,24 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to check the commit log message.
4
+ # Called by git-commit with one argument, the name of the file
5
+ # that has the commit message. The hook should exit with non-zero
6
+ # status after issuing an appropriate message if it wants to stop the
7
+ # commit. The hook is allowed to edit the commit message file.
8
+ #
9
+ # To enable this hook, rename this file to "commit-msg".
10
+
11
+ # Uncomment the below to add a Signed-off-by line to the message.
12
+ # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13
+ # hook is more suited to it.
14
+ #
15
+ # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16
+ # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17
+
18
+ # This example catches duplicate Signed-off-by lines.
19
+
20
+ test "" = "$(grep '^Signed-off-by: ' "$1" |
21
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22
+ echo >&2 Duplicate Signed-off-by lines.
23
+ exit 1
24
+ }
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script that is called after a successful
4
+ # commit is made.
5
+ #
6
+ # To enable this hook, rename this file to "post-commit".
7
+
8
+ : Nothing
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script for the "post-receive" event.
4
+ #
5
+ # The "post-receive" script is run after receive-pack has accepted a pack
6
+ # and the repository has been updated. It is passed arguments in through
7
+ # stdin in the form
8
+ # <oldrev> <newrev> <refname>
9
+ # For example:
10
+ # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11
+ #
12
+ # see contrib/hooks/ for an sample, or uncomment the next line and
13
+ # rename the file to "post-receive".
14
+
15
+ #. /usr/share/doc/git-core/contrib/hooks/post-receive-email