Merge pull request #15911 from jawshooah/fix-staged-path

Fix `staged_path` and `caskroom_path` in DSL
This commit is contained in:
Josh Hagins
2015-12-17 19:04:35 -05:00
3 changed files with 16 additions and 16 deletions
-10
View File
@@ -14,16 +14,6 @@ class Hbc::Cask
@token = self.class.token
end
def caskroom_path
Hbc.caskroom.join(token)
end
# todo: move to staged.rb ?
def staged_path
cask_version = version ? version : :unknown
caskroom_path.join(cask_version.to_s)
end
METADATA_SUBDIR = '.metadata'
def metadata_master_container_path
+4 -2
View File
@@ -222,11 +222,13 @@ module Hbc::DSL
end
def caskroom_path
@caskroom_path ||= self.caskroom
@caskroom_path ||= Hbc.caskroom.join(self.token)
end
def staged_path
@staged_path ||= self.caskroom.join(self.name, self.version)
return @staged_path if @staged_path
cask_version = self.version || :unknown
@staged_path = self.caskroom_path.join(cask_version.to_s)
end
def caveats(*string, &block)
+12 -4
View File
@@ -1,13 +1,21 @@
class Hbc::WithoutSource < Hbc::Cask
def staged_path
caskroom_path.children.first
end
def initialize(sourcefile_path=nil)
@sourcefile_path = sourcefile_path
@token = sourcefile_path
end
# Override from `Hbc::DSL` because `@token` is set to the constructor argument
# instead of `self.class.token` as in `Hbc::Cask`.
def caskroom_path
Hbc.caskroom.join(token)
end
# Override from `Hbc::DSL` because we don't have a cask source file to work
# with, so we don't know the cask's `version`.
def staged_path
caskroom_path.children.first
end
def to_s
"#{token} (!)"
end