webgit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +21 -0
- data/app/assets/javascripts/webgit/application.js +15 -0
- data/app/assets/javascripts/webgit/git.js.coffee +3 -0
- data/app/assets/stylesheets/webgit/application.css +14 -0
- data/app/assets/stylesheets/webgit/coderay.css +143 -0
- data/app/assets/stylesheets/webgit/git.css.scss +24 -0
- data/app/controllers/webgit/application_controller.rb +4 -0
- data/app/controllers/webgit/git_controller.rb +66 -0
- data/app/helpers/webgit/application_helper.rb +42 -0
- data/app/helpers/webgit/git_helper.rb +44 -0
- data/app/views/layouts/webgit/application.html.erb +14 -0
- data/app/views/webgit/git/_nav_header.html.erb +17 -0
- data/app/views/webgit/git/blob.html.erb +10 -0
- data/app/views/webgit/git/index.html.erb +8 -0
- data/app/views/webgit/git/tree.html.erb +20 -0
- data/config/routes.rb +10 -0
- data/lib/tasks/webgit_tasks.rake +4 -0
- data/lib/webgit.rb +5 -0
- data/lib/webgit/app_config.rb +5 -0
- data/lib/webgit/engine.rb +10 -0
- data/lib/webgit/version.rb +3 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1b793c42cc9548de1036284c48e6bb7188f64cb6
|
4
|
+
data.tar.gz: 71429f49a41bc93ce819268c18b85cc939ee2d13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c66e7f11852310bd4853e6d85035cdcc7d078be05070e92451884660b02df001369b48e351627974b7f98a9e044aabc128dfbe26aaa9558cbe513d99a2d1b0bb
|
7
|
+
data.tar.gz: c70a2bb59d8d5454362522c9342fe87b7929b2f914e9d3d42f592d11b0bb6372f04c26a5449f31e3fbc2044bd392302b73c762734bb5ed377752105bf96cd173
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Webgit'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require bootstrap
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require bootstrap
|
12
|
+
*= require_self
|
13
|
+
*= require_tree .
|
14
|
+
*/
|
@@ -0,0 +1,143 @@
|
|
1
|
+
.CodeRay {
|
2
|
+
background-color: #efefef;
|
3
|
+
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
|
4
|
+
color: #000;
|
5
|
+
margin-bottom: 14px;
|
6
|
+
}
|
7
|
+
|
8
|
+
.CodeRay pre {
|
9
|
+
display: block;
|
10
|
+
padding: 5px;
|
11
|
+
margin: 0;
|
12
|
+
font-size: 13px;
|
13
|
+
line-height: 20px;
|
14
|
+
word-break: break-all;
|
15
|
+
word-wrap: break-word;
|
16
|
+
white-space: pre;
|
17
|
+
background-color: #fcfcfc;
|
18
|
+
border: 1px solid #fcfcfc;
|
19
|
+
-webkit-border-radius: 5px;
|
20
|
+
-moz-border-radius: 5px;
|
21
|
+
border-radius: 5px;
|
22
|
+
}
|
23
|
+
|
24
|
+
div.CodeRay { }
|
25
|
+
span.CodeRay { white-space: pre; border: 0px; padding: 2px }
|
26
|
+
|
27
|
+
table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
|
28
|
+
table.CodeRay td {
|
29
|
+
padding: 1em 0.5em;
|
30
|
+
vertical-align: top;
|
31
|
+
}
|
32
|
+
|
33
|
+
.CodeRay .line-numbers, .CodeRay .no {
|
34
|
+
background-color: #ECECEC;
|
35
|
+
color: #AAA;
|
36
|
+
text-align: right;
|
37
|
+
}
|
38
|
+
|
39
|
+
.CodeRay .line-numbers a {
|
40
|
+
color: #AAA;
|
41
|
+
}
|
42
|
+
|
43
|
+
.CodeRay .line-numbers tt { font-weight: bold }
|
44
|
+
.CodeRay .line-numbers .highlighted { color: red }
|
45
|
+
.CodeRay .line { display: block; float: left; width: 100%; }
|
46
|
+
.CodeRay span.line-numbers { padding: 0px 4px }
|
47
|
+
.CodeRay .code { width: 100% }
|
48
|
+
|
49
|
+
ol.CodeRay { font-size: 10pt }
|
50
|
+
ol.CodeRay li { white-space: pre }
|
51
|
+
|
52
|
+
.CodeRay .code pre { overflow: auto }
|
53
|
+
.CodeRay .debug { color:white ! important; background:blue ! important; }
|
54
|
+
|
55
|
+
.CodeRay .annotation { color:#007 }
|
56
|
+
.CodeRay .attribute-name { color:#f08 }
|
57
|
+
.CodeRay .attribute-value { color:#700 }
|
58
|
+
.CodeRay .binary { color:#509; font-weight:bold }
|
59
|
+
.CodeRay .comment { color:#998; font-style: italic;}
|
60
|
+
.CodeRay .char { color:#04D }
|
61
|
+
.CodeRay .char .content { color:#04D }
|
62
|
+
.CodeRay .char .delimiter { color:#039 }
|
63
|
+
.CodeRay .class { color:#458; font-weight:bold }
|
64
|
+
.CodeRay .complex { color:#A08; font-weight:bold }
|
65
|
+
.CodeRay .constant { color:teal; }
|
66
|
+
.CodeRay .color { color:#0A0 }
|
67
|
+
.CodeRay .class-variable { color:#369 }
|
68
|
+
.CodeRay .decorator { color:#B0B; }
|
69
|
+
.CodeRay .definition { color:#099; font-weight:bold }
|
70
|
+
.CodeRay .directive { color:#088; font-weight:bold }
|
71
|
+
.CodeRay .delimiter { color:black }
|
72
|
+
.CodeRay .doc { color:#970 }
|
73
|
+
.CodeRay .doctype { color:#34b }
|
74
|
+
.CodeRay .doc-string { color:#D42; font-weight:bold }
|
75
|
+
.CodeRay .escape { color:#666; font-weight:bold }
|
76
|
+
.CodeRay .entity { color:#800; font-weight:bold }
|
77
|
+
.CodeRay .error { color:#F00; background-color:#FAA }
|
78
|
+
.CodeRay .exception { color:#C00; font-weight:bold }
|
79
|
+
.CodeRay .filename { color:#099; }
|
80
|
+
.CodeRay .function { color:#900; font-weight:bold }
|
81
|
+
.CodeRay .global-variable { color:teal; font-weight:bold }
|
82
|
+
.CodeRay .hex { color:#058; font-weight:bold }
|
83
|
+
.CodeRay .integer { color:#099; }
|
84
|
+
.CodeRay .include { color:#B44; font-weight:bold }
|
85
|
+
.CodeRay .inline { color: black }
|
86
|
+
.CodeRay .inline .inline { background: #ccc }
|
87
|
+
.CodeRay .inline .inline .inline { background: #bbb }
|
88
|
+
.CodeRay .inline .inline-delimiter { color: #D14; }
|
89
|
+
.CodeRay .inline-delimiter { color: #D14; }
|
90
|
+
.CodeRay .important { color:#f00; }
|
91
|
+
.CodeRay .interpreted { color:#B2B; font-weight:bold }
|
92
|
+
.CodeRay .instance-variable { color:teal }
|
93
|
+
.CodeRay .label { color:#970; font-weight:bold }
|
94
|
+
.CodeRay .local-variable { color:#963 }
|
95
|
+
.CodeRay .octal { color:#40E; font-weight:bold }
|
96
|
+
.CodeRay .operator { }
|
97
|
+
.CodeRay .predefined-constant { font-weight:bold }
|
98
|
+
.CodeRay .predefined { color:#369; font-weight:bold }
|
99
|
+
.CodeRay .preprocessor { color:#579; }
|
100
|
+
.CodeRay .pseudo-class { color:#00C; font-weight:bold }
|
101
|
+
.CodeRay .predefined-type { color:#074; font-weight:bold }
|
102
|
+
.CodeRay .reserved, .keyword { color:#000; font-weight:bold }
|
103
|
+
|
104
|
+
.CodeRay .key { color: #808; }
|
105
|
+
.CodeRay .key .delimiter { color: #606; }
|
106
|
+
.CodeRay .key .char { color: #80f; }
|
107
|
+
.CodeRay .value { color: #088; }
|
108
|
+
|
109
|
+
.CodeRay .regexp { background-color:#fff0ff }
|
110
|
+
.CodeRay .regexp .content { color:#808 }
|
111
|
+
.CodeRay .regexp .delimiter { color:#404 }
|
112
|
+
.CodeRay .regexp .modifier { color:#C2C }
|
113
|
+
.CodeRay .regexp .function { color:#404; font-weight: bold }
|
114
|
+
|
115
|
+
.CodeRay .string { color: #D20; }
|
116
|
+
.CodeRay .string .string { }
|
117
|
+
.CodeRay .string .string .string { background-color:#ffd0d0 }
|
118
|
+
.CodeRay .string .content { color: #D14; }
|
119
|
+
.CodeRay .string .char { color: #D14; }
|
120
|
+
.CodeRay .string .delimiter { color: #D14; }
|
121
|
+
|
122
|
+
.CodeRay .shell { color:#D14 }
|
123
|
+
.CodeRay .shell .content { }
|
124
|
+
.CodeRay .shell .delimiter { color:#D14 }
|
125
|
+
|
126
|
+
.CodeRay .symbol { color:#990073 }
|
127
|
+
.CodeRay .symbol .content { color:#A60 }
|
128
|
+
.CodeRay .symbol .delimiter { color:#630 }
|
129
|
+
|
130
|
+
.CodeRay .tag { color:#070 }
|
131
|
+
.CodeRay .tag-special { color:#D70; font-weight:bold }
|
132
|
+
.CodeRay .type { color:#339; font-weight:bold }
|
133
|
+
.CodeRay .variable { color:#036 }
|
134
|
+
|
135
|
+
.CodeRay .insert { background: #afa; }
|
136
|
+
.CodeRay .delete { background: #faa; }
|
137
|
+
.CodeRay .change { color: #aaf; background: #007; }
|
138
|
+
.CodeRay .head { color: #f8f; background: #505 }
|
139
|
+
|
140
|
+
.CodeRay .insert .insert { color: #080; font-weight:bold }
|
141
|
+
.CodeRay .delete .delete { color: #800; font-weight:bold }
|
142
|
+
.CodeRay .change .change { color: #66f; }
|
143
|
+
.CodeRay .head .head { color: #f4f; }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// Place all the styles related to the git controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: http://sass-lang.com/
|
4
|
+
.box {
|
5
|
+
background-color: #f9f9f9;
|
6
|
+
padding: 10px;
|
7
|
+
margin: 0 0 20px 0; /* negative indent the amount of the padding to maintain the grid system */
|
8
|
+
-webkit-border-radius: 6px;
|
9
|
+
-moz-border-radius: 6px;
|
10
|
+
border-radius: 6px;
|
11
|
+
-webkit-box-shadow: 0 0px 2px rgba(0,0,0,.05);
|
12
|
+
-moz-box-shadow: 0 0px 2px rgba(0,0,0,.1);
|
13
|
+
box-shadow: 0 0px 2px rgba(0,0,0,.05);
|
14
|
+
h2.title {
|
15
|
+
font-size: 12px;
|
16
|
+
margin:0 -10px; padding:0 10px; margin-bottom:8px;
|
17
|
+
color:#999; line-height:100%;
|
18
|
+
border-bottom:1px solid #ddd; padding-bottom:8px;
|
19
|
+
}
|
20
|
+
&.box_gray {
|
21
|
+
background-color: #F5F5F5;
|
22
|
+
padding: 0;
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Webgit
|
2
|
+
class GitController < ApplicationController
|
3
|
+
before_action :set_repo_branch, except: [:index, :set_current_repo]
|
4
|
+
|
5
|
+
def index
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
def set_current_repo
|
10
|
+
session[:current_repo] = params[:repo_name]
|
11
|
+
redirect_to webgit_tree_path(:master)
|
12
|
+
end
|
13
|
+
|
14
|
+
def tree
|
15
|
+
@tree = find_object
|
16
|
+
end
|
17
|
+
|
18
|
+
def blob
|
19
|
+
@blob = find_object
|
20
|
+
render formats: [:html]
|
21
|
+
end
|
22
|
+
|
23
|
+
def preview
|
24
|
+
@blob = find_object
|
25
|
+
content_type = Mime.fetch(params[:format]){|fallback| "text/html"}.to_s
|
26
|
+
response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
|
27
|
+
response.headers['Content-Type'] = content_type
|
28
|
+
response.headers['Content-Disposition'] = 'inline'
|
29
|
+
render text: @blob.content, content_type: content_type
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
def find_object
|
34
|
+
obj = @branch.tree
|
35
|
+
if ps = params[:path]
|
36
|
+
ps = ps + "." + params[:format] if params[:format]
|
37
|
+
ps.split('/').each do|p|
|
38
|
+
obj = find_object_in_tree(obj, p)
|
39
|
+
break unless obj
|
40
|
+
end
|
41
|
+
end
|
42
|
+
obj
|
43
|
+
end
|
44
|
+
|
45
|
+
def find_object_in_tree(tree, name)
|
46
|
+
tree.each do|obj|
|
47
|
+
if name == obj[:name]
|
48
|
+
oid = obj[:oid]
|
49
|
+
return @repo.lookup(obj[:oid])
|
50
|
+
end
|
51
|
+
end if tree.respond_to?(:each)
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_repo_branch
|
55
|
+
if session[:current_repo] && (path = AppConfig::REPOS[session[:current_repo]]['path'])
|
56
|
+
@repo = Rugged::Repository.new(path)
|
57
|
+
@branch = @repo.rev_parse(params[:branch])
|
58
|
+
@branches = Rugged::Branch.each_name(@repo).select{|item| !item.include?('/') && item != params[:branch]}
|
59
|
+
else
|
60
|
+
redirect_to webgit_path
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Webgit
|
2
|
+
module ApplicationHelper
|
3
|
+
EXT_WITH_LANGUAGE = {
|
4
|
+
ru: :ruby,
|
5
|
+
rb: :ruby,
|
6
|
+
rake: :ruby,
|
7
|
+
clj: :clojure,
|
8
|
+
h: :c,
|
9
|
+
py: :python,
|
10
|
+
txt: :text,
|
11
|
+
sh: :text,
|
12
|
+
js: :java_script,
|
13
|
+
htm: :html
|
14
|
+
}
|
15
|
+
|
16
|
+
def preview(blob, format)
|
17
|
+
f = format_to_sym(format)
|
18
|
+
case f
|
19
|
+
when :html, :htm then
|
20
|
+
"<div>#{blob.content}</div>"
|
21
|
+
when :ruby, :java, :js, :python, :scss, :php, :lua, :html, :json, :go, :sql, :yaml, :text, :coffee then
|
22
|
+
CodeRay.scan(blob.content.force_encoding('UTF-8'), f).div(:line_numbers => :table, :css => :class)
|
23
|
+
when :png, :jpg, :gif then
|
24
|
+
"<img src=\"#{preview_path(params[:branch], params[:path])}.#{params[:format]}\" />"
|
25
|
+
when '.pdf' then
|
26
|
+
"<iframe src=\"#{preview_path(params[:branch], params[:path])}.#{params[:format]}\" width='860' height='800' border='0' style='border:none'></iframe>"
|
27
|
+
else
|
28
|
+
"Binary File [#{params[:path]}]"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
def format_to_sym(format)
|
34
|
+
if format
|
35
|
+
EXT_WITH_LANGUAGE.fetch(format.to_sym, format.to_sym)
|
36
|
+
else
|
37
|
+
:text
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Webgit
|
2
|
+
module GitHelper
|
3
|
+
|
4
|
+
def navigation
|
5
|
+
ps = (params[:path] || "").split("/")
|
6
|
+
i = -1
|
7
|
+
nav = ps.map do|p|
|
8
|
+
i += 1
|
9
|
+
if i < ps.length - 1
|
10
|
+
link_to p, webgit_tree_path(params[:branch], ps[0..i].join('/'))
|
11
|
+
else
|
12
|
+
p
|
13
|
+
end
|
14
|
+
end.join(" / ")
|
15
|
+
raw nav
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def git_tree_path(item)
|
20
|
+
if params[:path]
|
21
|
+
webgit_tree_path(params[:branch], "#{params[:path]}/#{item}")
|
22
|
+
else
|
23
|
+
webgit_tree_path(params[:branch], item)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def git_blob_path(item)
|
28
|
+
if params[:path]
|
29
|
+
webgit_blob_path(params[:branch], "#{params[:path]}/#{item}")
|
30
|
+
else
|
31
|
+
webgit_blob_path(params[:branch], item)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def upper_path()
|
36
|
+
paths = params[:path].try(:split, "/")
|
37
|
+
if paths
|
38
|
+
path_url = paths.tap{|ps|ps.pop}.join("/")
|
39
|
+
end
|
40
|
+
webgit_tree_path(params[:branch], path_url)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Webgit</title>
|
5
|
+
<%= stylesheet_link_tag "webgit/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "webgit/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<thead>
|
2
|
+
<tr>
|
3
|
+
<td class="dropdown" style="width: 120px;">
|
4
|
+
<%= link_to "javascript:void(0)", class: "dropdown-toggle", data: {toggle: "dropdown"} do %>
|
5
|
+
<%= params[:branch] %> <b class="caret"></b>
|
6
|
+
<% end %>
|
7
|
+
<ul class="dropdown-menu">
|
8
|
+
<%- @branches.each do|branch| %>
|
9
|
+
<li><%= link_to branch, webgit_tree_path(branch) %></li>
|
10
|
+
<%- end %>
|
11
|
+
</ul>
|
12
|
+
</td>
|
13
|
+
<td>
|
14
|
+
<%= link_to params[:branch], webgit_tree_path(params[:branch]) %> / <%= navigation %>
|
15
|
+
</td>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="box">
|
2
|
+
<table class="table table-bordered table-striped table-condensed">
|
3
|
+
<%= render "nav_header" %>
|
4
|
+
<tbody>
|
5
|
+
<tr>
|
6
|
+
<td colspan="2"><%= link_to "..", upper_path %></td>
|
7
|
+
</tr>
|
8
|
+
<%- @tree.each_tree do|item| %>
|
9
|
+
<tr>
|
10
|
+
<td colspan="2"><%= link_to item[:name], git_tree_path(item[:name]) %></td>
|
11
|
+
</tr>
|
12
|
+
<%- end %>
|
13
|
+
<%- @tree.each_blob do|item| %>
|
14
|
+
<tr>
|
15
|
+
<td colspan="2"><%= link_to item[:name], git_blob_path(item[:name]) %></td>
|
16
|
+
</tr>
|
17
|
+
<%- end %>
|
18
|
+
</tbody>
|
19
|
+
</table>
|
20
|
+
</div>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Webgit::Engine.routes.draw do
|
2
|
+
|
3
|
+
root 'git#index'
|
4
|
+
|
5
|
+
get 'current_repo/:repo_name' => 'git#set_current_repo', as: 'current_repo'
|
6
|
+
get 'tree/:branch(/*path)' => 'git#tree', as: 'webgit_tree'
|
7
|
+
get 'blob/:branch(/*path)' => 'git#blob', as: 'webgit_blob'
|
8
|
+
get 'preview/:branch(/*path)' => 'git#preview', as: 'preview'
|
9
|
+
|
10
|
+
end
|
data/lib/webgit.rb
ADDED
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webgit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Zhan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rugged
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coderay
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Git Web Client.
|
42
|
+
email:
|
43
|
+
- zhiqiangzhan@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- app/assets/javascripts/webgit/application.js
|
49
|
+
- app/assets/javascripts/webgit/git.js.coffee
|
50
|
+
- app/assets/stylesheets/webgit/application.css
|
51
|
+
- app/assets/stylesheets/webgit/coderay.css
|
52
|
+
- app/assets/stylesheets/webgit/git.css.scss
|
53
|
+
- app/controllers/webgit/application_controller.rb
|
54
|
+
- app/controllers/webgit/git_controller.rb
|
55
|
+
- app/helpers/webgit/application_helper.rb
|
56
|
+
- app/helpers/webgit/git_helper.rb
|
57
|
+
- app/views/layouts/webgit/application.html.erb
|
58
|
+
- app/views/webgit/git/_nav_header.html.erb
|
59
|
+
- app/views/webgit/git/blob.html.erb
|
60
|
+
- app/views/webgit/git/index.html.erb
|
61
|
+
- app/views/webgit/git/tree.html.erb
|
62
|
+
- config/routes.rb
|
63
|
+
- lib/tasks/webgit_tasks.rake
|
64
|
+
- lib/webgit/app_config.rb
|
65
|
+
- lib/webgit/engine.rb
|
66
|
+
- lib/webgit/version.rb
|
67
|
+
- lib/webgit.rb
|
68
|
+
- MIT-LICENSE
|
69
|
+
- Rakefile
|
70
|
+
- README.rdoc
|
71
|
+
homepage: https://github.com/jameszhan
|
72
|
+
licenses: []
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.1.9
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Git Web Client
|
94
|
+
test_files: []
|
95
|
+
has_rdoc:
|