Module: Capistrano::Helpers::CapflowHelper

Defined in:
lib/capistrano/helpers/capflow_helper.rb

Instance Method Summary collapse

Instance Method Details

#available_releasesObject



43
44
45
46
# File 'lib/capistrano/helpers/capflow_helper.rb', line 43

def available_releases
  Capistrano::CLI.ui.say "\nAvailable Releases:"
  Capistrano::CLI.ui.say "#{releases.join("\n")}"
end

#available_tagsObject



38
39
40
41
# File 'lib/capistrano/helpers/capflow_helper.rb', line 38

def available_tags
  Capistrano::CLI.ui.say "Available Tags:"
  Capistrano::CLI.ui.say "#{non_release_tags.join("\n")}"
end


48
49
50
51
52
53
# File 'lib/capistrano/helpers/capflow_helper.rb', line 48

def banner

  <<-BANNER
\nCapflow for Gitflow
  BANNER
end

#branchesObject



22
23
24
# File 'lib/capistrano/helpers/capflow_helper.rb', line 22

def branches
 `git branch --no-color`.split("\n")
end

#current_branchObject



18
19
20
# File 'lib/capistrano/helpers/capflow_helper.rb', line 18

def current_branch
  branches.select{|b| b =~ /^\*\s/}.first.gsub(/^\*\s/,"")
end

#latest_releaseObject



34
35
36
# File 'lib/capistrano/helpers/capflow_helper.rb', line 34

def latest_release
  releases.sort{|x,y| x.split(version_tag_prefix).last <=> y.split(version_tag_prefix).last}.last
end

#non_release_tagsObject



14
15
16
# File 'lib/capistrano/helpers/capflow_helper.rb', line 14

def non_release_tags
  tags - releases 
end

#releasesObject



30
31
32
# File 'lib/capistrano/helpers/capflow_helper.rb', line 30

def releases
  tags.select{|t| t =~ /^#{version_tag_prefix}(\d+)/}
end

#tagsObject



10
11
12
# File 'lib/capistrano/helpers/capflow_helper.rb', line 10

def tags
  `git tag`.split("\n").compact
end

#version_tag_prefixObject



26
27
28
# File 'lib/capistrano/helpers/capflow_helper.rb', line 26

def version_tag_prefix
  `git config gitflow.prefix.versiontag`.split("\n").first
end

#whoObject



5
6
7
8
# File 'lib/capistrano/helpers/capflow_helper.rb', line 5

def who
  identity = (`git config user.name` || `whoami`)
  identity.chomp.to_url
end