Class: Octopolo::Scripts::PullRequest

Inherits:
Issue
  • Object
show all
Defined in:
lib/octopolo/scripts/pull_request.rb

Instance Attribute Summary collapse

Attributes inherited from Issue

#jira_ids, #labels, #options, #pivotal_ids, #title

Attributes included from GitWrapper

#git

Attributes included from ConfigWrapper

#config

Attributes included from CLIWrapper

#cli

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Issue

#ask_jira_ids, #generate_generic_label_choices, #label_choices, #label_hash, #label_prompt, #label_questions

Constructor Details

#initialize(destination_branch = nil, options = {}) ⇒ PullRequest

Returns a new instance of PullRequest.



19
20
21
22
# File 'lib/octopolo/scripts/pull_request.rb', line 19

def initialize(destination_branch=nil, options={})
  @destination_branch = destination_branch || default_destination_branch
  @options = options
end

Instance Attribute Details

#destination_branchObject

Returns the value of attribute destination_branch.



11
12
13
# File 'lib/octopolo/scripts/pull_request.rb', line 11

def destination_branch
  @destination_branch
end

#pull_requestObject Also known as: issue

Returns the value of attribute pull_request.



10
11
12
# File 'lib/octopolo/scripts/pull_request.rb', line 10

def pull_request
  @pull_request
end

Class Method Details

.execute(destination_branch = nil, options = {}) ⇒ Object



15
16
17
# File 'lib/octopolo/scripts/pull_request.rb', line 15

def self.execute(destination_branch=nil, options={})
  new(destination_branch, options).execute
end

Instance Method Details

#default_destination_branchObject



24
25
26
# File 'lib/octopolo/scripts/pull_request.rb', line 24

def default_destination_branch
  config.deploy_branch
end

#executeObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/octopolo/scripts/pull_request.rb', line 28

def execute
  GitHub.connect do

    if options[:expedite]
      infer_questionnaire
    else
      ask_questionnaire
    end

    create_pull_request
    update_pivotal
    update_jira
    update_labels
    open_in_browser
  end
end