Sha256: 9212514b65b3b1fda560d5d42735889088158593ed1c0a7ca5cdab5d7a5db6b1

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

namespace 'gem' do
  GEM_SPEC = "#{Origen.root}/#{Origen.app.gem_name}.gemspec"
  GEM_NAME = "#{Origen.app.gem_name}-#{Origen.app.version}.gem"

  if File.exist?(GEM_SPEC)

    built_gem_path = nil

    desc "Build #{GEM_NAME} into the pkg directory"
    task :build do
      # Ensure all files are readable
      sh("chmod a+r -R #{Origen.root}")
      sh("gem build -V '#{GEM_SPEC}'") do |_ok, _res|
        outdir = File.join(Origen.root, 'pkg')
        FileUtils.mkdir_p(outdir)
        FileUtils.mv(GEM_NAME, outdir)
        built_gem_path = File.join(outdir, GEM_NAME)
        puts "#{Origen.app.name} #{Origen.app.version} built to pkg/#{GEM_NAME}".green
      end
    end

    desc "Push #{GEM_NAME} to the Origen gem server"
    task release: [:build] do
      if Origen.app.config.release_externally
        cmd = "gem push #{built_gem_path}"
      else
        cmd = "gem push --host #{Origen.site_config.gem_server!} #{built_gem_path}"
      end
      sh(cmd) do |ok, _res|
        if ok
          puts "#{Origen.app.name} #{Origen.app.version} has been released successfully".green
        else
          puts "Something went wrong releasing #{Origen.app.name} to the gem server!".red
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
origen-0.7.0 lib/tasks/gem.rake