Sha256: 320d68006309866abd9fa3631a25ab46a92d4005d646194b277c3ca9a1c4b011
Contents?: true
Size: 846 Bytes
Versions: 34
Compression:
Stored size: 846 Bytes
Contents
require 'singleton' module Scrivito module Migrations class WorkspaceLock include Singleton def validate(workspace) unless exists? && workspace.revision_id == File.read(filename) raise ScrivitoError.new("There is a migration in progress right now. \ Please try again after the migration working copy '#{workspace.id}' has \ been published or removed.") end end def write(workspace) File.open(filename, 'w') do |file| file.write(workspace.revision_id) end end def remove if exists? File.delete(filename) end end def exists? File.exists?(filename) end private def filename File.join(Rails.root, 'tmp/migration_store.lock') end end end end
Version data entries
34 entries across 34 versions & 1 rubygems