Class: Fastlane::Actions::ReadPodspecAction

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

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, method_missing, other_action, return_value, sh, step_text

Class Method Details

.authorsObject



56
57
58
# File 'lib/fastlane/actions/read_podspec.rb', line 56

def self.authors
  ["czechboy0"]
end

.available_optionsObject



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fastlane/actions/read_podspec.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "FL_READ_PODSPEC_PATH",
                                 description: "Path to the podspec to be read",
                                 default_value: Dir['*.podspec*'].first,
                                 verify_block: proc do |value|
                                   UI.user_error!("File #{value} not found") unless File.exist?(value)
                                 end)
  ]
end

.descriptionObject



26
27
28
# File 'lib/fastlane/actions/read_podspec.rb', line 26

def self.description
  "Loads a CocoaPods spec as JSON"
end

.detailsObject



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

def self.details
  [
    "This can be used for only specifying a version string in your podspec",
    "- and during your release process you'd read it from the podspec by running",
    "`version = read_podspec['version']` at the beginning of your lane"
  ].join("\n")
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/fastlane/actions/read_podspec.rb', line 60

def self.is_supported?(platform)
  true
end

.outputObject



50
51
52
53
54
# File 'lib/fastlane/actions/read_podspec.rb', line 50

def self.output
  [
    ['READ_PODSPEC_JSON', 'Podspec JSON payload']
  ]
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/actions/read_podspec.rb', line 8

def self.run(params)
  Actions.verify_gem!('cocoapods')

  path = params[:path]

  require 'cocoapods-core'
  spec = Pod::Spec.from_file(path).to_hash

  UI.success("Reading podspec from file #{path}")

  Actions.lane_context[SharedValues::READ_PODSPEC_JSON] = spec
  return spec
end