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



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

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

.available_optionsObject



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

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)

  ]
end

.descriptionObject



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

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

.detailsObject



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

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_file_generator_action.rb', line 73

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

.return_valueObject



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

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
# 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]
  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