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.18.0.beta.20170217010035 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.0.beta.20170216184940 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.17.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.17.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.16.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.15.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.16.0.beta.20170214010051 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.15.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.15.0.beta.20170213032052 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.14.2 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.14.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.14.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.13.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.12.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.11.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.10.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.9.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.8.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.7.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.6.0 fastlane/lib/fastlane/actions/number_of_commits.rb