Skip to content

Commit

Permalink
gem (tasks) push rewrite + bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
SwagDevOps committed Feb 2, 2021
1 parent db2bb10 commit 2270c66
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lib/kamaze/project/tasks/gem/push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.

[nil, :gem_runner, :exceptions].each do |req|
require "rubygems/#{req}".rstrip('/')
end

# Code mostly based on gem executable
#
# @see http://guides.rubygems.org/publishing/
# @see rubygems-tasks
builder = tools.fetch(:gemspec_builder)
desc 'Push gem up to the gem server'
task 'gem:push': [builder.buildable] do
args = [:push, builder.buildable].map(&:to_s)
[nil, :gem_runner, :exceptions].each { |req| require ['rubygems', req].compact.join('/') }

begin
Gem::GemRunner.new.run(args.map(&:to_s))
rescue Gem::SystemExitException => e
exit(e.exit_code)
tools.fetch(:gemspec_builder).tap do |builder|
# Code mostly based on gem executable
#
# @see http://guides.rubygems.org/publishing/
# @see rubygems-tasks
runner = lambda do
[:push, builder.buildable].map(&:to_s).yield_self do |args|
Gem::GemRunner.new.run(args.map(&:to_s))
rescue Gem::SystemExitException => e
exit(e.exit_code)
end
end

desc 'Push gem up to the gem server'
task('gem:push': [builder.buildable]) { runner.call }
end

0 comments on commit 2270c66

Please sign in to comment.