Class: Octopolo::Scripts::Deployable
- Inherits:
-
Object
- Object
- Octopolo::Scripts::Deployable
- Includes:
- CLIWrapper, ConfigWrapper
- Defined in:
- lib/octopolo/scripts/deployable.rb
Instance Attribute Summary collapse
-
#pull_request_id ⇒ Object
Returns the value of attribute pull_request_id.
Attributes included from ConfigWrapper
Attributes included from CLIWrapper
Class Method Summary collapse
Instance Method Summary collapse
-
#execute ⇒ Object
Public: Perform the script.
-
#initialize(pull_request_id = nil, options = {}) ⇒ Deployable
constructor
A new instance of Deployable.
Constructor Details
#initialize(pull_request_id = nil, options = {}) ⇒ Deployable
Returns a new instance of Deployable.
21 22 23 24 |
# File 'lib/octopolo/scripts/deployable.rb', line 21 def initialize(pull_request_id=nil, ={}) @pull_request_id = pull_request_id @force = [:force] end |
Instance Attribute Details
#pull_request_id ⇒ Object
Returns the value of attribute pull_request_id.
11 12 13 |
# File 'lib/octopolo/scripts/deployable.rb', line 11 def pull_request_id @pull_request_id end |
Class Method Details
.deployable_label ⇒ Object
17 18 19 |
# File 'lib/octopolo/scripts/deployable.rb', line 17 def self.deployable_label Octopolo::GitHub::Label.new(name: "deployable", color: "428BCA") end |
.execute(pull_request_id = nil, options = {}) ⇒ Object
13 14 15 |
# File 'lib/octopolo/scripts/deployable.rb', line 13 def self.execute(pull_request_id=nil, ={}) new(pull_request_id, ).execute end |
Instance Method Details
#execute ⇒ Object
Public: Perform the script
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/octopolo/scripts/deployable.rb', line 27 def execute if (!self.pull_request_id) current = GitHub::PullRequest.current self.pull_request_id = current.number if current end self.pull_request_id ||= cli.prompt("Pull Request ID: ") GitHub.connect do unless deployable? || @force CLI.say 'Pull request status checks have not passed. Cannot be marked deployable.' exit! end merge_result = merge add_deployable_label if config.deployable_label && merge_result end end |