class Git::Semaphore::API::Cache

Public Class Methods

branches(project_hash_id, refresh) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 12
def self.branches(project_hash_id, refresh)
  @branches ||= Git::Semaphore.from_json_cache(branches_cache(project_hash_id), refresh) do
    API.branches project_hash_id
  end
end
history(project_hash_id, branch_id, refresh) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 24
def self.history(project_hash_id, branch_id, refresh)
  @history ||= Git::Semaphore.from_json_cache(history_cache(project_hash_id, branch_id), refresh) do
    API::Enrich.history project_hash_id, branch_id
  end
end
information(project_hash_id, branch_id, build_number, refresh) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 30
def self.information(project_hash_id, branch_id, build_number, refresh)
  @information ||= Git::Semaphore.from_json_cache(information_cache(project_hash_id, branch_id, build_number), refresh) do
    API.information project_hash_id, branch_id, build_number
  end
end
log(project_hash_id, branch_id, build_number, refresh) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 36
def self.log(project_hash_id, branch_id, build_number, refresh)
  @log ||= Git::Semaphore.from_json_cache(log_cache(project_hash_id, branch_id, build_number), refresh) do
    API.log project_hash_id, branch_id, build_number
  end
end
projects(refresh) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 6
def self.projects(refresh)
  @projects ||= Git::Semaphore.from_json_cache(projects_cache, refresh) do
    API::Enrich.projects
  end
end
status(project_hash_id, branch_id, refresh) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 18
def self.status(project_hash_id, branch_id, refresh)
  @status ||= Git::Semaphore.from_json_cache(status_cache(project_hash_id, branch_id), refresh) do
    API::Enrich.status project_hash_id, branch_id
  end
end

Private Class Methods

branches_cache(project_hash_id) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 50
def self.branches_cache(project_hash_id)
  File.join(Git::Semaphore.cache_dir_for(project_hash_id), 'branches.json')
end
history_cache(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 62
def self.history_cache(project_hash_id, branch_id)
  File.join(Git::Semaphore.cache_dir_for(project_hash_id), "#{branch_id}_history.json")
end
information_cache(project_hash_id, branch_id, build_number) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 68
def self.information_cache(project_hash_id, branch_id, build_number)
  File.join(Git::Semaphore.cache_dir_for(project_hash_id), "#{branch_id}_#{build_number}_information.json")
end
log_cache(project_hash_id, branch_id, build_number) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 74
def self.log_cache(project_hash_id, branch_id, build_number)
  File.join(Git::Semaphore.cache_dir_for(project_hash_id), "#{branch_id}_#{build_number}_log.json")
end
projects_cache() click to toggle source

private helper functions

# File lib/git/semaphore/api_cache.rb, line 44
def self.projects_cache
  File.join(Git::Semaphore.cache_dir, 'projects.json')
end
status_cache(project_hash_id, branch_id) click to toggle source
# File lib/git/semaphore/api_cache.rb, line 56
def self.status_cache(project_hash_id, branch_id)
  File.join(Git::Semaphore.cache_dir_for(project_hash_id), "#{branch_id}_status.json")
end