Sha256: 3ebadf4c0d89e99beec9008a2a01fa99247a4c2ff6313d7035e8839da6c1251a
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
desc 'review will push your latest feature branch changes to your remote repo and create a pull request' arg_name 'Describe arguments to review here' command :review do |c| c.desc 'push your latest feature branch changes to your remote repo and create a pull request against the destination branch' c.arg_name '[destination_branch] - the branch you want to merge your feature branch into' c.flag [:t, :title], default_value: 'last commit message' c.flag [:m, :message], default_value: 'title' c.action do |global_options,options,args| pull_request_msg_file = "#{GitReflow.git_root_dir}/.git/GIT_REFLOW_PR_MSG" if global_options[:title] || global_options[:message] review_options = { 'base' => args[0], 'title' => (global_options[:title] || GitReflow.current_branch), 'body' => global_options[:message] } else default_editor = ENV['EDITOR'] if default_editor.empty? default_editor = 'vi' end File.open(pull_request_msg_file, 'w') do |file| file.write(GitReflow.current_branch) end GitReflow.run("#{default_editor} #{pull_request_msg_file}", with_system: true) pr_msg = File.open(pull_request_msg_file).each_line.map(&:strip).to_a title = pr_msg.shift File.delete(pull_request_msg_file) unless pr_msg.empty? pr_msg.shift if pr_msg.first.empty? end review_options = {'base' => args[0],'title' => title,'body' => pr_msg.join("\n")} end puts "\nReview your PR:\n" puts "--------\n" puts "Title:\n#{review_options['title']}\n\n" puts "Body:\n#{review_options['body']}\n" puts "--------\n" GitReflow.review(review_options) unless ask("Submit pull request? (Y)") =~ /n/i end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_reflow-0.6.2 | lib/git_reflow/commands/review.rb |