Sha256: 53c7de3f5cfd409765d68f347aa2a1a0ea7a3ef9c1a8ca11bf5f3facf1fb09cc
Contents?: true
Size: 823 Bytes
Versions: 14
Compression:
Stored size: 823 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("Migration Workspace already exists. Please make sure to \ publish or discard any changes in the '#{workspace.id}' workspace.") 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
14 entries across 14 versions & 1 rubygems