git_guts 0.1.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 (88) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +19 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/bin/bash-bin +5 -0
  8. data/bin/git-about +19 -0
  9. data/bin/git-autocommit +19 -0
  10. data/bin/git-fireworks +5 -0
  11. data/bin/git-guts +19 -0
  12. data/bin/git-inception +19 -0
  13. data/bin/git-map +19 -0
  14. data/bin/git-multipush +19 -0
  15. data/bin/git-music +5 -0
  16. data/bin/git-open +19 -0
  17. data/bin/git-quote +19 -0
  18. data/bin/git-server +19 -0
  19. data/bin/git-test +19 -0
  20. data/bin/git-welcome +19 -0
  21. data/bin/ruby-bin +19 -0
  22. data/bin/scripts/git-about.rb +12 -0
  23. data/bin/scripts/git-autocommit.rb +3 -0
  24. data/bin/scripts/git-fireworks +158 -0
  25. data/bin/scripts/git-guts.rb +28 -0
  26. data/bin/scripts/git-inception.rb +3 -0
  27. data/bin/scripts/git-map.rb +3 -0
  28. data/bin/scripts/git-multipush.rb +3 -0
  29. data/bin/scripts/git-music +4 -0
  30. data/bin/scripts/git-open.rb +4 -0
  31. data/bin/scripts/git-quote.rb +13 -0
  32. data/bin/scripts/git-server.rb +3 -0
  33. data/bin/scripts/git-test.rb +3 -0
  34. data/bin/scripts/git-welcome.rb +61 -0
  35. data/bin/support/africa-fullmap.gif +0 -0
  36. data/bin/support/africa-map.gif +0 -0
  37. data/bin/support/inception.mp3 +0 -0
  38. data/git_guts.gemspec +43 -0
  39. data/lib/extensions/string.rb +31 -0
  40. data/lib/git_guts/about.rb +20 -0
  41. data/lib/git_guts/autocommit.rb +28 -0
  42. data/lib/git_guts/guts.rb +11 -0
  43. data/lib/git_guts/inception.rb +14 -0
  44. data/lib/git_guts/map.rb +19 -0
  45. data/lib/git_guts/multi_push.rb +24 -0
  46. data/lib/git_guts/open.rb +21 -0
  47. data/lib/git_guts/quote.rb +20 -0
  48. data/lib/git_guts/server.rb +33 -0
  49. data/lib/git_guts/test.rb +15 -0
  50. data/lib/git_guts/version.rb +3 -0
  51. data/lib/git_guts/welcome.rb +12 -0
  52. data/lib/git_guts.rb +4 -0
  53. data/lib/git_server/.gitignore +2 -0
  54. data/lib/git_server/Gemfile +9 -0
  55. data/lib/git_server/README.md +1 -0
  56. data/lib/git_server/Rakefile +4 -0
  57. data/lib/git_server/config.ru +4 -0
  58. data/lib/git_server/lib/git_server.rb +62 -0
  59. data/lib/git_server/lib/git_server_app.rb +38 -0
  60. data/lib/git_server/lib/version.rb +3 -0
  61. data/lib/git_server/log/.gitignore +1 -0
  62. data/lib/git_server/public/css/app.css +184 -0
  63. data/lib/git_server/public/css/details.css +54 -0
  64. data/lib/git_server/public/css/fonts.css +12 -0
  65. data/lib/git_server/public/css/pre.css +11 -0
  66. data/lib/git_server/public/images/.gitignore +0 -0
  67. data/lib/git_server/public/images/arrow.png +0 -0
  68. data/lib/git_server/public/images/cat.png +0 -0
  69. data/lib/git_server/public/images/diff.png +0 -0
  70. data/lib/git_server/public/images/loader.gif +0 -0
  71. data/lib/git_server/public/images/pipe.png +0 -0
  72. data/lib/git_server/public/images/reset.png +0 -0
  73. data/lib/git_server/public/js/.gitignore +0 -0
  74. data/lib/git_server/public/js/app.js +129 -0
  75. data/lib/git_server/public/js/jquery-2.0-min.js +6 -0
  76. data/lib/git_server/views/404.haml +4 -0
  77. data/lib/git_server/views/blob.haml +26 -0
  78. data/lib/git_server/views/commit.haml +17 -0
  79. data/lib/git_server/views/commit_summary.haml +19 -0
  80. data/lib/git_server/views/diff.haml +21 -0
  81. data/lib/git_server/views/diff_file.haml +19 -0
  82. data/lib/git_server/views/diff_summary.haml +3 -0
  83. data/lib/git_server/views/index.haml +25 -0
  84. data/lib/git_server/views/layout.haml +10 -0
  85. data/lib/git_server/views/tree.haml +19 -0
  86. data/lib/guard/git.rb +22 -0
  87. data/lib/thor/git_group.rb +12 -0
  88. metadata +285 -0
