Class: Fastlane::Actions::PodSpecGeneratorAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



42
43
44
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_spec_generator_action.rb', line 42

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

.available_optionsObject



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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_spec_generator_action.rb', line 54

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: "POD_SPEC_GENERATOR_VERSION",
                                 description: "Version String",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :summary,
                                 env_name: "POD_SPEC_GENERATOR_SUMMARY",
                                 description: "Summary String",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :description,
                                 env_name: "POD_SPEC_GENERATOR_DESCRIPTION",
                                 description: "Description String",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :name,
                                 env_name: "POD_SPEC_GENERATOR_NAME",
                                 description: "Pod Name String",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :homepage,
                                 env_name: "POD_SPEC_GENERATOR_HOMEPAGE",
                                 description: "Homepage",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :license,
                                 description: "License Object",
                                 default_value: { type: "MIT", file: "LICENSE" },
                                 optional: false,
                                 type: Hash),
    FastlaneCore::ConfigItem.new(key: :dependencies,
                                 description: "Dependencies array",
                                 default_value: [],
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :source,
                                 description: "Source",
                                 optional: true,
                                 type: Hash),
    FastlaneCore::ConfigItem.new(key: :author,
                                 description: "Author",
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :source_files,
                                 description: "Source Files",
                                 default_value: [],
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :swift_version,
                                 env_name: "POD_SPEC_GENERATOR_SWIFT_VERSION",
                                 description: "Source Files",
                                 default_value: "5.9",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :folder,
                                 env_name: "POD_SPEC_GENERATOR_FOLDER",
                                 description: "Folder for the file String",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :platform,
                                 env_name: "POD_SPEC_GENERATOR_PLATFORM",
                                 description: "Platform",
                                 default_value: {ios: "14.0"},
                                 optional: true,
                                 type: Hash),
    FastlaneCore::ConfigItem.new(key: :spm_local_dependencies,
                                 description: "Local spm dependencies",
                                 default_value: [],
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :subspecs,
                                 description: "Additional subspecs",
                                 default_value: [],
                                 optional: true,
                                 type: Array),
    FastlaneCore::ConfigItem.new(key: :static_framework,
                                 description: "Static Framework",
                                 default_value: false,
                                 optional: true,
                                 is_string: false),
    FastlaneCore::ConfigItem.new(key: :vendored_frameworks,
                                 description: "Vendored Framework",
                                 default_value: nil,
                                 optional: true,
                                 type: String)


  ]
end

.descriptionObject



38
39
40
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_spec_generator_action.rb', line 38

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

.detailsObject



50
51
52
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_spec_generator_action.rb', line 50

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_spec_generator_action.rb', line 145

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

.return_valueObject



46
47
48
# File 'lib/fastlane/plugin/pod_spec_generator/actions/pod_spec_generator_action.rb', line 46

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

.run(params) ⇒ Object



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

def self.run(params)
  builder = PodSpecBuilder.new
  builder.author = params[:author]
  builder.version = params[:version]
  builder.summary = params[:summary]
  builder.name = params[:name]
  builder.description = params[:description]
  builder.homepage = params[:homepage]
  builder.license = params[:license]
  (params[:dependencies]).each do |dep|
    builder.add_dependency(dep[:name], dep[:version])
  end
  builder.source = params[:source]
  builder.source_files = params[:source_files]
  builder.swift_version = params[:swift_version]
  builder.spm_local_dependencies = params[:spm_local_dependencies]
  builder.platform = params[:platform].reduce([]) do |content, pair|
    content += pair
  end
  (params[:subspecs] || []).each do |dep|
    builder.add_subspec(dep[:name], dep[:local_files], dep[:dependencies])
  end
  builder.static_framework = params[:static_framework]
  builder.vendored_frameworks = params[:vendored_frameworks]
  output = builder.build_pod_spec_string
  File.write("#{params[:folder]}/#{params[:name]}.podspec", output)

end