Class: Fastlane::Helper::Auth0ShipperHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::Auth0ShipperHelper
- Defined in:
- lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb
Class Method Summary collapse
- .calculate_next_version(current, bump) ⇒ Object
- .clean_release_branch(name, force) ⇒ Object
- .create_release_branch(name) ⇒ Object
- .get_changelog(version, filename) ⇒ Object
- .ios_current_version(target) ⇒ Object
- .prepare_changelog(current, next_version, organization, repository) ⇒ Object
- .prepare_changelog_file(file, entry) ⇒ Object
- .prepare_readme_file(file_name, current, next_version) ⇒ Object
- .release_branch_exists(name) ⇒ Object
- .release_branch_name(name, next_version) ⇒ Object
- .resolve_current_version(target) ⇒ Object
- .tag_current_version ⇒ Object
- .wrap_version(version) ⇒ Object
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 |
.clean_release_branch(name, force) ⇒ Object
89 90 91 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 89 def self.clean_release_branch(name, force) system("git branch -q #{force ? '-D' : '-d'} #{name}") end |
.create_release_branch(name) ⇒ Object
81 82 83 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 81 def self.create_release_branch(name) system("git checkout -q -b #{name}") end |
.get_changelog(version, filename) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 48 def self.get_changelog(version, filename) lines = [] found = false version_header = "## [#{version}]" header_format = /\#\# \[.*\]\(https:\/\/github\.com/ File.open(filename) do | file | while (line = file.gets) != nil do is_version_header = line.strip.start_with? version_header is_next_header = line.match(header_format) && !is_version_header && found break if is_next_header found = true if is_version_header lines << line.strip if !is_version_header && found end end string = lines.join "\n" end |
.ios_current_version(target) ⇒ Object
14 15 16 17 18 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 14 def self.ios_current_version(target) current_version_number = Actions::GetVersionNumberAction.run({target: target}) 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
67 68 69 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 67 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
71 72 73 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 71 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 |
.release_branch_exists(name) ⇒ Object
85 86 87 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 85 def self.release_branch_exists(name) system("git branch --list -a | grep -q #{name}") end |
.release_branch_name(name, next_version) ⇒ Object
75 76 77 78 79 |
# File 'lib/fastlane/plugin/auth0_shipper/helper/auth0_shipper_helper.rb', line 75 def self.release_branch_name(name, next_version) branch_name = "release-#{next_version}" branch_name = name unless name.nil? branch_name end |
.resolve_current_version(target) ⇒ Object
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(target) current_version_plist = ios_current_version(target) 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_version ⇒ Object
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 |