Class: TxghServer::Webhooks::Git::PushHandler
- Inherits:
-
Object
- Object
- TxghServer::Webhooks::Git::PushHandler
- Includes:
- ResponseHelpers
- Defined in:
- lib/txgh-server/webhooks/git/push_handler.rb
Direct Known Subclasses
TxghServer::Webhooks::Github::PushHandler, TxghServer::Webhooks::Gitlab::PushHandler
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, repo, logger, attributes) ⇒ PushHandler
constructor
A new instance of PushHandler.
Constructor Details
#initialize(project, repo, logger, attributes) ⇒ PushHandler
Returns a new instance of PushHandler.
12 13 14 15 16 17 |
# File 'lib/txgh-server/webhooks/git/push_handler.rb', line 12 def initialize(project, repo, logger, attributes) @project = project @repo = repo @logger = logger @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
10 11 12 |
# File 'lib/txgh-server/webhooks/git/push_handler.rb', line 10 def attributes @attributes end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/txgh-server/webhooks/git/push_handler.rb', line 10 def logger @logger end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'lib/txgh-server/webhooks/git/push_handler.rb', line 10 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
10 11 12 |
# File 'lib/txgh-server/webhooks/git/push_handler.rb', line 10 def repo @repo end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/txgh-server/webhooks/git/push_handler.rb', line 19 def execute # Check if the branch in the hook data is the configured branch we want logger.info("request git branch: #{branch}") logger.info("config git branch: #{repo.git_config_branch}") if should_process? logger.info('found branch in git request') pusher.push_resources(added_and_modified_resources) do |tx_resource| # block should return categories for the passed-in resource { 'author' => attributes. } end status_updater.update_status end respond_with(200, true) rescue => e status_updater.report_error_and_update_status(e) respond_with_error(500, "Internal server error: #{e.}", e) end |