Class: BrewCaskTools::Casks::Versions

Inherits:
Object
  • Object
show all
Defined in:
lib/bct/cask/versions.rb

Overview

Operations on a collection of Cask versions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, candidate) ⇒ Versions

Returns a new instance of Versions.



9
10
11
12
13
# File 'lib/bct/cask/versions.rb', line 9

def initialize(dir, candidate)
  @candidate = candidate
  @local = Version.new(dir)
  @meta = Version.new(File.join(dir, '.metadata'))
end

Instance Attribute Details

#localObject (readonly)

Returns the value of attribute local.



7
8
9
# File 'lib/bct/cask/versions.rb', line 7

def local
  @local
end

#metaObject (readonly)

Returns the value of attribute meta.



7
8
9
# File 'lib/bct/cask/versions.rb', line 7

def meta
  @meta
end

Instance Method Details

#candidateObject



23
24
25
# File 'lib/bct/cask/versions.rb', line 23

def candidate
  Version.parse_version(@candidate)
end

#currentObject



27
28
29
# File 'lib/bct/cask/versions.rb', line 27

def current
  installed.last
end

#installedObject



15
16
17
# File 'lib/bct/cask/versions.rb', line 15

def installed
  @local.versions
end

#latest?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/bct/cask/versions.rb', line 31

def latest?
  current.to_s == 'latest'
end

#metadataObject



19
20
21
# File 'lib/bct/cask/versions.rb', line 19

def 
  @meta.versions
end

#old_installedObject



35
36
37
# File 'lib/bct/cask/versions.rb', line 35

def old_installed
  @local.old
end

#old_metadataObject



39
40
41
# File 'lib/bct/cask/versions.rb', line 39

def 
  @meta.old
end

#rm_oldObject



43
44
45
46
# File 'lib/bct/cask/versions.rb', line 43

def rm_old
  @local.rm_old
  @meta.rm_old
end