Class: Fastlane::Actions::PodFileGeneratorAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



29
30
31
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 29

def self.authors
  ["Swift Gurus / Alex Crowe"]
end

.available_optionsObject



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
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 41

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :use_frameworks,
                                 env_name: "POD_FILE_GENERATOR_VERSION",
                                 description: "Version String",
                                 is_string: false,
                                 default_value: true,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :apply_local_spm_fix,
                                 env_name: "POD_LOCAL_SPM",
                                 description: "Use local spm",
                                 is_string: false,
                                 default_value: false,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :targets,
                                 description: "Targets",
                                 optional: false,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :folder,
                                 env_name: "POD_FILE_GENERATOR_FOLDER",
                                 description: "Folder for the file String",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :platform,
                                 env_name: "POD_FILE_GENERATOR_PLATFORM",
                                 description: "Platform",
                                 default_value: {ios: "14.0"},
                                 optional: true,
                                 type: Hash),
    FastlaneCore::ConfigItem.new(key: :source_urls,
                                 env_name: "POD_FILE_GENERATOR_SOURCE_URLS",
                                 description: "Podspec source URLs",
                                 default_value: [],
                                 optional: true,
                                 type: Array)

  ]
end

.descriptionObject



25
26
27
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 25

def self.description
  "Generate a simple pod spec for CI automation"
end

.detailsObject



37
38
39
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 37

def self.details
  "Generate a simple pod file for CI automation, local and prod specs"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 80

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

.return_valueObject



33
34
35
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 33

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 8

def self.run(params)
  builder = PodFileBuilder.new
  builder.apply_local_spm_fix = params[:apply_local_spm_fix]
  builder.targets = params[:targets]
  builder.use_frameworks = params[:use_frameworks]
  builder.source_urls = params[:source_urls] || []
  if params[:platform]
    builder.platform = params[:platform].reduce([]) do |content, pair|
      content += [":#{pair[0]}", pair[1]]
    end
  end

  output = builder.build_pod_file_string
  File.write("#{params[:folder]}/Podfile", output)

end