gitx 2.13.2 → 2.13.3
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 +4 -4
- data/.hound.yml +2 -0
- data/.rubocop.yml +12 -0
- data/Rakefile +1 -1
- data/bin/git-buildtag +1 -1
- data/bin/git-cleanup +1 -2
- data/bin/git-integrate +1 -1
- data/bin/git-nuke +1 -1
- data/bin/git-release +1 -1
- data/bin/git-review +1 -1
- data/bin/git-share +1 -1
- data/bin/git-start +1 -1
- data/bin/git-track +1 -1
- data/bin/git-update +1 -1
- data/gitx.gemspec +4 -3
- data/lib/gitx/cli/base_command.rb +2 -2
- data/lib/gitx/cli/buildtag_command.rb +0 -1
- data/lib/gitx/cli/integrate_command.rb +5 -5
- data/lib/gitx/cli/nuke_command.rb +5 -5
- data/lib/gitx/cli/release_command.rb +1 -1
- data/lib/gitx/cli/review_command.rb +22 -22
- data/lib/gitx/cli/update_command.rb +3 -5
- data/lib/gitx/extensions/string.rb +2 -2
- data/lib/gitx/github.rb +8 -8
- data/lib/gitx/version.rb +1 -1
- data/spec/gitx/cli/base_command_spec.rb +3 -3
- data/spec/gitx/cli/integrate_command_spec.rb +12 -12
- data/spec/gitx/cli/release_command_spec.rb +1 -1
- data/spec/gitx/cli/review_command_spec.rb +33 -33
- data/spec/support/matchers/meet_expectations_matcher.rb +2 -2
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6879c6b0b329e85ee4fa68d2aa1ae44c95298263
|
4
|
+
data.tar.gz: da978aaaab7573d8dac8033b2b6522e362312cd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a4dee3357477bf1304472c4cc2084560fcb31d00d02abdf3aabe270d92196730722d41a1806aebb38499fa2918da50aef02f320599d78fe0d8dcb844b0b5ab3
|
7
|
+
data.tar.gz: 5faca0a6beef13c58855059a5bcbe1eb9710dfdd285a52e85b91f63c8337840eba8affdf00b14588acd89f333f7e2ec7763ca43e3346d503b68d75f82c1f59bf
|
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
data/Rakefile
CHANGED
data/bin/git-buildtag
CHANGED
data/bin/git-cleanup
CHANGED
data/bin/git-integrate
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
4
4
|
require 'gitx/cli/integrate_command'
|
5
5
|
args = ARGV.dup.unshift('integrate')
|
6
6
|
Gitx::Cli::IntegrateCommand.start(args)
|
data/bin/git-nuke
CHANGED
data/bin/git-release
CHANGED
data/bin/git-review
CHANGED
data/bin/git-share
CHANGED
data/bin/git-start
CHANGED
data/bin/git-track
CHANGED
data/bin/git-update
CHANGED
data/gitx.gemspec
CHANGED
@@ -8,12 +8,12 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Gitx::VERSION
|
9
9
|
spec.authors = ['Ryan Sonnek']
|
10
10
|
spec.email = ['ryan.sonnek@gmail.com']
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
11
|
+
spec.description = 'Git eXtensions for improved development workflow'
|
12
|
+
spec.summary = 'Utility scripts for Git to increase productivity for common operations'
|
13
13
|
spec.homepage = ''
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files = `git ls-files`.split(
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
@@ -34,4 +34,5 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'coveralls'
|
35
35
|
spec.add_development_dependency 'terminal-notifier'
|
36
36
|
spec.add_development_dependency 'terminal-notifier-guard'
|
37
|
+
spec.add_development_dependency 'rubocop'
|
37
38
|
end
|
@@ -12,7 +12,7 @@ module Gitx
|
|
12
12
|
|
13
13
|
add_runtime_options!
|
14
14
|
|
15
|
-
method_option :trace, :
|
15
|
+
method_option :trace, type: :boolean, aliases: '-v'
|
16
16
|
def initialize(*args)
|
17
17
|
super(*args)
|
18
18
|
end
|
@@ -40,7 +40,7 @@ module Gitx
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def assert_not_protected_branch!(branch, action)
|
43
|
-
|
43
|
+
fail "Cannot #{action} reserved branch" if config.reserved_branch?(branch) || config.aggregate_branch?(branch)
|
44
44
|
end
|
45
45
|
|
46
46
|
# helper to invoke other CLI commands
|
@@ -5,7 +5,6 @@ require 'gitx/cli/base_command'
|
|
5
5
|
module Gitx
|
6
6
|
module Cli
|
7
7
|
class BuildtagCommand < BaseCommand
|
8
|
-
|
9
8
|
desc 'buildtag', 'create a tag for the current build and push it back to origin (supports Travis CI and Codeship)'
|
10
9
|
def buildtag
|
11
10
|
fail 'Unknown branch. Environment variables TRAVIS_BRANCH or CI_BRANCH are required' unless branch_name
|
@@ -9,8 +9,8 @@ module Gitx
|
|
9
9
|
class IntegrateCommand < BaseCommand
|
10
10
|
include Gitx::Github
|
11
11
|
desc 'integrate', 'integrate the current branch into one of the aggregate development branches (default = staging)'
|
12
|
-
method_option :resume, :
|
13
|
-
method_option :comment, :
|
12
|
+
method_option :resume, type: :string, aliases: '-r', desc: 'resume merging of feature-branch'
|
13
|
+
method_option :comment, type: :boolean, aliases: '-c', desc: 'add a comment to the pull request for this branch. Creates a new PR if none exists.'
|
14
14
|
def integrate(integration_branch = 'staging')
|
15
15
|
assert_aggregate_branch!(integration_branch)
|
16
16
|
|
@@ -20,7 +20,7 @@ module Gitx
|
|
20
20
|
begin
|
21
21
|
execute_command(UpdateCommand, :update)
|
22
22
|
rescue
|
23
|
-
|
23
|
+
raise MergeError, 'Merge Conflict Occurred. Please Merge Conflict Occurred. Please fix merge conflict and rerun the integrate command'
|
24
24
|
end
|
25
25
|
|
26
26
|
integrate_branch(branch, integration_branch) unless options[:resume]
|
@@ -44,7 +44,7 @@ module Gitx
|
|
44
44
|
begin
|
45
45
|
run_cmd "git merge #{branch}"
|
46
46
|
rescue
|
47
|
-
|
47
|
+
raise MergeError, "Merge Conflict Occurred. Please fix merge conflict and rerun command with --resume #{branch} flag"
|
48
48
|
end
|
49
49
|
run_cmd 'git push origin HEAD'
|
50
50
|
end
|
@@ -63,7 +63,7 @@ module Gitx
|
|
63
63
|
def fetch_remote_branch(target_branch)
|
64
64
|
create_remote_branch(target_branch) unless remote_branch_exists?(target_branch)
|
65
65
|
run_cmd 'git fetch origin'
|
66
|
-
run_cmd "git branch -D #{target_branch}", :
|
66
|
+
run_cmd "git branch -D #{target_branch}", allow_failure: true
|
67
67
|
checkout_branch target_branch
|
68
68
|
end
|
69
69
|
|
@@ -6,7 +6,7 @@ module Gitx
|
|
6
6
|
module Cli
|
7
7
|
class NukeCommand < BaseCommand
|
8
8
|
desc 'nuke', 'nuke the specified aggregate branch and reset it to a known good state'
|
9
|
-
method_option :destination, :
|
9
|
+
method_option :destination, type: :string, aliases: '-d', desc: 'destination branch to reset to'
|
10
10
|
def nuke(bad_branch)
|
11
11
|
good_branch = options[:destination] || ask("What branch do you want to reset #{bad_branch} to? (default: #{bad_branch})")
|
12
12
|
good_branch = bad_branch if good_branch.length == 0
|
@@ -22,8 +22,8 @@ module Gitx
|
|
22
22
|
say last_known_good_tag, :green
|
23
23
|
|
24
24
|
checkout_branch Gitx::BASE_BRANCH
|
25
|
-
run_cmd "git branch -D #{bad_branch}", :
|
26
|
-
run_cmd "git push origin --delete #{bad_branch}", :
|
25
|
+
run_cmd "git branch -D #{bad_branch}", allow_failure: true
|
26
|
+
run_cmd "git push origin --delete #{bad_branch}", allow_failure: true
|
27
27
|
run_cmd "git checkout -b #{bad_branch} #{last_known_good_tag}"
|
28
28
|
run_cmd "git push origin #{bad_branch}"
|
29
29
|
run_cmd "git branch --set-upstream-to origin/#{bad_branch}"
|
@@ -39,7 +39,7 @@ module Gitx
|
|
39
39
|
|
40
40
|
say "#{bad_branch} contains migrations that may need to be reverted. Ensure any reversable migrations are reverted on affected databases before nuking.", :red
|
41
41
|
say 'Example commands to revert outdated migrations:'
|
42
|
-
outdated_migrations.
|
42
|
+
outdated_migrations.reverse_each do |migration|
|
43
43
|
version = File.basename(migration).split('_').first
|
44
44
|
say "rake db:migrate:down VERSION=#{version}"
|
45
45
|
end
|
@@ -48,7 +48,7 @@ module Gitx
|
|
48
48
|
|
49
49
|
def current_build_tag(branch)
|
50
50
|
last_build_tag = build_tags_for_branch(branch).last
|
51
|
-
|
51
|
+
fail "No known good tag found for branch: #{branch}. Verify tag exists via `git tag -l 'build-#{branch}-*'`" unless last_build_tag
|
52
52
|
last_build_tag
|
53
53
|
end
|
54
54
|
|
@@ -12,7 +12,7 @@ module Gitx
|
|
12
12
|
include Gitx::Github
|
13
13
|
|
14
14
|
desc 'release', 'release the current branch to production'
|
15
|
-
method_option :cleanup, :
|
15
|
+
method_option :cleanup, type: :boolean, desc: 'cleanup merged branches after release'
|
16
16
|
def release(branch = nil)
|
17
17
|
return unless yes?("Release #{current_branch.name} to production? (y/n)", :green)
|
18
18
|
|
@@ -10,34 +10,34 @@ module Gitx
|
|
10
10
|
|
11
11
|
BUMP_COMMENT_PREFIX = '[gitx] review bump :tada:'
|
12
12
|
BUMP_COMMENT_FOOTER = <<-EOS.dedent
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
# Bump comments should include:
|
14
|
+
# * summary of what changed
|
15
|
+
#
|
16
|
+
# This footer will automatically be stripped from the created comment
|
17
17
|
EOS
|
18
18
|
APPROVAL_COMMENT_PREFIX = '[gitx] review approved :shipit:'
|
19
19
|
APPROVAL_COMMENT_FOOTER = <<-EOS.dedent
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
# Approval comments can include:
|
21
|
+
# * feedback
|
22
|
+
# * post-release follow-up items
|
23
|
+
#
|
24
|
+
# This footer will automatically be stripped from the created comment
|
25
25
|
EOS
|
26
26
|
REJECTION_COMMENT_PREFIX = '[gitx] review rejected'
|
27
27
|
REJECTION_COMMENT_FOOTER = <<-EOS.dedent
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
# Rejection comments should include:
|
29
|
+
# * feedback for fixes required before approved
|
30
|
+
#
|
31
|
+
# This footer will automatically be stripped from the created comment
|
32
32
|
EOS
|
33
33
|
|
34
34
|
desc 'review', 'Create or update a pull request on github'
|
35
|
-
method_option :description, :
|
36
|
-
method_option :assignee, :
|
37
|
-
method_option :open, :
|
38
|
-
method_option :bump, :
|
39
|
-
method_option :approve, :
|
40
|
-
method_option :reject, :
|
35
|
+
method_option :description, type: :string, aliases: '-d', desc: 'pull request description'
|
36
|
+
method_option :assignee, type: :string, aliases: '-a', desc: 'pull request assignee'
|
37
|
+
method_option :open, type: :boolean, aliases: '-o', desc: 'open the pull request in a web browser'
|
38
|
+
method_option :bump, type: :boolean, aliases: '-b', desc: 'bump an existing pull request by posting a comment to re-review new changes'
|
39
|
+
method_option :approve, type: :boolean, desc: 'approve the pull request an post comment on pull request'
|
40
|
+
method_option :reject, type: :boolean, desc: 'reject the pull request an post comment on pull request'
|
41
41
|
# @see http://developer.github.com/v3/pulls/
|
42
42
|
def review(branch = nil)
|
43
43
|
fail 'Github authorization token not found' unless authorization_token
|
@@ -68,17 +68,17 @@ module Gitx
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def bump_pull_request(pull_request)
|
71
|
-
|
71
|
+
comment_from_template(pull_request, BUMP_COMMENT_PREFIX, BUMP_COMMENT_FOOTER)
|
72
72
|
update_review_status(pull_request, 'pending', 'Peer review in progress')
|
73
73
|
end
|
74
74
|
|
75
75
|
def reject_pull_request(pull_request)
|
76
|
-
|
76
|
+
comment_from_template(pull_request, REJECTION_COMMENT_PREFIX, REJECTION_COMMENT_FOOTER)
|
77
77
|
update_review_status(pull_request, 'failure', 'Peer review rejected')
|
78
78
|
end
|
79
79
|
|
80
80
|
def approve_pull_request(pull_request)
|
81
|
-
|
81
|
+
comment_from_template(pull_request, APPROVAL_COMMENT_PREFIX, APPROVAL_COMMENT_FOOTER)
|
82
82
|
update_review_status(pull_request, 'success', 'Peer review approved')
|
83
83
|
end
|
84
84
|
|
@@ -20,11 +20,9 @@ module Gitx
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def update_branch(branch)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
fail MergeError, 'Merge Conflict Occurred. Please fix merge conflict and rerun the update command'
|
27
|
-
end
|
23
|
+
run_cmd "git pull origin #{branch}"
|
24
|
+
rescue
|
25
|
+
raise MergeError, 'Merge Conflict Occurred. Please fix merge conflict and rerun the update command'
|
28
26
|
end
|
29
27
|
|
30
28
|
def remote_branch_exists?(branch)
|
data/lib/gitx/github.rb
CHANGED
@@ -103,12 +103,12 @@ module Gitx
|
|
103
103
|
password = ask_without_echo("Github password for #{username}: ")
|
104
104
|
client = Octokit::Client.new(login: username, password: password)
|
105
105
|
options = {
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
106
|
+
scopes: ['repo'],
|
107
|
+
note: github_client_name,
|
108
|
+
note_url: CLIENT_URL
|
109
109
|
}
|
110
110
|
two_factor_auth_token = ask_without_echo('Github two factor authorization token (if enabled): ')
|
111
|
-
options[:headers] = {'X-GitHub-OTP' => two_factor_auth_token} if two_factor_auth_token
|
111
|
+
options[:headers] = { 'X-GitHub-OTP' => two_factor_auth_token } if two_factor_auth_token
|
112
112
|
response = client.create_authorization(options)
|
113
113
|
response.token
|
114
114
|
rescue Octokit::ClientError => e
|
@@ -122,7 +122,7 @@ module Gitx
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def github_client
|
125
|
-
@client ||= Octokit::Client.new(:
|
125
|
+
@client ||= Octokit::Client.new(access_token: authorization_token)
|
126
126
|
end
|
127
127
|
|
128
128
|
# @return [String] github username (ex: 'wireframe') of the current github.user
|
@@ -140,7 +140,7 @@ module Gitx
|
|
140
140
|
# https://github.com/wireframe/gitx.git #=> wireframe/gitx
|
141
141
|
def github_slug
|
142
142
|
remote = repo.config['remote.origin.url']
|
143
|
-
remote.to_s.gsub(/\.git$/,'').split(/[:\/]/).last(2).join('/')
|
143
|
+
remote.to_s.gsub(/\.git$/, '').split(/[:\/]/).last(2).join('/')
|
144
144
|
end
|
145
145
|
|
146
146
|
def github_organization
|
@@ -153,13 +153,13 @@ module Gitx
|
|
153
153
|
|
154
154
|
def global_config
|
155
155
|
@config ||= begin
|
156
|
-
File.
|
156
|
+
File.exist?(global_config_file) ? YAML.load_file(global_config_file) : {}
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
160
|
def save_global_config(options)
|
161
161
|
config_dir = File.dirname(global_config_file)
|
162
|
-
::FileUtils.mkdir_p(config_dir, mode: 0700) unless File.
|
162
|
+
::FileUtils.mkdir_p(config_dir, mode: 0700) unless File.exist?(config_dir)
|
163
163
|
|
164
164
|
@config = global_config.merge(options)
|
165
165
|
File.open(global_config_file, 'a+') do |file|
|
data/lib/gitx/version.rb
CHANGED
@@ -21,9 +21,9 @@ describe Gitx::Cli::BaseCommand do
|
|
21
21
|
describe 'with custom .gitx.yml config file' do
|
22
22
|
let(:config) do
|
23
23
|
{
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
'aggregate_branches' => %w( foo bar ),
|
25
|
+
'reserved_branches' => %w( baz qux ),
|
26
|
+
'taggable_branches' => %w( quux corge )
|
27
27
|
}
|
28
28
|
end
|
29
29
|
before do
|
@@ -38,7 +38,7 @@ describe Gitx::Cli::IntegrateCommand do
|
|
38
38
|
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
|
39
39
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
40
40
|
|
41
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
41
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
42
42
|
|
43
43
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
44
44
|
cli.integrate
|
@@ -91,7 +91,7 @@ describe Gitx::Cli::IntegrateCommand do
|
|
91
91
|
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
|
92
92
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
93
93
|
|
94
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
94
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
95
95
|
|
96
96
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
97
97
|
cli.integrate
|
@@ -115,7 +115,7 @@ describe Gitx::Cli::IntegrateCommand do
|
|
115
115
|
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
|
116
116
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
117
117
|
|
118
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
118
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
119
119
|
|
120
120
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
121
121
|
cli.integrate 'prototype'
|
@@ -174,7 +174,7 @@ describe Gitx::Cli::IntegrateCommand do
|
|
174
174
|
expect(cli).not_to receive(:run_cmd).with('git push origin HEAD')
|
175
175
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch')
|
176
176
|
|
177
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
177
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
178
178
|
|
179
179
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
180
180
|
cli.integrate
|
@@ -201,7 +201,7 @@ describe Gitx::Cli::IntegrateCommand do
|
|
201
201
|
expect(cli).not_to receive(:run_cmd).with('git push origin HEAD')
|
202
202
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
203
203
|
|
204
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
204
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
205
205
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
206
206
|
cli.integrate
|
207
207
|
end
|
@@ -227,7 +227,7 @@ describe Gitx::Cli::IntegrateCommand do
|
|
227
227
|
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
|
228
228
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
229
229
|
|
230
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
230
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
231
231
|
|
232
232
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
233
233
|
cli.integrate
|
@@ -237,8 +237,8 @@ describe Gitx::Cli::IntegrateCommand do
|
|
237
237
|
should meet_expectations
|
238
238
|
end
|
239
239
|
it 'posts comment to pull request' do
|
240
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
241
|
-
with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
|
240
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
241
|
+
.with(body: { body: '[gitx] integrated into staging :twisted_rightwards_arrows:' })
|
242
242
|
end
|
243
243
|
end
|
244
244
|
context 'with --comment flag when a pull request doesn\'t exist for the feature-branch' do
|
@@ -271,8 +271,8 @@ describe Gitx::Cli::IntegrateCommand do
|
|
271
271
|
expect(cli).to receive(:run_cmd).with('git checkout feature-branch').ordered
|
272
272
|
expect(cli).to receive(:run_cmd).with("git log master...feature-branch --reverse --no-merges --pretty=format:'* %s%n%b'").and_return('2013-01-01 did some stuff').ordered
|
273
273
|
|
274
|
-
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(:
|
275
|
-
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments').to_return(:
|
274
|
+
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
275
|
+
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments').to_return(status: 201)
|
276
276
|
|
277
277
|
VCR.use_cassette('pull_request_does_not_exist') do
|
278
278
|
cli.integrate
|
@@ -282,8 +282,8 @@ describe Gitx::Cli::IntegrateCommand do
|
|
282
282
|
should meet_expectations
|
283
283
|
end
|
284
284
|
it 'creates github comment for integration' do
|
285
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
286
|
-
with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
|
285
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
286
|
+
.with(body: { body: '[gitx] integrated into staging :twisted_rightwards_arrows:' })
|
287
287
|
end
|
288
288
|
end
|
289
289
|
end
|
@@ -128,7 +128,7 @@ describe Gitx::Cli::ReleaseCommand do
|
|
128
128
|
expect(cli).to receive(:run_cmd).with('git merge --no-ff feature-branch').ordered
|
129
129
|
expect(cli).to receive(:run_cmd).with('git push origin HEAD').ordered
|
130
130
|
|
131
|
-
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(:
|
131
|
+
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
132
132
|
VCR.use_cassette('pull_request_does_not_exist') do
|
133
133
|
cli.release
|
134
134
|
end
|
@@ -47,7 +47,7 @@ describe Gitx::Cli::ReviewCommand do
|
|
47
47
|
expect(cli).to receive(:run_cmd).with("git log master...feature-branch --reverse --no-merges --pretty=format:'* %s%n%b'").and_return("* old commit\n\n* new commit").ordered
|
48
48
|
expect(cli).to receive(:ask_editor).with("### Changelog\n* old commit\n\n* new commit\n#{Gitx::Github::PULL_REQUEST_FOOTER}", anything).and_return('description')
|
49
49
|
|
50
|
-
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(:
|
50
|
+
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
51
51
|
|
52
52
|
VCR.use_cassette('pull_request_does_not_exist') do
|
53
53
|
cli.review
|
@@ -82,7 +82,7 @@ describe Gitx::Cli::ReviewCommand do
|
|
82
82
|
expect(cli).to receive(:run_cmd).with("git log master...feature-branch --reverse --no-merges --pretty=format:'* %s%n%b'").and_return("* old commit\n\n* new commit").ordered
|
83
83
|
expect(cli).to receive(:ask_editor).with("### Changelog\n* old commit\n\n* new commit\n#{Gitx::Github::PULL_REQUEST_FOOTER}", anything).and_return('description')
|
84
84
|
|
85
|
-
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(:
|
85
|
+
stub_request(:post, 'https://api.github.com/repos/wireframe/gitx/pulls').to_return(status: 201, body: new_pull_request.to_json, headers: { 'Content-Type' => 'application/json' })
|
86
86
|
|
87
87
|
VCR.use_cassette('pull_request_does_not_exist') do
|
88
88
|
cli.review 'feature-branch'
|
@@ -126,7 +126,7 @@ describe Gitx::Cli::ReviewCommand do
|
|
126
126
|
before do
|
127
127
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
128
128
|
|
129
|
-
stub_request(:patch, /.*api.github.com.*/).to_return(:
|
129
|
+
stub_request(:patch, /.*api.github.com.*/).to_return(status: 200)
|
130
130
|
|
131
131
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
132
132
|
cli.review
|
@@ -166,19 +166,19 @@ describe Gitx::Cli::ReviewCommand do
|
|
166
166
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
167
167
|
expect(cli).to receive(:ask_editor).and_return('comment description')
|
168
168
|
allow(repo).to receive(:head).and_return(reference)
|
169
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
169
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
170
170
|
|
171
171
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
172
172
|
cli.review
|
173
173
|
end
|
174
174
|
end
|
175
175
|
it 'posts comment to github' do
|
176
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
177
|
-
with(body: {body: "[gitx] review bump :tada:\n\ncomment description"})
|
176
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
177
|
+
.with(body: { body: "[gitx] review bump :tada:\n\ncomment description" })
|
178
178
|
end
|
179
179
|
it 'creates pending build status for latest commit' do
|
180
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/statuses/e12da4')
|
181
|
-
with(body: {state: 'pending', context: 'peer_review', description: 'Peer review in progress'})
|
180
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/statuses/e12da4')
|
181
|
+
.with(body: { state: 'pending', context: 'peer_review', description: 'Peer review in progress' })
|
182
182
|
end
|
183
183
|
end
|
184
184
|
context 'when --reject flag is passed' do
|
@@ -193,19 +193,19 @@ describe Gitx::Cli::ReviewCommand do
|
|
193
193
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
194
194
|
expect(cli).to receive(:ask_editor).and_return('comment body')
|
195
195
|
allow(repo).to receive(:head).and_return(reference)
|
196
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
196
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
197
197
|
|
198
198
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
199
199
|
cli.review
|
200
200
|
end
|
201
201
|
end
|
202
202
|
it 'posts comment to github' do
|
203
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
204
|
-
with(body: {body: "[gitx] review rejected\n\ncomment body"})
|
203
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
204
|
+
.with(body: { body: "[gitx] review rejected\n\ncomment body" })
|
205
205
|
end
|
206
206
|
it 'creates failure build status for latest commit' do
|
207
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/statuses/e12da4')
|
208
|
-
with(body: {state: 'failure', context: 'peer_review', description: 'Peer review rejected'})
|
207
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/statuses/e12da4')
|
208
|
+
.with(body: { state: 'failure', context: 'peer_review', description: 'Peer review rejected' })
|
209
209
|
end
|
210
210
|
end
|
211
211
|
context 'when --approve flag is passed' do
|
@@ -220,19 +220,19 @@ describe Gitx::Cli::ReviewCommand do
|
|
220
220
|
allow(cli).to receive(:authorization_token).and_return(authorization_token)
|
221
221
|
expect(cli).to receive(:ask_editor).and_return('comment body')
|
222
222
|
allow(repo).to receive(:head).and_return(reference)
|
223
|
-
stub_request(:post, /.*api.github.com.*/).to_return(:
|
223
|
+
stub_request(:post, /.*api.github.com.*/).to_return(status: 201)
|
224
224
|
|
225
225
|
VCR.use_cassette('pull_request_does_exist_with_success_status') do
|
226
226
|
cli.review
|
227
227
|
end
|
228
228
|
end
|
229
229
|
it 'posts comment to github' do
|
230
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
231
|
-
with(body: {body: "[gitx] review approved :shipit:\n\ncomment body"})
|
230
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/issues/10/comments')
|
231
|
+
.with(body: { body: "[gitx] review approved :shipit:\n\ncomment body" })
|
232
232
|
end
|
233
233
|
it 'creates success build status for latest commit' do
|
234
|
-
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/statuses/e12da4')
|
235
|
-
with(body: {state: 'success', context: 'peer_review', description: 'Peer review approved'})
|
234
|
+
expect(WebMock).to have_requested(:post, 'https://api.github.com/repos/wireframe/gitx/statuses/e12da4')
|
235
|
+
.with(body: { state: 'success', context: 'peer_review', description: 'Peer review approved' })
|
236
236
|
end
|
237
237
|
end
|
238
238
|
end
|
@@ -268,11 +268,11 @@ describe Gitx::Cli::ReviewCommand do
|
|
268
268
|
let(:github_password) { 'secretz' }
|
269
269
|
let(:authorization_token) { '123981239123' }
|
270
270
|
before do
|
271
|
-
stub_request(:post, 'https://ryan@codecrate.com:secretz@api.github.com/authorizations')
|
272
|
-
to_return(:
|
271
|
+
stub_request(:post, 'https://ryan@codecrate.com:secretz@api.github.com/authorizations')
|
272
|
+
.to_return(status: 200, body: JSON.dump(token: authorization_token), headers: { 'Content-Type' => 'application/json' })
|
273
273
|
|
274
|
-
expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ',
|
275
|
-
expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ',
|
274
|
+
expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ', echo: false).and_return(github_password)
|
275
|
+
expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ', echo: false).and_return(nil)
|
276
276
|
|
277
277
|
@auth_token = cli.send(:authorization_token)
|
278
278
|
end
|
@@ -291,13 +291,13 @@ describe Gitx::Cli::ReviewCommand do
|
|
291
291
|
let(:github_password) { 'secretz' }
|
292
292
|
let(:authorization_token) { '123981239123' }
|
293
293
|
before do
|
294
|
-
stub_request(:post, 'https://ryan@codecrate.com:secretz@api.github.com/authorizations')
|
295
|
-
to_return(:
|
296
|
-
then
|
297
|
-
to_return(:
|
294
|
+
stub_request(:post, 'https://ryan@codecrate.com:secretz@api.github.com/authorizations')
|
295
|
+
.to_return(status: 401, body: JSON.dump(token: authorization_token), headers: { 'Content-Type' => 'application/json' })
|
296
|
+
.then
|
297
|
+
.to_return(status: 200, body: JSON.dump(token: authorization_token), headers: { 'Content-Type' => 'application/json' })
|
298
298
|
|
299
|
-
expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ',
|
300
|
-
expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ',
|
299
|
+
expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ', echo: false).and_return(github_password).twice
|
300
|
+
expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ', echo: false).and_return(nil).twice
|
301
301
|
|
302
302
|
@auth_token = cli.send(:authorization_token)
|
303
303
|
end
|
@@ -338,12 +338,12 @@ describe Gitx::Cli::ReviewCommand do
|
|
338
338
|
let(:authorization_token) { '123981239123' }
|
339
339
|
let(:two_factor_auth_token) { '456456' }
|
340
340
|
before do
|
341
|
-
stub_request(:post, 'https://ryan@codecrate.com:secretz@api.github.com/authorizations')
|
342
|
-
with(headers: {'X-GitHub-OTP' => two_factor_auth_token})
|
343
|
-
to_return(:
|
341
|
+
stub_request(:post, 'https://ryan@codecrate.com:secretz@api.github.com/authorizations')
|
342
|
+
.with(headers: { 'X-GitHub-OTP' => two_factor_auth_token })
|
343
|
+
.to_return(status: 200, body: JSON.dump(token: authorization_token), headers: { 'Content-Type' => 'application/json' })
|
344
344
|
|
345
|
-
expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ',
|
346
|
-
expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ',
|
345
|
+
expect(cli).to receive(:ask).with('Github password for ryan@codecrate.com: ', echo: false).and_return(github_password)
|
346
|
+
expect(cli).to receive(:ask).with('Github two factor authorization token (if enabled): ', echo: false).and_return(two_factor_auth_token)
|
347
347
|
|
348
348
|
@auth_token = cli.send(:authorization_token)
|
349
349
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Sonnek
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: rubocop
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
223
237
|
description: Git eXtensions for improved development workflow
|
224
238
|
email:
|
225
239
|
- ryan.sonnek@gmail.com
|
@@ -238,7 +252,9 @@ extensions: []
|
|
238
252
|
extra_rdoc_files: []
|
239
253
|
files:
|
240
254
|
- ".gitignore"
|
255
|
+
- ".hound.yml"
|
241
256
|
- ".rspec"
|
257
|
+
- ".rubocop.yml"
|
242
258
|
- ".ruby-version"
|
243
259
|
- ".travis.yml"
|
244
260
|
- CONTRIBUTING.md
|