class Fastlane::Helper::SequeniaGitflowHelper

Public Class Methods

array_from_gitlog(source) click to toggle source
# File lib/fastlane/plugin/sequenia_gitflow/helper/sequenia_gitflow_helper.rb, line 44
def self.array_from_gitlog(source)
  `#{source}`.split($/)
             .map { |line| line.strip }
             .filter { |line| !line.empty? }
end
current_branch_all_commit_hashes(tag) click to toggle source

Получение всех коммитов текущей ветки

# File lib/fastlane/plugin/sequenia_gitflow/helper/sequenia_gitflow_helper.rb, line 23
def self.current_branch_all_commit_hashes(tag)
  array_from_gitlog("git log \"#{tag}\"...HEAD --pretty=\"%H\" --first-parent")
end
current_branch_merge_commit_hashes(tag) click to toggle source

Получение merge-коммитов от последнего релизного тэга до HEAD ветки

# File lib/fastlane/plugin/sequenia_gitflow/helper/sequenia_gitflow_helper.rb, line 18
def self.current_branch_merge_commit_hashes(tag)
  array_from_gitlog("git log \"#{tag}\"...HEAD --pretty=\"%H\" --merges")
end
fetch_merged_task_branches(all_hashes, merge_hashes, regexp) click to toggle source

Перевод хэшей коммитов в список веток

# File lib/fastlane/plugin/sequenia_gitflow/helper/sequenia_gitflow_helper.rb, line 28
def self.fetch_merged_task_branches(all_hashes, merge_hashes, regexp)
  merge_hashes.map do |hash|
    array_from_gitlog("git branch --remotes --contains #{hash} --merged")
  end
              .flatten
              .uniq
              .select do |b|
    b =~ regexp
  end
              .reject do |branch|
    # Проверка, если в ветке всего один коммит и он находится в версионной ветке
    last_commit = array_from_gitlog("git log --pretty=\"%H\" -p -1 #{branch}").first
    all_hashes.include?(last_commit)
  end
end
first_commit() click to toggle source
# File lib/fastlane/plugin/sequenia_gitflow/helper/sequenia_gitflow_helper.rb, line 13
def self.first_commit
  array_from_gitlog('git log --pretty=\"%H\" --reverse | head -n1').first
end
tag_exist?(tag) click to toggle source

Проверка, существует ли тэг в репозитории

# File lib/fastlane/plugin/sequenia_gitflow/helper/sequenia_gitflow_helper.rb, line 9
def self.tag_exist?(tag)
  !array_from_gitlog("git tag -l \"#{tag}\"").empty?
end