Permalink
Browse files

Handle nil repo path when creating repo object

  • Loading branch information...
1 parent 51147ac commit c8ff57cbf309cf3587b55f0c2906125db9035bf9 @aussiegeek aussiegeek committed Dec 13, 2011
Showing with 19 additions and 172 deletions.
  1. +4 −2 .gitignore
  2. +4 −0 Gemfile
  3. +1 −82 Rakefile
  4. +6 −87 grit.gemspec
  5. +1 −1 lib/grit/git.rb
  6. +3 −0 lib/grit/version.rb
View
@@ -1,2 +1,4 @@
-pkg
-.DS_Store
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in grit.gemspec
+gemspec
View
@@ -1,82 +1 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-begin
- require 'rubygems'
- require 'jeweler'
- Jeweler::Tasks.new do |s|
- s.name = "grit"
- s.rubyforge_project = "grit"
- s.summary = "Grit is a Ruby library for extracting information from a git repository in an object oriented manner."
- s.email = "tom@mojombo.com"
- s.homepage = "http://github.com/mojombo/grit"
- s.description = "Grit is a Ruby library for extracting information from a git repository in an object oriented manner."
- s.authors = ["Tom Preston-Werner", "Scott Chacon"]
- s.files = FileList["[A-Z]*.*", "lib/**/*"]
- s.add_dependency('mime-types', '>= 1.15')
- s.add_dependency('diff-lcs', '>= 1.1.2')
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
-end
-
-Rake::TestTask.new do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/test_*.rb'
- t.verbose = false
-end
-
-Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'grit'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
-begin
- require 'rake/contrib/sshpublisher'
- namespace :rubyforge do
-
- desc "Release gem and RDoc documentation to RubyForge"
- task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
-
- namespace :release do
- desc "Publish RDoc to RubyForge."
- task :docs => [:rdoc] do
- config = YAML.load(
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
- )
-
- host = "#{config['username']}@rubyforge.org"
- remote_dir = "/var/www/gforge-projects/grit/"
- local_dir = 'rdoc'
-
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
- end
- end
- end
-rescue LoadError
- puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
-end
-
-task :default => :test
-
-# custom
-
-desc "Open an irb session preloaded with this library"
-task :console do
- sh "irb -rubygems -r ./lib/grit.rb"
-end
-
-task :coverage do
- system("rm -fr coverage")
- system("rcov test/test_*.rb")
- system("open coverage/index.html")
-end
-
-desc "Upload site to Rubyforge"
-task :site do
- sh "scp -r doc/* mojombo@grit.rubyforge.org:/var/www/gforge-projects/grit"
-end
+require "bundler/gem_tasks"
View
@@ -1,8 +1,3 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE
-# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
-# -*- encoding: utf-8 -*-
-
Gem::Specification.new do |s|
s.name = %q{grit}
s.version = "2.0.0"
@@ -20,94 +15,18 @@ Gem::Specification.new do |s|
"API.txt",
"History.txt",
"README.md",
- "VERSION.yml",
- "lib/grit.rb",
- "lib/grit/actor.rb",
- "lib/grit/blame.rb",
- "lib/grit/blob.rb",
- "lib/grit/commit.rb",
- "lib/grit/commit_stats.rb",
- "lib/grit/config.rb",
- "lib/grit/diff.rb",
- "lib/grit/errors.rb",
- "lib/grit/git-ruby.rb",
- "lib/grit/git-ruby/commit_db.rb",
- "lib/grit/git-ruby/file_index.rb",
- "lib/grit/git-ruby/git_object.rb",
- "lib/grit/git-ruby/internal/file_window.rb",
- "lib/grit/git-ruby/internal/loose.rb",
- "lib/grit/git-ruby/internal/pack.rb",
- "lib/grit/git-ruby/internal/raw_object.rb",
- "lib/grit/git-ruby/object.rb",
- "lib/grit/git-ruby/repository.rb",
- "lib/grit/git.rb",
- "lib/grit/index.rb",
- "lib/grit/lazy.rb",
- "lib/grit/merge.rb",
- "lib/grit/ref.rb",
- "lib/grit/repo.rb",
- "lib/grit/ruby1.9.rb",
- "lib/grit/status.rb",
- "lib/grit/submodule.rb",
- "lib/grit/tag.rb",
- "lib/grit/tree.rb",
- "lib/open3_detach.rb"
- ]
+ "VERSION.yml"] + Dir.glob("**/*.rb")
s.homepage = %q{http://github.com/mojombo/grit}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{grit}
s.rubygems_version = %q{1.3.5}
s.summary = %q{Grit is a Ruby library for extracting information from a git repository in an object oriented manner.}
- s.test_files = [
- "test/bench/benchmarks.rb",
- "test/helper.rb",
- "test/profile.rb",
- "test/suite.rb",
- "test/test_actor.rb",
- "test/test_blame.rb",
- "test/test_blame_tree.rb",
- "test/test_blob.rb",
- "test/test_commit.rb",
- "test/test_commit_stats.rb",
- "test/test_commit_write.rb",
- "test/test_config.rb",
- "test/test_diff.rb",
- "test/test_file_index.rb",
- "test/test_git.rb",
- "test/test_grit.rb",
- "test/test_head.rb",
- "test/test_index_status.rb",
- "test/test_merge.rb",
- "test/test_raw.rb",
- "test/test_real.rb",
- "test/test_reality.rb",
- "test/test_remote.rb",
- "test/test_repo.rb",
- "test/test_rubygit.rb",
- "test/test_rubygit_alt.rb",
- "test/test_rubygit_index.rb",
- "test/test_rubygit_iv2.rb",
- "test/test_submodule.rb",
- "test/test_tag.rb",
- "test/test_tree.rb",
- "examples/ex_add_commit.rb",
- "examples/ex_index.rb"
- ]
+ s.test_files = Dir.glob("test/**/*.rb")
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.specification_version = 3
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<mime-types>, [">= 1.15"])
- s.add_runtime_dependency(%q<diff-lcs>, [">= 1.1.2"])
- else
- s.add_dependency(%q<mime-types>, [">= 1.15"])
- s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
- end
- else
- s.add_dependency(%q<mime-types>, [">= 1.15"])
- s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
- end
+ s.add_runtime_dependency(%q<mime-types>, [">= 1.15"])
+ s.add_runtime_dependency(%q<diff-lcs>, [">= 1.1.2"])
+ s.add_development_dependency("rake")
end
View
@@ -56,7 +56,7 @@ def self.with_timeout(timeout = 10.seconds)
def initialize(git_dir, work_tree=nil)
self.git_dir = git_dir
- self.work_tree = work_tree || git_dir.gsub(/\/\.git$/,'')
+ self.work_tree = work_tree || (git_dir && git_dir.gsub(/\/\.git$/,''))
self.bytes_read = 0
end
View
@@ -0,0 +1,3 @@
+module Grit
+ VERSION = "0.0.1"
+end

0 comments on commit c8ff57c

Please sign in to comment.