Sha256: c4b6b73131ccbaba21227fad12423369a70917b127d2e4a8a3edfc184a35bc3d

Contents?: true

Size: 830 Bytes

Versions: 5

Compression:

Stored size: 830 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).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.3.0 lib/tasks/gem/release_task.rb
anvil-core-0.2.0 lib/tasks/gem/release_task.rb
anvil-core-0.1.0 lib/tasks/gem/release_task.rb
anvil-core-0.0.1.pre.alpha.3 lib/tasks/gem/release_task.rb
anvil-core-0.0.1.pre.alpha.2 lib/tasks/gem/release_task.rb