Class: Txgh::Pusher
- Inherits:
-
Object
- Object
- Txgh::Pusher
- Defined in:
- lib/txgh/pusher.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(project, repo, branch = nil) ⇒ Pusher
constructor
A new instance of Pusher.
- #push ⇒ Object
- #push_resource(tx_resource) ⇒ Object
- #push_slug(resource_slug) ⇒ Object
Constructor Details
#initialize(project, repo, branch = nil) ⇒ Pusher
Returns a new instance of Pusher.
5 6 7 8 9 |
# File 'lib/txgh/pusher.rb', line 5 def initialize(project, repo, branch = nil) @project = project @repo = repo @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
3 4 5 |
# File 'lib/txgh/pusher.rb', line 3 def branch @branch end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/txgh/pusher.rb', line 3 def project @project end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
3 4 5 |
# File 'lib/txgh/pusher.rb', line 3 def repo @repo end |
Instance Method Details
#push ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/txgh/pusher.rb', line 11 def push tx_config.resources.each do |tx_resource| if repo.process_all_branches? tx_resource = Txgh::TxBranchResource.new(tx_resource, branch) end push_resource(tx_resource) end end |
#push_resource(tx_resource) ⇒ Object
21 22 23 24 |
# File 'lib/txgh/pusher.rb', line 21 def push_resource(tx_resource) ref = repo.api.get_ref(repo.name, branch || repo.branch) updater.update_resource(tx_resource, ref[:object][:sha]) end |
#push_slug(resource_slug) ⇒ Object
26 27 28 |
# File 'lib/txgh/pusher.rb', line 26 def push_slug(resource_slug) push_resource(tx_config.resource(resource_slug, branch)) end |