Module: BranchDb
- Defined in:
- lib/branch_db/switcher.rb,
lib/branch_db.rb,
lib/branch_db/task_helper.rb,
lib/branch_db/mysql_switcher.rb,
lib/branch_db/sqlite_switcher.rb,
lib/branch_db/postgresql_switcher.rb,
lib/branch_db/configuration_twiddler.rb,
lib/branch_db/real_db_switchers_common.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ConfigurationTwiddler, RealDbSwitchersCommon, TaskHelper Classes: Error, MysqlSwitcher, PostgresqlSwitcher, SqliteSwitcher, Switcher
Constant Summary collapse
- VERSION =
'0.0.9'
- DEFAULT_BRANCH =
'master'
Class Method Summary collapse
Class Method Details
.current_repo_branch(raise_on_error = false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/branch_db.rb', line 10 def self.current_repo_branch(raise_on_error = false) @current_repo_branch ||= begin raw = `git rev-parse --symbolic-full-name HEAD` if $? == 0 raw.sub(%r{^refs/heads/}, '').chomp elsif raise_on_error raise Error, "Unable to determine the current repository branch." else # Don't raise an exception. We might be running in an exported copy. $stderr.puts %{Unable to determine the current repository branch, assuming "#{DEFAULT_BRANCH}".} DEFAULT_BRANCH end end end |