Class: Fastlane::Actions::PodPushAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, lane_context, method_missing, other_action, output, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



106
107
108
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 106

def self.authors
  ["squarefrog"]
end

.available_optionsObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 59

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
                                   description: "Use bundle exec when there is a Gemfile presented",
                                   is_string: false,
                                   default_value: false),
    FastlaneCore::ConfigItem.new(key: :path,
                                 description: "The Podspec you want to push",
                                 optional: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
                                   UI.user_error!("File must be a `.podspec` or `.podspec.json`") unless value.end_with?(".podspec", ".podspec.json")
                                 end),
    FastlaneCore::ConfigItem.new(key: :repo,
                                 description: "The repo you want to push. Pushes to Trunk by default",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :allow_warnings,
                                 description: "Allow warnings during pod push",
                                 optional: true,
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :use_libraries,
                                 description: "Allow lint to use static libraries to install the spec",
                                 optional: true,
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :sources,
                                 description: "The sources of repos you want the pod spec to lint with, separated by commas",
                                 optional: true,
                                 is_string: false,
                                 verify_block: proc do |value|
                                   UI.user_error!("Sources must be an array.") unless value.kind_of?(Array)
                                 end),
    FastlaneCore::ConfigItem.new(key: :swift_version,
                                 description: "The SWIFT_VERSION that should be used to lint the spec. This takes precedence over a .swift-version file",
                                 optional: true,
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :verbose,
                                 description: "Show more debugging information",
                                 optional: true,
                                 is_string: false,
                                 default_value: false)
  ]
end

.categoryObject



127
128
129
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 127

def self.category
  :misc
end

.descriptionObject



51
52
53
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 51

def self.description
  "Push a Podspec to Trunk or a private repository"
end

.detailsObject



55
56
57
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 55

def self.details
  ""
end

.example_codeObject



114
115
116
117
118
119
120
121
122
123
124
125
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 114

def self.example_code
  [
    '# If no path is supplied then Trunk will attempt to find the first Podspec in the current directory.
    pod_push',
    '# Alternatively, supply the Podspec file path
    pod_push(path: "TSMessages.podspec")',
    '# You may also push to a private repo instead of Trunk
    pod_push(path: "TSMessages.podspec", repo: "MyRepo")',
    '# If the podspec has a dependency on another private pod, then you will have to supply the sources you want the podspec to lint with for pod_push to succeed. Read more here - https://github.com/CocoaPods/CocoaPods/issues/2543.
    pod_push(path: "TMessages.podspec", repo: "MyRepo", sources: ["https://github.com/username/Specs", "https://github.com/CocoaPods/Specs"])'
  ]
end

.is_supported?(platform) ⇒ Boolean



110
111
112
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 110

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

.return_valueObject



102
103
104
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 102

def self.return_value
  nil
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'fastlane/lib/fastlane/actions/pod_push.rb', line 4

def self.run(params)
  command = []

  command << "bundle exec" if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?

  if params[:repo]
    repo = params[:repo]
    command << "pod repo push #{repo}"
  else
    command << 'pod trunk push'
  end

  if params[:path]
    command << "'#{params[:path]}'"
  end

  if params[:sources]
    sources = params[:sources].join(",")
    command << "--sources='#{sources}'"
  end

  if params[:swift_version]
    swift_version = params[:swift_version]
    command << "--swift-version=#{swift_version}"
  end

  if params[:allow_warnings]
    command << "--allow-warnings"
  end

  if params[:use_libraries]
    command << "--use-libraries"
  end

  if params[:verbose]
    command << "--verbose"
  end

  result = Actions.sh(command.join(' '))
  UI.success("Successfully pushed Podspec ⬆️ ")
  return result
end