Class: Omnibus::Command::Cache

Inherits:
Base
  • Object
show all
Defined in:
lib/omnibus/cli/cache.rb

Instance Method Summary collapse

Methods inherited from Base

dispatch, exit_on_failure?, #help, #initialize

Methods included from Logging

included

Constructor Details

This class inherits a constructor from Omnibus::Command::Base

Instance Method Details

#existingObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/omnibus/cli/cache.rb', line 27

def existing
  result = S3Cache.list

  if result.empty?
    say("There are no packages in the cache!")
  else
    say("The following packages are in the cache:")
    result.each do |software|
      say("  * #{software.name}-#{software.version}")
    end
  end
end

#fetchObject



84
85
86
87
# File 'lib/omnibus/cli/cache.rb', line 84

def fetch
  say("Fetching missing packages...")
  S3Cache.fetch_missing
end

#listObject



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/omnibus/cli/cache.rb', line 46

def list
  result = S3Cache.keys

  if result.empty?
    say("There is nothing in the cache!")
  else
    say("Cached files (by S3 key):")
    result.each do |key|
      say("  * #{key}")
    end
  end
end

#missingObject



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/omnibus/cli/cache.rb', line 65

def missing
  result = S3Cache.missing

  if result.empty?
    say("There are no missing packages in the cache.")
  else
    say("The following packages are missing from the cache:")
    result.each do |software|
      say("  * #{software.name}-#{software.version}")
    end
  end
end

#populateObject



95
96
97
98
# File 'lib/omnibus/cli/cache.rb', line 95

def populate
  say("Populating the cache...")
  S3Cache.populate
end