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

- (ClientPkgCache) initialize

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

- (Object) client_rev (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

- (Object) gz_cache (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

- (Object) js_cache (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

- (Object) last_modified (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

- (Object) scan_time (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

- (Object) theme_cache (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

- (Object) httime(time)

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

- (Object) set_cache(js, gz, themes)



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

- (Object) suffix(file_path)

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