Sha256: ac65e2b4ed413a261467afce57cb00d811193e580ad217cb941d9efba6ec4da0

Contents?: true

Size: 1.75 KB

Versions: 31

Compression:

Stored size: 1.75 KB

Contents

module Fastlane
  module Actions
    module SharedValues
    end

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

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

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

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

      def self.run(params)
         begin

          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
      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

31 entries across 31 versions & 1 rubygems

Version Path
fastlane-1.20.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.19.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.18.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.17.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.17.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.16.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.15.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.14.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.14.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.13.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.13.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.12.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.11.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.10.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.9.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.8.0 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.7.3 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.7.2 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.7.1 lib/fastlane/actions/set_build_number_repository.rb
fastlane-1.7.0 lib/fastlane/actions/set_build_number_repository.rb