git-lighttp 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -0
  3. data/README.md +90 -0
  4. data/README.pt-BR.md +96 -0
  5. data/doc/releases/{v0.1.0.rdoc → v0.1.0.md} +4 -4
  6. data/doc/releases/{v0.2.0.rdoc → v0.2.0.md} +3 -5
  7. data/doc/releases/{v0.3.0.rdoc → v0.3.0.md} +3 -3
  8. data/doc/releases/v0.3.1.md +12 -0
  9. data/git-lighttp.gemspec +34 -21
  10. data/lib/git/lighttp.rb +100 -97
  11. data/lib/git/lighttp/extensions.rb +26 -30
  12. data/lib/git/lighttp/http_backend.rb +20 -20
  13. data/lib/git/lighttp/treeish.rb +2 -2
  14. data/lib/git/lighttp/version.rb +3 -3
  15. metadata +79 -71
  16. data/Gemfile +0 -11
  17. data/Makefile +0 -41
  18. data/README.pt-BR.rdoc +0 -81
  19. data/README.rdoc +0 -75
  20. data/Rakefile +0 -50
  21. data/test/all.rb +0 -12
  22. data/test/config_test.rb +0 -43
  23. data/test/fixtures/config.yml +0 -13
  24. data/test/fixtures/htgroup +0 -3
  25. data/test/fixtures/htpasswd +0 -4
  26. data/test/fixtures/mycode.git/HEAD +0 -1
  27. data/test/fixtures/mycode.git/config +0 -4
  28. data/test/fixtures/mycode.git/description +0 -1
  29. data/test/fixtures/mycode.git/hooks/applypatch-msg.sample +0 -15
  30. data/test/fixtures/mycode.git/hooks/commit-msg.sample +0 -24
  31. data/test/fixtures/mycode.git/hooks/post-commit.sample +0 -8
  32. data/test/fixtures/mycode.git/hooks/post-receive.sample +0 -15
  33. data/test/fixtures/mycode.git/hooks/post-update.sample +0 -8
  34. data/test/fixtures/mycode.git/hooks/pre-applypatch.sample +0 -14
  35. data/test/fixtures/mycode.git/hooks/pre-commit.sample +0 -46
  36. data/test/fixtures/mycode.git/hooks/pre-rebase.sample +0 -169
  37. data/test/fixtures/mycode.git/hooks/prepare-commit-msg.sample +0 -36
  38. data/test/fixtures/mycode.git/hooks/update.sample +0 -128
  39. data/test/fixtures/mycode.git/info/exclude +0 -6
  40. data/test/fixtures/mycode.git/info/refs +0 -3
  41. data/test/fixtures/mycode.git/objects/02/83eb96425444e17b97182e1ba9f216cc67c132 +0 -0
  42. data/test/fixtures/mycode.git/objects/03/9927042df267a1bc606fc4485b7a79b6a9e3cd +0 -1
  43. data/test/fixtures/mycode.git/objects/0d/eed0a56fa8f5f2a788d58b3ea235afd547b828 +0 -2
  44. data/test/fixtures/mycode.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
  45. data/test/fixtures/mycode.git/objects/5e/54a0767e0c380f3baab17938d68c7f464cf171 +0 -1
  46. data/test/fixtures/mycode.git/objects/63/9b96262e7e19ca2169575e797b234098b8a72e +0 -0
  47. data/test/fixtures/mycode.git/objects/71/6e9568eed27d5ee4378b3ecf6dd095a547bde9 +0 -1
  48. data/test/fixtures/mycode.git/objects/b6/f3f0fabeaaaaf2db22b8ef98f59115baec7ef9 +0 -0
  49. data/test/fixtures/mycode.git/objects/be/118435b9d908fd4a689cd8b0cc98059911a31a +0 -0
  50. data/test/fixtures/mycode.git/objects/db/aefcb5bde664671c73b99515c386dcbc7f22b6 +0 -0
  51. data/test/fixtures/mycode.git/objects/eb/669b878d2013ac70aa5dee75e6357ea81d16ea +0 -0
  52. data/test/fixtures/mycode.git/objects/ed/10cfcf72862e140c97fe899cba2a55f4cb4c20 +0 -0
  53. data/test/fixtures/mycode.git/objects/ed/1c3a255ab3fce056dc31cd82df9f61a4d9fa22 +0 -0
  54. data/test/fixtures/mycode.git/objects/info/alternates +0 -0
  55. data/test/fixtures/mycode.git/objects/info/http-alternates +0 -0
  56. data/test/fixtures/mycode.git/objects/info/packs +0 -2
  57. data/test/fixtures/mycode.git/objects/pack/pack-40a8636b62258fffd78ec1e8d254116e72d385a9.idx +0 -0
  58. data/test/fixtures/mycode.git/objects/pack/pack-40a8636b62258fffd78ec1e8d254116e72d385a9.pack +0 -0
  59. data/test/fixtures/mycode.git/packed-refs +0 -4
  60. data/test/fixtures/mycode.git/refs/heads/master +0 -1
  61. data/test/fixtures/mycode.git/refs/tags/v0.1.0 +0 -1
  62. data/test/helpers.rb +0 -53
  63. data/test/htgroup_test.rb +0 -29
  64. data/test/htpasswd_test.rb +0 -63
  65. data/test/http_backend_authentication_test.rb +0 -61
  66. data/test/http_backend_test.rb +0 -123
  67. data/test/project_handler_test.rb +0 -45
  68. data/test/treeish_test.rb +0 -33
