Class: Todidnt::GitRepo
- Inherits:
-
Object
- Object
- Todidnt::GitRepo
- Defined in:
- lib/todidnt/git_repo.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ GitRepo
constructor
A new instance of GitRepo.
- #run(&blk) ⇒ Object
Constructor Details
#initialize(path) ⇒ GitRepo
Returns a new instance of GitRepo.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/todidnt/git_repo.rb', line 3 def initialize(path) = File.(path) if File.exist?(File.join(, '.git')) @working_dir = else $stderr.puts "Whoops, #{expanded_path} is not a git repository!" exit end end |
Instance Method Details
#run(&blk) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/todidnt/git_repo.rb', line 14 def run(&blk) unless Dir.pwd == @working_dir Dir.chdir(@working_dir) do yield @working_dir end else yield end end |