Sha256: 96c4dc2e4d5b5f3b9139ff5c52c4faf5b2ed97e9d25b64b39f1b1c6afb6daffc

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

require 'bundler/setup'
require 'rspec/core/rake_task'
require 'fileutils'

DISTRIBUTIONS = [
  { rb_platform: 'x86_64-darwin', filename: 'darwin-amd64.tar.gz' },
  { rb_platform: 'x86_64-linux',  filename: 'linux-amd64.tar.gz' },
  { rb_platform: 'arm-linux',     filename: 'linux-arm.tar.gz' },
  { rb_platform: 'arm64-linux',   filename: 'linux-arm64.tar.gz' },
  { rb_platform: 'i386-linux',    filename: 'linux-386.tar.gz' },
  { rb_platform: 'ppc64le-linux', filename: 'linux-ppc64le.tar.gz' },
  { rb_platform: 's390x-linux',   filename: 'linux-s390x.tar.gz' },
  { rb_platform: 'x64-mswin64',   filename: 'windows-amd64.zip' }
]

task :build do
  require 'rubygems/package'
  require 'open-uri'
  require 'helm-rb/version'

  FileUtils.mkdir_p('pkg')

  DISTRIBUTIONS.each do |distro|
    FileUtils.rm_rf('vendor')
    FileUtils.mkdir('vendor')

    url = "https://get.helm.sh/helm-v#{HelmRb::HELM_VERSION}-#{distro[:filename]}"
    ext = distro[:filename][distro[:filename].index('.')..-1]
    distro_name = distro[:filename].chomp(ext)
    archive = "helm#{ext}"
    File.write(archive, open(url).read)
    FileUtils.mkdir('helm')
    system("tar -C helm -xzvf #{archive}")
    FileUtils.rm(archive)

    Dir.glob(File.join('helm', distro_name, 'helm*')).each do |exe|
      system("chmod +x #{exe}")
      FileUtils.cp(exe, 'vendor')
    end

    FileUtils.rm_rf('helm')

    gemspec = eval(File.read('helm-rb.gemspec'))
    gemspec.platform = distro[:rb_platform]
    package = Gem::Package.build(gemspec)
    FileUtils.mv(package, 'pkg')
  end
end

task default: :spec

desc 'Run specs'
RSpec::Core::RakeTask.new do |t|
  t.pattern = './spec/**/*_spec.rb'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
helm-rb-0.1.0-x86_64-linux Rakefile
helm-rb-0.1.0-x86_64-darwin Rakefile
helm-rb-0.1.0-i386-linux Rakefile
helm-rb-0.1.0-x64-mswin64 Rakefile
helm-rb-0.1.0-s390x-linux Rakefile
helm-rb-0.1.0-ppc64le-linux Rakefile
helm-rb-0.1.0-arm64-linux Rakefile
helm-rb-0.1.0-arm-linux Rakefile