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
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2010 Dmitry Maksimov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,37 @@
1
+ == Git-bro
2
+ {Git-bro}[http://github.com/kolo/git-bro] is a server for your Git repositories. Git-bro is build on top of {Sinatra}[http://www.sinatrarb.com/] framework.
3
+
4
+ 1) Install the gem with the following command
5
+
6
+ sudo gem install git-bro
7
+
8
+ 2) Start serving
9
+
10
+ # serve given path
11
+ git-bro serve /path/to/my/git/repository
12
+
13
+ # serve current directory
14
+ git-bro serve
15
+
16
+ 3) Open link in browser - http://localhost:4567
17
+
18
+ == Usage
19
+ Common syntax of command is
20
+
21
+ git-bro [--version] [--help] COMMAND [ARGS]
22
+
23
+ Supported commands:
24
+
25
+ * serve serve given or current directory
26
+
27
+ == Development
28
+
29
+ Sources can be found on {Github}[http://github.com/kolo/git-bro].
30
+
31
+ == Authors
32
+
33
+ * Dmitry Maksimov (http://dmaximov.net)
34
+
35
+ == Copyright
36
+
37
+ Copyright (c) 2010 Dmitry Maksimov. See {LICENSE}[link://files/LICENSE.html] for details.
data/bin/git-bro CHANGED
@@ -1,85 +1,85 @@
1
- #! /usr/bin/ruby
2
-
3
- require 'optparse'
4
- require 'ostruct'
5
- require 'rbconfig'
6
- require 'git-bro'
7
- require 'git-bro/commands'
8
-
9
- module GitBro
10
- TARGET_OS = Config::CONFIG['target_os']
11
- require 'git-bro/process' if TARGET_OS == 'mswin32'
12
- end
13
-
14
- class GitBroApp
15
- attr_reader :options
16
-
17
- def initialize(arguments)
18
- @valid_commands = ['serve']
19
- @arguments = arguments
20
- @options = OpenStruct.new
21
-
22
- @options.gem_path = File.expand_path(File.dirname(__FILE__)) + "/.."
23
- end
24
-
25
- # parse options, check arguments, then process the command
26
- def run
27
- if parsed_options? and arguments_valid?
28
- process_arguments
29
- process_command
30
- else
31
- output_usage
32
- end
33
- end
34
-
35
- protected
36
- include GitBro::ServeCommand
37
-
38
- def parsed_options?
39
- return false if @arguments.empty?
40
- @command = @arguments.delete_at(0)
41
-
42
- opts = OptionParser.new
43
- opts.on('-v', '--version'){output_version;exit 0}
44
- opts.on('-h', '--help'){output_help;exit 0}
45
-
46
- opts.parse!(@arguments) rescue return false
47
-
48
- true
49
- end
50
-
51
- def arguments_valid?
52
- return false unless @valid_commands.include?(@command)
53
- self.send("#{@command}_arguments_valid?")
54
- end
55
-
56
- def process_arguments
57
- self.send("#{@command}_process_arguments")
58
- end
59
-
60
- def output_version
61
- puts "#{GitBro::VERSION}"
62
- end
63
-
64
- def output_help
65
- output_version
66
- File.readlines("#{File.dirname(__FILE__)}/short_help.txt").each {|l| puts l}
67
- end
68
-
69
- def output_usage
70
- puts "Usage: git-bro [--version] [--help] COMMAND [options]"
71
- end
72
-
73
- def process_command
74
- self.send("do_#{@command}")
75
- end
76
- end
77
-
78
- begin
79
- gb_app = GitBroApp.new(ARGV)
80
- gb_app.run
81
- rescue SystemExit
82
- # do nothing
83
- rescue Exception => e
84
- puts e.message
85
- end
1
+ #! /usr/bin/ruby
2
+
3
+ require 'optparse'
4
+ require 'ostruct'
5
+ require 'rbconfig'
6
+ require 'git-bro'
7
+ require 'git-bro/commands'
8
+
9
+ module GitBro
10
+ TARGET_OS = Config::CONFIG['target_os']
11
+ end
12
+
13
+ class GitBroApp
14
+ attr_reader :options
15
+
16
+ def initialize(arguments)
17
+ @valid_commands = ['serve']
18
+ @arguments = arguments
19
+ @options = OpenStruct.new
20
+
21
+ @options.gem_path = File.expand_path(File.dirname(__FILE__)) + "/.."
22
+ end
23
+
24
+ # parse options, check arguments, then process the command
25
+ def run
26
+ if parsed_options? and arguments_valid?
27
+ process_arguments
28
+ process_command
29
+ else
30
+ output_usage
31
+ end
32
+ end
33
+
34
+ protected
35
+ include GitBro::ServeCommand
36
+
37
+ def parsed_options?
38
+ opts = OptionParser.new
39
+ opts.on('-v', '--version'){ output_version; exit 0 }
40
+ opts.on('-h', '--help'){ output_help; exit 0 }
41
+
42
+ opts.parse!(@arguments) rescue return false
43
+
44
+ true
45
+ end
46
+
47
+ def arguments_valid?
48
+ @command = @arguments.delete_at(0)
49
+
50
+ return false unless @valid_commands.include?(@command)
51
+ self.send("#{@command}_arguments_valid?")
52
+ end
53
+
54
+ def process_arguments
55
+ self.send("#{@command}_process_arguments")
56
+ end
57
+
58
+ def output_version
59
+ puts "#{GitBro::VERSION}"
60
+ end
61
+
62
+ def output_help
63
+ output_usage
64
+ puts ""
65
+ puts "Available commands:"
66
+ puts "\s\s#{"serve".ljust(12)}Serve current or given folder"
67
+ end
68
+
69
+ def output_usage
70
+ puts "Usage: git-bro [--version] [--help] COMMAND [ARGS]"
71
+ end
72
+
73
+ def process_command
74
+ self.send("do_#{@command}")
75
+ end
76
+ end
77
+
78
+ begin
79
+ gb_app = GitBroApp.new(ARGV)
80
+ gb_app.run
81
+ rescue SystemExit
82
+ # do nothing
83
+ rescue Exception => e
84
+ puts e.message
85
+ end
data/docs/created.rid ADDED
@@ -0,0 +1 @@
1
+ Tue, 04 May 2010 11:44:34 +0400
@@ -0,0 +1,129 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: LICENSE</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>LICENSE</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>LICENSE
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue May 04 11:42:07 +0400 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ Copyright (c) 2010 Dmitry Maksimov
74
+ </p>
75
+ <p>
76
+ Permission is hereby granted, free of charge, to any person obtaining a
77
+ copy of this software and associated documentation files (the
78
+ &quot;Software&quot;), to deal in the Software without restriction,
79
+ including without limitation the rights to use, copy, modify, merge,
80
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
81
+ permit persons to whom the Software is furnished to do so, subject to the
82
+ following conditions:
83
+ </p>
84
+ <p>
85
+ The above copyright notice and this permission notice shall be included in
86
+ all copies or substantial portions of the Software.
87
+ </p>
88
+ <p>
89
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
96
+ </p>
97
+
98
+ </div>
99
+
100
+
101
+ </div>
102
+
103
+
104
+ </div>
105
+
106
+
107
+ <!-- if includes -->
108
+
109
+ <div id="section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- if method_list -->
119
+
120
+
121
+ </div>
122
+
123
+
124
+ <div id="validator-badges">
125
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
126
+ </div>
127
+
128
+ </body>
129
+ </html>
@@ -0,0 +1,178 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README.rdoc</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README.rdoc</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README.rdoc
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue May 04 11:44:30 +0400 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h2>Git-bro</h2>
73
+ <p>
74
+ <a href="http://github.com/kolo/git-bro">Git-bro</a> is a server for your
75
+ Git repositories. Git-bro is build on top of <a
76
+ href="http://www.sinatrarb.com/">Sinatra</a> framework.
77
+ </p>
78
+ <p>
79
+ 1) Install the gem with the following command
80
+ </p>
81
+ <pre>
82
+ sudo gem install git-bro
83
+ </pre>
84
+ <p>
85
+ 2) Start serving
86
+ </p>
87
+ <pre>
88
+ # serve given path
89
+ git-bro serve /path/to/my/git/repository
90
+
91
+ # serve current directory
92
+ git-bro serve
93
+ </pre>
94
+ <p>
95
+ 3) Open link in browser - <a
96
+ href="http://localhost:4567">localhost:4567</a>
97
+ </p>
98
+ <h2>Usage</h2>
99
+ <p>
100
+ Common syntax of command is
101
+ </p>
102
+ <pre>
103
+ git-bro [--version] [--help] COMMAND [ARGS] [OPTIONS]
104
+ </pre>
105
+ <p>
106
+ Supported commands:
107
+ </p>
108
+ <ul>
109
+ <li>serve serve given or current directory
110
+
111
+ </li>
112
+ </ul>
113
+ <p>
114
+ Available options:
115
+ </p>
116
+ <ul>
117
+ <li>-e environment
118
+
119
+ </li>
120
+ <li>-p port
121
+
122
+ </li>
123
+ <li>-s server
124
+
125
+ </li>
126
+ <li>-o addr
127
+
128
+ </li>
129
+ </ul>
130
+ <h2>Development</h2>
131
+ <p>
132
+ Sources can be found on <a
133
+ href="http://github.com/kolo/git-bro">Github</a>.
134
+ </p>
135
+ <h2>Authors</h2>
136
+ <ul>
137
+ <li>Dmitry Maksimov (<a href="http://dmaximov.net">dmaximov.net</a>)
138
+
139
+ </li>
140
+ </ul>
141
+ <h2>Copyright</h2>
142
+ <p>
143
+ Copyright (c) 2010 Dmitry Maksimov. See <a
144
+ href="../files/LICENSE.html">LICENSE</a> for details.
145
+ </p>
146
+
147
+ </div>
148
+
149
+
150
+ </div>
151
+
152
+
153
+ </div>
154
+
155
+
156
+ <!-- if includes -->
157
+
158
+ <div id="section">
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <!-- if method_list -->
168
+
169
+
170
+ </div>
171
+
172
+
173
+ <div id="validator-badges">
174
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
175
+ </div>
176
+
177
+ </body>
178
+ </html>