class Object

Constants

DATABASE_NAME
EXECUTABLE_NAME
Issues
Main
LeftFieldLength
SUB_COMMANDS
SubCommandHelp

Public Instance Methods

edit_string(aString) click to toggle source
# File bin/issues, line 40
def edit_string(aString)
  tempfile_name = "/tmp/issues-" << SecureRandom.hex.force_encoding("UTF-8")
  File.write(tempfile_name, aString)
  system("$EDITOR #{tempfile_name}")
  new_string = File.read(tempfile_name)
  File.unlink(tempfile_name)
  new_string
end
get_issue_ids(num_ids, usage) click to toggle source
Command Line Parsing
# File bin/issues, line 563
def get_issue_ids(num_ids, usage)
  result = []
  count = num_ids >= 0 ? num_ids : ARGV.count
  
  begin
    count.times do
      ARGV.count > 0 && /^\h{1,32}$/ =~ ARGV[0] || raise 
      result << ARGV.shift 
    end

    result.count == 1 && num_ids > 0 ? result[0] : result

  rescue
    abort("Usage: issues #{usage}")
  end
end
git_get_current_branch() click to toggle source
# File bin/issues, line 17
def git_get_current_branch()
  current_branch = `git branch`.split(/\n/).find{ |l| l.start_with?("*") }
  
  if current_branch
    current_branch =~ /\*\s+(.+)/
    $~[1]
  end 
end
is_issue_branch() click to toggle source
# File bin/issues, line 28
def is_issue_branch()
  (git_get_current_branch() =~ /(feature|improvement|bug|task)\/[a-f0-9]{6}/) != nil
end
max(a,b) click to toggle source
# File bin/issues, line 34
def max(a,b)
  a > b ? a : b
end