Sha256: ad303b96fd55b5c5680b22f620138a4c525bf9b1d7b8c0a6f23d0ba21863ec11

Contents?: true

Size: 494 Bytes

Versions: 5

Compression:

Stored size: 494 Bytes

Contents

module Todidnt
  class GitRepo
    def initialize(path)
      expanded_path = File.expand_path(path)

      if File.exist?(File.join(expanded_path, '.git'))
        @working_dir = expanded_path
      else
        $stderr.puts "Whoops, #{expanded_path} is not a git repository!"
        exit
      end
    end

    def run(&blk)
      unless Dir.pwd == @working_dir
        Dir.chdir(@working_dir) do
          yield @working_dir
        end
      else
        yield
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
todidnt-0.4.1 lib/todidnt/git_repo.rb
todidnt-0.3.1 lib/todidnt/git_repo.rb
todidnt-0.2.0 lib/todidnt/git_repo.rb
todidnt-0.1.0 lib/todidnt/git_repo.rb
todidnt-0.0.0 lib/todidnt/git_repo.rb