Module: MuxTf::VersionCheck
- Defined in:
- lib/mux_tf/version_check.rb
Class Method Summary collapse
- .cache ⇒ Object
- .current_gem_version ⇒ Object
-
.has_updates? ⇒ Boolean
rubocop:disable Naming/PredicateName.
- .latest_gem_version ⇒ Object
Class Method Details
.cache ⇒ Object
24 25 26 |
# File 'lib/mux_tf/version_check.rb', line 24 def cache @cache ||= YamlCache.new(File.("~/.mux_tf.yaml"), default_ttl: 1.hour) end |
.current_gem_version ⇒ Object
20 21 22 |
# File 'lib/mux_tf/version_check.rb', line 20 def current_gem_version Gem::Version.new(MuxTf::VERSION) end |
.has_updates? ⇒ Boolean
rubocop:disable Naming/PredicateName
5 6 7 |
# File 'lib/mux_tf/version_check.rb', line 5 def has_updates? # rubocop:disable Naming/PredicateName current_gem_version < latest_gem_version end |
.latest_gem_version ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mux_tf/version_check.rb', line 9 def latest_gem_version value = cache.fetch("latest_gem_version") { fetcher = Gem::SpecFetcher.fetcher dependency = Gem::Dependency.new "mux_tf" remotes, = fetcher.search_for_dependency dependency remotes.map(&:first).map(&:version).max.to_s } Gem::Version.new(value) end |