Sha256: ea0d0e56398b44c401a37943676059b5426805f87b4f3bf58af17db4dafc0b66

Contents?: true

Size: 1.3 KB

Versions: 106

Compression:

Stored size: 1.3 KB

Contents

module Fastlane
  module Actions
    class NumberOfCommitsAction < Action
      def self.is_git?
        Actions.sh 'git rev-parse HEAD'
        return true
      rescue
        return false
      end

      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

      #####################################################
      # @!group Documentation
      #####################################################

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

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

      def self.details
        "You can use this action to get the number of commits of this repo. This is useful if you want to set the build number to the number of commits."
      end

      def self.authors
        ["onevcat"]
      end

      def self.is_supported?(platform)
        true
      end

      def self.example_code
        [
          'build_number = number_of_commits
          increment_build_number(build_number: build_number)'
        ]
      end

      def self.category
        :source_control
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
fastlane-2.21.0.beta.20170320010043 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.21.0.beta.20170319010027 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.21.0.beta.20170318010107 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.21.0.beta.20170317010039 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.21.0.beta.20170316010039 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170315010053 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170314010029 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170313010048 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170312010035 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170311010030 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170310010058 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170309010049 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170308010036 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.3 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170307010029 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.2 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170306010752 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170305010057 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170304010023 fastlane/lib/fastlane/actions/number_of_commits.rb