Class: ClientPkgCache

Inherits:
Object
  • Object
show all
Defined in:
plugins/client_pkg/lib/client_pkg_cache.rb

Overview

FileCache scans and stores the ui path for javascript files and

(css/html/image) theme files compiled as the result of the client
SDK's build_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClientPkgCache

Initially, scan.



24
25
26
27
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 24

def initialize
  @client_rev = 0
  # scan_dirs
end

Instance Attribute Details

#client_revObject (readonly)

Returns the value of attribute client_rev.



17
18
19
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 17

def client_rev
  @client_rev
end

#gz_cacheObject (readonly)

Returns the value of attribute gz_cache.



17
18
19
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 17

def gz_cache
  @gz_cache
end

#js_cacheObject (readonly)

Returns the value of attribute js_cache.



17
18
19
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 17

def js_cache
  @js_cache
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



17
18
19
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 17

def last_modified
  @last_modified
end

#scan_timeObject (readonly)

Returns the value of attribute scan_time.



17
18
19
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 17

def scan_time
  @scan_time
end

#theme_cacheObject (readonly)

Returns the value of attribute theme_cache.



17
18
19
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 17

def theme_cache
  @theme_cache
end

Instance Method Details

#httime(time) ⇒ Object

Helper method to return the time formatted according to the HTTP RFC



35
36
37
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 35

def httime(time)
  return time.gmtime.strftime('%a, %d %b %Y %H:%M:%S %Z')
end

#set_cache(js, gz, themes) ⇒ Object



39
40
41
42
43
44
45
46
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 39

def set_cache( js, gz, themes )
  @js_cache    = js
  @gz_cache    = gz
  @theme_cache = themes
  time_now = Time.now
  @client_rev  = time_now.to_i.to_s( 36 )
  @last_modified = httime( time_now )
end

#suffix(file_path) ⇒ Object

Helper method to return the suffix of a file



30
31
32
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 30

def suffix(file_path)
  return '.'+file_path.split('.')[-1]
end