class Targit::Release

GitHub Release object

Attributes

repo[R]
tag[R]

Public Class Methods

new(repo, tag, params = {}) click to toggle source
# File lib/targit/release.rb, line 9
def initialize(repo, tag, params = {})
  @repo = repo
  @tag = tag
  @options = params
  @options[:client] ||= client
  create if @options.include?(:create) && data.nil?
  raise('No release found') if data.nil?
end

Public Instance Methods

data() click to toggle source
# File lib/targit/release.rb, line 18
def data
  @data ||= _data
end

Private Instance Methods

_data() click to toggle source
# File lib/targit/release.rb, line 24
def _data
  client.releases(@repo).find { |x| x[:tag_name] == @tag }
end
create() click to toggle source
# File lib/targit/release.rb, line 28
def create
  client.create_release(@repo, @tag, create_options)
end
create_options() click to toggle source
# File lib/targit/release.rb, line 32
def create_options
  opts = {}
  opts[:name] = @options[:release_name] if @options[:release_name]
  %i[prerelease target_commitish].each_with_object(opts) do |option, hash|
    hash[option] = @options[option] if @options[option]
  end
end