octopolo 1.9.0 → 1.12.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 99207cf6d908d02747dfa354364fcb7a5489c4d1
4
- data.tar.gz: 2becf7b4837964d9f40aa460ec65d42674e801b0
2
+ SHA256:
3
+ metadata.gz: '0282df5e557fc60fc1ba3c327481fb19d7dbc345783b489b2b94f56bd0b663d9'
4
+ data.tar.gz: a6dc8e635242a0f9414e410d7ac1afede799868788852aab207465498cb114d7
5
5
  SHA512:
6
- metadata.gz: 314f19aacdd2ee12e72717812eea2d7f864f3de87c216b75011843a32e83fadd2ac0c74c0a6dd71ba71357e7b82426c6aed33ad1129e09f0b4a86d7d67f7c438
7
- data.tar.gz: e29c63d641279110743350e2a1bc5808f7addb32144f2ef5f13c1f73820f19884744ccd3226748ab9aa85dd8e967976f3d16ac5ebbcc4b8abb212c2aa829febb
6
+ metadata.gz: 042ab96b2a9e518338c28dd9898221486e84de0c41fde51c700c20e881c2e601723a64104dd1f9184614f73e9b82833b91384513bf3afdd3a450e82efff20d03
7
+ data.tar.gz: 97913a3a1f5c3af9d4e978c9ee3dba4a286f4c43caa6faeae65a6ea73b865b6d79f89ca2e84cfdea3848137f0311401f641d4ce4b69776811a442788cd1416d8
@@ -1 +1 @@
1
- ruby-2.0.0
1
+ 2.6.5
data/.soyuz.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  defaults:
2
2
  deploy_cmd: gem push *.gem
3
3
  before_deploy_cmds:
4
- - /usr/local/bin/op tag-release
5
- - sed -i "" -e "s/\".*/\"$(git tag | sed s/v// | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -1)\"/" lib/octopolo/version.rb
6
- - git add lib/octopolo/version.rb
7
- - git commit -m "Version Bump" && git push
4
+ # - /usr/local/bin/op tag-release
5
+ # - sed -i "" -e "s/\".*/\"$(git tag | sed s/v// | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -1)\"/" lib/octopolo/version.rb
6
+ # - git add lib/octopolo/version.rb
7
+ # - git commit -m "Version Bump" && git push
8
8
  - gem build octopolo.gemspec
9
9
  after_deploy_cmds:
10
10
  - rm *.gem
@@ -1,3 +1,23 @@
1
+ #### v1.12.0
2
+ #### v1.11.4
3
+ * IS-12227 Upgrade octokit
4
+
5
+ > Emma Sax: Sean Griffin, production-status-check[bot]: https://github.com/sportngin/octopolo/pull/140
6
+
7
+ #### v1.11.3
8
+ #### v1.11.2
9
+ * Fix bug where op tag-release on repo with no releases breaks
10
+
11
+ > Emma Sax: production-status-check[bot]: https://github.com/sportngin/octopolo/pull/139
12
+
13
+ #### v1.11.1
14
+ * Make expedite's branch form more flexible
15
+
16
+ > Emma Sax: production-status-check[bot]: https://github.com/sportngin/octopolo/pull/135
17
+
18
+ #### v1.11.0
19
+ #### v1.10.0
20
+ #### v1.9.1
1
21
  #### v1.10.0
2
22
  #### v1.9.0
3
23
  #### v1.8.1
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'guard', '~>2.5.0'
4
3
  gemspec
5
-
@@ -0,0 +1 @@
1
+ bin/op
@@ -3,7 +3,10 @@ command 'pull-request' do |c|
3
3
  c.desc "Branch to create the pull request against"
4
4
  c.flag [:d, :dest, :destination], :arg_name => "destination_branch", :default_value => Octopolo.config.deploy_branch
5
5
 
