fastlane/lib/fastlane/actions/number_of_commits.rb in fastlane-2.26.0.beta.20170405010026 vs fastlane/lib/fastlane/actions/number_of_commits.rb in fastlane-2.26.0.beta.20170406010019

- old
+ new

@@ -8,11 +8,15 @@ return false end def self.run(params) if is_git? - command = 'git rev-list HEAD --count' + if params[:all] + command = 'git rev-list --all --count' + else + command = 'git rev-list HEAD --count' + end else UI.user_error!("Not in a git repository.") end return Actions.sh(command).strip.to_i end @@ -20,32 +24,43 @@ ##################################################### # @!group Documentation ##################################################### def self.description - "Return the total number of all commits in current git repo" + "Return the number of commits in current git branch" end def self.return_value - "The total number of all commits in current git repo" + "The total number of all commits in current git branch" end + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :all, + env_name: "FL_NUMBER_OF_COMMITS_ALL", + optional: true, + is_string: false, + description: "Returns number of all commits instead of current branch") + ] + 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." + "You can use this action to get the number of commits of this branch. This is useful if you want to set the build number to the number of commits. See `faslane actions number_of_commits` for more details" end def self.authors - ["onevcat"] + ["onevcat", "samuelbeek"] end def self.is_supported?(platform) true end def self.example_code [ - 'build_number = number_of_commits - increment_build_number(build_number: build_number)' + 'increment_build_number(build_number: number_of_commits)', + 'build_number = number_of_commits(all: true) + increment_build_number(build_number: number_of_commits)' ] end def self.category :source_control