Class: Fastlane::Actions::PrepareGitRepositoryAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



49
50
51
52
# File 'lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb', line 49

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["SemenovAlexander"]
end

.available_optionsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb', line 30

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :branch,
                                 env_name: "FL_PREPARE_GIT_REPOSITORY_BRANCH",
                                 description: "Git branch to checkout and track for rest of fastlane",
                                 default_value: "master",
                                 verify_block: proc do |value|
                                   UI.user_error!("No branch for PrepareGitRepositoryAction given, pass using `branch: 'branch'`") unless value and !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :remote,
                                 env_name: "FL_PREPARE_GIT_REPOSITORY_REMOTE",
                                 description: "Git remote name to checkout and track for rest of fastlane",
                                 default_value: "origin",
                                 verify_block: proc do |value|
                                   UI.user_error!("No git remote for PrepareGitRepositoryAction given, pass using `remote: 'origin'`") unless value and !value.empty?
                                 end)
  ]
end

.descriptionObject



20
21
22
# File 'lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb', line 20

def self.description
  "Prepares repo for fastlane to work"
end

.detailsObject



24
25
26
27
28
# File 'lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb', line 24

def self.details
  # Optional:
  # this is your chance to provide a more detailed description of this action
  "You can use this action to do cool things..."
end

.is_supported?(platform) ⇒ Boolean

Returns:



54
55
56
# File 'lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb', line 54

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/fastlane/plugin/mobile_common/actions/prepare_git_repository.rb', line 7

def self.run(params)
  git_branch = params[:branch]
  remote = params[:remote]
  sh("git checkout #{git_branch}")
  sh("git remote set-branches --add #{remote} #{git_branch}")
  sh("git branch --set-upstream-to=refs/remotes/#{remote}/#{git_branch} #{git_branch}")
  other_action.git_pull
end