6
- c.desc "Pass -x to skip the prompt and infer from branch. Expects the branch to be in this format: JIRA-123_describe_pr"
6
+ c.desc "Pass --sd to skip creating this pull request as a draft"
7
+ c.switch %i[sd skip-draft], :arg_name => "skip-draft"
8
+
9
+ c.desc "Pass -x to skip the prompt and infer from branch. Expects the branch to be in this format: JIRA-123_describe_pr OR JIRA_123_describe_pr"
7
10
  c.switch [:x, :expedite], :arg_name => "expedite"
8
11
 
9
12
  c.desc "Use $EDITOR to update PR description before creating"
@@ -22,7 +22,14 @@ module Octopolo
22
22
  # Returns an array with the first element being the pull request's
23
23
  # number, the second being a Mash of the response from GitHub's API
24
24
  def perform
25
- result = GitHub.create_pull_request(repo_name, destination_branch, source_branch, title, body)
25
+ result = GitHub.create_pull_request(
26
+ repo_name,
27
+ destination_branch,
28
+ source_branch,
29
+ title,
30
+ body,
31
+ {draft: draft}
32
+ )
26
33
  # capture the information
27
34
  self.number = result.number
28
35
  self.data = result
@@ -30,6 +37,13 @@ module Octopolo
30
37
  raise CannotCreate, e.message
31
38
  end
32
39
 
40
+ # Public: Draft Pull request
41
+ #
42
+ # Returns a boolean that marks the PR a draft PR
43
+ def draft
44
+ !options[:skip_draft]
45
+ end
46
+
33
47
  # Public: Branch to merge the pull request into
34
48
  #
35
49
  # Returns a String with the branch name
@@ -51,7 +65,6 @@ module Octopolo
51
65
  Renderer::PULL_REQUEST_BODY
52
66
  end
53
67
 
54
-
55
68
  # Public: Temporary file for body editing
56
69
  #
57
70
  # Returns Name of temporary file
@@ -26,7 +26,7 @@ module Octopolo
26
26
  begin
27
27
  issue.comments.add(comment)
28
28
  rescue => e
29
- puts "Error: Failed to comment on Jira Issue #{issue_id}"
29
+ puts "Error: Failed to comment on Jira Issue. \nException: #{e}"
30
30
  end
31
31
  end
32
32
  end
@@ -29,9 +29,9 @@ module Octopolo
29
29
  GitHub.connect do
30
30
 
31
31
  if options[:expedite]
32
- infer_questionaire
32
+ infer_questionnaire
33
33
  else
34
- ask_questionaire
34
+ ask_questionnaire
35
35
  end
36
36
 
37
37
  create_pull_request
@@ -43,7 +43,7 @@ module Octopolo
43
43
  end
44
44
 
45
45
  # Private: Ask questions to create a pull request
46
- def ask_questionaire
46
+ def ask_questionnaire
47
47
  alert_reserved_and_exit if git.reserved_branch?
48
48
  announce
49
49
  ask_title
@@ -51,25 +51,30 @@ module Octopolo
51
51
  ask_pivotal_ids if config.use_pivotal_tracker
52
52
  ask_jira_ids if config.use_jira
53
53
  end
54
- private :ask_questionaire
54
+ private :ask_questionnaire
55
55
 
56
- def infer_questionaire
56
+ def infer_questionnaire
57
57
  alert_reserved_and_exit if git.reserved_branch?
58
58
  check_branch_format
59
59
  branch_arr = git.current_branch.split('_')
60
60
  issue = branch_arr[0].upcase
61
- descr = branch_arr[1..-1].join(' ')
61
+ if issue.include?('-')
62
+ descr = branch_arr[1..-1].join(' ')
63
+ else
64
+ issue = "#{issue}-#{branch_arr[1]}"
65
+ descr = branch_arr[2..-1].join(' ')
66
+ end
62
67
 
63
- self.title = "#{issue} #{descr}"
68
+ self.title = "#{issue} #{descr.capitalize}"
64
69
  self.pivotal_ids = [issue] if config.use_pivotal_tracker
65
70
  self.jira_ids = [issue] if config.use_jira
66
71
  end
