Class: LogBench::VersionChecker
- Inherits:
-
Object
- Object
- LogBench::VersionChecker
- Defined in:
- lib/log_bench/version_checker.rb
Constant Summary collapse
- CACHE_DIR =
Cache file location
File.("~/.cache/log_bench")
- CACHE_FILE =
File.join(CACHE_DIR, "version_check.json")
- CACHE_DURATION =
Cache duration (24 hours)
24 * 60 * 60
- RUBYGEMS_API_URL =
RubyGems API endpoint
"https://rubygems.org/api/v1/gems/log_bench.json"- REQUEST_TIMEOUT =
Timeout for HTTP requests
5
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.check_for_update ⇒ Object
22 23 24 |
# File 'lib/log_bench/version_checker.rb', line 22 def self.check_for_update new.check_for_update end |
Instance Method Details
#check_for_update ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/log_bench/version_checker.rb', line 26 def check_for_update return nil unless should_check? latest_version = fetch_latest_version return nil unless latest_version update_cache(latest_version) if newer_version_available?(latest_version) latest_version end rescue # Silently fail - don't interrupt the user experience nil end |