Class: PactBroker::Domain::Version
- Inherits:
-
Object
- Object
- PactBroker::Domain::Version
- Defined in:
- lib/pact_broker/domain/version.rb
Instance Method Summary collapse
-
#after_create ⇒ Object
Isn’t called on upsert when the record is updated with Sqlite Is called with Postgres/MySQL Haven’t had time to dig into why.
- #before_destroy ⇒ Object
- #branch_names ⇒ Object
- #branch_version_for_branch(branch) ⇒ Object
- #branch_version_for_branch_name(branch_name) ⇒ Object
- #head_tags ⇒ Object
- #latest_for_branch? ⇒ Boolean
- #latest_for_pacticipant? ⇒ Boolean
-
#latest_pact_publication ⇒ Object
What about provider??? This makes no sense.
- #tag_names ⇒ Object
- #to_s ⇒ Object
- #version_and_updated_date ⇒ Object
Instance Method Details
#after_create ⇒ Object
Isn’t called on upsert when the record is updated with Sqlite Is called with Postgres/MySQL Haven’t had time to dig into why
272 273 274 275 276 |
# File 'lib/pact_broker/domain/version.rb', line 272 def after_create super OrderVersions.(self) unless self.order refresh end |
#before_destroy ⇒ Object
278 279 280 281 282 283 |
# File 'lib/pact_broker/domain/version.rb', line 278 def before_destroy PactBroker::Deployments::DeployedVersion.where(version: self).destroy PactBroker::Deployments::ReleasedVersion.where(version: self).destroy PactBroker::Domain::Tag.where(version: self).destroy super end |
#branch_names ⇒ Object
318 319 320 |
# File 'lib/pact_broker/domain/version.rb', line 318 def branch_names branch_versions.collect(&:branch_name) end |
#branch_version_for_branch(branch) ⇒ Object
310 311 312 |
# File 'lib/pact_broker/domain/version.rb', line 310 def branch_version_for_branch(branch) branch_versions.find { | branch_version | branch_version.branch_id == branch.id } end |
#branch_version_for_branch_name(branch_name) ⇒ Object
314 315 316 |
# File 'lib/pact_broker/domain/version.rb', line 314 def branch_version_for_branch_name(branch_name) branch_versions.find { | branch_version | branch_version.branch_name == branch_name } end |
#head_tags ⇒ Object
293 294 295 |
# File 'lib/pact_broker/domain/version.rb', line 293 def .select(&:latest_for_pacticipant?) end |
#latest_for_branch? ⇒ Boolean
302 303 304 |
# File 'lib/pact_broker/domain/version.rb', line 302 def latest_for_branch? branch_heads.any? end |
#latest_for_pacticipant? ⇒ Boolean
306 307 308 |
# File 'lib/pact_broker/domain/version.rb', line 306 def latest_for_pacticipant? latest_version_for_pacticipant == self end |
#latest_pact_publication ⇒ Object
What about provider??? This makes no sense
298 299 300 |
# File 'lib/pact_broker/domain/version.rb', line 298 def latest_pact_publication pact_publications.last end |
#tag_names ⇒ Object
322 323 324 |
# File 'lib/pact_broker/domain/version.rb', line 322 def tag_names .collect(&:name) end |
#to_s ⇒ Object
285 286 287 |
# File 'lib/pact_broker/domain/version.rb', line 285 def to_s "Version: number=#{number}, pacticipant=#{pacticipant_id}" end |
#version_and_updated_date ⇒ Object
289 290 291 |
# File 'lib/pact_broker/domain/version.rb', line 289 def version_and_updated_date "Version #{number} - #{updated_at.to_time.localtime.strftime("%d/%m/%Y")}" end |