67
- private :infer_questionaire
72
+ private :infer_questionnaire
68
73
 
69
74
  def check_branch_format
70
- return if /.*-\d+_.*/ =~ git.current_branch
75
+ return if (/[a-zA-Z]+-\d+_.*/ =~ git.current_branch || /[a-zA-Z]+_\d+_.*/ =~ git.current_branch)
71
76
 
72
- cli.say "Branch must match format like 'iss-123_describe_branch' to expedite"
77
+ cli.say "Branch must match format like 'iss-123_describe_branch' or 'iss_123_describe_branch' to expedite"
73
78
  exit 1
74
79
  end
75
80
  private :check_branch_format
@@ -105,7 +110,8 @@ module Octopolo
105
110
  source_branch: git.current_branch,
106
111
  pivotal_ids: pivotal_ids,
107
112
  jira_ids: jira_ids,
108
- editor: options[:editor]
113
+ editor: options[:editor],
114
+ skip_draft: options[:"skip-draft"]
109
115
  }
110
116
  end
111
117
  private :pull_request_attributes
@@ -12,9 +12,17 @@ module Octopolo
12
12
  private
13
13
 
14
14
  def self.scrub_via_regexp(tag, regexp)
15
- result = tag.match(regexp)[0]
16
- tag.gsub!(regexp, '')
17
- result
15
+ begin
16
+ result = tag.match(regexp)[0]
17
+ tag.gsub!(regexp, '')
18
+ result
19
+ rescue Exception => e
20
+ if e.message.include?("match' for nil:NilClass")
21
+ puts 'You are creating the first GitHub release for this repository.'
22
+ else
23
+ puts "Error finding existing GitHub release(s): #{e.message}"
24
+ end
25
+ end
18
26
  end
19
27
 
20
28
  end
@@ -1,3 +1,3 @@
1
1
  module Octopolo
2
- VERSION = "1.9.0"
2
+ VERSION = "1.12.0"
3
3
  end
@@ -18,18 +18,16 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency 'gli', '~> 2.13'
20
20
  gem.add_dependency 'hashie', '~> 1.2'
21
- gem.add_dependency 'octokit', '~> 4.0'
21
+ gem.add_dependency 'octokit', '~> 4.18'
22
22
  gem.add_dependency 'public_suffix', '~> 2.0' # Lock down to 2.x for Ruby 2.0 compatibility.
23
23
  gem.add_dependency 'highline', '~> 1.6'
24
24
  gem.add_dependency 'pivotal-tracker', '~> 0.5'
25
- gem.add_dependency 'jiralicious', '~> 0.4'
25
+ gem.add_dependency 'jiralicious', '~> 0.5'
26
26
  gem.add_dependency 'semantic', '~> 1.3'
27
27
  gem.add_dependency 'nokogiri-happymapper', '~> 0.6.0' # Lock down to 0.6.x for Ruby 2.0 compatibility.
28
28
 
29
29
  gem.add_development_dependency 'rake', '~> 10.1'
30
- gem.add_development_dependency 'bundler', '~> 1.16'
31
30
  gem.add_development_dependency 'rspec', '~> 2.99'
32
- gem.add_development_dependency 'guard', '~> 2.6'
33
31
  gem.add_development_dependency 'guard-rspec', '~> 4.3'
34
32
  gem.add_development_dependency 'hitimes', '~> 1.2.6'
35
33
  gem.add_development_dependency 'octopolo-plugin-example', '~> 0'
@@ -46,7 +46,9 @@ module Octopolo
46
46
  end
47
47
 
48
48
  it "generates the pull request with the given details and retains the information" do
49
- GitHub.should_receive(:create_pull_request).with(repo_name, destination_branch, source_branch, title, body) { data }
49
+ GitHub.should_receive(:create_pull_request).with(
50
+ repo_name, destination_branch, source_branch, title, body, {draft: true}
51
+ ) { data }
50
52
  creator.perform.should == data
51
53
  creator.number.should == data.number