@@ -0,0 +1,61 @@
1
+ require 'git_guts'
2
+ require 'git_guts/welcome'
3
+ GitGuts::Welcome.start
4
+ __END__
5
+
6
+ ##### / ## ### ###
7
+ ###### / ##### ### ###
8
+ /# / / ##### ### ## #
9
+ / / ## # ## ## ## ##
10
+ / ### # ## ## ##
11
+ ## ## # ## /## ## /### /### ### /### /### /## ######## /###
12
+ ## ## # ## / ### ## / ### / / ### / ##/ ###/ /## / / ### ######## / ### /
13
+ ## ## # ## / ### ## / ###/ / ###/ ## ###/ ###/ / ### ## / ###/
14
+ ## ## # ## ## ### ## ## ## ## ## ## ## ## ### ## ## ##
15
+ ## ## # ## ######## ## ## ## ## ## ## ## ######## ## ## ##
16
+ ## ## # ## ####### ## ## ## ## ## ## ## ####### ## ## ##
17
+ ## # # / ## ## ## ## ## ## ## ## ## ## ## ##
18
+ ### /## / #### / ## ### / ## ## ## ## ## #### / ## ## ##
19
+ #######/ #######/ ######/ ### / ######/ ###### ### ### ### ######/ ## ######
20
+ #### #### ##### ##/ ##### #### ### ### ### ##### ## ####
21
+
22
+
23
+
24
+ ##### # ## # ### # ###
25
+ ###### / # ## / /### / # / /### /
26
+ /# / / ### ## / / ###/ ### # / / ###/ #
27
+ / / / # ## / ## ## # ## / ## ## ##
28
+ / / ## / ### ## / ### ##
29
+ ## ## ### /### /### ### ### ## /## ## ## ### ######## ## ## ## #### ######## /###
30
+ ## ## ###/ #### / / #### / ### ######### / ### ## ## ### ### ######## ## ## ### ## ### / ######## / #### /
31
+ /### ## ## ###/ ## ###/ ## ## #### / ### ## ## /### / ## ## ## ## /### / ## ###/ ## ## ###/
32
+ / ### ## ## ## #### ## ## ## ## ### ## ## / ###/ ## ## ## ## / ###/ ## ## ## ####
33
+ ## ## ## ## ### ## ## ## ######## ## ##/ ## ## ## ## ##/ ## ## ## ## ###
34
+ ## ## ## ## ## ### ## ## ## ####### ## ## # ## ## ## ## # ## ## ## ###
35
+ ### # / ## ## ### ## ## ## ## ## # / ## ## ## # / ## ## ## ###
36
+ ### / ## ## /### ## ## ## /# #### / ### / ## ## ### / ## /# ## /### ##
37
+ #####/ ### ### / #### / ### / ####/ ######/ ######/ ### / ## ######/ ######/ ## ## / #### /
38
+ ### ### ### ###/ ##/ ### ##### ### ##/ ## ### ##### ## ## ###/
39
+
40
+
41
+
42
+
43
+ / ##### /## /
44
+ # #/ ###### / ## #/
45
+ ### # ## /# / / ## ##
46
+ ## # ## ## / / / ## ##
47
+ ## ## ## / / / ##
48
+ ## ### #### ### ######## ## /## ## ## / ## #### ## /### ## ####
49
+ ## ### ### / ### ######## ## / ### ## ## / ## ### / ##/ ### / ## ### /
50
+ ## ### ###/ ## ## ##/ ### ## ###/ ## ###/ ## ###/ ## ###/
51
+ ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ##
52
+ ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
53
+ ## ## ## ## ## ## ## # ## ## ## ## ## ## ## ##
54
+ ## ## ## ## ## ## ## / ## ## ## ## ## ## ##
55
+ ## /# / ## ## ## ## /##/ ### ## /# ## /# ## ##
56
+ ######/ ######/ ### / ## ## ## / #### ## ######/ ## ####/ #########
57
+ ##### ##### ##/ ## ## ## / ## # ##### ## ### #### ###
58
+ / # ###
59
+ / ## ##### ###
60
+ / /####### /#
61
+ / / ###/
Binary file
Binary file
Binary file
data/git_guts.gemspec ADDED
@@ -0,0 +1,43 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'git_guts/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "git_guts"
8
+ gem.version = GitGuts::VERSION
9
+ gem.authors = ["Shadab Ahmed"]
10
+ gem.email = ["shadab.ansari@gmail.com"]
11
+ gem.description = %q{Diving deep into git with ruby}
12
+ gem.summary = %q{Helper commands to see your way around git}
13
+ gem.homepage = "http://github.com/shadabahmed/git_guts"
14
+
15
+ gem.add_dependency 'rack'
16
+ gem.add_dependency 'guard'
17
+ gem.add_dependency 'thor'
18
+ gem.add_dependency 'sinatra'
19
+ gem.add_dependency 'haml'
20
+ gem.add_dependency 'git'
21
+ gem.add_dependency 'ruby-filemagic'
22
+ gem.add_dependency 'diffy'
23
+ gem.add_dependency 'thin'
24
+
25
+ gem.files = `git ls-files`.split($/)
26
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
27
+ gem.require_paths = ["lib"]
28
+ gem.executables = `git ls-files ./bin`.split($/).reject{|f| f =~ /(scripts|support)/}.collect{|f| f.sub('bin/', '')}
29
+ Gem.post_install do
30
+ `which ruby > #{gem.gem_dir}/bin/RUBY_BIN`
31
+ end
32
+ gem.post_install_message = <<-MSG
33
+
34
+ ************************************************************
35
+ Thanks for installing git-guts
36
+
37
+ Please run this command manually:
38
+
39
+ which ruby > #{gem.gem_dir}/bin/RUBY_BIN_PATH
40
+
41
+ ************************************************************
42
+ MSG
43
+ end
@@ -0,0 +1,31 @@
1
+ class String
2
+ ColorMap = {:default => 39, :cyan => 36, :red => 31, :green => 32, :blue => 34, :magent => 35, :yellow => 33, :white => 37}
3
+ Colors = ColorMap.keys
4
+
5
+ # colorization
6
+ def colorize(color_code)
7
+ empty? ? self : "\e[#{color_code}m#{self}\e[0m"
8
+ end
9
+
10
+ ColorMap.each do |name, code|
11
+ define_method(name) do
12
+ colorize(code)
13
+ end
14
+ end
15
+
16
+ def random_color
17
+ self.send(Colors[rand(Colors.length)])
18
+ end
19
+
20
+ def slow_puts(opts = {})
21
+ opts[:delay] = 0.02 unless opts[:delay]
22
+ opts[:newline] = true if opts[:newline].nil?
23
+ self.each_char do |x|
24
+ print x
25
+ STDOUT.flush
26
+ sleep opts[:delay]
27
+ end
28
+ puts if opts[:newline]
29
+ end
30
+ end
31
+
@@ -0,0 +1,20 @@
1
+ module GitGuts
2
+ class About < Thor::GitGroup
3
+ desc 'Describe the person'
4
+ argument :name, :required => true, :banner => '<PERSON NAME>', :type => :string
5
+
6
+ def about
7
+ if name.downcase != 'shadab'
8
+ "\nSorry, I do not know this guy\n".red.slow_puts
9
+ else
10
+ DATA.each_line.each do |msg|
11
+ msg.chomp.random_color.slow_puts
12
+ end
13
+ "\nGeography geek - ".random_color.slow_puts(:newline => false)
14
+ sleep 1
15
+ "Infact claims, that he can name and place all countries on the African continent\n".random_color.slow_puts
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,28 @@
1
+ require 'git'
2
+ require 'guard'
3
+ require 'guard/git'
4
+
5
+ module GitGuts
6
+ class Autocommit < Thor::GitGroup
7
+ WORKING_DIRECTORY = Dir.getwd
8
+ desc 'Auto commit if files change'
9
+ argument :files, :required => true, :banner => '<Files To Watch>', :type => :array
10
+ class_option :exclusive, :aliases => '-e', :desc => 'Only commit the files being observed', :banner => ''
11
+ def autocommit
12
+ begin
13
+ Git.open(WORKING_DIRECTORY)
14
+ guard_file = <<-EOF
15
+ guard 'git'#{",:exclusive => true" if options[:exclusive]} do
16
+ watch(%r{^#{files.join('|')}$})
17
+ end
18
+ EOF
19
+ Guard.start(:guardfile_contents => guard_file)
20
+ while Guard.running do
21
+ sleep 0.5
22
+ end
23
+ rescue ArgumentError
24
+ puts "Could open repository. Is it a valid git repository ?"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ module GitGuts
2
+ class Guts < Thor::GitGroup
3
+ desc 'Shows the git guts repo'
4
+ def guts
5
+ system 'clear'
6
+ DATA.each_line do |line|
7
+ line.chomp.red.slow_puts(:delay => 0.005)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module GitGuts
2
+ class Inception < Thor::GitGroup
3
+ desc 'Shows git inception'
4
+ def inception
5
+ 1.upto(30) do |level|
6
+ str = " "*(30-level) + ".git"
7
+ puts level == 29 ? (str + " <--- 2nd Level Gitception").red : str
8
+
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+
@@ -0,0 +1,19 @@
1
+ module GitGuts
2
+ class Map < Thor::GitGroup
3
+ argument :country, :required => true
4
+ class_option :full, :aliases => '-f'
5
+
6
+ desc 'Shows a map'
7
+ def map
8
+ if country.downcase != 'africa'
9
+ "\nMap for #{ARGV[0]} does not exist\n".red.slow_puts
10
+ else
11
+ type = options[:full] ? 'fullmap' : 'map'
12
+ file_path = File.expand_path("../../../bin/support/#{country}-#{type}.gif", __FILE__)
13
+ `open file://#{file_path}`
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+
@@ -0,0 +1,24 @@
1
+ require 'git'
2
+ require 'net/ssh'
3
+
4
+ module GitGuts
5
+ class MultiPush < Thor::GitGroup
6
+ WORKING_DIRECTORY = Dir.getwd
7
+ desc 'Creates a remote'
8
+ argument :remotes, :required => true, :banner => '<Remotes> <Branch>', :desc => 'remotes and branches', :type => :array
9
+ def create
10
+ begin
11
+ raise Thor::Error.new("No branch specified".red) if remotes.size < 2
12
+ branch = remotes.pop
13
+ Git.open(WORKING_DIRECTORY)
14
+ remotes.each do |remote|
15
+ puts "Pushing #{branch} to #{remote}"
16
+ puts %x[git push #{remote} #{branch}]
17
+ raise Thor::Error.new "Push to #{remote} failed" if $?.to_i > 0
18
+ end
19
+ rescue ArgumentError
20
+ raise Thor::Error.new "Could open repository. Is it a valid git repository ?"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ require 'git'
2
+
3
+ module GitGuts
4
+ class Open < Thor::GitGroup
5
+ desc 'Opens a git object'
6
+ argument :sha, :required => true, :banner => '<Object SHA>', :type => :string
7
+ WORKING_DIRECTORY = Dir.getwd
8
+ def open
9
+ begin
10
+ repo = Git.open(WORKING_DIRECTORY)
11
+ puts repo.object(sha).contents
12
+ rescue ArgumentError
13
+ puts "Could open repository. Is it a valid git repository ?"
14
+ rescue Git::GitExecuteError
15
+ puts "Not a valid git object"
16
+ end
17
+ end
18
+ end
19
+ end
20
+
21
+
@@ -0,0 +1,20 @@
1
+ module GitGuts
2
+ class Quote < Thor::GitGroup
3
+ desc 'Quotes a person'
4
+ argument :name, :required => true, :banner => '<PERSON NAME>', :type => :string
5
+
6
+ def quote
7
+ if name.downcase != 'linus'
8
+ "\nSorry, I do not know this guy\n".red.slow_puts
9
+ else
10
+ DATA.each_line.each_with_index do |msg, i|
11
+ if i == 4
12
+ msg.chomp.random_color.slow_puts :delay => 0.015
13
+ else
14
+ msg.chomp.random_color.slow_puts
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,33 @@
1
+ require 'rack'
2
+ require 'git'
3
+ require 'sinatra'
4
+ require 'haml'
5
+ require 'git'
6
+ require 'filemagic'
7
+ require 'diffy'
8
+ require 'thin'
9
+
10
+ module GitGuts
11
+ class Server < Thor::GitGroup
12
+ desc 'Starts a local git server'
13
+ class_option :port, :aliases => '-p', :required => true, :type => :numeric
14
+ class_option :dir, :aliases => '-d', :required => false, :type => :string, :desc => 'Repository directory . Default is current directory'
15
+ def start
16
+ repo_dir = (options[:dir] && File.expand_path(options[:dir])) || Dir.getwd
17
+ puts repo_dir
18
+ begin
19
+ options[:dir] ? Git.bare(repo_dir) : Git.open(repo_dir)
20
+ ENV['RACK_ENV'] = 'production'
21
+ ENV['GIT_DIR'] = repo_dir
22
+ ENV['BARE'] = '1' if options[:dir]
23
+ require 'git_server/lib/git_server_app'
24
+ Rack::Server.start :app => GitServerApp, :Port => options[:port]
25
+ rescue ArgumentError
26
+ puts "Could not start server. Is it a valid git repository ?"
27
+ else
28
+ puts "Server closed"
29
+ end
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,15 @@
1
+ module GitGuts
2
+ class Test < Thor::GitGroup
3
+ desc 'Prints out Hello'
4
+
5
+ argument :name, :required => true, :banner => 'Please enter a name', :type => :string
6
+ class_option :verbose, :aliases => '-v'
7
+ class_option :terbose, :aliases => '-t'
8
+ def hi
9
+ puts "Hi #{name} !"
10
+ puts "How are you today?" if options[:verbose]
11
+ puts "I am good" if options[:terbose]
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module GitGuts
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,12 @@
1
+ module GitGuts
2
+ class Welcome < Thor::GitGroup
3
+ desc 'Gives a big warm welcome'
4
+ def welcome
5
+ system 'clear'
6
+ ask "Did you reduce the font size ? It's really BIGGGGGGGGGGGG".random_color
7
+ DATA.each_line do |line|
8
+ line.chomp.slow_puts(:delay => 0.0001)
9
+ end
10
+ end
11
+ end
12
+ end
data/lib/git_guts.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'git_guts/version'
2
+ require 'thor'
3
+ require 'extensions/string'
4
+ require 'thor/git_group'
@@ -0,0 +1,2 @@
1
+ .idea
2
+ /tmp
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+ ruby '1.9.3'
3
+ gem 'sinatra'
4
+ gem 'haml'
5
+ gem 'git'
6
+ gem 'ptools'
7
+ gem 'mimemagic'
8
+ gem 'diffy'
9
+ gem 'thin'
@@ -0,0 +1 @@
1
+ A more interactive way to explore git logs
@@ -0,0 +1,4 @@
1
+ require 'sinatra/asset_pipeline/task.rb'
2
+ require File.expand_path '../lib/git_server_app.rb', __FILE__
3
+
4
+ Sinatra::AssetPipeline::Task.define! GitServer::App
@@ -0,0 +1,4 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ Bundler.require
3
+ require 'git_server_app'
4
+ run GitServer::App
@@ -0,0 +1,62 @@
1
+ module GitServer
2
+ REPO_PATH = ENV['GIT_DIR'] || Dir.getwd
3
+ GitRepo = ENV['BARE'] ? Git.bare(REPO_PATH) : Git.open(REPO_PATH)
4
+ class App < Sinatra::Base
5
+ get '/' do
6
+ commits = GitRepo.object('HEAD') && GitRepo.log(100) rescue []
7
+ haml :index, :locals => {:commits => commits, :repo => GitRepo}
8
+ end
9
+
10
+ get '/commit/:sha' do |sha|
11
+ commit = GitRepo.gcommit(sha)
12
+ haml :commit, :layout => false, :locals => {:commit => commit}, :ugly => true
13
+ end
14
+
15
+ get '/tree/:sha' do |sha|
16
+ tree = GitRepo.gtree(sha)
17
+ haml :tree, :layout => false, :locals => {:tree => tree}, :ugly => true
18
+ end
19
+
20
+ get '/blob/:sha' do |sha|
21
+ blob = GitRepo.gblob(sha)
22
+ @file_type = determine_type(blob, params[:name]) if params[:name]
23
+ haml :blob, :layout => false, :locals => {:blob => blob}, :ugly => true
24
+ end
25
+
26
+ get '/diff/:sha1/:sha2' do |sha1, sha2|
27
+ diffs = GitRepo.diff(sha1, sha2)
28
+ haml :diff, :layout => false, :locals => {:diffs => diffs}, :ugly => true
29
+ end
30
+
31
+ get '*' do
32
+ haml :'404'
33
+ end
34
+
35
+ private
36
+
37
+ helpers do
38
+ def data_uri(blob)
39
+ base64 = Base64.encode64(blob.contents).gsub("\n",'')
40
+ mime = FileMagic.new(FileMagic::MAGIC_MIME).buffer(blob.contents)
41
+ "data:#{mime};base64,#{base64}"
42
+ end
43
+
44
+ def file_type(blob, name)
45
+ determine_type(blob, name)
46
+ end
47
+
48
+ def determine_type(blob, name)
49
+ extname = File.extname(name).downcase
50
+ if %w[.bmp .gif .jpg .jpeg .png].include?(extname)
51
+ :image
52
+ else
53
+ case FileMagic.new(FileMagic::MAGIC_MIME).buffer(blob.contents)
54
+ when /image/ then :image
55
+ when /binary|octet/ then :binary
56
+ else :text
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,38 @@
1
+ require_relative 'version'
2
+ require 'tempfile'
3
+ require 'base64'
4
+ require_relative 'git_server'
5
+
6
+ module GitServer
7
+
8
+ class App
9
+ configure do
10
+ set :root, File.join(File.dirname(__FILE__), '..')
11
+ set :public_folder, File.join(root, 'public')
12
+ set :views, File.join(root, 'views')
13
+ set :environment, :production
14
+ disable :logging, :sessions
15
+ end
16
+ end
17
+
18
+ class Repository < Rack::Directory
19
+ def self.path
20
+ GitRepo.repo.path
21
+ end
22
+
23
+ def self.url
24
+ if ENV['BARE']
25
+ "/#{File.basename File.expand_path(GitRepo.repo.path)}"
26
+ else
27
+ "/#{File.basename GitRepo.dir.path}.git"
28
+ end
29
+ end
30
+
31
+ def initialize
32
+ super(self.class.path)
33
+ end
34
+ end
35
+ end
36
+
37
+ GitServerApp = Rack::URLMap.new('/' => GitServer::App.new,
38
+ GitServer::Repository.url => GitServer::Repository.new)
@@ -0,0 +1,3 @@
1
+ module GitServer
2
+ Version = "0.1"
3
+ end
@@ -0,0 +1 @@
1
+ *.log