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.



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

def initialize
  @client_rev = 0
  # scan_dirs
end

Instance Attribute Details

#client_revObject (readonly)

Returns the value of attribute client_rev.



9
10
11
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 9

def client_rev
  @client_rev
end

#gz_cacheObject (readonly)

Returns the value of attribute gz_cache.



9
10
11
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 9

def gz_cache
  @gz_cache
end

#js_cacheObject (readonly)

Returns the value of attribute js_cache.



9
10
11
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 9

def js_cache
  @js_cache
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



9
10
11
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 9

def last_modified
  @last_modified
end

#scan_timeObject (readonly)

Returns the value of attribute scan_time.



9
10
11
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 9

def scan_time
  @scan_time
end

#theme_cacheObject (readonly)

Returns the value of attribute theme_cache.



9
10
11
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 9

def theme_cache
  @theme_cache
end

Instance Method Details

#httime(time) ⇒ Object

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



27
28
29
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 27

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

#set_cache(js, gz, themes) ⇒ Object



31
32
33
34
35
36
37
38
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 31

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



22
23
24
# File 'plugins/client_pkg/lib/client_pkg_cache.rb', line 22

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