Sha256: e7ee6d5ed64eefcbfa9771f9cf37cf61a5f98c53513e7c8ea19c79c9c881ba5b

Contents?: true

Size: 1.59 KB

Versions: 21

Compression:

Stored size: 1.59 KB

Contents

module Fastlane
  module Actions
    module SharedValues
    end

    class SetBuildNumberRepositoryAction < Action
      def self.is_supported?(platform)
        platform == :ios
      end

      def self.is_svn?
        Actions.sh 'svn info'
        return true
      rescue
        return false
      end

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

      def self.is_git_svn?
        Actions.sh 'git svn info'
        return true
      rescue
        return false
      end

      def self.run(params)
        if is_svn?
          Helper.log.info "Detected repo: svn"
          command = 'svn info | grep Revision | egrep -o "[0-9]+"'
        elsif is_git_svn?
          Helper.log.info "Detected repo: git-svn"
          command = 'git svn info | grep Revision | egrep -o "[0-9]+"'
        elsif is_git?
          Helper.log.info "Detected repo: git"
          command = 'git rev-parse --short HEAD'
        else
          raise "No repository detected"
        end

        build_number = Actions.sh command

        Fastlane::Actions::IncrementBuildNumberAction.run(build_number: build_number)
      end

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

      def self.description
        "Set the build number from the current repository"
      end

      def self.available_options
        [
        ]
      end

      def self.output
        [
        ]
      end

      def self.author
        'pbrooks'
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fastlane-1.32.4 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.32.3 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.32.2 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.32.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.32.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.31.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.30.2 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.30.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.30.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.29.2 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.29.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.29.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.28.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.27.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.26.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.25.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.25.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.24.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.23.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.22.0 lib/fastlane/actions/set_build_number_repository.rb