Class: Fastlane::Actions::PodPushAction

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

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

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

Class Method Details

.authorsObject



80
81
82
# File 'lib/fastlane/actions/pod_push.rb', line 80

def self.authors
  ["squarefrog"]
end

.available_optionsObject



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
# File 'lib/fastlane/actions/pod_push.rb', line 46

def self.available_options
  [
    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)
  ]
end

.categoryObject



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

def self.category
  :misc
end

.descriptionObject



38
39
40
# File 'lib/fastlane/actions/pod_push.rb', line 38

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

.detailsObject



42
43
44
# File 'lib/fastlane/actions/pod_push.rb', line 42

def self.details
  ""
end

.example_codeObject



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/fastlane/actions/pod_push.rb', line 88

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/MyGithubPage/Specs", "https://github.com/CocoaPods/Specs"])'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/fastlane/actions/pod_push.rb', line 84

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

.return_valueObject



76
77
78
# File 'lib/fastlane/actions/pod_push.rb', line 76

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
# File 'lib/fastlane/actions/pod_push.rb', line 4

def self.run(params)
  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[:allow_warnings]
    command << " --allow-warnings"
  end

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

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