Sha256: 1994c8fc24e6937be6a7f727f0867470e342c595821bdd3590f0db45b2fb1f13
Contents?: true
Size: 857 Bytes
Versions: 5
Compression:
Stored size: 857 Bytes
Contents
require 'singleton' module RailsConnector module Migrations class WorkspaceLock include Singleton def validate(workspace) unless exists? && workspace.revision_id == File.read(filename) raise RailsConnectorError.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
5 entries across 5 versions & 1 rubygems