lib/nutrella/task_board_name.rb in nutrella-0.5.0 vs lib/nutrella/task_board_name.rb in nutrella-0.6.0
- old
+ new
@@ -1,14 +1,16 @@
-require "git"
+require "open3"
module Nutrella
#
# Knows the name of the task board associated with the current git branch.
#
module TaskBoardName
- def self.from_git_branch(working_dir = ".")
- Git.open(working_dir).current_branch.titleize
- rescue
- abort "Sorry. Can't find an associated git branch here."
+ def self.from_git_branch
+ git_branch_name, status = Open3.capture2("git rev-parse --abbrev-ref HEAD")
+
+ abort "Sorry. Can't find an associated git branch here." unless status.success?
+
+ git_branch_name.chomp.titleize
end
end
end