@@ -1,81 +0,0 @@
1
- = Git-Lighttp - Web mais esperta para o Git
2
-
3
- {<img src="https://badge.fury.io/rb/git-lighttp.svg" alt="Gem Version" />}[https://badge.fury.io/rb/git-lighttp]
4
-
5
- == DESCRIÇÃO
6
-
7
- Este projeto foi inspirado no {Grack}[http://github.com/schacon/grack], um
8
- servidor de processos Smart-HTTP (escrito por
9
- {Scott Chacon}[http://github.com/schacon]), mas projetado usando
10
- {Sinatra}[http://www.sinatrarb.com] e visa substituir o `git-http-backend`
11
- original incluindo novas funcionalidades.
12
-
13
- O objetivo principal do <b>Git-Lighttp</b> é implementar as seguintes
14
- funcionalidades:
15
-
16
- - Smart-HTTP, baseado no _git-http-backend_.
17
- - Autenticação flexível baseado em banco de dados ou arquivo de configuração
18
- como <tt>.htpasswd</tt>.
19
- - API para obter informações sobre o repositório (_Treeish_).
20
-
21
- == SINOPSE
22
-
23
- Instale o Git-Lighttp usando {Rubygems}[http://rubygems.org/gems/git-lighttp].
24
-
25
- gem install git-lighttp
26
-
27
- Ou faça um _checkout_ do projeto hospedado no
28
- {Github}[http://github.com/hallison/git-lighttp].
29
-
30
- git clone https://github.com/hallison/git-lighttp.git
31
- ...
32
- cd git-lighttp
33
- rake install
34
-
35
- Configure o arquivo Rackup (<tt>config.ru</tt>) usando as seguintes instruções:
36
-
37
- # config.ru
38
- require "git/lighttp"
39
-
40
- Git::Lighttp::HttpBackend.configure do |server|
41
- server.project_root = "/home/git/repositories"
42
- server.git_path = "/usr/bin/git"
43
- server.get_any_file = true
44
- server.upload_pack = true
45
- server.receive_pack = false
46
- server.authenticate = true
47
- end
48
-
49
- $ rackup --port 2011 --daemonize
50
- $ git clone http://localhost:2011/mycode.git
51
-
52
- Você poderá usar o arquivo <tt>.netrc</tt> para melhorar sua conexão. Coloque
53
- isso:
54
-
55
- machine <servidor> login <usuario> password <senha>
56
-
57
- O Git-Lighttp está em desenvolvimento, então ainda há muitas melhorias a serem
58
- feitas. Por favor, nos ajude a melhorar o projeto enviando seu comentário nos
59
- {problemas}[http://github.com/hallison/git-lighttp/issues] encontrados ou
60
- enviando um email para
61
- {hallisonbatista@gmail.com}[mailto:hallisonbatista@gmail.com].
62
-
63
- Discuta no {Google Groups}[http://groups.google.com/group/git-lighttp].
64
-
65
- == AUTORES
66
-
67
- Escrito por Hallison Batista <hallisonbatista@gmail.com>.
68
-
69
- == ERROS
70
-
71
- Se você encontrar um erro, por favor, informe no
72
- {gerenciador de erros}[http://github.com/hallison/git-lighttp] do projeto
73
- Git-Lighttp no Github.
74
-
75
- == LICENÇA
76
-
77
- Git-Lighttp é Copyright (c) 2011-2015 Hallison Batista.
78
-
79
- Este é um _software_ livre e pode ser redistribuído sob os termos
80
- especificados em LICENSE.txt.
81
-
@@ -1,75 +0,0 @@
1
- = Git-Lighttp - Web smarty for Git
2
-
3
- {<img src="https://badge.fury.io/rb/git-lighttp.svg" alt="Gem Version" />}[https://badge.fury.io/rb/git-lighttp]
4
-
5
- == DESCRIPTION
6
-
7
- This project was inspired in the {Grack}[http://github.com/schacon/grack]
8
- Smart-HTTP server handler (written by
9
- {Scott Chacon}[http://github.com/schacon]) but developed using
10
- {Sinatra}[http://www.sinatrarb.com] and aims replace the original
11
- `git-http-backend` including new features.
12
-
13
- The main goal of the <b>Git-Lighttp</b> is implement the following useful features.
14
-
15
- - Smart-HTTP, based on _git-http-backend_.
16
- - Authentication flexible based on database or configuration file like .+htpasswd+.
17
- - API to get information about repository (_Treeish_).
18
-
19
- == SINOPSIS
20
-
21
- Install the Git-Lighttp using {Rubygems}[http://rubygems.org/gems/git-lighttp].
22
-
23
- gem install git-lighttp
24
-
25
- Or checkout the project hosted on {Github}[http://github.com/hallison/git-lighttp].
26
-
27
- git clone https://github.com/hallison/git-lighttp.git
28
- ...
29
- cd git-lighttp
30
- rake install
31
-
32
- Configure the Rackup file (<tt>config.ru</tt>) using the following instructions:
33
-
34
- # config.ru
35
- require "git/lighttp"
36
-
37
- Git::Lighttp::HttpBackend.configure do |server|
38
- server.project_root = "/home/git/repositories"
39
- server.git_path = "/usr/bin/git"
40
- server.get_any_file = true
41
- server.upload_pack = true
42
- server.receive_pack = false
43
- server.authenticate = true
44
- end
45
-
46
- $ rackup --port 2011 --daemonize
47
- $ git clone http://localhost:2011/mycode.git
48
-
49
- You can use the <tt>.netrc</tt> for improve your connection. Put this:
50
-
51
- machine <host> login <username> password <password>
52
-
53
- The Git-Lighttp is under development, so there are still many improvements to be
54
- made. Please, help us to improve the project sending your feedback to
55
- {issues}[http://github.com/hallison/git-lighttp] or sending email to
56
- {hallisonbatista@gmail.com}[mailto:hallisonbatista@gmail.com].
57
-
58
- Discuss in {Google Groups}[http://groups.google.com/group/git-lighttp].
59
-
60
- == AUTHORS
61
-
62
- Written by Hallison Batista <hallisonbatista@gmail.com>.
63
-
64
- == BUGS
65
-
66
- If you find a bug, please report it at the Git-Lighttp project's
67
- {issues tracker}[http://github.com/hallison/git-lighttp] on Github.
68
-
69
- == LICENSE
70
-
71
- Git-Lighttp is Copyright (c) 2011-2015 Hallison Batista.
72
-
73
- This is free software, and may be redistributed under the terms specified in
74
- LICENSE.txt.
75
-
data/Rakefile DELETED
@@ -1,50 +0,0 @@
1
- require "git/lighttp"
2
-
3
- def spec
4
- @spec ||= Gem::Specification.load("git-lighttp.gemspec")
5
- end
6
-
7
- desc "Run tests"
8
- task :test, [:file] do |spec, args|
9
- Dir["test/#{args.file}*_test.rb"].each do |file|
10
- sh "ruby #{file}"
11
- end
12
- end
13
-
14
- desc "API Documentation (RDoc)"
15
- task :doc do
16
- sh "rdoc -o doc/api -H -f hanna -m README.rdoc"
17
- end
18
-
19
- desc "Build tags"
20
- task :tags do
21
- rbalias = '/.*alias(_method)?[[:space:]]+:([[:alnum:]_=!?]+),?[[:space:]]+:([[:alnum:]_=!]+)/\\2/f/'
22
- sh "ctags", "--recurse=yes",
23
- "--tag-relative=yes",
24
- "--totals=yes",
25
- "--extra=+f",
26
- "--fields=+iaS",
27
- "--regex-ruby="+rbalias
28
- end
29
-
30
- desc "Build #{spec.file_name}"
31
- task :build => "#{spec.name}.gemspec" do
32
- sh "gem build #{spec.name}.gemspec"
33
- end
34
-
35
- desc "Release #{spec.file_name}"
36
- task :release => :build do
37
- sh "gem push #{spec.file_name}"
38
- end
39
-
40
- desc "Install gem file #{spec.file_name}"
41
- task :install => :build do
42
- sh "gem install -l #{spec.file_name}"
43
- end
44
-
45
- desc "Uninstall gem #{spec.name} v#{spec.version}"
46
- task :uninstall do
47
- sh "gem uninstall #{spec.name} -v #{spec.version}"
48
- end
49
-
50
- task :default => :test
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift 'lib'
2
- $LOAD_PATH.unshift '.'
3
-
4
- require 'minitest/autorun'
5
- require 'minitest/rg'
6
- require 'test/helpers'
7
- require 'rack/test'
8
- require 'git/lighttp'
9
-
10
- Dir['test/*_test.rb'].each do |test|
11
- load test
12
- end
@@ -1,43 +0,0 @@
1
- describe 'Configuration' do
2
- before do
3
- @config = {
4
- :default => {
5
- :project_root => '/var/git/repos',
6
- :git_path => '/usr/local/bin/git'
7
- },
8
- :treeish => {
9
- :authenticate => true
10
- },
11
- :http_backend => {
12
- :authenticate => true,
13
- :get_any_file => true,
14
- :upload_pack => true,
15
- :receive_pack => false,
16
- }
17
- }
18
- end
19
-
20
- it 'configure by application' do
21
- Git::Lighttp.configure do |app|
22
- app.default.project_root = '/var/git/repos'
23
- app.default.git_path = '/usr/local/bin/git'
24
- app.treeish.authenticate = true
25
- end
26
-
27
- @config.keys.each do |app|
28
- @config[app].each do |option, value|
29
- assert_equal value, Git::Lighttp.config[app][option]
30
- end
31
- end
32
- end
33
-
34
- it 'load from YAML file' do
35
- yaml = YAML.load_file(fixtures('config.yml')).symbolize_keys
36
- config = Git::Lighttp.load_config_file(fixtures('config.yml'))
37
- yaml.keys.each do |app|
38
- yaml[app].each do |option, value|
39
- assert_equal value, config[app][option]
40
- end
41
- end
42
- end
43
- end
@@ -1,13 +0,0 @@
1
- default:
2
- project_root: /var/git/repos
3
- git_path : /usr/bin/git
4
-
5
- treeish:
6
- authenticate: true
7
-
8
- http_backend:
9
- authenticate: true
10
- get_any_file: true
11
- upload_pack : true
12
- receive_pack: false
13
-
@@ -1,3 +0,0 @@
1
- prophets: malachi jeremiah
2
- writers: matthew mark luke john
3
- disciples: john peter
@@ -1,4 +0,0 @@
1
- john:BInD5.JEyr5Ng
2
- luke:1y687odVzuFJs
3
- mark:V5.e7XhcXHmQc
4
- matthew:zKOzsdCzE.mEE
@@ -1 +0,0 @@
1
- ref: refs/heads/master
@@ -1,4 +0,0 @@
1
- [core]
2
- repositoryformatversion = 0
3
- filemode = true
4
- bare = true
@@ -1 +0,0 @@
1
- Unnamed repository; edit this file 'description' to name the repository.
@@ -1,15 +0,0 @@
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
- :
@@ -1,24 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
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
@@ -1,15 +0,0 @@
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 a 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
@@ -1,8 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to prepare a packed repository for use over
4
- # dumb transports.
5
- #
6
- # To enable this hook, rename this file to "post-update".
7
-
8
- exec git update-server-info
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to verify what is about to be committed
4
- # by 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.
8
- #
9
- # To enable this hook, rename this file to "pre-applypatch".
10
-
11
- . git-sh-setup
12
- test -x "$GIT_DIR/hooks/pre-commit" &&
13
- exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
14
- :
@@ -1,46 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # An example hook script to verify what is about to be committed.
4
- # Called by "git commit" with no arguments. The hook should
5
- # exit with non-zero status after issuing an appropriate message if
6
- # it wants to stop the commit.
7
- #
8
- # To enable this hook, rename this file to "pre-commit".
9
-
10
- if git rev-parse --verify HEAD >/dev/null 2>&1
11
- then
12
- against=HEAD
13
- else
14
- # Initial commit: diff against an empty tree object
15
- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
16
- fi
17
-
18
- # If you want to allow non-ascii filenames set this variable to true.
19
- allownonascii=$(git config hooks.allownonascii)
20
-
21
- # Cross platform projects tend to avoid non-ascii filenames; prevent
22
- # them from being added to the repository. We exploit the fact that the
23
- # printable range starts at the space character and ends with tilde.
24
- if [ "$allownonascii" != "true" ] &&
25
- # Note that the use of brackets around a tr range is ok here, (it's
26
- # even required, for portability to Solaris 10's /usr/bin/tr), since
27
- # the square bracket bytes happen to fall in the designated range.
28
- test "$(git diff --cached --name-only --diff-filter=A -z $against |
29
- LC_ALL=C tr -d '[ -~]\0')"
30
- then
31
- echo "Error: Attempt to add a non-ascii file name."
32
- echo
33
- echo "This can cause problems if you want to work"
34
- echo "with people on other platforms."
35
- echo
36
- echo "To be portable it is advisable to rename the file ..."
37
- echo
38
- echo "If you know what you are doing you can disable this"
39
- echo "check using:"
40
- echo
41
- echo " git config hooks.allownonascii true"
42
- echo
43
- exit 1
44
- fi
45
-
46
- exec git diff-index --check --cached $against --