socialcast-git-extensions 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -14,7 +14,8 @@ begin
14
14
  gem.add_runtime_dependency "grit", ">= 0"
15
15
  gem.add_runtime_dependency "jira4r", ">= 0"
16
16
  gem.add_runtime_dependency "soap4r", ">= 0"
17
- gem.add_runtime_dependency "activesupport", ">= 2.3.5"
17
+ gem.add_runtime_dependency "activesupport", ">= 0"
18
+ gem.add_runtime_dependency "git_remote_branch", ">= 0"
18
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
20
  end
20
21
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
data/bin/git-integrate CHANGED
@@ -1,17 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'grit'
4
3
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
5
4
  include Socialcast
6
5
 
7
- repo = Grit::Repo.new(Dir.pwd)
8
- branch = Grit::Head.current(repo).name
6
+ ticket = ARGV.shift
7
+ raise 'JIRA ticket is required in order to move into staging' unless ticket
9
8
 
9
+ branch = current_branch
10
10
  update(branch)
11
11
  integrate(branch, 'staging')
12
12
 
13
- ticket = ARGV.shift
14
- if ticket
15
- update_ticket ticket, {:branch => branch, :in_staging => true}
16
- start_ticket ticket
17
- end
13
+ update_ticket ticket, {:branch => branch, :in_staging => true}
14
+ start_ticket ticket
data/bin/git-promote CHANGED
@@ -1,15 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'grit'
4
3
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
5
4
  include Socialcast
6
5
 
7
- repo = Grit::Repo.new(Dir.pwd)
8
- branch = Grit::Head.current(repo).name
9
-
10
6
  ticket = ARGV.shift
11
- raise 'JIRA ticket is required in order to move into next_release'
7
+ raise 'JIRA ticket is required in order to move into next_release' unless ticket
12
8
 
9
+ branch = current_branch
13
10
  update(branch)
14
11
  integrate(branch, 'next_release')
15
12
 
data/bin/git-release CHANGED
@@ -1,20 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'grit'
4
3
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extensions.rb')
5
4
  require 'readline'
6
5
  include Socialcast
7
6
 
8
- repo = Grit::Repo.new(Dir.pwd)
9
- branch = Grit::Head.current(repo).name
10
-
7
+ branch = current_branch
11
8
  raise "Cannot release reserved branch" if %w{master staging}.include?(branch)
12
9
 
10
+ ticket = ARGV.shift
11
+ raise 'JIRA ticket is required in order to release this branch' unless ticket
12
+
13
13
  exit unless Readline.readline("This will release #{branch} to production. Are you sure (y/n)? ") == 'y'
14
- run_cmd 'git checkout master'
15
- run_cmd 'git pull origin master'
16
- run_cmd "git pull . #{branch}"
17
- run_cmd 'git push origin HEAD'
18
- run_cmd "grb rm #{branch}"
19
14
 
20
- run_cmd "git integrate"
15
+ update branch
16
+ integrate branch, 'master'
17
+
18
+ update_ticket ticket, {:branch => branch}
19
+ release_ticket ticket
20
+
21
+ run_cmd "git integrate #{ticket}"
22
+ run_cmd "grb rm #{branch}"
@@ -1,11 +1,16 @@
1
1
  require 'jira4r'
2
2
  require 'activesupport'
3
+ require 'grit'
3
4
 
4
5
  module Socialcast
5
6
  GIT_BRANCH_FIELD = 'customfield_10010'
6
7
  IN_STAGING_FIELD = 'customfield_10020'
7
8
  JIRA_CREDENTIALS_FILE = File.expand_path('~/.jira_key')
8
-
9
+
10
+ def current_branch
11
+ repo = Grit::Repo.new(Dir.pwd)
12
+ Grit::Head.current(repo).name
13
+ end
9
14
  def jira_credentials
10
15
  @credentials ||= YAML.load_file(JIRA_CREDENTIALS_FILE).symbolize_keys!
11
16
  @credentials
@@ -46,19 +51,18 @@ module Socialcast
46
51
  jira_server.updateIssue ticket, fields
