Class: Reviewr::CLI::Request

Inherits:
Command
  • Object
show all
Defined in:
lib/reviewr/cli/request.rb

Instance Attribute Summary

Attributes inherited from Command

#arguments, #input, #output, #project

Instance Method Summary collapse

Methods inherited from Command

#call, #initialize, #prompt_for_user, #read_template

Constructor Details

This class inherits a constructor from Reviewr::CLI::Command

Instance Method Details

#commit_msgObject



23
24
25
# File 'lib/reviewr/cli/request.rb', line 23

def commit_msg
  read_template('commit_msg.erb')
end

#compare_urlObject



18
19
20
21
# File 'lib/reviewr/cli/request.rb', line 18

def compare_url
  repo = project.origin_location.split(':')[1].gsub(/.git$/, "/compare")
  "http://github.com/#{repo}/#{project.master_sha}...#{project.review_sha}"
end

#email_bodyObject



27
28
29
# File 'lib/reviewr/cli/request.rb', line 27

def email_body
  read_template('request_email.erb')
end

#executeObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/reviewr/cli/request.rb', line 7

def execute
  project.to = arguments.first
  prompt_for_user
  original_branch = project.current_branch
  project.create_review_branch(original_branch)
  project.create_review_commit(commit_msg)
  project.push_review_branch
  Mailer.new(project).send(email_body)
  project.change_branch(original_branch)
end