Class: PactBroker::Domain::Version
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- PactBroker::Domain::Version
- Defined in:
- lib/pact_broker/domain/version.rb
Constant Summary collapse
- VERSION_COLUMNS =
do not include the branch column, as we now have a branches table
Sequel::Model.db.schema(:versions).collect(&:first) - [:branch]
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 ⇒ Object
- #branch=(branch) ⇒ 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
277 278 279 280 281 |
# File 'lib/pact_broker/domain/version.rb', line 277 def after_create super OrderVersions.(self) unless self.order refresh end |
#before_destroy ⇒ Object
283 284 285 286 287 288 |
# File 'lib/pact_broker/domain/version.rb', line 283 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 ⇒ Object
331 332 333 |
# File 'lib/pact_broker/domain/version.rb', line 331 def branch raise NotImplementedError end |
#branch=(branch) ⇒ Object
335 336 337 |
# File 'lib/pact_broker/domain/version.rb', line 335 def branch= branch raise NotImplementedError end |
#branch_names ⇒ Object
323 324 325 |
# File 'lib/pact_broker/domain/version.rb', line 323 def branch_names branch_versions.collect(&:branch_name) end |
#branch_version_for_branch(branch) ⇒ Object
315 316 317 |
# File 'lib/pact_broker/domain/version.rb', line 315 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
319 320 321 |
# File 'lib/pact_broker/domain/version.rb', line 319 def branch_version_for_branch_name(branch_name) branch_versions.find { | branch_version | branch_version.branch_name == branch_name } end |
#head_tags ⇒ Object
298 299 300 |
# File 'lib/pact_broker/domain/version.rb', line 298 def .select(&:latest_for_pacticipant?) end |
#latest_for_branch? ⇒ Boolean
307 308 309 |
# File 'lib/pact_broker/domain/version.rb', line 307 def latest_for_branch? branch_heads.any? end |
#latest_for_pacticipant? ⇒ Boolean
311 312 313 |
# File 'lib/pact_broker/domain/version.rb', line 311 def latest_for_pacticipant? latest_version_for_pacticipant == self end |
#latest_pact_publication ⇒ Object
What about provider??? This makes no sense
303 304 305 |
# File 'lib/pact_broker/domain/version.rb', line 303 def latest_pact_publication pact_publications.last end |
#tag_names ⇒ Object
327 328 329 |
# File 'lib/pact_broker/domain/version.rb', line 327 def tag_names .collect(&:name) end |
#to_s ⇒ Object
290 291 292 |
# File 'lib/pact_broker/domain/version.rb', line 290 def to_s "Version: number=#{number}, pacticipant=#{pacticipant_id}" end |
#version_and_updated_date ⇒ Object
294 295 296 |
# File 'lib/pact_broker/domain/version.rb', line 294 def version_and_updated_date "Version #{number} - #{updated_at.to_time.localtime.strftime("%d/%m/%Y")}" end |