47
52
  end
48
53
  def start_ticket(ticket)
49
- issue = jira_server.getIssue ticket
50
- if issue.status == '1'
51
- puts "Transitioning ticket from 'Open' to 'In Progress'"
52
- start_work_action = '11'
53
- jira_server.progressWorkflowAction ticket, start_work_action, []
54
- end
54
+ transition_ticket_if_has_status ticket, '1', '11'
55
55
  end
56
56
  def resolve_ticket(ticket)
57
+ transition_ticket_if_has_status ticket, '3', '21'
58
+ end
59
+ def release_ticket(ticket)
60
+ transition_ticket_if_has_status ticket, '4', '101'
61
+ end
62
+ def transition_ticket_if_has_status(ticket, status, action)
57
63
  issue = jira_server.getIssue ticket
58
- if issue.status == '3'
59
- puts 'Transitioning ticket from "In Progress" to "Resolved"'
60
- finish_work_action = '21'
61
- jira_server.progressWorkflowAction ticket, finish_work_action, []
64
+ if issue.status == status
65
+ jira_server.progressWorkflowAction ticket, action, []
62
66
  end
63
67
  end
64
68
 
@@ -76,8 +80,10 @@ module Socialcast
76
80
  def integrate(branch, destination_branch = 'staging')
77
81
  puts "integrating #{branch} into #{destination_branch}"
78
82
  run_cmd "git remote prune origin"
79
- run_cmd "git branch -D #{destination_branch}" rescue nil
80
- run_cmd "grb track #{destination_branch}"
83
+ unless destination_branch == 'master'
84
+ run_cmd "git branch -D #{destination_branch}" rescue nil
85
+ run_cmd "grb track #{destination_branch}"
86
+ end
81
87
  run_cmd "git checkout #{destination_branch}"
82
88
  run_cmd "git pull . #{branch}"
83
89
  run_cmd "git push origin HEAD"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{socialcast-git-extensions}
8
- s.version = "0.4.0"
8
+ s.version = "0.5.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"]
@@ -52,20 +52,23 @@ Gem::Specification.new do |s|
52
52
  s.add_runtime_dependency(%q<grit>, [">= 0"])
53
53
  s.add_runtime_dependency(%q<jira4r>, [">= 0"])
54
54
  s.add_runtime_dependency(%q<soap4r>, [">= 0"])
55
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
55
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
56
+ s.add_runtime_dependency(%q<git_remote_branch>, [">= 0"])
56
57
  else
57
58
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
58
59
  s.add_dependency(%q<grit>, [">= 0"])
59
60
  s.add_dependency(%q<jira4r>, [">= 0"])
60
61
  s.add_dependency(%q<soap4r>, [">= 0"])
61
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
62
+ s.add_dependency(%q<activesupport>, [">= 0"])
63
+ s.add_dependency(%q<git_remote_branch>, [">= 0"])
62
64
  end
63
65
  else
64
66
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
65
67
  s.add_dependency(%q<grit>, [">= 0"])
66
68
  s.add_dependency(%q<jira4r>, [">= 0"])
67
69
  s.add_dependency(%q<soap4r>, [">= 0"])
68
- s.add_dependency(%q<activesupport>, [">= 2.3.5"])
70
+ s.add_dependency(%q<activesupport>, [">= 0"])
71
+ s.add_dependency(%q<git_remote_branch>, [">= 0"])
69
72
  end
70
73
  end
71
74
 
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: 15
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
8
+ - 5
9
9
  - 0
10
- version: 0.4.0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -82,14 +82,26 @@ dependencies:
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- hash: 9
85
+ hash: 3
86
86
  segments:
87
- - 2
88
- - 3
89
- - 5
90
- version: 2.3.5
87
+ - 0
88
+ version: "0"
91
89
  type: :runtime
92
90
  version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: git_remote_branch
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :runtime
104
+ version_requirements: *id006
93
105
  description: git extension scripts for socialcast workflow
94
106
  email: ryan@socialcast.com
95
107
  executables: