socialcast-git-extensions 2.0.8 → 2.1.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/bin/git-integrate CHANGED
@@ -10,14 +10,8 @@ include Socialcast
10
10
  is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
11
11
 
12
12
  branch = current_branch
13
- tickets = tickets_from_arguments_or_branch(ARGV, branch)
14
13
 
15
14
  run_cmd 'git update'
16
15
  integrate(branch, 'prototype')
17
16
 
18
- if tickets.any?
19
- update_tickets tickets, :branch => branch, :in_prototype => true
20
- start_tickets tickets
21
- end
22
-
23
17
  run_cmd "socialcast share '#worklog integrating #{branch} into prototype #scgitx'" unless is_quiet
data/bin/git-promote CHANGED
@@ -6,15 +6,10 @@ include Socialcast
6
6
  is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
7
7
 
8
8
  branch = current_branch
9
- tickets = tickets_from_arguments_or_branch(ARGV, branch)
10
9
 
11
10
  run_cmd 'git update'
12
11
  integrate(branch, 'staging')
13
12
 
14
- if tickets.any?
15
- update_tickets tickets, :branch => branch, :in_prototype => true, :in_staging => true
16
- resolve_tickets tickets
17
- end
18
13
 
19
14
  integrate('staging', 'prototype')
20
15
  run_cmd "git checkout #{branch}"
data/bin/git-release CHANGED
@@ -7,18 +7,12 @@ branch = current_branch
7
7
  abort("Cannot release reserved branch") if %w{master staging prototype}.include?(branch)
8
8
 
9
9
  is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
10
- tickets = tickets_from_arguments_or_branch(ARGV, branch)
11
10
 
12
11
  exit unless HighLine.agree("<%= color('Release #{branch} to production? (y/n)', :green) %>")
13
12
 
14
13
  run_cmd 'git update'
15
14
  integrate branch, 'master'
16
15
 
17
- if tickets.any?
18
- update_tickets tickets, :branch => branch
19
- release_tickets tickets
20
- end
21
-
22
16
  integrate branch, 'staging'
23
17
  integrate 'staging', 'prototype'
24
18
  run_cmd "git checkout master"
@@ -10,37 +10,6 @@ run_cmd 'git pull'
10
10
  run_cmd 'git pull origin last_known_good_staging'
11
11
  run_cmd 'git push origin HEAD'
12
12
 
13
- filter_id = '10102'
14
- issues = jira_server.getIssuesFromFilterWithLimit filter_id, 0, 1000
15
- branches = issues.collect do |issue|
16
- field = issue.customFieldValues.detect {|k| k.customfieldId == GIT_BRANCH_FIELD }
17
- field ? field.values.first : nil
18
- end.uniq.compact
19
-
20
- issues_with_no_branch = issues.reject do |issue|
21
- issue.customFieldValues.detect {|k| k.customfieldId == GIT_BRANCH_FIELD }
22
- end
23
- if issues_with_no_branch.any?
24
- HighLine.say "\n<%= color('The following tickets do NOT have a git branch properly configured:', :red) %>"
25
- issues_with_no_branch.each do |issue|
26
- print_issue issue
27
- end
28
- end
29
-
30
- branches.each do |branch|
31
- HighLine.say "\nThe changes on branch <%= color('#{branch}', :green) %> "
32
- if branches(:merged => true, :remote => true).include?(branch)
33
- HighLine.say "<%= color('HAVE', :green) %> been merged into master"
34
- releasable_tickets = tickets_from_branch(branch).select do |issue|
35
- print_issue issue
36
- HighLine.agree("Mark this issue as released? (y/n)")
37
- end
38
- release_tickets releasable_tickets
39
- else
40
- HighLine.say "<%= color('HAVE NOT', :red) %> been merged into master"
41
- end
42
- end
43
-
44
13
  run_cmd 'git prune-merged -r'
45
14
 
46
15
  run_cmd "socialcast share '#worklog releasing staging branch to production #scgitx'" unless is_quiet
@@ -6,11 +6,7 @@ include Socialcast
6
6
  reset_branch('prototype')
7
7
  reset_branch('last_known_good_prototype')
8
8
 
9
- filter_id = '10151'
10
- issues = jira_server.getIssuesFromFilterWithLimit filter_id, 0, 1000
11
-
12
9
  HighLine.say "\n<%= color('Updating the following tickets to no longer be in prototype:', :red) %>"
13
- update_tickets issues, :in_prototype => false
14
10
 
15
11
  is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
16
12
  run_cmd "socialcast share '#worklog resetting prototype branch #scgitx'" unless is_quiet
@@ -6,11 +6,5 @@ include Socialcast
6
6
  reset_branch('staging')
7
7
  reset_branch('last_known_good_staging')
8
8
 
9
- filter_id = '10102'
10
- issues = jira_server.getIssuesFromFilterWithLimit filter_id, 0, 1000
11
-
12
- HighLine.say "\n<%= color('Updating the following tickets to no longer be in staging:', :red) %>"
13
- update_tickets issues, :in_staging => false
14
-
15
9
  is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
16
10
  run_cmd "socialcast share '#worklog resetting staging branch #scgitx'" unless is_quiet
data/bin/git-start CHANGED
@@ -6,25 +6,21 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast-git-extension
6
6
  include Socialcast
7
7
 
8
8
  is_quiet = ARGV.delete("--quiet") || ARGV.delete("-q")
9
- tickets = tickets_from_arguments ARGV
10
9
 
11
- example_branch = %w{ api-fix-invalid-auth desktop-cleanup-avatar-markup share-form-add-edit-link }.sort_by { rand }.first
12
- repo = Grit::Repo.new(Dir.pwd)
13
- remote_branches = repo.remotes.collect {|b| b.name.split('/').last }
14
- until branch_name = HighLine.ask("What would you like to name your branch? (ex: #{example_branch})") {|q|
15
- q.validate = Proc.new { |branch|
16
- branch =~ /^[A-Za-z0-9\-_]+$/ && !remote_branches.include?(branch)
10
+ unless branch_name = ARGV.first
11
+ example_branch = %w{ api-fix-invalid-auth desktop-cleanup-avatar-markup share-form-add-edit-link }.sort_by { rand }.first
12
+ repo = Grit::Repo.new(Dir.pwd)
13
+ remote_branches = repo.remotes.collect {|b| b.name.split('/').last }
14
+ until branch_name = HighLine.ask("What would you like to name your branch? (ex: #{example_branch})") {|q|
15
+ q.validate = Proc.new { |branch|
16
+ branch =~ /^[A-Za-z0-9\-_]+$/ && !remote_branches.include?(branch)
17
+ }
17
18
  }
18
- }
19
+ end
19
20
  end
20
21
 
21
22
  run_cmd 'git checkout master'
22
23
  run_cmd 'git pull'
23
24
  run_cmd "git checkout -b #{branch_name}"
24
25
 
25
- if tickets.any?
26
- update_tickets tickets, :branch => branch_name
27
- start_tickets tickets
28
- end
29
-
30
26
  run_cmd "socialcast share '#worklog starting work on #{branch_name} #scgitx'" unless is_quiet
@@ -1,117 +1,14 @@
1
- require 'jira4r'
2
1
  require 'grit'
3
2
  require 'active_support/all'
4
3
  require 'highline/import'
5
4
 
6
5
  module Socialcast
7
- GIT_BRANCH_FIELD = 'customfield_10010'
8
- IN_PROTOTYPE_FIELD = 'customfield_10033'
9
- IN_STAGING_FIELD = 'customfield_10020'
10
- JIRA_CREDENTIALS_FILE = File.expand_path('~/.jira_key')
11
6
 
12
7
  def current_branch
13
8
  repo = Grit::Repo.new(Dir.pwd)
14
9
  Grit::Head.current(repo).name
15
10
  end
16
- def jira_credentials
17
- @credentials ||= YAML.load_file(JIRA_CREDENTIALS_FILE).symbolize_keys!
18
- @credentials
19
- end
20
- def jira_server
21
- return @jira if @jira
22
- if !File.exists?(JIRA_CREDENTIALS_FILE)
23
- input = {}
24
- input[:username] = HighLine.ask("JIRA username: ")
25
- input[:password] = HighLine.ask("JIRA password: ") { |q| q.echo = "*" }
26
-
27
- File.open(JIRA_CREDENTIALS_FILE, "w") do |f|
28
- f.write input.to_yaml
29
- end
30
- end
31
- File.chmod 0600, JIRA_CREDENTIALS_FILE
32
- credentials = jira_credentials
33
-
34
- begin
35
- @jira = Jira4R::JiraTool.new 2, "https://issues.socialcast.com"
36
- @jira.login credentials[:username], credentials[:password]
37
- return @jira
38
- rescue => e
39
- print_error e.message
40
- File.delete config_file
41
- raise e
42
- end
43
- end
44
-
45
- def assert_tickets_provided(ticket_ids, branch)
46
- tickets = tickets_from_arguments_or_branch(ticket_ids, branch)
47
- abort("JIRA ticket id or existing JIRA Git Branch is required to run this process") unless tickets.any?
48
- tickets
49
- end
50
- def tickets_from_arguments_or_branch(ticket_ids, branch)
51
- ticket_ids.any? ? tickets_from_arguments(ticket_ids) : tickets_from_branch(branch)
52
- end
53
- def tickets_from_arguments(ticket_ids)
54
- ticket_ids.collect do |key|
55
- jira_server.getIssue key
56
- end
57
- end
58
- def tickets_from_branch(branch)
59
- jira_server.getIssuesFromJqlSearch "project = 'SCWEBAPP' and 'Git Branch' ~ '#{branch}'", 1000
60
- end
61
- def update_tickets(tickets, options = {})
62
- tickets.each do |ticket|
63
- print_issue ticket
64
- fields = []
65
- fields << Jira4R::V2::RemoteFieldValue.new(GIT_BRANCH_FIELD, [options[:branch]]) unless options[:branch].nil?
66
- fields << Jira4R::V2::RemoteFieldValue.new(IN_PROTOTYPE_FIELD, [options[:in_prototype].to_s]) unless options[:in_prototype].nil?
67
- fields << Jira4R::V2::RemoteFieldValue.new(IN_STAGING_FIELD, [options[:in_staging] ? 'true' : '']) unless options[:in_staging].nil?
68
- begin
69
- jira_server.updateIssue ticket.key, fields
70
- rescue => e
71
- print_error e.message
72
- end
73
- end
74
- end
75
- STANDARD_WORKFLOW_TYPES = []
76
- STANDARD_WORKFLOW_TYPES << 1 #bug
77
- STANDARD_WORKFLOW_TYPES << 2 #feature
78
- STANDARD_WORKFLOW_TYPES << 9 #story
79
-
80
- WORKFLOW_MAPPINGS = {
81
- :start => {:standard => 11, :other => 21},
82
- :resolve => {:standard => 21, :other => nil},
83
- :release => {:standard => 101, :other => 31}
84
- }
85
- def start_tickets(tickets)
86
- transition_tickets tickets, :start
87
- end
88
- def resolve_tickets(tickets)
89
- start_tickets tickets
90
- transition_tickets tickets, :resolve
91
- end
92
- def release_tickets(tickets)
93
- resolve_tickets tickets
94
- transition_tickets tickets, :release
95
- end
96
- def transition_tickets(tickets, action)
97
- tickets.each do |ticket|
98
- begin
99
- mappings = WORKFLOW_MAPPINGS[action]
100
- transition = STANDARD_WORKFLOW_TYPES.include?(ticket.type.to_i) ? mappings[:standard] : mappings[:other]
101
- next unless transition
102
- jira_server.progressWorkflowAction ticket.key, transition.to_s, []
103
- rescue => e
104
- print_error "Unable to transition issue #{ticket.key} to #{action}"
105
- end
106
- end
107
- end
108
- def print_issue(issue)
109
- HighLine.say "<%= color('#{issue.key}', :green) %> - #{issue.summary}"
110
- end
111
- def print_error(message)
112
- HighLine.say "<%= color('Error: ', :red) %> #{message}"
113
- end
114
-
11
+
115
12
  def run_cmd(cmd)
116
13
  HighLine.say "\n> <%= color('#{cmd.gsub("'", '')}', :red) %>"
117
14
  raise "#{cmd} failed" unless system cmd
@@ -1,7 +1,7 @@
1
1
  module Socialcast
2
2
  module Git
3
3
  module Extensions
4
- VERSION = "2.0.8"
4
+ VERSION = "2.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "socialcast-git-extensions"
16
16
 
17
17
  s.add_runtime_dependency(%q<grit>, [">= 0"])
18
- s.add_runtime_dependency(%q<wireframe-jira4r>, [">= 0"])
19
18
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
20
19
  s.add_runtime_dependency(%q<git_remote_branch>, [">= 0"])
21
20
  s.add_runtime_dependency(%q<highline>, [">= 0"])
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: 31
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 8
10
- version: 2.0.8
10
+ version: 2.1.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: 2011-06-10 00:00:00 Z
18
+ date: 2011-09-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: grit
@@ -32,7 +32,7 @@ dependencies:
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: wireframe-jira4r
35
+ name: activesupport
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
@@ -46,7 +46,7 @@ dependencies:
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
49
- name: activesupport
49
+ name: git_remote_branch
50
50
  prerelease: false
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
52
  none: false
@@ -60,7 +60,7 @@ dependencies:
60
60
  type: :runtime
61
61
  version_requirements: *id003
62
62
  - !ruby/object:Gem::Dependency
63
- name: git_remote_branch
63
+ name: highline
64
64
  prerelease: false
65
65
  requirement: &id004 !ruby/object:Gem::Requirement
66
66
  none: false
@@ -73,24 +73,10 @@ dependencies:
73
73
  version: "0"
74
74
  type: :runtime
75
75
  version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: highline
78
- prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- type: :runtime
89
- version_requirements: *id005
90
76
  - !ruby/object:Gem::Dependency
91
77
  name: socialcast
92
78
  prerelease: false
93
- requirement: &id006 !ruby/object:Gem::Requirement
79
+ requirement: &id005 !ruby/object:Gem::Requirement
94
80
  none: false
95
81
  requirements:
96
82
  - - ">="
@@ -102,7 +88,7 @@ dependencies:
102
88
  - 4
103
89
  version: 0.3.4
104
90
  type: :runtime
105
- version_requirements: *id006
91
+ version_requirements: *id005
106
92
  description: GIT it done!
107
93
  email:
108
94
  - ryan@socialcast.com
@@ -176,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
162
  requirements: []
177
163
 
178
164
  rubyforge_project: socialcast-git-extensions
179
- rubygems_version: 1.8.1
165
+ rubygems_version: 1.8.5
180
166
  signing_key:
181
167
  specification_version: 3
182
168
  summary: git extension scripts for socialcast workflow