lib/gitscape/base.rb in gitscape-1.2 vs lib/gitscape/base.rb in gitscape-1.3

- old
+ new

@@ -55,18 +55,18 @@ `git checkout #{current_branch}` unless current_branch == live_branch live_current_version_number end - def git_has_conflicts puts_conflicts=true - conflicts_status = `git status --porcelain | grep UU` - has_conflicts = conflicts_status.length > 0 + def git_has_conflicts puts_conflicts=true + conflicts_status = `git status --porcelain | grep UU` + has_conflicts = conflicts_status.length > 0 - puts conflicts_status if has_conflicts && puts_conflicts + puts conflicts_status if has_conflicts && puts_conflicts - has_conflicts - end + has_conflicts + end def hotfix_start(hotfix_branch_name=nil) checkout "live" if hotfix_branch_name.length == 0 @@ -123,9 +123,45 @@ raise "Merge on #{branch.full} has failed.\nResolve the conflicts and run the script again." if git_has_conflicts end # Checkout previous branch for user convenience `git checkout #{previous_branch}` + end + + def release_start + # Switch to master branch + # puts"About to checkout master" + `git checkout master` + # puts"Checkout of master branch successful" + + # Check that the working copy is clean + exit 1 unless git_working_copy_is_clean + + # Figure out the previous and new version numbers + version_file = File.new("version", "r") + previous_version_number = version_file.read.delete("i").to_i + new_version_number = previous_version_number + 1 + + # Get the new release_branch_name + release_branch_name = "i#{new_version_number}" + + # Cut the branch + `git checkout -b "release/#{release_branch_name}" master` + exit 1 unless $?.exitstatus == 0 + + # Bump the version number + `echo "#{release_branch_name}" > ./version` + exit 1 unless $?.exitstatus == 0 + + # Commit the bump + `git commit -a -m "Begin #{release_branch_name} release candidate"` + exit 1 unless $?.exitstatus == 0 + + # Push to origin + `git push origin -u "release/#{release_branch_name}"` + exit 1 unless $?.exitstatus == 0 + `git push origin "release/#{release_branch_name}:qa"` + exit 1 unless $?.exitstatus == 0 end def release_finish new_version_number=0 # Check if the working copy is clean, if not, exit exit 1 unless git_working_copy_is_clean