52
54
  creator.data.should == data
@@ -45,7 +45,7 @@ module Octopolo
45
45
  context "#execute" do
46
46
  it "if connected to GitHub, asks some questions, creates the pull request, and opens it" do
47
47
  GitHub.should_receive(:connect).and_yield
48
- expect(subject).to receive(:ask_questionaire)
48
+ expect(subject).to receive(:ask_questionnaire)
49
49
  expect(subject).to receive(:create_pull_request)
50
50
  expect(subject).to receive(:update_pivotal)
51
51
  expect(subject).to receive(:update_jira)
@@ -61,7 +61,7 @@ module Octopolo
61
61
  end
62
62
  end
63
63
 
64
- context "#ask_questionaire" do
64
+ context "#ask_questionnaire" do
65
65
  it "asks appropriate questions to create a pull request" do
66
66
  expect(subject).to receive(:announce)
67
67
  expect(subject).to receive(:ask_title)
@@ -69,7 +69,7 @@ module Octopolo
69
69
  expect(subject).to receive(:ask_jira_ids)
70
70
  expect(subject).to receive(:ask_labels)
71
71
 
72
- subject.send(:ask_questionaire)
72
+ subject.send(:ask_questionnaire)
73
73
  end
74
74
 
75
75
  context "when checking for staging branch" do
@@ -85,7 +85,7 @@ module Octopolo
85
85
 
86
86
  subject.should_receive(:alert_reserved_and_exit)
87
87
 
88
- subject.send(:ask_questionaire)
88
+ subject.send(:ask_questionnaire)
89
89
  end
90
90
 
91
91
  it "should not ask if the branch is not staging" do
@@ -93,7 +93,7 @@ module Octopolo
93
93
 
94
94
  subject.should_not_receive(:alert_reserved_and_exit)
95
95
 
96
- subject.send(:ask_questionaire)
96
+ subject.send(:ask_questionnaire)
97
97
  end
98
98
  end
99
99
  end
@@ -101,13 +101,23 @@ module Octopolo
101
101
  context "#expedite" do
102
102
  subject { PullRequest.new(nil, { expedite: true }) }
103
103
 
104
- context 'good format' do
104
+ context 'good format 1' do
105
105
  let(:current_branch) { 'abc-123_so_fast'}
106
106
 
107
107
  it 'likes the issue-123_blah branch format' do
108
- subject.send(:infer_questionaire)
108
+ subject.send(:infer_questionnaire)
109
109
  expect(subject.jira_ids).to eq(['ABC-123'])
110
- expect(subject.title).to eq('ABC-123 so fast')
110
+ expect(subject.title).to eq('ABC-123 So fast')
111
+ end
112
+ end
113
+
114
+ context 'good format 2' do
115
+ let(:current_branch) { 'abc_123_so_fast'}
116
+
117
+ it 'likes the issue-123_blah branch format' do
118
+ subject.send(:infer_questionnaire)
119
+ expect(subject.jira_ids).to eq(['ABC-123'])
120
+ expect(subject.title).to eq('ABC-123 So fast')
111
121
  end
112
122
  end
113
123
 
@@ -117,7 +127,7 @@ module Octopolo
117
127
  it 'does not like other branch format' do
118
128
  subject.git.stub(:reserved_branch?).and_return false
119
129
  cli.should_receive(:say)
120
- expect { subject.send(:infer_questionaire) }.to raise_error(SystemExit)
130
+ expect { subject.send(:infer_questionnaire) }.to raise_error(SystemExit)
121
131
  end
122
132
  end
123
133
 
@@ -125,7 +135,7 @@ module Octopolo
125
135
  subject.git.stub(:reserved_branch?).and_return true
126
136
  subject.should_receive(:alert_reserved_and_exit).and_call_original
127
137
  cli.should_receive(:say)
128
- expect { subject.send(:infer_questionaire) }.to raise_error(SystemExit)
138
+ expect { subject.send(:infer_questionnaire) }.to raise_error(SystemExit)
129
139
  end
