Sha256: e9daa973b4e3aecf962078964f55afb1db4415a2730dd09f271afab1f7f6208c

Contents?: true

Size: 781 Bytes

Versions: 7

Compression:

Stored size: 781 Bytes

Contents

require 'json'
require 'open-uri'

module LogCabin
  module Modules
    ##
    # Pull state from a GitHub release
    module GithubRelease
      include Prospectus.helpers.find(:regex)
      include Prospectus.helpers.find(:github_api)
      include Prospectus.helpers.find(:filter)

      def load!
        raise('No repo specified') unless @repo
        @state.value = regex_helper(release)
      end

      private

      def allow_prerelease
        @allow_prerelease = true
      end

      def release
        return @release if @release
        releases = github_api.releases(@repo)
        releases.reject!(&:draft)
        releases.reject!(&:prerelease) unless @allow_prerelease
        @release = filter_helper(releases.map(&:tag_name)).first
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
prospectus-0.9.0 lib/prospectus/modules/github_release.rb
prospectus-0.8.1 lib/prospectus/modules/github_release.rb
prospectus-0.8.0 lib/prospectus/modules/github_release.rb
prospectus-0.6.0 lib/prospectus/modules/github_release.rb
prospectus-0.5.8 lib/prospectus/modules/github_release.rb
prospectus-0.5.7 lib/prospectus/modules/github_release.rb
prospectus-0.5.6 lib/prospectus/modules/github_release.rb