Class: Fastlane::Helper::SemanticReleaseHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::SemanticReleaseHelper
- Defined in:
- lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb
Class Method Summary collapse
- .format_patterns ⇒ Object
-
.git_log(params) ⇒ Object
class methods that you define here become available in your action as ‘Helper::SemanticReleaseHelper.your_method`.
- .parse_commit(params) ⇒ Object
- .semver_gt(first, second) ⇒ Object
- .semver_lt(first, second) ⇒ Object
Class Method Details
.format_patterns ⇒ Object
8 9 10 11 12 13 |
# File 'lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb', line 8 def self.format_patterns return { "default" => /^(docs|fix|feat|chore|style|refactor|perf|test)(?:\((.*)\))?(!?)\: (.*)/, "angular" => /^(\w*)(?:\((.*)\))?(): (.*)/ } end |
.git_log(params) ⇒ Object
class methods that you define here become available in your action as ‘Helper::SemanticReleaseHelper.your_method`
18 19 20 21 |
# File 'lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb', line 18 def self.git_log(params) command = "git log --pretty='#{params[:pretty]}' --reverse #{params[:start]}..HEAD" Actions.sh(command, log: params[:debug]).chomp end |
.parse_commit(params) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb', line 23 def self.parse_commit(params) commit_subject = params[:commit_subject].strip commit_body = params[:commit_body] releases = params[:releases] codepush_friendly = params[:codepush_friendly] pattern = params[:pattern] breaking_change_pattern = /BREAKING CHANGES?: (.*)/ codepush_pattern = /codepush?: (.*)/ matched = commit_subject.match(pattern) result = { is_valid: false, subject: commit_subject, is_merge: !(commit_subject =~ /^Merge/).nil?, type: 'no_type' } unless matched.nil? type = matched[1] scope = matched[2] result[:is_valid] = true result[:type] = type result[:scope] = scope result[:has_exclamation_mark] = matched[3] == '!' result[:subject] = matched[4] unless releases.nil? result[:release] = releases[type.to_sym] end unless codepush_friendly.nil? result[:is_codepush_friendly] = codepush_friendly.include?(type) end unless commit_body.nil? breaking_change_matched = commit_body.match(breaking_change_pattern) codepush_matched = commit_body.match(codepush_pattern) unless breaking_change_matched.nil? result[:is_breaking_change] = true result[:breaking_change] = breaking_change_matched[1] end unless codepush_matched.nil? result[:is_codepush_friendly] = codepush_matched[1] == 'ok' end end end result end |
.semver_gt(first, second) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb', line 74 def self.semver_gt(first, second) first_major = (first.split('.')[0] || 0).to_i first_minor = (first.split('.')[1] || 0).to_i first_patch = (first.split('.')[2] || 0).to_i second_major = (second.split('.')[0] || 0).to_i second_minor = (second.split('.')[1] || 0).to_i second_patch = (second.split('.')[2] || 0).to_i # Check if next version is higher then last version if first_major > second_major return true elsif first_major == second_major if first_minor > second_minor return true elsif first_minor == second_minor if first_patch > second_patch return true end end end return false end |
.semver_lt(first, second) ⇒ Object
99 100 101 |
# File 'lib/fastlane/plugin/semantic_release/helper/semantic_release_helper.rb', line 99 def self.semver_lt(first, second) return !semver_gt(first, second) end |