grit/lib/grit.rb

79 строки
1.6 KiB
Ruby
Исходник Обычный вид История

2007-10-25 20:23:01 +04:00
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2007-10-10 10:18:20 +04:00
# core
2008-01-20 00:35:57 +03:00
require 'fileutils'
2008-03-26 07:32:29 +03:00
require 'time'
2007-10-10 10:18:20 +04:00
# stdlib
2008-03-31 03:31:20 +04:00
require 'timeout'
require 'logger'
2008-11-07 21:35:54 +03:00
require 'digest/sha1'
2009-07-24 04:52:32 +04:00
if defined? RUBY_ENGINE && RUBY_ENGINE == 'jruby'
require 'open3'
2009-07-24 04:52:32 +04:00
elsif RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin/
require 'win32/open3'
else
require 'open3_detach'
end
2007-10-10 10:18:20 +04:00
2008-01-07 05:59:51 +03:00
# third party
require 'rubygems'
begin
gem "mime-types", ">=0"
require 'mime/types'
rescue Gem::LoadError => e
puts "WARNING: Gem LoadError: #{e.message}"
end
2008-01-07 05:59:51 +03:00
# ruby 1.9 compatibility
require 'grit/ruby1.9'
2007-10-10 10:18:20 +04:00
# internal requires
2007-10-13 13:20:41 +04:00
require 'grit/lazy'
2007-10-10 11:06:12 +04:00
require 'grit/errors'
require 'grit/git-ruby'
2009-05-14 02:54:49 +04:00
require 'grit/git' unless defined? Grit::Git
require 'grit/ref'
require 'grit/tag'
2007-10-10 11:50:39 +04:00
require 'grit/commit'
2008-06-20 02:36:35 +04:00
require 'grit/commit_stats'
2007-10-13 14:37:12 +04:00
require 'grit/tree'
2007-10-14 03:10:05 +04:00
require 'grit/blob'
require 'grit/actor'
2007-10-29 10:16:38 +03:00
require 'grit/diff'
require 'grit/config'
require 'grit/repo'
require 'grit/index'
require 'grit/status'
2008-08-29 12:18:03 +04:00
require 'grit/submodule'
2008-12-12 01:58:32 +03:00
require 'grit/blame'
require 'grit/merge'
2007-10-10 10:18:20 +04:00
module Grit
2007-10-20 10:08:03 +04:00
class << self
2008-06-28 06:22:41 +04:00
# Set +debug+ to true to log all git calls and responses
2007-10-20 10:08:03 +04:00
attr_accessor :debug
2008-05-29 21:29:59 +04:00
attr_accessor :use_git_ruby
attr_accessor :no_quote
2008-06-28 06:22:41 +04:00
# The standard +logger+ for debugging git calls - this defaults to a plain STDOUT logger
attr_accessor :logger
def log(str)
logger.debug { str }
end
2007-10-20 10:08:03 +04:00
end
self.debug = false
2008-05-29 21:29:59 +04:00
self.use_git_ruby = true
self.no_quote = false
@logger ||= ::Logger.new(STDOUT)
2009-02-11 09:53:41 +03:00
def self.version
yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
"#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
end
end