class Origen::Application::VersionTracker
Keeps track of production released versions
Constants
- STORAGE_FILE
Public Instance Methods
add_version(version)
click to toggle source
Adds a new version to the tracker
# File lib/origen/application/version_tracker.rb, line 14 def add_version(version) restore_to_latest versions << version save check_in end
check_in()
click to toggle source
Check in the persisted storage container
# File lib/origen/application/version_tracker.rb, line 44 def check_in Origen.app.rc.checkin(STORAGE_FILE, force: true, unmanaged: true, comment: 'Recorded new version in the version tracker') end
restore_to_latest()
click to toggle source
Force the storage container to the latest checked in version
# File lib/origen/application/version_tracker.rb, line 49 def restore_to_latest @storage = nil # Check out the latest version of the storage, forcing to Trunk system "dssc co -get -force '#{STORAGE_FILE};Trunk:Latest'" system "dssc setselector 'Trunk' #{STORAGE_FILE}" `chmod 666 #{STORAGE_FILE}` end
save()
click to toggle source
Save the persisted storage container to disk
# File lib/origen/application/version_tracker.rb, line 37 def save File.open(STORAGE_FILE, 'w') do |f| Marshal.dump(storage, f) end end
storage()
click to toggle source
Returns the persisted storage container (a Hash
)
# File lib/origen/application/version_tracker.rb, line 22 def storage return @storage if @storage if File.exist?(STORAGE_FILE) File.open(STORAGE_FILE) do |f| @storage = Marshal.load(f) rescue @storage = {} end else @storage = {} end end
versions()
click to toggle source
Returns an array containing all Production release tags since they started being tracked
# File lib/origen/application/version_tracker.rb, line 9 def versions storage[:versions] ||= [] end