livebuzz-gitx 0.1.1 → 0.1.2

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
2
  SHA1:
3
- metadata.gz: e95393877a28deae40217edaf4b8f793c7373ba2
4
- data.tar.gz: 86b9752de05692937102a6fd82aafd12c0332e97
3
+ metadata.gz: 497e2533e014caa1f6245273f00ce034bd384b11
4
+ data.tar.gz: fe897d1e87b69fc841d2759c44eeea5da6ca62ea
5
5
  SHA512:
6
- metadata.gz: db889c8f63ca2fdd8f227cc62d7816ccc7cfdbfc6c6f516b00ea2d0e4bdba7d63e89a848631ce61df4b3ed6e433c4a699f06175467f48357ab131b11514f2a54
7
- data.tar.gz: 89a29b797ba8e32881a645e341328e3ca6c24f11a360f593b77c165c0c9b99b1784d254c3dac0138aefce4e111e76672fee2e098dadb7b95d6414f4b61c2720f
6
+ metadata.gz: 6cfaaeb6be7c8d94e02857ce27125ee14ef90ceed8d9c55e751eb4bf5d56e2a7eed873e937bc95d64dbbbbdab6f45a582d5b91f8308e4d05e70c81b20f5f0cf2
7
+ data.tar.gz: 7efb57a5a0832a3300fbdddd346d08c45e85eb6b12c085aa5e781f904d57e782b28dc487d93ab18e5e5bf539c54fe178347533e104ff3e960f1c44cb898ea32b
File without changes
data/README.md CHANGED
@@ -1,12 +1,11 @@
1
1
  # livebuzz-gitx
2
2
 
