Sha256: ad275fa8f806a42f3ee2e8caf080cb2fb86992015bcb50cbaad3a8bf3d54789a

Contents?: true

Size: 1007 Bytes

Versions: 2

Compression:

Stored size: 1007 Bytes

Contents

#!/usr/bin/env ruby

#start a new git branch with latest changes from master

require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
require 'readline'
include Socialcast

tickets = tickets_from_arguments ARGV
raise "JIRA ticket id is required to run this process" unless tickets.any?

def validate_branch_name(proposed_branch_name)
  proposed_branch_name = proposed_branch_name.strip.parameterize
  if !(proposed_branch_name =~ /^[A-Za-z0-9\-_]+$/)
    puts "'#{proposed_branch_name}' isn't a valid branch name; stick with letters, numbers, dashes, and underscores."
    return nil
  end

  proposed_branch_name
end

branch_name = nil
until branch_name.present?
  proposed_branch_name = Readline.readline("What would you like to name your branch? ")
  branch_name = validate_branch_name(proposed_branch_name)
end

run_cmd 'git checkout master'
run_cmd 'git pull'
run_cmd "git checkout -b #{branch_name}"

update_tickets tickets, :branch => branch_name
start_tickets tickets

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
socialcast-git-extensions-1.3.1 bin/git-start
socialcast-git-extensions-1.3.0 bin/git-start