File: version.rake

package info (click to toggle)
ruby-app-store-connect 0.37.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 444 kB
  • sloc: ruby: 856; makefile: 4
file content (28 lines) | stat: -rw-r--r-- 656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require 'app_store_connect/version'
require 'semantic'

namespace :version do
  desc 'Print current version'
  task :current do
    puts AppStoreConnect::VERSION
  end

  desc 'Increment version'
  task :increment do
    version = Semantic::Version.new(AppStoreConnect::VERSION)
    path = File.expand_path(File.join('..', 'app_store_connect', 'version.rb'), __dir__)
    new_version = version.increment!(:minor).to_s

    File.open(path, 'r+') do |file|
      contents = file.read
      contents.gsub!(AppStoreConnect::VERSION, new_version)

      file.rewind
      file.write(contents)

      new_version
    end
  end
end