Module: Veksel

Defined in:
lib/veksel.rb,
lib/veksel/cli.rb,
lib/veksel/suffix.rb,
lib/veksel/railtie.rb,
lib/veksel/version.rb,
lib/veksel/pg_cluster.rb,
lib/veksel/commands/fork.rb,
lib/veksel/commands/list.rb,
lib/veksel/commands/clean.rb

Defined Under Namespace

Modules: CLI, Commands Classes: AdapterNotSupported, PgCluster, Railtie, Suffix

Constant Summary collapse

VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.active_branchesObject



24
25
26
# File 'lib/veksel.rb', line 24

def active_branches
  `git for-each-ref 'refs/heads/' --format '%(refname)'`.split("\n").map { |ref| ref.sub('refs/heads/', '') }
end

.adapter_for(config, exception: true) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/veksel.rb', line 9

def adapter_for(config, exception: true)
  case config[:adapter]
  when 'postgresql'
    require_relative './veksel/pg_cluster'
    Veksel::PgCluster.new(config)
  else
    return unless exception
    raise AdapterNotSupported, "Veksel does not yet support #{config[:adapter]}"
  end
end

.current_branchObject



20
21
22
# File 'lib/veksel.rb', line 20

def current_branch
  `git rev-parse --abbrev-ref HEAD`.strip
end

.skip_fork?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/veksel.rb', line 28

def skip_fork?
  suffix.to_s.strip.empty?
end

.suffixObject



32
33
34
# File 'lib/veksel.rb', line 32

def suffix
  Suffix.new(current_branch).to_s
end