Class: CiHelper::Bitbucket::PullRequestPage

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_helper/bitbucket/pull_request_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePullRequestPage

Returns a new instance of PullRequestPage.



21
22
23
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 21

def initialize
  @point_counter = 1
end

Instance Attribute Details

#formObject

This class is responsible for the update the pull request form in the bitbucket example : object.form_set do |config|

config.title = 'your title'
config.destination = 'the branch name you want to merge'
config.reviewer = 'the reviewer you want to add'
config.append_description = 'text '
config.description_syntax('ruby') do |content|
  content.value += 'your code'
end

end



19
20
21
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 19

def form
  @form
end

#point_counterObject

This class is responsible for the update the pull request form in the bitbucket example : object.form_set do |config|

config.title = 'your title'
config.destination = 'the branch name you want to merge'
config.reviewer = 'the reviewer you want to add'
config.append_description = 'text '
config.description_syntax('ruby') do |content|
  content.value += 'your code'
end

end



19
20
21
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 19

def point_counter
  @point_counter
end

Instance Method Details

#append_description=(append_text) ⇒ Object



46
47
48
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 46

def append_description=(append_text)
  description.value += "\n#{append_text}\n"
end

#description_point=(text) ⇒ Object



41
42
43
44
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 41

def description_point=(text)
  description.value += "#{point_counter}. #{text}\n"
  self.point_counter += 1
end

#description_syntax(language, &failure_block) ⇒ Object



50
51
52
53
54
55
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 50

def description_syntax(language, &failure_block)
  description.value += "```\n"
  description.value += "#!#{language} \n"
  failure_block.call(description) if block_given?
  description.value += "```\n"
end

#destination=(dest) ⇒ Object



29
30
31
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 29

def destination=(dest)
  form.field_with(name: 'dest').options.select { |option| option.text == dest.to_s}.first.select
end

#reviewers=(reviewers) ⇒ Object



37
38
39
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 37

def reviewers=(reviewers)
  form.field_with(name: 'reviewers').value = reviewers
end

#source=(branch_name) ⇒ Object



33
34
35
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 33

def source=(branch_name)
  form.field_with(name: 'source').options.select { |option| option.text == branch_name}.first.select
end

#submitObject



57
58
59
60
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 57

def submit
  description.value += "\n CiHelper Version #{::CiHelper::VERSION}"
  form.click_button
end

#title=(text) ⇒ Object



25
26
27
# File 'lib/ci_helper/bitbucket/pull_request_page.rb', line 25

def title=(text)
  form.field_with(name: 'title').value = text
end