Sha256: fc31ac9cc6c9b83031fe6116af90fa879c7cc757479fb836a2545a47b63f46c9

Contents?: true

Size: 873 Bytes

Versions: 15

Compression:

Stored size: 873 Bytes

Contents

module Githug
  class Repository

    attr_accessor :grit
  
    def initialize(location = ".")
      @grit = Grit::Repo.new(location)
    rescue Grit::InvalidGitRepositoryError
      @grit = nil
    end

    def reset
      dont_delete = ["..", ".", ".gitignore", ".profile.yml"]
      if File.basename(Dir.pwd) == "git_hug"
        Dir.entries(Dir.pwd).each do |file|
          FileUtils.rm_rf(file) unless dont_delete.include?(file) 
        end
      end
    end

    def valid?
      !@grit.nil?
    end

    def init(gitignore = true)
      @grit = Grit::Repo.init(".")
      if gitignore
        @grit.add(".gitignore")
        @grit.commit_all("added .gitignore")
      end
    end

    def method_missing(method, *args, &block)
      if @grit && @grit.respond_to?(method) 
        return @grit.send(method, *args, &block)
      end
      super
    end


  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
githug-0.2.4 lib/githug/repository.rb
githug-0.2.3 lib/githug/repository.rb
githug-0.2.2 lib/githug/repository.rb
githug-0.2.1 lib/githug/repository.rb
githug-0.2.0 lib/githug/repository.rb
githug-0.1.8 lib/githug/repository.rb
githug-0.1.7 lib/githug/repository.rb
githug-0.1.6 lib/githug/repository.rb
githug-0.1.5 lib/githug/repository.rb
githug-0.1.4 lib/githug/repository.rb
githug-0.1.3 lib/githug/repository.rb
githug-0.1.2 lib/githug/repository.rb
githug-0.1.1 lib/githug/repository.rb
githug-0.1.0 lib/githug/repository.rb
githug-0.0.10 lib/githug/repository.rb