diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 0b3e87bb18..d42332c645 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1,5 +1,5 @@ require "formula_support" -require "formula_lock" +require "lock_file" require "formula_pin" require "hardware" require "utils/bottles" diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 8733def270..07d4dd9cd8 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -1,6 +1,6 @@ require "extend/pathname" require "keg_relocate" -require "formula_lock" +require "lock_file" require "ostruct" class Keg diff --git a/Library/Homebrew/formula_lock.rb b/Library/Homebrew/lock_file.rb similarity index 72% rename from Library/Homebrew/formula_lock.rb rename to Library/Homebrew/lock_file.rb index bf747fea22..83743b7441 100644 --- a/Library/Homebrew/formula_lock.rb +++ b/Library/Homebrew/lock_file.rb @@ -1,9 +1,9 @@ require "fcntl" -class FormulaLock +class LockFile def initialize(name) @name = name - @path = HOMEBREW_LOCK_DIR/"#{@name}.brewing" + @path = HOMEBREW_LOCK_DIR/"#{@name}.lock" @lockfile = nil end @@ -35,3 +35,15 @@ class FormulaLock @lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) end end + +class FormulaLock < LockFile + def initialize(name) + super("#{name}.formula") + end +end + +class CaskLock < LockFile + def initialize(name) + super("#{name}.cask") + end +end diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 3cb6c51787..f975962cf1 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -1,5 +1,5 @@ require "formula" -require "formula_lock" +require "lock_file" require "keg" require "tab" diff --git a/Library/Homebrew/test/formula_lock_spec.rb b/Library/Homebrew/test/lock_file_spec.rb similarity index 88% rename from Library/Homebrew/test/formula_lock_spec.rb rename to Library/Homebrew/test/lock_file_spec.rb index 9b5ece8131..82c47a70a7 100644 --- a/Library/Homebrew/test/formula_lock_spec.rb +++ b/Library/Homebrew/test/lock_file_spec.rb @@ -1,6 +1,6 @@ -require "formula_lock" +require "lock_file" -describe FormulaLock do +describe LockFile do subject { described_class.new("foo") } describe "#lock" do @@ -24,7 +24,7 @@ describe FormulaLock do expect { subject.unlock }.not_to raise_error end - it "unlocks a locked Formula" do + it "unlocks when locked" do subject.lock subject.unlock