Class: Status::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/status/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
# File 'lib/status/base.rb', line 9

def initialize(options)
  @qa_status = options[:state] || qa_required
  @branch = options[:branch] || branch
  @sha = options[:sha] || nil
  @statuses = Status::Github::Statuses.new(@qa_status, @branch, @sha)
end

Instance Attribute Details

#qa_statusObject (readonly)

Returns the value of attribute qa_status.



7
8
9
# File 'lib/status/base.rb', line 7

def qa_status
  @qa_status
end

Instance Method Details

#branchObject



16
17
18
# File 'lib/status/base.rb', line 16

def branch
  `git rev-parse --abbrev-ref HEAD`.chomp
end

#qa_requiredObject



28
29
30
# File 'lib/status/base.rb', line 28

def qa_required
  Status.qa_required? ? "pending" : "pass"
end

#updateObject



20
21
22
23
24
25
26
# File 'lib/status/base.rb', line 20

def update
  puts "Updating..."
  pull = Status::Github::PullRequest.new(@branch)
  pull.create_pull_request unless pull.pull_request_found?
  @statuses.request
  puts "Done."
end