130
140
  end
131
141
 
@@ -224,7 +234,8 @@ module Octopolo
224
234
  source_branch: git.current_branch,
225
235
  pivotal_ids: subject.pivotal_ids,
226
236
  jira_ids: subject.jira_ids,
227
- editor: nil
237
+ editor: nil,
238
+ skip_draft: nil
228
239
  }
229
240
  end
230
241
  end
@@ -27,5 +27,21 @@ module Octopolo
27
27
  end
28
28
  end
29
29
 
30
+ describe 'scrub_via_regexp' do
31
+ let(:regexp) { /[a-z]*\z/i }
32
+ let(:tag) { '0.1.1' }
33
+
34
+ it 'should return a string' do
35
+ expect(SemverTagScrubber.scrub_via_regexp(tag, regexp)).to be_a(String)
36
+ end
37
+
38
+ it 'should not raise an error if the tag does not exist' do
39
+ expect{ SemverTagScrubber.scrub_via_regexp(nil, regexp) }.not_to raise_error(NoMethodError)
40
+ end
41
+
42
+ it 'should return nil if there was no tag' do
43
+ expect(SemverTagScrubber.scrub_via_regexp(nil, regexp)).to eq(nil)
44
+ end
45
+ end
30
46
  end
31
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopolo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Byrne
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-03-12 00:00:00.000000000 Z
13
+ date: 2020-09-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: gli
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '4.0'
49
+ version: '4.18'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '4.0'
56
+ version: '4.18'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: public_suffix
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -102,14 +102,14 @@ dependencies:
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '0.4'
105
+ version: '0.5'
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '0.4'
112
+ version: '0.5'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: semantic
115
115
  requirement: !ruby/object:Gem::Requirement
@@ -152,20 +152,6 @@ dependencies:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
154
  version: '10.1'
155
- - !ruby/object:Gem::Dependency
156
- name: bundler
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - "~>"
160
- - !ruby/object:Gem::Version
161
- version: '1.16'
162
- type: :development
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - "~>"
167
- - !ruby/object:Gem::Version
168
- version: '1.16'
169
155
  - !ruby/object:Gem::Dependency
170
156
  name: rspec
171
157
  requirement: !ruby/object:Gem::Requirement
@@ -180,20 +166,6 @@ dependencies:
180
166
  - - "~>"
181
167
  - !ruby/object:Gem::Version
182
168
  version: '2.99'
183
- - !ruby/object:Gem::Dependency
184
- name: guard
185
- requirement: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - "~>"
188
- - !ruby/object:Gem::Version
189
- version: '2.6'
190
- type: :development
191
- prerelease: false
192
- version_requirements: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - "~>"
195
- - !ruby/object:Gem::Version
196
- version: '2.6'
197
169
  - !ruby/object:Gem::Dependency
198
170
  name: guard-rspec
199
171
  requirement: !ruby/object:Gem::Requirement
@@ -388,8 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
388
360
  - !ruby/object:Gem::Version
389
361
  version: '0'
390
362
  requirements: []
391
- rubyforge_project:
392
- rubygems_version: 2.4.8
363
+ rubygems_version: 3.1.4
393
364
  signing_key:
394
365
  specification_version: 4
395
366
  summary: A set of GitHub workflow scripts to provide a smooth development process
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'gli'
4
- require_relative '../lib/octopolo'
5
-
6
- include GLI::App
7
-
8
- program_desc 'GitHub workflow scripts. From the Ngineers at Sport Ngin.'
9
- version Octopolo::VERSION
10
-
11
- autocomplete_commands false
12
- wrap_help_text :verbatim
13
-
14
- program_long_desc """
15
- DOCUMENTATION
16
- For documentation and help in setting up your configuration files,
17
- see Octopolo's GitHub repo: https://github.com/sportngin/octopolo
18
- """
19
-
20
- commands_from File.expand_path(File.dirname(__FILE__) + '/../lib/octopolo/commands')
21
-
22
- exit run(ARGV)