Class: Fastlane::Actions::NumberOfCommitsAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/number_of_commits.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, available_options, details, method_missing, other_action, output, sh, step_text

Class Method Details

.authorsObject



32
33
34
# File 'lib/fastlane/actions/number_of_commits.rb', line 32

def self.authors
  ["onevcat"]
end

.descriptionObject



24
25
26
# File 'lib/fastlane/actions/number_of_commits.rb', line 24

def self.description
  "Return the total number of all commits in current git repo"
end

.is_git?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
# File 'lib/fastlane/actions/number_of_commits.rb', line 4

def self.is_git?
  Actions.sh 'git rev-parse HEAD'
  return true
rescue
  return false
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fastlane/actions/number_of_commits.rb', line 36

def self.is_supported?(platform)
  true
end

.return_valueObject



28
29
30
# File 'lib/fastlane/actions/number_of_commits.rb', line 28

def self.return_value
  "The total number of all commits in current git repo"
end

.run(params) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/fastlane/actions/number_of_commits.rb', line 11

def self.run(params)
  if is_git?
    command = 'git rev-list HEAD --count'
  else
    UI.user_error!("Not in a git repository.")
  end
  return Actions.sh(command).strip.to_i
end