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
# File 'lib/status/base.rb', line 9

def initialize(options)
  @qa_status = options[:state] || "pending"
  @branch = options[:branch] || branch
  @statuses = Status::Github::Statuses.new(@qa_status, @branch)
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



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

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

#updateObject



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

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