git_reflow 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb81aa92d38e6c5b348ce8838f4c387ddcd93acb
4
- data.tar.gz: d9e9551ff37a67dec4593a368f8fcd72080ad1c9
3
+ metadata.gz: 412c28714e64f91f462fe9b108b3679a7d299f59
4
+ data.tar.gz: 0984ef9112a092cba604b95845b394aa986725ce
5
5
  SHA512:
6
- metadata.gz: dede713a4bd84a1060afaf57de37a3edd797a64708c3e7e2ee9cfe3705ea28490f554723bfeb01b541da0becc239ad17eeeb6039d230361c3f53798a721d5c19
7
- data.tar.gz: 8049748445af1ef7fe6b5d9c214d96aa06194ed430d32da8fcdb26c95aa107374b52a14da6f757aac59b1c165855622d715059bddea90973a7097ca5c698dee7
6
+ metadata.gz: d3d16defd3d4924b6827a3e145c7115061a7b9d14a3572cf10ef8cbdd373b348739bbb3b61092ad33a758e3a439851c55b0e4b9cb2c3b709e39ea1dac45c2d8e
7
+ data.tar.gz: 8d4ef3aafabe9ad955982d0248cd7cc74d1decb6817b1c69c7c0d0ffd600ed21f287be9ce28cd008d824288181a6fb55d05ae40fdfdb327b7fac7e7d372577c9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_reflow (0.6.6)
4
+ git_reflow (0.6.7)
5
5
  colorize (>= 0.7.0)
6
6
  github_api (= 0.12.3)
7
7
  gli (= 2.12.2)
@@ -66,13 +66,13 @@ module GitReflow
66
66
 
67
67
  def deliver(options = {})
68
68
  feature_branch = current_branch
69
- options['base'] ||= 'master'
70
- fetch_destination options['base']
69
+ base_branch = options['base'] || 'master'
71
70
 
72
- update_destination(current_branch)
71
+ fetch_destination(base_branch)
72
+ update_destination(feature_branch)
73
73
 
74
74
  begin
75
- existing_pull_request = git_server.find_open_pull_request( :from => current_branch, :to => options['base'] )
75
+ existing_pull_request = git_server.find_open_pull_request( :from => current_branch, :to => base_branch )
76
76
 
77
77
  if existing_pull_request.nil?
78
78
  say "No pull request exists for #{remote_user}:#{current_branch}\nPlease submit your branch for review first with \`git reflow review\`", :deliver_halted
@@ -90,9 +90,9 @@ module GitReflow
90
90
  if options['skip_lgtm'] or ((status.nil? or status.state == "success") and (has_comments and open_comment_authors.empty?))
91
91
  puts "Merging pull request ##{existing_pull_request.number}: '#{existing_pull_request.title}', from '#{existing_pull_request.feature_branch_name}' into '#{existing_pull_request.base_branch_name}'"
92
92
 
93
- update_destination(options['base'])
93
+ update_destination(base_branch)
94
94
  merge_feature_branch(feature_branch,
95
- :destination_branch => options['base'],
95
+ :destination_branch => base_branch,
96
96
  :pull_request_number => existing_pull_request.number,
97
97
  :lgtm_authors => git_server.approvals(existing_pull_request),
98
98
  :message => commit_message)
@@ -106,13 +106,13 @@ module GitReflow
106
106
  deploy_and_cleanup = always_deploy_and_cleanup || (ask "Would you like to push this branch to your remote repo and cleanup your feature branch? ") =~ /^y/i
107
107
 
108
108
  if deploy_and_cleanup
109
- run_command_with_label "git push origin #{options['base']}"
109
+ run_command_with_label "git push origin #{base_branch}"
110
110
  run_command_with_label "git push origin :#{feature_branch}"
111
111
  run_command_with_label "git branch -D #{feature_branch}"
112
112
  puts "Nice job buddy."
113
113
  else
114
114
  puts "Cleanup halted. Local changes were not pushed to remote repo.".colorize(:red)
