Sha256: 202cbfd3413c37124604f9ed8d7694aa5c28ff2fa359e688e112978df1ad2541

Contents?: true

Size: 627 Bytes

Versions: 4

Compression:

Stored size: 627 Bytes

Contents

#
# stuff to go here
#

require 'pathname'

require_relative 'git-root/errors'
require_relative 'git-root/version'

#
# and here
#
class GitRoot
    #
    # Stuff
    #

    class << self
        def path(base_path = Dir.getwd)
            git_path_parts = Pathname(base_path).each_filename.to_a

            while git_path_parts.count.positive?
                git_root = "/#{git_path_parts.join('/')}"
                git_path = "#{git_root}/.git"

                return git_root if File.directory?(git_path)

                git_path_parts.pop
            end
            raise InvalidRepoError.new
        end
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git-root-0.1.3 lib/git-root.rb
git-root-0.1.2 lib/git-root.rb
git-root-0.1.1 lib/git-root.rb
git-root-0.1.0 lib/git-root.rb