Sha256: aca9bac4862df4add45f28ea9d28e126e9ff60510d99a3ec1606efacb742099d

Contents?: true

Size: 656 Bytes

Versions: 27

Compression:

Stored size: 656 Bytes

Contents

module MuxTf
  module VersionCheck
    def has_updates?
      current_gem_version < latest_gem_version
    end

    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

    def current_gem_version
      Gem::Version.new(MuxTf::VERSION)
    end

    def cache
      @cache ||= YamlCache.new(File.expand_path("~/.mux_tf.yaml"), default_ttl: 1.hour)
    end

    extend self
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
mux_tf-0.8.4 lib/mux_tf/version_check.rb
mux_tf-0.8.3 lib/mux_tf/version_check.rb
mux_tf-0.8.2 lib/mux_tf/version_check.rb
mux_tf-0.8.1 lib/mux_tf/version_check.rb
mux_tf-0.8.0 lib/mux_tf/version_check.rb
mux_tf-0.7.2 lib/mux_tf/version_check.rb
mux_tf-0.7.1 lib/mux_tf/version_check.rb
mux_tf-0.7.0 lib/mux_tf/version_check.rb
mux_tf-0.6.1 lib/mux_tf/version_check.rb
mux_tf-0.6.0 lib/mux_tf/version_check.rb
mux_tf-0.5.3 lib/mux_tf/version_check.rb
mux_tf-0.5.2 lib/mux_tf/version_check.rb
mux_tf-0.5.1 lib/mux_tf/version_check.rb
mux_tf-0.5.0 lib/mux_tf/version_check.rb
mux_tf-0.4.9 lib/mux_tf/version_check.rb
mux_tf-0.4.8 lib/mux_tf/version_check.rb
mux_tf-0.4.7 lib/mux_tf/version_check.rb
mux_tf-0.4.6 lib/mux_tf/version_check.rb
mux_tf-0.4.5 lib/mux_tf/version_check.rb
mux_tf-0.4.4 lib/mux_tf/version_check.rb