115
- puts "To reset and go back to your branch run \`git reset --hard origin/master && git checkout new-feature\`"
115
+ puts "To reset and go back to your branch run \`git reset --hard origin/#{base_branch} && git checkout #{feature_branch}\`"
116
116
  end
117
117
  else
118
118
  say "There were problems commiting your feature... please check the errors above and try again.", :error
@@ -62,10 +62,20 @@ module GitReflow
62
62
  end
63
63
 
64
64
  def append_to_squashed_commit_message(message = '')
65
- run "echo \"#{message}\" | cat - #{git_root_dir}/.git/SQUASH_MSG > #{git_root_dir}/tmp_squash_msg"
66
- run "mv #{git_root_dir}/tmp_squash_msg #{git_root_dir}/.git/SQUASH_MSG"
65
+ tmp_squash_message_path = "#{git_root_dir}/.git/tmp_squash_msg"
66
+ squash_message_path = "#{git_root_dir}/.git/SQUASH_MSG"
67
+ File.open(tmp_squash_message_path, "w") do |file_content|
68
+ file_content.puts message
69
+ if File.exists?(squash_message_path)
70
+ File.foreach(squash_message_path) do |line|
71
+ file_content.puts line
72
+ end
73
+ end
74
+ end
75
+
76
+ run "mv #{tmp_squash_message_path} #{squash_message_path}"
67
77
  end
68
-
78
+
69
79
  private
70
80
 
71
81
  def extract_remote_user_and_repo_from_remote_url(remote_url)
@@ -1,3 +1,3 @@
1
1
  module GitReflow
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.7"
3
3
  end
@@ -149,6 +149,8 @@ describe GitReflow do
149
149
 
150
150
 
151
151
  before do
152
+ GitReflow.stub(:append_to_squashed_commit_message).and_return(true)
153
+
152
154
  module Kernel
153
155
  def system(cmd)
154
156
  "call #{cmd}"
@@ -149,15 +149,24 @@ describe GitReflow::GitHelpers do
149
149
  end
150
150
 
151
151
  describe ".append_to_squashed_commit_message(message)" do
152
- let(:message) { "do do the voodoo that you do" }
153
- let(:root_dir) { '/home/gitreflow' }
154
- before { allow(Gitacular).to receive(:git_root_dir).and_return(root_dir) }
155
- subject { Gitacular.append_to_squashed_commit_message(message) }
152
+ let(:original_squash_message) { "Oooooo, SQUASH IT" }
153
+ let(:message) { "do do the voodoo that you do" }
154
+ let(:root_dir) { '/home/gitreflow' }
155
+ let(:squash_path) { "#{root_dir}/.git/SQUASH_MSG" }
156
+ let(:tmp_squash_path) { "#{root_dir}/.git/tmp_squash_msg" }
157
+ before { allow(Gitacular).to receive(:git_root_dir).and_return(root_dir) }
158
+ subject { Gitacular.append_to_squashed_commit_message(message) }
156
159
 
157
160
  it "appends the message to git's SQUASH_MSG temp file" do
161
+ tmp_file = double('file')
162
+ allow(File).to receive(:open).with(tmp_squash_path, "w").and_yield(tmp_file)
163
+ allow(File).to receive(:exists?).with(squash_path).and_return(true)
164
+ allow(File).to receive(:foreach).with(squash_path).and_yield(original_squash_message)
165
+ expect(tmp_file).to receive(:puts).with(message)
166
+ expect(tmp_file).to receive(:puts).with(original_squash_message)
167
+
158
168
  expect { subject }.to have_run_commands_in_order [
159
- "echo \"#{message}\" | cat - #{root_dir}/.git/SQUASH_MSG > #{root_dir}/tmp_squash_msg",
160
- "mv #{root_dir}/tmp_squash_msg #{root_dir}/.git/SQUASH_MSG"
169
+ "mv #{tmp_squash_path} #{squash_path}"
161
170
  ]
162
171
  end
163
172
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_reflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentino Stoll
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-09-28 00:00:00.000000000 Z
13
+ date: 2015-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: appraisal