Class: Fastlane::Actions::CocoapodsAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, lane_context, method_missing, other_action, output, return_value, sample_return_value, sh, step_text

Class Method Details

.authorsObject



86
87
88
# File 'lib/fastlane/actions/cocoapods.rb', line 86

def self.authors
  ["KrauseFx", "tadpol", "birmacher", "Liquidsoul"]
end

.available_optionsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/fastlane/actions/cocoapods.rb', line 34

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :clean,
                                 env_name: "FL_COCOAPODS_CLEAN",
                                 description: "Remove SCM directories",
                                 is_string: false,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :integrate,
                                 env_name: "FL_COCOAPODS_INTEGRATE",
                                 description: "Integrate the Pods libraries into the Xcode project(s)",
                                 is_string: false,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :repo_update,
                                 env_name: "FL_COCOAPODS_REPO_UPDATE",
                                 description: "Run `pod repo update` before install",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :silent,
                                 env_name: "FL_COCOAPODS_SILENT",
                                 description: "Execute command without logging output",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :verbose,
                                 env_name: "FL_COCOAPODS_VERBOSE",
                                 description: "Show more debugging information",
                                 is_string: false,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :ansi,
                                 env_name: "FL_COCOAPODS_ANSI",
                                 description: "Show output with ANSI codes",
                                 is_string: false,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
                                 env_name: "FL_COCOAPODS_USE_BUNDLE_EXEC",
                                 description: "Use bundle exec when there is a Gemfile presented",
                                 is_string: false,
                                 default_value: true),
    FastlaneCore::ConfigItem.new(key: :podfile,
                                 env_name: "FL_COCOAPODS_PODFILE",
                                 description: "Explicitly specify the path to the Cocoapods' Podfile. You can either set it to the Podfile's path or to the folder containing the Podfile file",
                                 optional: true,
                                 is_string: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("Could not find Podfile") unless File.exist?(value) || Helper.test?
                                 end)
  ]
end

.categoryObject



104
105
106
# File 'lib/fastlane/actions/cocoapods.rb', line 104

def self.category
  :building
end

.descriptionObject



30
31
32
# File 'lib/fastlane/actions/cocoapods.rb', line 30

def self.description
  "Runs `pod install` for the project"
end

.detailsObject



90
91
92
# File 'lib/fastlane/actions/cocoapods.rb', line 90

def self.details
  "If you use [CocoaPods](http://cocoapods.org) you can use the `cocoapods` integration to run `pod install` before building your app."
end

.example_codeObject



94
95
96
97
98
99
100
101
102
# File 'lib/fastlane/actions/cocoapods.rb', line 94

def self.example_code
  [
    'cocoapods',
    'cocoapods(
      clean: true,
      podfile: "./CustomPodfile"
    )'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/fastlane/actions/cocoapods.rb', line 82

def self.is_supported?(platform)
  [:ios, :mac].include? platform
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/actions/cocoapods.rb', line 4

def self.run(params)
  Actions.verify_gem!('cocoapods')
  cmd = []

  unless params[:podfile].nil?
    if params[:podfile].end_with?('Podfile')
      podfile_folder = File.dirname(params[:podfile])
    else
      podfile_folder = params[:podfile]
    end
    cmd << ["cd '#{podfile_folder}' &&"]
  end

  cmd << ['bundle exec'] if File.exist?('Gemfile') && params[:use_bundle_exec]
  cmd << ['pod install']

  cmd << '--no-clean' unless params[:clean]
  cmd << '--no-integrate' unless params[:integrate]
  cmd << '--repo-update' if params[:repo_update]
  cmd << '--silent' if params[:silent]
  cmd << '--verbose' if params[:verbose]
  cmd << '--no-ansi' unless params[:ansi]

  Actions.sh(cmd.join(' '))
end