gitscape 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/gitscape CHANGED
@@ -4,12 +4,52 @@ begin
4
4
  require 'gitscape'
5
5
  rescue LoadError
6
6
  require 'rubygems'
7
+ require "optparse"
7
8
  require 'gitscape'
8
9
  end
9
10
 
11
+
12
+ OVERVIEW = <<-EOS
13
+ gitscape perform git-related promotions in a consistent manner.
14
+
15
+ The following actions are supported.
16
+
17
+ hotfix_start <branch-name> Creates a branch off live called hotfix/<branch-name>
18
+ hotfix_finish [<branch-name>] Merges the branch hotfix/<branch-name> into live,
19
+ the current release branch and master. If <branch-name> is
20
+ omitted and you are already on a hotfix branch, it is used.
21
+ release_start Branches master, incrementing the release number to create
22
+ a new release branch, release/i<version+1>. The release
23
+ branch is forced to the qa branch.
24
+ ** These actions update the origin server. **
25
+ release_finish After performing several validations, it merges the latest
26
+ release branch into live and master. Tags are created that
27
+ facilitate a rollback.
28
+ ** These actions update the origin server. **
29
+ EOS
30
+
31
+ # Parse option overrides.
32
+ options = {}
33
+
34
+ op = OptionParser.new do |op|
35
+ op.banner = 'Usage: gitscape [action] [options]'
36
+ op.separator('Options:')
37
+ op.on '--trace', 'Verbose output for debugging' do
38
+ options[:trace] = true
39
+ end
40
+ op.on '-h', '--help', 'Show a list of actions' do
41
+ puts OVERVIEW
42
+ exit
43
+ end
44
+ end
45
+
46
+ args = op.parse(ARGV)
47
+
48
+ # Get the app name. Note that if the app name is 'app', we have to rename it
49
+ # so that it doesn't conflict with the 'app' subdirectory.
50
+
10
51
  if ARGV.size < 1
11
- puts "*** Improper Usage ***"
12
- puts "TODO: write usage help text"
52
+ puts op
13
53
  exit(1)
14
54
  else
15
55
  case ARGV[0]
@@ -21,8 +61,6 @@ else
21
61
  Gitscape::Base.new.release_start
22
62
  when "release_finish"
23
63
  Gitscape::Base.new.release_finish ARGV[1].to_i
24
- when "promote_to_qa"
25
- Gitscape::Base.new.promote_to_qa ARGV[1].to_i
26
64
  else
27
65
  puts "Unknown command"
28
66
  end
data/gitscape.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.name = "gitscape"
8
8
  s.version = Gitscape::VERSION
9
9
  s.platform = Gem::Platform::RUBY
10
- s.authors = ["Jon Botelho"]
10
+ s.authors = ["Jon Botelho", "Xavier Matos"]
11
11
  s.email = ["gitscape@eachscape.com"]
12
12
  s.homepage = "https://github.com/eachscape/gitscape"
13
13
  s.summary = "Various Git utilities for cherry-pick/rebase workflows."
data/lib/gitscape/base.rb CHANGED
@@ -58,8 +58,8 @@ class Gitscape::Base
58
58
  end
59
59
 
60
60
  def git_has_conflicts puts_conflicts=true
61
- conflicts_status = `git status --porcelain | grep UU`
62
- has_conflicts = conflicts_status.length > 0
61
+ conflicts_status = `git status --porcelain`
62
+ has_conflicts = conflicts_status.scan(/[AUD]{2}/).count > 0
63
63
 
64
64
  puts conflicts_status if has_conflicts && puts_conflicts
65
65
 
@@ -198,8 +198,13 @@ class Gitscape::Base
198
198
  end
199
199
  end
200
200
 
201
+ # Checkout release branch
202
+ puts `git checkout #{release_branch_name}`
203
+ puts `git pull live`
204
+
201
205
  # Checkout live
202
- `git checkout live`
206
+ puts `git checkout live`
207
+ puts `git pull live`
203
208
 
204
209
  # Record the revision of live used for the rollback tag
205
210
  live_rollback_revision = `git log -n1 --oneline`.scan(/(^[^ ]+) .*$/).flatten[0]
@@ -207,7 +212,7 @@ class Gitscape::Base
207
212
  merge_options = "--no-ff -s recursive -Xignore-space-change"
208
213
 
209
214
  # Merge the release branch into live
210
- `git merge #{merge_options} #{release_branch_name}`
215
+ puts `git merge #{merge_options} #{release_branch_name}`
211
216
 
212
217
  # Error and conflict checking
213
218
  if !$?.success? then exit 4 end
@@ -230,8 +235,9 @@ class Gitscape::Base
230
235
  live_release_revision = `git log -n1 --oneline`.scan(/(^[^ ]+) .*$/).flatten[0]
231
236
 
232
237
  # Merge the release branch into master
233
- `git checkout master`
234
- `git merge #{merge_options} #{release_branch_name}`
238
+ puts `git checkout master`
239
+ puts `git pull`
240
+ puts `git merge #{merge_options} #{release_branch_name}`
235
241
 
236
242
  # Error and conflict checking
237
243
  if !$?.success? then exit 4 end
@@ -242,21 +248,20 @@ class Gitscape::Base
242
248
  end
243
249
 
244
250
  # Tag the state of live for both release and rollback
245
- `git tag rollback-to/i#{current_version_number} #{live_rollback_revision}`
251
+ puts `git tag rollback-to/i#{current_version_number} #{live_rollback_revision}`
246
252
  if !$?.success? then
247
253
  puts "=== WARNING: Failed to create rollback-to/i#{current_version_number} tag"
248
- `git tag -d rollback-to/i#{current_version_number}`
249
254
  end
250
255
 
251
256
  `git tag live/i#{new_version_number}/release #{live_release_revision}`
252
257
  if !$?.success? then
253
- `git tag -d rollback-to/i#{current_version_number}`
254
- `git tag -d live/i#{new_version_number}/release #{live_release_revision}`
258
+ puts "=== WARNING: Failed to create live/i#{new_version_number}/release"
259
+ puts `git tag -d rollback-to/i#{current_version_number}`
255
260
  exit 4
256
261
  end
257
262
 
258
- `git push origin live --tags`
259
- `git push origin master`
263
+ puts `git push origin live --tags`
264
+ puts `git push origin master`
260
265
  end
261
266
 
262
267
  # Returns true if the supplied Git commit hash or reference exists
@@ -1,3 +1,3 @@
1
1
  module Gitscape
2
- VERSION = '1.3.4'
2
+ VERSION = '1.3.5'
3
3
  end
metadata CHANGED
@@ -5,16 +5,17 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 3
8
- - 4
9
- version: 1.3.4
8
+ - 5
9
+ version: 1.3.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jon Botelho
13
+ - Xavier Matos
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2013-03-08 00:00:00 -05:00
18
+ date: 2013-03-19 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency