Sha256: f0463cabef8cb9b0716b3cb27777ace87c70c69b023444589686edd277373376

Contents?: true

Size: 1.44 KB

Versions: 26

Compression:

Stored size: 1.44 KB

Contents

PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.')

task :require_version do
  unless ENV['VERSION']
    puts "VERSION is required: rake build VERSION=X.Y.Z"
    exit 1
  end
end

# Note: The sh command is built into Rake:
# https://rubydoc.info/gems/rake/FileUtils#sh-instance_method
task :build => [:require_version] do
  _, platform, *_ = RUBY_PLATFORM.split("-")
  if platform == 'mswin32' or platform == 'mingw32'
    puts "Warning: Building gem on Windows will lose file permissions"
  end

  # Run yarn build if we have a package.json
  if File.exist?('package.json')
    sh('yarn run build') do |ok, status|
      raise "yarn run build failed" if !ok
    end
  end

  split_version = ENV['VERSION'].to_s.split('.')
  major = split_version[0]
  minor = split_version[1]
  if ENV['VERSION'] =~ /[a-zA-Z]+/
    # Prerelease version
    remainder = split_version[2..-1].join(".")
    remainder.gsub!('-', '.pre.') # Rubygems replaces dashes with .pre.
    remainder_split = remainder.split('.')
    patch = remainder_split[0]
    other = remainder_split[1..-1].join('.')
    gem_version = "#{major}.#{minor}.#{patch}.#{other}"
  else
    gem_version = ENV['VERSION']
  end
  gem_name = PLUGIN_NAME + '-' + gem_version + '.gem'

  sh('gem', 'build', PLUGIN_NAME)
  sh("openc3cli validate #{gem_name}") do |ok, status|
    if !ok && status.exitstatus == 127 # command not found
      puts "Install the openc3 gem to validate! (gem install openc3)"
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
openc3-6.1.0 templates/plugin/Rakefile
openc3-6.0.2 templates/plugin/Rakefile
openc3-6.0.1 templates/plugin/Rakefile
openc3-6.0.0 templates/plugin/Rakefile
openc3-5.20.0 templates/plugin/Rakefile
openc3-5.19.0 templates/plugin/Rakefile
openc3-5.18.0 templates/plugin/Rakefile
openc3-5.17.1 templates/plugin/Rakefile
openc3-5.17.0 templates/plugin/Rakefile
openc3-5.16.0 templates/plugin/Rakefile
openc3-5.15.2 templates/plugin/Rakefile
openc3-5.15.1 templates/plugin/Rakefile
openc3-5.15.0 templates/plugin/Rakefile
openc3-5.14.2 templates/plugin/Rakefile
openc3-5.14.1 templates/plugin/Rakefile
openc3-5.14.0 templates/plugin/Rakefile
openc3-5.13.0 templates/plugin/Rakefile
openc3-5.12.0 templates/plugin/Rakefile
openc3-5.11.3 templates/plugin/Rakefile
openc3-5.11.2 templates/plugin/Rakefile