lib/rally_user_helper.rb
def cache_refresh_needed()

      refresh_needed = false
      reason = ""
      subscription_cache_filename = File.dirname(__FILE__) + "/" + SUB_CACHE
      workspace_cache_filename = File.dirname(__FILE__) + "/" + WORKSPACE_CACHE
      project_cache_filename = File.dirname(__FILE__) + "/" + PROJECT_CACHE

      if !FileTest.exist?(subscription_cache_filename) ||
         !FileTest.exist?(workspace_cache_filename) ||
         !FileTest.exist?(project_cache_filename) then
         refresh_needed = true
         reason = "One or more cache files is not found."
         return refresh_needed, reason
      end

      cache_age = get_cache_age()
      if cache_age > @max_cache_age then
        refresh_needed = true
        reason = "Age of workspace/project cache is greater than specified max of #{@max_cache_age}"
        return refresh_needed, reason
      end

      read_subscription_cache()
      cached_subscription_id = @cached_sub_id
      current_subscription_id = get_current_sub_id()

      if current_subscription_id != cached_subscription_id then
        refresh_needed = true
        reason = "Specified SubID: #{current_subscription_id} is different from cached SubID: #{cached_subscription_id}"
        return refresh_needed, reason
      end

      # If we've fallen through to here, no refresh is needed
      reason = "No workspace/project cache refresh currently required"
      return refresh_needed, reason
    end
# Determine whether or not to refresh local sub/workspace/project cache
Determine whether or not to refresh local sub/workspace/project cache
Determine whether or not to refresh local sub / workspace / project cache
def cache_refresh_needed()
      refresh_needed = false
      reason = ""
      subscription_cache_filename = File.dirname(__FILE__) + "/" + SUB_CACHE
      workspace_cache_filename = File.dirname(__FILE__) + "/" + WORKSPACE_CACHE
      project_cache_filename = File.dirname(__FILE__) + "/" + PROJECT_CACHE
      if !FileTest.exist?(subscription_cache_filename) ||
         !FileTest.exist?(workspace_cache_filename) ||
         !FileTest.exist?(project_cache_filename) then
         refresh_needed = true
         reason = "One or more cache files is not found."
         return refresh_needed, reason
      end
      cache_age = get_cache_age()
      if cache_age > @max_cache_age then
        refresh_needed = true
        reason = "Age of workspace/project cache is greater than specified max of #{@max_cache_age}"
        return refresh_needed, reason
      end
      read_subscription_cache()
      cached_subscription_id = @cached_sub_id
      current_subscription_id = get_current_sub_id()
      if current_subscription_id != cached_subscription_id then
        refresh_needed = true
        reason = "Specified SubID: #{current_subscription_id} is different from cached SubID: #{cached_subscription_id}"
        return refresh_needed, reason
      end
      reason = "No workspace/project cache refresh currently required"
      return refresh_needed, reason
    end
def cache_refresh_needed ( ) refresh_needed = false reason = "" subscription_cache_filename = File . dirname ( __FILE__ ) + "/" + SUB_CACHE workspace_cache_filename = File . dirname ( __FILE__ ) + "/" + WORKSPACE_CACHE project_cache_filename = File . dirname ( __FILE__ ) + "/" + PROJECT_CACHE if ! FileTest . exist? ( subscription_cache_filename ) || ! FileTest . exist? ( workspace_cache_filename ) || ! FileTest . exist? ( project_cache_filename ) then refresh_needed = true reason = "One or more cache files is not found." return refresh_needed , reason end cache_age = get_cache_age ( ) if cache_age > @max_cache_age then refresh_needed = true reason = "Age of workspace/project cache is greater than specified max of #{@max_cache_age}" return refresh_needed , reason end read_subscription_cache ( ) cached_subscription_id = @cached_sub_id current_subscription_id = get_current_sub_id ( ) if current_subscription_id != cached_subscription_id then refresh_needed = true reason = "Specified SubID: #{current_subscription_id} is different from cached SubID: #{cached_subscription_id}" return refresh_needed , reason end reason = "No workspace/project cache refresh currently required" return refresh_needed , reason end
Determine whether or not to refresh local sub/workspace/project cache
Determine whether or not to refresh local sub / workspace / project cache
# If we've fallen through to here, no refresh is needed