Add Cask#install_time
method.
This commit is contained in:
parent
b12623f4eb
commit
17f6d19b9c
@ -80,6 +80,13 @@ module Cask
|
||||
!versions.empty?
|
||||
end
|
||||
|
||||
def install_time
|
||||
_, time = timestamped_versions.last
|
||||
return unless time
|
||||
|
||||
Time.strptime(time, Metadata::TIMESTAMP_FORMAT)
|
||||
end
|
||||
|
||||
def installed_caskfile
|
||||
installed_version = timestamped_versions.last
|
||||
metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb")
|
||||
|
@ -3,6 +3,7 @@
|
||||
module Cask
|
||||
module Metadata
|
||||
METADATA_SUBDIR = ".metadata"
|
||||
TIMESTAMP_FORMAT = "%Y%m%d%H%M%S.%L"
|
||||
|
||||
def metadata_master_container_path
|
||||
@metadata_master_container_path ||= caskroom_path.join(METADATA_SUBDIR)
|
||||
@ -58,12 +59,7 @@ module Cask
|
||||
private
|
||||
|
||||
def new_timestamp(time = Time.now)
|
||||
time = time.utc
|
||||
|
||||
timestamp = time.strftime("%Y%m%d%H%M%S")
|
||||
fraction = format("%.3f", time.to_f - time.to_i)[1..-1]
|
||||
|
||||
timestamp.concat(fraction)
|
||||
time.utc.strftime(TIMESTAMP_FORMAT)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user