socialcast-git-extensions 0.10.3 → 0.11.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 +1 -2
- data/VERSION +1 -1
- data/bin/git-prune-merged +2 -15
- data/bin/git-release-pending +30 -7
- data/lib/socialcast-git-extensions.rb +18 -1
- data/socialcast-git-extensions.gemspec +5 -8
- metadata +8 -22
data/Rakefile
CHANGED
@@ -12,8 +12,7 @@ begin
|
|
12
12
|
gem.authors = ["Ryan Sonnek"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
14
|
gem.add_runtime_dependency "grit", ">= 0"
|
15
|
-
gem.add_runtime_dependency "jira4r", ">= 0"
|
16
|
-
gem.add_runtime_dependency "soap4r", ">= 0"
|
15
|
+
gem.add_runtime_dependency "wireframe-jira4r", ">= 0"
|
17
16
|
gem.add_runtime_dependency "activesupport", ">= 0"
|
18
17
|
gem.add_runtime_dependency "git_remote_branch", ">= 0"
|
19
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
data/bin/git-prune-merged
CHANGED
@@ -11,25 +11,12 @@ remote = ARGV.delete("--remote") || ARGV.delete("-r")
|
|
11
11
|
run_cmd "git checkout master"
|
12
12
|
run_cmd "git pull"
|
13
13
|
|
14
|
-
|
15
|
-
reserved_branches = %w{ HEAD master last_known_good_master staging last_known_good_staging next_release last_known_good_next_release }
|
16
|
-
args = []
|
17
|
-
args << '-r' if options[:remote]
|
18
|
-
args << '--merged'
|
19
|
-
branches = `git branch #{args.join(' ')}`.split("\n")
|
20
|
-
branches.each do |branch|
|
21
|
-
branch = branch.gsub(/\*/, '').strip.split(' ').first
|
22
|
-
branch = branch.split('/').last if options[:remote]
|
23
|
-
yield(branch) unless reserved_branches.include?(branch)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
each_branch do |branch|
|
14
|
+
branches(:merged => true).each do |branch|
|
28
15
|
run_cmd "git branch -d #{branch}"
|
29
16
|
end
|
30
17
|
|
31
18
|
if remote
|
32
|
-
|
19
|
+
branches(:merged => true, :remote => true).each do |branch|
|
33
20
|
run_cmd "grb rm #{branch}"
|
34
21
|
end
|
35
22
|
end
|
data/bin/git-release-pending
CHANGED
@@ -7,16 +7,39 @@ include Socialcast
|
|
7
7
|
run_cmd 'git checkout master'
|
8
8
|
run_cmd 'git pull'
|
9
9
|
run_cmd 'git pull origin last_known_good_next_release'
|
10
|
-
run_cmd '
|
10
|
+
run_cmd 'git push origin HEAD'
|
11
11
|
|
12
12
|
filter_id = '10102'
|
13
13
|
issues = jira_server.getIssuesFromFilterWithLimit filter_id, 0, 1000
|
14
|
-
issues.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
branches = issues.collect do |issue|
|
15
|
+
field = issue.customFieldValues.detect {|k| k.customfieldId == GIT_BRANCH_FIELD }
|
16
|
+
field ? field.values.first : nil
|
17
|
+
end.uniq.compact
|
18
|
+
|
19
|
+
issues_with_no_branch = issues.reject do |issue|
|
20
|
+
issue.customFieldValues.detect {|k| k.customfieldId == GIT_BRANCH_FIELD }
|
21
|
+
end
|
22
|
+
if issues_with_no_branch.any?
|
23
|
+
puts "The following tickets do not have a git branch configured"
|
24
|
+
puts issues_with_no_branch.collect(&:key).join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
branches.each do |branch|
|
28
|
+
if branches(:merged => true, :remote => true).include?(branch)
|
29
|
+
puts "All changes in #{branch} have been merged into master"
|
30
|
+
issues_in_branch = associated_tickets(branch)
|
31
|
+
puts "Related tickets on branch #{branch}: #{issues_in_branch.collect(&:key).join(' ')}"
|
32
|
+
|
33
|
+
issues_in_branch.each do |issue|
|
34
|
+
puts "#{issue.key} - #{issue.summary}"
|
35
|
+
next unless Readline.readline("Mark this issue as released? (y/n)? ") == 'y'
|
36
|
+
|
37
|
+
release_action = '101'
|
38
|
+
jira_server.progressWorkflowAction issue.key, release_action, []
|
39
|
+
end
|
40
|
+
else
|
41
|
+
puts "#{branch} has NOT yet been merged into master"
|
42
|
+
end
|
20
43
|
end
|
21
44
|
|
22
45
|
run_cmd 'git prune-merged -r'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'jira4r'
|
2
|
-
require '
|
2
|
+
require 'active_support'
|
3
3
|
require 'grit'
|
4
4
|
|
5
5
|
module Socialcast
|
@@ -65,12 +65,29 @@ module Socialcast
|
|
65
65
|
jira_server.progressWorkflowAction ticket, action.to_s, []
|
66
66
|
end
|
67
67
|
end
|
68
|
+
def associated_tickets(branch)
|
69
|
+
jira_server.getIssuesFromJqlSearch "project = 'SCWEBAPP' and 'Git Branch' ~ '#{branch}'", 1000
|
70
|
+
end
|
68
71
|
|
69
72
|
def run_cmd(cmd)
|
70
73
|
puts "\nRunning: #{cmd}"
|
71
74
|
raise "#{cmd} failed" unless system cmd
|
72
75
|
end
|
73
76
|
|
77
|
+
def branches(options = {})
|
78
|
+
branches = []
|
79
|
+
reserved_branches = %w{ HEAD master last_known_good_master staging last_known_good_staging next_release last_known_good_next_release }
|
80
|
+
args = []
|
81
|
+
args << '-r' if options[:remote]
|
82
|
+
args << '--merged' if options[:merged]
|
83
|
+
output = `git branch #{args.join(' ')}`.split("\n")
|
84
|
+
output.each do |branch|
|
85
|
+
branch = branch.gsub(/\*/, '').strip.split(' ').first
|
86
|
+
branch = branch.split('/').last if options[:remote]
|
87
|
+
branches << branch unless reserved_branches.include?(branch)
|
88
|
+
end
|
89
|
+
branches
|
90
|
+
end
|
74
91
|
def reset_branch(branch)
|
75
92
|
run_cmd "git checkout master"
|
76
93
|
run_cmd "git pull"
|
@@ -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.
|
8
|
+
s.version = "0.11.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-
|
12
|
+
s.date = %q{2010-07-16}
|
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"]
|
@@ -55,23 +55,20 @@ Gem::Specification.new do |s|
|
|
55
55
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
56
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
57
57
|
s.add_runtime_dependency(%q<grit>, [">= 0"])
|
58
|
-
s.add_runtime_dependency(%q<jira4r>, [">= 0"])
|
59
|
-
s.add_runtime_dependency(%q<soap4r>, [">= 0"])
|
58
|
+
s.add_runtime_dependency(%q<wireframe-jira4r>, [">= 0"])
|
60
59
|
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
61
60
|
s.add_runtime_dependency(%q<git_remote_branch>, [">= 0"])
|
62
61
|
else
|
63
62
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
64
63
|
s.add_dependency(%q<grit>, [">= 0"])
|
65
|
-
s.add_dependency(%q<jira4r>, [">= 0"])
|
66
|
-
s.add_dependency(%q<soap4r>, [">= 0"])
|
64
|
+
s.add_dependency(%q<wireframe-jira4r>, [">= 0"])
|
67
65
|
s.add_dependency(%q<activesupport>, [">= 0"])
|
68
66
|
s.add_dependency(%q<git_remote_branch>, [">= 0"])
|
69
67
|
end
|
70
68
|
else
|
71
69
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
72
70
|
s.add_dependency(%q<grit>, [">= 0"])
|
73
|
-
s.add_dependency(%q<jira4r>, [">= 0"])
|
74
|
-
s.add_dependency(%q<soap4r>, [">= 0"])
|
71
|
+
s.add_dependency(%q<wireframe-jira4r>, [">= 0"])
|
75
72
|
s.add_dependency(%q<activesupport>, [">= 0"])
|
76
73
|
s.add_dependency(%q<git_remote_branch>, [">= 0"])
|
77
74
|
end
|
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:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 11
|
9
|
+
- 0
|
10
|
+
version: 0.11.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-
|
18
|
+
date: 2010-07-16 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
type: :runtime
|
48
48
|
version_requirements: *id002
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name: jira4r
|
50
|
+
name: wireframe-jira4r
|
51
51
|
prerelease: false
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
type: :runtime
|
62
62
|
version_requirements: *id003
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
64
|
+
name: activesupport
|
65
65
|
prerelease: false
|
66
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
@@ -75,7 +75,7 @@ dependencies:
|
|
75
75
|
type: :runtime
|
76
76
|
version_requirements: *id004
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
|
-
name:
|
78
|
+
name: git_remote_branch
|
79
79
|
prerelease: false
|
80
80
|
requirement: &id005 !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
@@ -88,20 +88,6 @@ dependencies:
|
|
88
88
|
version: "0"
|
89
89
|
type: :runtime
|
90
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
|
105
91
|
description: git extension scripts for socialcast workflow
|
106
92
|
email: ryan@socialcast.com
|
107
93
|
executables:
|