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