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.20.0.beta.20170303010054 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.20.0.beta.20170302010029 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170301010932 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170228010016 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170227010016 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170226010028 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170225010031 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170224010025 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.3 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170223010028 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.2 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.19.0.beta.20170222010016 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.1 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.0 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.0.beta.20170221010026 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.0.beta.20170220010017 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.0.beta.20170219010032 fastlane/lib/fastlane/actions/number_of_commits.rb
fastlane-2.18.0.beta.20170218010103 fastlane/lib/fastlane/actions/number_of_commits.rb