Class: Fastlane::Actions::SetBuildNumberRepositoryAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/set_build_number_repository.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, details, sh, step_text

Class Method Details

.authorObject



79
80
81
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 79

def self.author
  'pbrooks'
end

.available_optionsObject



69
70
71
72
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 69

def self.available_options
  [
  ]
end

.descriptionObject



65
66
67
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 65

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

.is_git?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
26
27
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 20

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

.is_git_svn?Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 29

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 7

def self.is_supported?(platform)
  platform == :ios
end

.is_svn?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 11

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

.outputObject



74
75
76
77
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 74

def self.output
  [
  ]
end

.run(params) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fastlane/actions/set_build_number_repository.rb', line 38

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