class Giticious::Cli::Main
Public Instance Methods
check()
click to toggle source
# File lib/giticious/cli/main.rb, line 13 def check begin Giticious::Check.run puts "Everything looks fine!" rescue => e $stderr.puts e.message exit 1 end end
gitserve(user)
click to toggle source
# File lib/giticious/cli/main.rb, line 34 def gitserve(user) abort unless user abort if ENV["SSH_ORIGINAL_COMMAND"].nil? command_match = ENV["SSH_ORIGINAL_COMMAND"].match(/(git\-upload\-pack|git\-receive\-pack) \'([A-Za-z0-9\-_\.]+)\.git\'/) abort "Project not found / Command invalid" if command_match.nil? action = command_match[1] repo = command_match[2] perms = Giticious::Service::Repository.new.permissions_for(repo, user) abort "You have no access to #{repo}" if perms == false command = "#{command_match[1]} 'repositories/#{command_match[2]}.git'" abort "Read access denied" unless perms.perm_read if action == "git-receive-pack" abort "Write access denied" unless perms.perm_write end Kernel.exec "git", "shell", "-c", command end
init()
click to toggle source
# File lib/giticious/cli/main.rb, line 24 def init begin Giticious::Setup.run rescue => e $stderr.puts e.message exit 1 end end
version()
click to toggle source
# File lib/giticious/cli/main.rb, line 7 def version puts "Giticious: #{Giticious::VERSION}" puts "Ruby: #{RUBY_VERSION}" end