Sha256: bf9dd7ad63a53bf726bdaadd2cca0796f2dcd249e0544919c2d2ce7f364ccf6f

Contents?: true

Size: 845 Bytes

Versions: 5

Compression:

Stored size: 845 Bytes

Contents

require 'anvil/task'
require 'anvil/rubygems'

class Gem::ReleaseTask < Anvil::Task
  description 'Builds a new version and pushes it to rubygems'

  parser do
    arguments %w[bump_term]

    on('-i', '--[no-]install', 'Install gem') do |i|
      options[:install] = i
    end
  end

  attr_reader :bump_term, :options

  def initialize(bump_term, options = {})
    @bump_term = bump_term
    @options = options
  end

  def task
    version  = bump
    gem_file = build

    push gem_file, version
  end

  protected

  def gemspec_file
    Dir['*.gemspec'].first
  end

  def bump
    Gem::BumpTask.new(bump_term, persist: true).task
  end

  def build
    Gem::BuildTask.new(gemspec_file, options).task
  end

  def push(gem_file, version)
    logger.info "Pushing version #{version} to rubygems"
    Anvil::Rubygems.push gem_file
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
anvil-core-0.4.2 lib/tasks/gem/release_task.rb
anvil-core-0.4.1 lib/tasks/gem/release_task.rb
anvil-core-0.4.0 lib/tasks/gem/release_task.rb
anvil-core-0.3.2 lib/tasks/gem/release_task.rb
anvil-core-0.3.1 lib/tasks/gem/release_task.rb