aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_lock.rb
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-24 17:59:14 +0200
committerMarkus Reiter2016-09-24 19:28:26 +0200
commit6c6a4c9fa771930c882ab7819e027031fb33b018 (patch)
treedf927520ef9c8d9414d104e931c62169899ab224 /Library/Homebrew/formula_lock.rb
parent162bfee90f760a4a473894f6f3013d1b0665b3e9 (diff)
downloadbrew-6c6a4c9fa771930c882ab7819e027031fb33b018.tar.bz2
RuboCop: Style/AccessorMethodName
Diffstat (limited to 'Library/Homebrew/formula_lock.rb')
-rw-r--r--Library/Homebrew/formula_lock.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/Library/Homebrew/formula_lock.rb b/Library/Homebrew/formula_lock.rb
index 4bd12df18..bf747fea2 100644
--- a/Library/Homebrew/formula_lock.rb
+++ b/Library/Homebrew/formula_lock.rb
@@ -8,8 +8,8 @@ class FormulaLock
end
def lock
- HOMEBREW_LOCK_DIR.mkpath
- @lockfile = get_or_create_lockfile
+ @path.parent.mkpath
+ create_lockfile
return if @lockfile.flock(File::LOCK_EX | File::LOCK_NB)
raise OperationInProgressError, @name
end
@@ -29,12 +29,9 @@ class FormulaLock
private
- def get_or_create_lockfile
- if @lockfile.nil? || @lockfile.closed?
- @lockfile = @path.open(File::RDWR | File::CREAT)
- @lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
- end
-
- @lockfile
+ def create_lockfile
+ return unless @lockfile.nil? || @lockfile.closed?
+ @lockfile = @path.open(File::RDWR | File::CREAT)
+ @lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
end
end