socialcast-git-extensions 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.2
1
+ 0.12.0
data/bin/git-integrate CHANGED
@@ -3,13 +3,12 @@
3
3
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
4
4
  include Socialcast
5
5
 
6
- ticket = ARGV.shift
7
- raise 'JIRA ticket is required in order to move into staging' unless ticket
6
+ assert_tickets_provided
8
7
 
9
8
  run_cmd 'git update'
10
9
 
11
10
  branch = current_branch
12
11
  integrate(branch, 'staging')
13
12
 
14
- update_ticket ticket, {:branch => branch, :in_staging => true}
15
- start_ticket ticket
13
+ update_tickets :branch => branch, :in_staging => true
14
+ start_tickets
data/bin/git-promote CHANGED
@@ -3,15 +3,14 @@
3
3
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
4
4
  include Socialcast
5
5
 
6
- ticket = ARGV.shift
7
- raise 'JIRA ticket is required in order to move into next_release' unless ticket
6
+ assert_tickets_provided
8
7
 
9
8
  run_cmd 'git update'
10
9
 
11
10
  branch = current_branch
12
11
  integrate(branch, 'next_release')
13
12
 
14
- update_ticket ticket, {:branch => branch, :in_staging => true}
15
- resolve_ticket ticket
13
+ update_tickets :branch => branch, :in_staging => true
14
+ resolve_tickets
16
15
 
17
16
  integrate(branch, 'staging')
data/bin/git-release CHANGED
@@ -7,8 +7,7 @@ include Socialcast
7
7
  branch = current_branch
8
8
  raise "Cannot release reserved branch" if %w{master staging}.include?(branch)
9
9
 
10
- ticket = ARGV.shift
11
- raise 'JIRA ticket is required in order to release this branch' unless ticket
10
+ assert_tickets_provided
12
11
 
13
12
  exit unless Readline.readline("This will release #{branch} to production. Are you sure (y/n)? ") == 'y'
14
13
 
@@ -16,8 +15,8 @@ run_cmd 'git update'
16
15
 
17
16
  integrate branch, 'master'
18
17
 
19
- update_ticket ticket, {:branch => branch}
20
- release_ticket ticket
18
+ update_tickets :branch => branch
19
+ release_tickets
21
20
 
22
21
  run_cmd "git promote #{ticket}"
23
22
  run_cmd "git integrate #{ticket}"
@@ -44,25 +44,47 @@ module Socialcast
44
44
  end
45
45
  end
46
46
 
47
- def update_ticket(ticket, options = {})
48
- fields = []
49
- fields << Jira4R::V2::RemoteFieldValue.new(GIT_BRANCH_FIELD, [options[:branch]]) if options[:branch]
50
- fields << Jira4R::V2::RemoteFieldValue.new(IN_STAGING_FIELD, ['true']) if options[:in_staging]
51
- jira_server.updateIssue ticket, fields
47
+ def assert_tickets_provided
48
+ raise "JIRA ticket is required to run this process" unless tickets.any?
52
49
  end
53
- def start_ticket(ticket)
54
- transition_ticket_if_has_status ticket, 1, 11
50
+ def tickets
51
+ ARGV
55
52
  end
56
- def resolve_ticket(ticket)
57
- transition_ticket_if_has_status ticket, 3, 21
53
+ def update_tickets(options = {})
54
+ tickets.each do |ticket|
55
+ fields = []
56
+ fields << Jira4R::V2::RemoteFieldValue.new(GIT_BRANCH_FIELD, [options[:branch]]) if options[:branch]
57
+ fields << Jira4R::V2::RemoteFieldValue.new(IN_STAGING_FIELD, ['true']) if options[:in_staging]
58
+ begin
59
+ jira_server.updateIssue ticket, fields
60
+ rescue => e
61
+ puts "Error updating ticket: #{e.message}"
62
+ end
63
+ end
64
+ end
65
+ def start_tickets
66
+ tickets.each do |ticket|
67
+ transition_ticket_if_has_status ticket, 1, 11
68
+ end
58
69
  end
59
- def release_ticket(ticket)
60
- transition_ticket_if_has_status ticket, 5, 101
70
+ def resolve_tickets
71
+ tickets.each do |ticket|
72
+ transition_ticket_if_has_status ticket, 3, 21
73
+ end
74
+ end
75
+ def release_tickets
76
+ tickets.each do |ticket|
77
+ transition_ticket_if_has_status ticket, 5, 101
78
+ end
61
79
  end
62
80
  def transition_ticket_if_has_status(ticket, status, action)
63
81
  issue = jira_server.getIssue ticket
64
82
  if issue.status == status.to_s
65
- jira_server.progressWorkflowAction ticket, action.to_s, []
83
+ begin
84
+ jira_server.progressWorkflowAction ticket, action.to_s, []
85
+ rescue => e
86
+ puts "Error updating ticket: #{e.message}"
87
+ end
66
88
  end
67
89
  end
68
90
  def associated_tickets(branch)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{socialcast-git-extensions}
8
- s.version = "0.11.2"
8
+ s.version = "0.12.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Sonnek"]
12
- s.date = %q{2010-07-16}
12
+ s.date = %q{2010-07-21}
13
13
  s.description = %q{git extension scripts for socialcast workflow}
14
14
  s.email = %q{ryan@socialcast.com}
15
15
  s.executables = ["git-integrate", "git-promote", "git-prune-merged", "git-release", "git-release-pending", "git-reset-staging", "git-track", "git-update", "git-wtf"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 11
9
- - 2
10
- version: 0.11.2
8
+ - 12
9
+ - 0
10
+ version: 0.12.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-16 00:00:00 -05:00
18
+ date: 2010-07-21 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency