Class: Fastlane::Helper::Auth0ShipperHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb

Class Method Summary collapse

Class Method Details

.calculate_next_version(current, bump) ⇒ Object



6
7
8
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 6

def self.calculate_next_version(current, bump)
  current.increment!(bump)
end

.ios_current_versionObject



14
15
16
17
18
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 14

def self.ios_current_version
  current_version_number = Actions::GetVersionNumberAction.run({})
  UI.user_error!("Cannot find current version number from .xcodeproj") if current_version_number.nil?
  Semantic::Version.new current_version_number
end

.prepare_changelog(current, next_version, organization, repository) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 33

def self.prepare_changelog(current, next_version, organization, repository)
  command = "curl -H \"Accept: text/markdown\" https://webtask.it.auth0.com/api/run/wt-hernan-auth0_com-0/oss-changelog.js\\?webtask_no_cache=1\\&repo=#{repository}\\&milestone=#{next_version} -f -s"
  changelog = FastlaneCore::CommandExecutor.execute(
    command: command,
    print_command: false,
    error: proc do |error_output|
      UI.user_error!("Failed to build changelog for version #{next_version}")
    end
  )
  "# Change Log\n\n" +
  "## [#{next_version}](https://github.com/#{organization}/#{repository}/tree/#{next_version}) (#{Time.now.strftime('%Y-%m-%d')})\n" +
  "[Full Changelog](https://github.com/#{organization}/#{repository}/compare/#{current}...#{next_version})\n" +
  changelog
end

.prepare_changelog_file(file, entry) ⇒ Object



48
49
50
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 48

def self.prepare_changelog_file(file, entry)
  File.write(f = file, File.read(f).gsub(/# Change Log/, entry))
end

.prepare_readme_file(file_name, current, next_version) ⇒ Object



52
53
54
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 52

def self.prepare_readme_file(file_name, current, next_version)
  File.write(f = file_name, File.read(f).gsub(/~> #{current.major}\.#{current.minor}/, "~> #{next_version.major}.#{next_version.minor}"))
end

.resolve_current_versionObject



25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 25

def self.resolve_current_version
  current_version_plist = ios_current_version
  current_version_tag = tag_current_version
  current_version = current_version_plist
  current_version = UI.select("Please select current version", [current_version_plist, current_version_tag]) unless current_version_tag.nil? || (current_version_plist == current_version_tag)
  current_version
end

.tag_current_versionObject



20
21
22
23
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 20

def self.tag_current_version
  tag = Actions::LastGitTagAction.run({})
  Semantic::Version.new tag.to_s unless tag.nil?
end

.wrap_version(version) ⇒ Object



10
11
12
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 10

def self.wrap_version(version)
  Semantic::Version.new version
end