Sha256: 68887070408443c2d1bc51eca396ec48aedd8b3715d5d53fec87d9bff467e976

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

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')
include Socialcast

is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
tickets = tickets_from_arguments ARGV
abort("JIRA ticket id is required to run this process") unless tickets.any?

example_branch = %w{ api-fix-invalid-auth desktop-cleanup-avatar-markup share-form-add-edit-link }.sort_by { rand }.first
repo = Grit::Repo.new(Dir.pwd)
remote_branches = repo.remotes.collect {|b| b.name.split('/').last }
until branch_name = HighLine.ask("What would you like to name your branch? (ex: #{example_branch})") {|q| 
    q.validate = Proc.new { |branch|
      branch =~ /^[A-Za-z0-9\-_]+$/ && !remote_branches.include?(branch)
    }
  }
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

run_cmd "socialcast share '#worklog starting work on #{branch_name} #scgitx'" unless is_quiet

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
socialcast-git-extensions-2.0.7 bin/git-start
socialcast-git-extensions-2.0.6 bin/git-start