3
- [![Build Status](https://travis-ci.org/livebuzz/livebuzz-gitx.png?branch=master)](https://travis-ci.org/livebuzz/livebuzz-gitx)
4
- [![Code Coverage](https://coveralls.io/repos/livebuzz/livebuzz-gitx/badge.png)](https://coveralls.io/r/livebuzz/livebuzz-gitx)
5
- [![Code Climate](https://codeclimate.com/github/livebuzz/livebuzz-gitx.png)](https://codeclimate.com/github/livebuzz/livebuzz-gitx)
3
+ [![Build Status](https://travis-ci.org/livebuzzevents/livebuzz-gitx.png?branch=master)](https://travis-ci.org/livebuzzevents/livebuzz-gitx)
4
+ [![Code Climate](https://codeclimate.com/github/livebuzzevents/livebuzz-gitx.png)](https://codeclimate.com/github/livebuzzevents/livebuzz-gitx)
6
5
 
7
6
  Useful Git eXtensions for Development workflow at LiveBuzz.
8
7
 
9
- Forked from [TheGarage-GitX](https://github.com/thegarage/thegarage-gitx), which is inspired by the [socialcast-git-extensions gem](https://github.com/socialcast/socialcast-git-extensions)
8
+ Based on [TheGarage-GitX](https://github.com/thegarage/thegarage-gitx) and [socialcast-git-extensions](https://github.com/socialcast/socialcast-git-extensions)
10
9
 
11
10
  # Git Extensions for Workflow
12
11
 
@@ -26,21 +25,6 @@ update the local feature branch with latest remote changes plus upstream release
26
25
 
27
26
  integrate the current feature branch into an aggregate branch (ex: prototype, staging)
28
27
 
29
- ## git review
30
-
31
- create a pull request on github for peer review of the current branch. This command is re-runnable
32
- in order to re-assign pull requests.
33
-
34
- options:
35
- * `--assign` or `-a` = assign pull request to github user
36
- * `--open` or `-o` = open pull request in default web browser.
37
- * `--bump` or `-b` = bump an existing pull request by posting a comment to re-review new changes
38
- * `--approve` = approve/signoff on pull request (with optional feedback)
39
- * `--reject` = reject pull request (with details)
40
-
41
- NOTE: the `--bump` option will also update the pull request commit status to mark the branch as 'pending peer review'.
42
- This setting is cleared when a reviewer approves or rejects the pull request.
43
-
44
28
  ## git release
45
29
 
46
30
  release the current feature branch to master. This operation will perform the following:
@@ -49,16 +33,16 @@ release the current feature branch to master. This operation will perform the f
49
33
  * merge in latest code from master branch
50
34
  * prompt user to confirm they actually want to perform the release
51
35
  * merge current branch into master
52
- * (optional) cleanup merged branches from remote server
36
+ * (optional) cleanup all merged branches from remote server
53
37
 
54
38
  options:
55
- * `--cleanup` = automatically cleanup merged branches after release complete
39
+ * `--cleanup` = automatically cleanup all merged branches after release complete
56
40
 
57
41
  # Extra Utility Git Extensions
58
42
 
59
43
  ## git cleanup
60
44
 
61
- delete released branches after they have been merged into master.
45
+ delete all released branches that have been merged into master.
62
46
 
63
47
  ## git nuke <aggregate_branch_name>
64
48
 
@@ -66,8 +50,7 @@ reset an aggregate branch (ex: prototype, staging) back to a known good state.
66
50
 
67
51
  ## git buildtag
68
52
 
69
- create a build tag for the current Travis-CI build and push it back to origin
70
-
53
+ create a build tag for the current build and push it back to origin
71
54
 
72
55
  ## Note on Patches/Pull Requests
73
56
 
@@ -81,4 +64,4 @@ create a build tag for the current Travis-CI build and push it back to origin
81
64
 
82
65
  ## Copyright
83
66
 
84
- Copyright (c) 2015 LiveBuzz Ltd. (c) 2013 The Garage, Inc. See LICENSE for details.
67
+ Copyright (c) 2015 LiveBuzz Ltd. See LICENSE for details.
@@ -2,13 +2,11 @@ require 'thor'
2
2
  require 'livebuzz/gitx'
3
3
  require 'livebuzz/gitx/cli/base_command'
4
4
  require 'livebuzz/gitx/cli/update_command'
5
- require 'livebuzz/gitx/github'
6
5
 
7
6
  module LiveBuzz
8
7
  module Gitx
9
8
  module Cli
10
9
  class IntegrateCommand < BaseCommand
11
- include LiveBuzz::Gitx::Github
12
10
  desc 'integrate', 'integrate the current branch into one of the aggregate development branches (default = staging)'
13
11
  method_option :resume, :type => :string, :aliases => '-r', :desc => 'resume merging of feature-branch'
14
12
  def integrate(integration_branch = 'staging')
@@ -25,8 +23,6 @@ module LiveBuzz
25
23
 
26
24
  integrate_branch(branch, integration_branch) unless options[:resume]
27
25
  checkout_branch branch
28
-
29
- create_integrate_comment(branch) unless config.reserved_branch?(branch)
30
26
  end
31
27
 
32
28
  private
@@ -83,13 +79,6 @@ module LiveBuzz
83
79
  repo.create_branch(target_branch, LiveBuzz::Gitx::BASE_BRANCH)
84
80
  run_cmd "git push origin #{target_branch}:#{target_branch}"
85
81
  end
86
-
87
- def create_integrate_comment(branch)
88
- # nulled github integration
89
- #pull_request = find_or_create_pull_request(branch)
90
- #comment = '[gitx] integrated into staging :twisted_rightwards_arrows:'
91
- #github_client.add_comment(github_slug, pull_request.number, comment)
92
- end
93
82
  end
94
83
  end
95
84
  end
@@ -4,14 +4,11 @@ require 'livebuzz/gitx/cli/base_command'
4
4
  require 'livebuzz/gitx/cli/update_command'
5
5
  require 'livebuzz/gitx/cli/integrate_command'
6
6
  require 'livebuzz/gitx/cli/cleanup_command'
7
- require 'livebuzz/gitx/github'
8
7
 
9
8
  module LiveBuzz
10
9
  module Gitx
11
10
  module Cli
12
11
  class ReleaseCommand < BaseCommand
13
- include LiveBuzz::Gitx::Github
14
-
15
12
  desc 'release', 'release the current branch to production'
16
13
  method_option :cleanup, :type => :boolean, :desc => 'cleanup merged branches after release'
17
14
  def release
@@ -21,13 +18,6 @@ module LiveBuzz
21
18
  assert_not_protected_branch!(branch, 'release')
22
19
  execute_command(UpdateCommand, :update)
23
20
 
24
- # nulled github integration
25
- #find_or_create_pull_request(branch)
26
- #status = branch_status(branch)
27
- #if status != 'success'
28
- # return unless yes?("Branch status is currently: #{status}. Proceed with release? (y/n)", :red)
29
- #end
30
-
31
21
  checkout_branch LiveBuzz::Gitx::BASE_BRANCH
32
22
  run_cmd "git pull origin #{LiveBuzz::Gitx::BASE_BRANCH}"
33
23
  run_cmd "git merge --no-ff #{branch}"
@@ -1,5 +1,5 @@
1
1
  module LiveBuzz
2
2
  module Gitx
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -6,7 +6,7 @@ require 'livebuzz/gitx/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "livebuzz-gitx"
8
8
  spec.version = LiveBuzz::Gitx::VERSION
9
- spec.authors = ["LiveBuzz, forked from code by Ryan Sonnek"]
9
+ spec.authors = ["LiveBuzz"]
10
10
  spec.email = ["rob.lambell@livebuzz.co.uk"]
11
11
  spec.description = %q{Git eXtensions for common development workflow}
12
12
  spec.summary = %q{Utility scripts for Git to increase productivity for common operations}
@@ -28,10 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "pry", '>= 0'
29
29
  spec.add_development_dependency "webmock", '>= 0'
30
30
  spec.add_development_dependency "timecop", "~> 0.7.0"
31
- spec.add_development_dependency "vcr"
32
31
  spec.add_development_dependency "guard"
33
32
  spec.add_development_dependency "guard-rspec"
34
- spec.add_development_dependency "coveralls"
35
33
  spec.add_development_dependency 'terminal-notifier'
36
34
  spec.add_development_dependency 'terminal-notifier-guard'
37
35
  end
@@ -48,7 +48,7 @@ describe LiveBuzz::Gitx::Cli::BuildtagCommand do
48
48
  cli.buildtag
49
49
  end
50
50
  end
51
- it 'creates a tag for the branch and push it to github' do
51
+ it 'creates a tag for the branch and push it to origin' do
52
52
  should meet_expectations
53
53
  end
54
54
  end
@@ -62,7 +62,7 @@ describe LiveBuzz::Gitx::Cli::BuildtagCommand do
62
62
  cli.buildtag
63
63
  end
64
64
  end
65
- it 'creates a tag for the branch and push it to github' do
65
+ it 'creates a tag for the branch and push it to origin' do
66
66
  should meet_expectations
67
67
  end
68
68
  end
@@ -25,10 +25,8 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
25
25
 
26
26
  describe '#integrate' do
27
27
  context 'when integration branch is ommitted and remote branch exists' do
28
- let(:authorization_token) { '123123' }
29
28
  let(:remote_branch_names) { ['origin/staging'] }
30
29
  before do
31
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
32
30
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
33
31
 
34
32
  expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
@@ -38,27 +36,17 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
38
36
  expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
39
37
  expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
40
38
 
41
- stub_request(:post, /.*api.github.com.*/).to_return(:status => 201)
42
-
43
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
44
- cli.integrate
45
- end
39
+ cli.integrate
46
40
  end
47
41
  it 'defaults to staging branch' do
48
42
  should meet_expectations
49
43
  end
50
- it 'posts comment to pull request' do
51
- expect(WebMock).to have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments").
52
- with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
53
- end
54
44
  end
55
45
  context 'when current_branch == master' do
56
46
  let(:current_branch) { double('fake branch', name: 'master', head?: true) }
57
47
  let(:local_branch_names) { ['master'] }
58
- let(:authorization_token) { '123123' }
59
48
  let(:remote_branch_names) { ['origin/staging'] }
60
49
  before do
61
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
62
50
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
63
51
 
64
52
  expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
@@ -70,60 +58,10 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
70
58
 
71
59
  cli.integrate
72
60
  end
73
- it 'does not create pull request' do
74
- expect(WebMock).to_not have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/pulls")
75
- end
76
- end
77
- context 'when a pull request doesnt exist for the feature-branch' do
78
- let(:authorization_token) { '123123' }
79
- let(:changelog) { '* made some fixes' }
80
- let(:new_pull_request) do
81
- {
82
- html_url: "https://path/to/html/pull/request",
83
- issue_url: "https://api/path/to/issue/url",
84
- number: 10,
85
- head: {
86
- ref: "branch_name"
87
- }
88
- }
89
- end
90
- before do
91
- allow(cli).to receive(:ask_editor).and_return('description')
92
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
93
- expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update).twice
94
-
95
- expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
96
- expect(cli).to receive(:run_cmd).with("git branch -D staging", allow_failure: true).ordered
97
- expect(cli).to receive(:run_cmd).with("git checkout staging").ordered
98
- expect(cli).to receive(:run_cmd).with("git merge feature-branch").ordered
99
- expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
100
- expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
101
-
102
- 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
103
-
104
- stub_request(:post, 'https://api.github.com/repos/livebuzzevents/livebuzz-gitx/pulls').to_return(:status => 201, :body => new_pull_request.to_json, :headers => {'Content-Type' => 'application/json'})
105
- stub_request(:post, 'https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments').to_return(:status => 201)
106
-
107
- VCR.use_cassette('pull_request_does_not_exist') do
108
- cli.integrate
109
- end
110
- end
111
- it 'creates github pull request' do
112
- should meet_expectations
113
- end
114
- it 'creates github comment for integration' do
115
- expect(WebMock).to have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments").
116
- with(body: {body: '[gitx] integrated into staging :twisted_rightwards_arrows:'})
117
- end
118
- it 'runs expected commands' do
119
- should meet_expectations
120
- end
121
61
  end
122
62
  context 'when staging branch does not exist remotely' do
123
- let(:authorization_token) { '123123' }
124
63
  let(:remote_branch_names) { [] }
125
64
  before do
126
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
127
65
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
128
66
 
129
67
  expect(repo).to receive(:create_branch).with('staging', 'master')
@@ -137,24 +75,15 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
137
75
  expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
138
76
  expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
139
77
 
140
- stub_request(:post, /.*api.github.com.*/).to_return(:status => 201)
141
-
142
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
143
- cli.integrate
144
- end
78
+ cli.integrate
145
79
  end
146
80
  it 'creates remote aggregate branch' do
147
81
  should meet_expectations
148
82
  end
149
- it 'posts comment to pull request' do
150
- expect(WebMock).to have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments")
151
- end
152
83
  end
153
84
  context 'when integration branch == prototype and remote branch exists' do
154
- let(:authorization_token) { '123123' }
155
85
  let(:remote_branch_names) { ['origin/prototype'] }
156
86
  before do
157
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
158
87
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
159
88
 
160
89
  expect(cli).to receive(:run_cmd).with("git fetch origin").ordered
@@ -164,18 +93,11 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
164
93
  expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
165
94
  expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
166
95
 
167
- stub_request(:post, /.*api.github.com.*/).to_return(:status => 201)
168
-
169
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
170
- cli.integrate 'prototype'
171
- end
96
+ cli.integrate 'prototype'
172
97
  end
173
98
  it 'runs expected commands' do
174
99
  should meet_expectations
175
100
  end
176
- it 'posts comment to pull request' do
177
- expect(WebMock).to have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments")
178
- end
179
101
  end
180
102
  context 'when integration branch is not an aggregate branch' do
181
103
  it 'raises an error' do
@@ -216,9 +138,7 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
216
138
  }
217
139
  end
218
140
  let(:repo) { cli.send(:repo) }
219
- let(:authorization_token) { '123123' }
220
141
  before do
221
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
222
142
 
223
143
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
224
144
 
@@ -226,18 +146,11 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
226
146
  expect(cli).not_to receive(:run_cmd).with("git push origin HEAD")
227
147
  expect(cli).to receive(:run_cmd).with("git checkout feature-branch")
228
148
 
229
- stub_request(:post, /.*api.github.com.*/).to_return(:status => 201)
230
-
231
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
232
- cli.integrate
233
- end
149
+ cli.integrate
234
150
  end
235
151
  it 'does not delete local staging branch' do
236
152
  should meet_expectations
237
153
  end
238
- it 'posts comment to pull request' do
239
- expect(WebMock).to have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments")
240
- end
241
154
  end
242
155
  context 'with --resume "feature-branch" flag when feature-branch does not exist' do
243
156
  let(:options) do
@@ -246,9 +159,7 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
246
159
  }
247
160
  end
248
161
  let(:local_branch_names) { ['feature-branch'] }
249
- let(:authorization_token) { '123123' }
250
162
  before do
251
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
252
163
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
253
164
  expect(cli).to receive(:ask).and_return('feature-branch')
254
165
 
@@ -256,17 +167,11 @@ describe LiveBuzz::Gitx::Cli::IntegrateCommand do
256
167
  expect(cli).not_to receive(:run_cmd).with("git push origin HEAD")
257
168
  expect(cli).to receive(:run_cmd).with("git checkout feature-branch").ordered
258
169
 
259
- stub_request(:post, /.*api.github.com.*/).to_return(:status => 201)
260
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
261
- cli.integrate
262
- end
170
+ cli.integrate
263
171
  end
264
172
  it 'asks user for feature-branch name' do
265
173
  should meet_expectations
266
174
  end
267
- it 'posts comment to pull request' do
268
- expect(WebMock).to have_requested(:post, "https://api.github.com/repos/livebuzzevents/livebuzz-gitx/issues/10/comments")
269
- end
270
175
  end
271
176
  end
272
177
  end
@@ -11,7 +11,6 @@ describe LiveBuzz::Gitx::Cli::ReleaseCommand do
11
11
  end
12
12
  let(:cli) { described_class.new(args, options, config) }
13
13
  let(:branch) { double('fake branch', name: 'feature-branch') }
14
- let(:authorization_token) { '123123' }
15
14
 
16
15
  before do
17
16
  allow(cli).to receive(:current_branch).and_return(branch)
@@ -29,86 +28,22 @@ describe LiveBuzz::Gitx::Cli::ReleaseCommand do
29
28
  should meet_expectations
30
29
  end
31
30
  end
32
- context 'when user confirms release and pull request exists with non-success status' do
31
+ context 'when user confirms release' do
33
32
  before do
34
- expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
35
- expect(cli).to_not receive(:execute_command).with(LiveBuzz::Gitx::Cli::IntegrateCommand, :integrate, 'staging')
36
- expect(cli).to_not receive(:execute_command).with(LiveBuzz::Gitx::Cli::CleanupCommand, :cleanup)
37
-
38
- expect(cli).to receive(:yes?).with('Release feature-branch to production? (y/n)', :green).and_return(true)
39
- expect(cli).to receive(:yes?).with('Branch status is currently: failure. Proceed with release? (y/n)', :red).and_return(false)
40
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
41
-
42
- expect(cli).to_not receive(:run_cmd).with("git checkout master")
43
- expect(cli).to_not receive(:run_cmd).with("git pull origin master")
44
- expect(cli).to_not receive(:run_cmd).with("git merge --no-ff feature-branch")
45
- expect(cli).to_not receive(:run_cmd).with("git push origin HEAD")
46
-
47
- VCR.use_cassette('pull_request_does_exist_with_failure_status') do
48
- cli.release
49
- end
50
- end
51
- it 'runs expected commands' do
52
- should meet_expectations
53
- end
54
- end
55
- context 'when user confirms release and pull request exists with success status' do
56
- before do
57
- expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
58
- expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::IntegrateCommand, :integrate, 'staging')
59
- expect(cli).to_not receive(:execute_command).with(LiveBuzz::Gitx::Cli::CleanupCommand, :cleanup)
60
-
61
- expect(cli).to receive(:yes?).and_return(true)
62
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
63
-
64
- expect(cli).to receive(:run_cmd).with("git checkout master").ordered
65
- expect(cli).to receive(:run_cmd).with("git pull origin master").ordered
66
- expect(cli).to receive(:run_cmd).with("git merge --no-ff feature-branch").ordered
67
- expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
68
-
69
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
70
- cli.release
71
- end
72
- end
73
- it 'runs expected commands' do
74
- should meet_expectations
75
- end
76
- end
77
- context 'when user confirms release and pull request does not exist' do
78
- let(:new_pull_request) do
79
- {
80
- html_url: "https://path/to/html/pull/request",
81
- issue_url: "https://api/path/to/issue/url",
82
- number: 10,
83
- head: {
84
- ref: "branch_name"
85
- }
86
- }
87
- end
88
- before do
89
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
90
33
  allow(cli).to receive(:ask_editor).and_return('description')
91
34
 
92
- expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update).twice
35
+ expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::UpdateCommand, :update)
93
36
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::IntegrateCommand, :integrate, 'staging')
94
37
  expect(cli).to_not receive(:execute_command).with(LiveBuzz::Gitx::Cli::CleanupCommand, :cleanup)
95
38
 
96
39
  expect(cli).to receive(:yes?).with('Release feature-branch to production? (y/n)', :green).and_return(true)
97
- expect(cli).to receive(:yes?).with('Branch status is currently: pending. Proceed with release? (y/n)', :red).and_return(true)
98
40
 
99
- 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
100
41
  expect(cli).to receive(:run_cmd).with("git checkout master").ordered
101
42
  expect(cli).to receive(:run_cmd).with("git pull origin master").ordered
102
43
  expect(cli).to receive(:run_cmd).with("git merge --no-ff feature-branch").ordered
103
44
  expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
104
45
 
105
- stub_request(:post, 'https://api.github.com/repos/livebuzzevents/livebuzz-gitx/pulls').to_return(:status => 201, :body => new_pull_request.to_json, :headers => {'Content-Type' => 'application/json'})
106
- VCR.use_cassette('pull_request_does_not_exist') do
107
- cli.release
108
- end
109
- end
110
- it 'creates pull request on github' do
111
- should meet_expectations
46
+ cli.release
112
47
  end
113
48
  it 'runs expected commands' do
114
49
  should meet_expectations
@@ -126,16 +61,13 @@ describe LiveBuzz::Gitx::Cli::ReleaseCommand do
126
61
  expect(cli).to receive(:execute_command).with(LiveBuzz::Gitx::Cli::CleanupCommand, :cleanup)
127
62
 
128
63
  expect(cli).to receive(:yes?).and_return(true)
129
- allow(cli).to receive(:authorization_token).and_return(authorization_token)
130
64
 
131
65
  expect(cli).to receive(:run_cmd).with("git checkout master").ordered
132
66
  expect(cli).to receive(:run_cmd).with("git pull origin master").ordered
133
67
  expect(cli).to receive(:run_cmd).with("git merge --no-ff feature-branch").ordered
134
68
  expect(cli).to receive(:run_cmd).with("git push origin HEAD").ordered
135
69
 
136
- VCR.use_cassette('pull_request_does_exist_with_success_status') do
137
- cli.release
138
- end
70
+ cli.release
139
71
  end
140
72
  it 'runs expected commands' do
141
73
  should meet_expectations
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,3 @@
1
- require 'coveralls'
2
- Coveralls.wear! do
3
- ::SimpleCov.add_filter 'spec'
4
- ::SimpleCov.add_filter 'lib/livebuzz/gitx/extensions'
5
- end
6
1
  require 'rubygems'
7
2
  require 'bundler/setup'
8
3
 
@@ -1,14 +1,5 @@
1
1
  # helper for reading global config file
2
2
  module GlobalConfig
3
- def global_config_file
4
- config_file = File.join(temp_dir, '.config/gitx/github.yml')
5
- config_dir = File.dirname(config_file)
6
- FileUtils.mkdir_p(config_dir) unless File.exists?(config_dir)
7
- config_file
8
- end
9
- def global_config
10
- YAML.load_file(global_config_file)
11
- end
12
3
  def temp_dir
13
4
  tmp_dir = File.join(__dir__, '../tmp')
14
5
  end
@@ -21,4 +12,4 @@ RSpec.configure do |config|
21
12
  FileUtils.rm_rf(temp_dir)
22
13
  FileUtils.mkdir_p(temp_dir)
23
14
  end
24
- end
15
+ end