class DevFlow::Commands::PR
Constants
- FV_REGEX
- PR_TEMPLATES_PATHS
- STORY_REGEX
- STORY_URL_BASE
- STORY_URL_PATTERN
Public Instance Methods
call()
click to toggle source
# File lib/devflow/commands/pr.rb, line 14 def call branch = `git rev-parse --abbrev-ref HEAD` case branch when STORY_REGEX story_id = $1 story_url = STORY_URL_BASE + "/" + story_id title = "[#{story_id}] #{titleize($2)}" when FV_REGEX story_url = "" title = "[FV] #{titleize($1)}" else story_url = "" title = titleize(branch) end message = if (file = PR_TEMPLATES_PATHS.find { |p| File.exist?(p) }) "#{title}\n" \ "\n" \ "#{File.read(file).gsub(STORY_URL_PATTERN, story_url)}" else "#{title}\n" \ "\n" \ "#{story_url}" end puts message end
titleize(str)
click to toggle source
# File lib/devflow/commands/pr.rb, line 44 def titleize(str) str.tr("-", " ").capitalize end