commit
9a2e9a4ad2
@ -0,0 +1,14 @@
|
|||||||
|
language: ruby
|
||||||
|
env:
|
||||||
|
- TRAVIS=true
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- 'master'
|
||||||
|
rvm:
|
||||||
|
- 1.9.3-p327
|
||||||
|
- 2.0.0
|
||||||
|
before_script:
|
||||||
|
- "bundle install"
|
||||||
|
- "git submodule init"
|
||||||
|
- "git submodule update"
|
||||||
|
script: "bundle exec rake"
|
@ -0,0 +1,16 @@
|
|||||||
|
2.0.2
|
||||||
|
- Revert MR that broke smart HTTP clients.
|
||||||
|
|
||||||
|
2.0.1
|
||||||
|
- Make sure child processes get reaped after popen, again.
|
||||||
|
|
||||||
|
2.0.0
|
||||||
|
- Use safer shell commands and avoid Dir.chdir
|
||||||
|
- Restrict the environment for shell commands
|
||||||
|
- Make Grack::Server thread-safe (zimbatm)
|
||||||
|
- Make sure child processes get reaped after popen
|
||||||
|
- Verify requested path is actually a Git directory (Ryan Canty)
|
||||||
|
|
||||||
|
|
||||||
|
1.1.0
|
||||||
|
- Modifies service_rpc to use chunked transfer (https://github.com/gitlabhq/grack/pull/1)
|
@ -0,0 +1,10 @@
|
|||||||
|
source "http://ruby.taobao.org"
|
||||||
|
|
||||||
|
gemspec
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem 'byebug'
|
||||||
|
gem 'rake'
|
||||||
|
gem 'pry'
|
||||||
|
gem 'rack-test'
|
||||||
|
end
|
@ -0,0 +1,37 @@
|
|||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
gitlab-grack (2.0.2)
|
||||||
|
rack (~> 1.5.1)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: http://ruby.taobao.org/
|
||||||
|
specs:
|
||||||
|
byebug (4.0.5)
|
||||||
|
columnize (= 0.9.0)
|
||||||
|
coderay (1.1.0)
|
||||||
|
columnize (0.9.0)
|
||||||
|
metaclass (0.0.1)
|
||||||
|
method_source (0.8.2)
|
||||||
|
mocha (0.14.0)
|
||||||
|
metaclass (~> 0.0.1)
|
||||||
|
pry (0.10.1)
|
||||||
|
coderay (~> 1.1.0)
|
||||||
|
method_source (~> 0.8.1)
|
||||||
|
slop (~> 3.4)
|
||||||
|
rack (1.5.2)
|
||||||
|
rack-test (0.6.2)
|
||||||
|
rack (>= 1.0)
|
||||||
|
rake (10.1.0)
|
||||||
|
slop (3.6.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
byebug
|
||||||
|
gitlab-grack!
|
||||||
|
mocha (~> 0.11)
|
||||||
|
pry
|
||||||
|
rack-test
|
||||||
|
rake
|
@ -0,0 +1,95 @@
|
|||||||
|
Grack - Ruby/Rack Git Smart-HTTP Server Handler
|
||||||
|
===============================================
|
||||||
|
|
||||||
|
[](https://travis-ci.org/gitlabhq/grack)
|
||||||
|
[](https://codeclimate.com/github/gitlabhq/grack)
|
||||||
|
|
||||||
|
This project aims to replace the builtin git-http-backend CGI handler
|
||||||
|
distributed with C Git with a Rack application. This reason for doing this
|
||||||
|
is to allow far more webservers to be able to handle Git smart http requests.
|
||||||
|
|
||||||
|
The default git-http-backend only runs as a CGI script, and specifically is
|
||||||
|
only targeted for Apache 2.x usage (it requires PATH_INFO to be set and
|
||||||
|
specifically formatted). So, instead of trying to get it to work with
|
||||||
|
other CGI capable webservers (Lighttpd, etc), we can get it running on nearly
|
||||||
|
every major and minor webserver out there by making it Rack capable. Rack
|
||||||
|
applications can run with the following handlers:
|
||||||
|
|
||||||
|
* CGI
|
||||||
|
* FCGI
|
||||||
|
* Mongrel (and EventedMongrel and SwiftipliedMongrel)
|
||||||
|
* WEBrick
|
||||||
|
* SCGI
|
||||||
|
* LiteSpeed
|
||||||
|
* Thin
|
||||||
|
|
||||||
|
These web servers include Rack handlers in their distributions:
|
||||||
|
|
||||||
|
* Ebb
|
||||||
|
* Fuzed
|
||||||
|
* Phusion Passenger (which is mod_rack for Apache and for nginx)
|
||||||
|
* Unicorn
|
||||||
|
* Puma
|
||||||
|
|
||||||
|
With [Warbler](http://caldersphere.rubyforge.org/warbler/classes/Warbler.html),
|
||||||
|
and JRuby, we can also generate a WAR file that can be deployed in any Java
|
||||||
|
web application server (Tomcat, Glassfish, Websphere, JBoss, etc).
|
||||||
|
|
||||||
|
Since the git-http-backend is really just a simple wrapper for the upload-pack
|
||||||
|
and receive-pack processes with the '--stateless-rpc' option, it does not
|
||||||
|
actually re-implement very much.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
========================
|
||||||
|
* Ruby - http://www.ruby-lang.org
|
||||||
|
* Rack - http://rack.rubyforge.org
|
||||||
|
* A Rack-compatible web server
|
||||||
|
* Git >= 1.7 (currently the 'pu' branch)
|
||||||
|
* Mocha (only for running the tests)
|
||||||
|
|
||||||
|
Quick Start
|
||||||
|
========================
|
||||||
|
$ gem install rack
|
||||||
|
$ (edit config.ru to set git project path)
|
||||||
|
$ rackup --host 127.0.0.1 -p 8080 config.ru
|
||||||
|
$ git clone http://127.0.0.1:8080/schacon/grit.git
|
||||||
|
|
||||||
|
Contributing
|
||||||
|
========================
|
||||||
|
If you would like to contribute to the Grack project, I prefer to get
|
||||||
|
pull-requests via GitHub. You should include tests for whatever functionality
|
||||||
|
you add. Just fork this project, push your changes to your fork and click
|
||||||
|
the 'pull request' button. To run the tests, you first need to install the
|
||||||
|
'mocha' mocking library and initialize the submodule.
|
||||||
|
|
||||||
|
$ sudo gem install mocha
|
||||||
|
$ git submodule init
|
||||||
|
$ git submodule update
|
||||||
|
|
||||||
|
Then you should be able to run the tests with a 'rake' command. You can also
|
||||||
|
run coverage tests with 'rake rcov' if you have rcov installed.
|
||||||
|
|
||||||
|
License
|
||||||
|
========================
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2009 Scott Chacon <schacon@gmail.com>
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
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.
|
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env rake
|
||||||
|
require "bundler/gem_tasks"
|
||||||
|
|
||||||
|
task :default => :test
|
||||||
|
|
||||||
|
desc "Run the tests."
|
||||||
|
task :test do
|
||||||
|
Dir.glob("tests/*_test.rb").each do |f|
|
||||||
|
system "ruby #{f}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Run test coverage."
|
||||||
|
task :rcov do
|
||||||
|
system "rcov tests/*_test.rb -i lib/git_http.rb -x rack -x Library -x tests"
|
||||||
|
system "open coverage/index.html"
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :grack do
|
||||||
|
desc "Start Grack"
|
||||||
|
task :start do
|
||||||
|
system('./bin/testserver')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Start everything."
|
||||||
|
multitask :start => [ 'grack:start' ]
|
@ -0,0 +1,6 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd $(dirname "$0")/..
|
||||||
|
exec /usr/bin/env bundle exec pry -Ilib -r grack
|
@ -0,0 +1,24 @@
|
|||||||
|
#! /usr/bin/env ruby
|
||||||
|
libdir = File.absolute_path( File.join( File.dirname(__FILE__), '../lib' ) )
|
||||||
|
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
||||||
|
|
||||||
|
Bundler.require(:default, :development)
|
||||||
|
|
||||||
|
|
||||||
|
require 'grack'
|
||||||
|
require 'rack'
|
||||||
|
root = File.absolute_path( File.join( File.dirname(__FILE__), '../examples' ) )
|
||||||
|
app = Grack::Server.new({
|
||||||
|
project_root: root,
|
||||||
|
upload_pack: true,
|
||||||
|
receive_pack:true
|
||||||
|
})
|
||||||
|
|
||||||
|
app1= Rack::Builder.new do
|
||||||
|
use Grack::Auth do |username, password|
|
||||||
|
[username, password] == ['123', '455']
|
||||||
|
end
|
||||||
|
run app
|
||||||
|
end
|
||||||
|
|
||||||
|
Rack::Server.start app: app1, Port: 3001
|
@ -0,0 +1 @@
|
|||||||
|
ref: refs/heads/master
|
@ -0,0 +1,6 @@
|
|||||||
|
[core]
|
||||||
|
repositoryformatversion = 0
|
||||||
|
filemode = true
|
||||||
|
bare = true
|
||||||
|
ignorecase = true
|
||||||
|
precomposeunicode = true
|
@ -0,0 +1 @@
|
|||||||
|
Unnamed repository; edit this file 'description' to name the repository.
|
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to check the commit log message taken by
|
||||||
|
# applypatch from an e-mail message.
|
||||||
|
#
|
||||||
|
# The hook should exit with non-zero status after issuing an
|
||||||
|
# appropriate message if it wants to stop the commit. The hook is
|
||||||
|
# allowed to edit the commit message file.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "applypatch-msg".
|
||||||
|
|
||||||
|
. git-sh-setup
|
||||||
|
test -x "$GIT_DIR/hooks/commit-msg" &&
|
||||||
|
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
||||||
|
:
|
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to check the commit log message.
|
||||||
|
# Called by "git commit" with one argument, the name of the file
|
||||||
|
# that has the commit message. The hook should exit with non-zero
|
||||||
|
# status after issuing an appropriate message if it wants to stop the
|
||||||
|
# commit. The hook is allowed to edit the commit message file.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "commit-msg".
|
||||||
|
|
||||||
|
# Uncomment the below to add a Signed-off-by line to the message.
|
||||||
|
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
||||||
|
# hook is more suited to it.
|
||||||
|
#
|
||||||
|
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
||||||
|
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
||||||
|
|
||||||
|
# This example catches duplicate Signed-off-by lines.
|
||||||
|
|
||||||
|
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
||||||
|
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
||||||
|
echo >&2 Duplicate Signed-off-by lines.
|
||||||
|
exit 1
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# An example hook script to prepare a packed repository for use over
|
||||||
|
# dumb transports.
|
||||||
|
#
|
||||||
|
# To enable this hook, rename this file to "post-update".
|
||||||
|
|
||||||
|
exec git update-server-info
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue