Sha256: 128950a388d44413b2016fcf4f152811fc37186e7e398060704994f36e45108e

Contents?: true

Size: 920 Bytes

Versions: 5

Compression:

Stored size: 920 Bytes

Contents

# frozen_string_literal: true

desc "Bump version of this gem"
task :version, [:version] do |_task, args|
  args.with_defaults(version: nil)

  if args[:version].nil?
    puts "Version: #{RemoveBg::VERSION}"
    exit 0
  end

  unless /(\d+)\.(\d+)\.(\d+)/.match?(args[:version])
    puts "#{args[:version]} needs to be a major/minor/patch SemVer version number!"
    exit 1
  end

  version_file_path = "lib/remove_bg/version.rb"
  version_pattern = /VERSION = "(.+)"/

  # Read the current version from file
  content = File.read(version_file_path)

  unless content.match(version_pattern)
    puts "Error in #{version_file_path} file! Cannot determine current version!"
    exit 1
  end

  puts "Setting gem version to #{args[:version]}..."
  File.open(version_file_path, "w") do |file|
    file.puts content.sub(version_pattern, %(VERSION = "#{args[:version]}"))
  end

  puts "Version set to #{args[:version]}"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
remove_bg-2.0.4 tasks/version.rake
remove_bg-2.0.3 tasks/version.rake
remove_bg-2.0.2 tasks/version.rake
remove_bg-2.0.1 tasks/version.rake
remove_bg-2.0.0 tasks/version.rake