Sha256: 96fbb0c890117d774bd85890156737b9090bcd2ad5ccf29afde233e043a0c07e

Contents?: true

Size: 971 Bytes

Versions: 61

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

module Koi
  module Release
    def version
      @version ||= read(::Rails.root.join("VERSION"))
    end

    module_function :version

    def revision
      @revision ||= read(::Rails.root.join("REVISION"))
    end

    module_function :revision

    def meta_tags(context)
      ReleaseMetaTagsBuilder.new(context).render
    end

    module_function :meta_tags

    def read(file)
      return "HEAD" if Rails.env.development?
      return "unknown" unless File.exist?(file)

      File.read(file).strip
    end

    module_function :read
  end

  class ReleaseMetaTagsBuilder
    delegate_missing_to :@context

    def initialize(context)
      @context = context
    end

    def version
      tag.meta(name: "application-version", content: Koi::Release.version)
    end

    def revision
      tag.meta(name: "application-revision", content: Koi::Release.revision)
    end

    def render
      version + revision
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
katalyst-koi-4.14.1 lib/koi/release.rb
katalyst-koi-4.14.0 lib/koi/release.rb
katalyst-koi-4.13.2 lib/koi/release.rb
katalyst-koi-4.13.0 lib/koi/release.rb
katalyst-koi-4.12.6 lib/koi/release.rb
katalyst-koi-4.12.5 lib/koi/release.rb
katalyst-koi-4.12.4 lib/koi/release.rb
katalyst-koi-4.12.3 lib/koi/release.rb
katalyst-koi-4.12.2 lib/koi/release.rb
katalyst-koi-4.12.1 lib/koi/release.rb
katalyst-koi-4.12.0 lib/koi/release.rb
katalyst-koi-4.11.2 lib/koi/release.rb
katalyst-koi-4.11.1 lib/koi/release.rb
katalyst-koi-4.11.0 lib/koi/release.rb
katalyst-koi-4.10.3 lib/koi/release.rb
katalyst-koi-4.10.2 lib/koi/release.rb
katalyst-koi-4.10.1 lib/koi/release.rb
katalyst-koi-4.10.0 lib/koi/release.rb
katalyst-koi-4.9.5 lib/koi/release.rb
katalyst-koi-4.9.4 lib/koi/release.rb