fastlane-plugin-pod_spec_generator 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 030c121fb95de7ecb68b24fb7fb7de91c087548d9bce3e0d1e3019c2b7cb8585
4
- data.tar.gz: 1b1fed0b388162b44d9ea9730a632aacaf1efdd284f2a8ed23f55be5b5449fcb
3
+ metadata.gz: 990680109f16f7fcadda9de2c11f5aa258b4630b2494c69ba586cb59d4607a81
4
+ data.tar.gz: 48c10a9a71c29d8036459f1fb6b35ba5e8b7abafd83770c497b725fa9b375171
5
5
  SHA512:
6
- metadata.gz: cc85d77599f2aae2f7086b678c5ae9d53511e7edd3e8c725eb3e7f4d30303a526334c01bf8f0e04789f947fd5a0d61377c784b0379a22887a7a94d4d28070106
7
- data.tar.gz: 21f9cddf3181a6816b68d9bf31ba67479a66ddc5abfbf6c88350f44f71a4525b2f4e355ea1c6c061566dad3d665dc86a0855a9a923f38d8180409e7799bd31c7
6
+ metadata.gz: 73709bffdb3691df658d6caf9234a2490d16388f6ce9bf552ebbc49306dfeea45ce6bcb0f453a6c68c51d1572c9bb5060ecce2bb851477e82cb1815f6c4bb205
7
+ data.tar.gz: bb1151ad542fe883b67cc6005138ec0a0cf5f853f7b3ceb4799b38092cdd48dd283ee3e549ccfbad2b08a25a6f79dc30baf9f3678c10ee431048e14d5bd6accc
@@ -107,7 +107,3 @@ class Pod::Podfile
107
107
  end
108
108
  end
109
109
  end
110
-
111
- # class Pod::Podfile
112
- # prepend PodFileExtension
113
- # end
@@ -7,9 +7,15 @@ module Fastlane
7
7
 
8
8
  def self.run(params)
9
9
  builder = PodFileBuilder.new
10
- builder.apply_local_spm_fix = params[:apply_local_spm_fix] ? true : false
10
+ builder.apply_local_spm_fix = params[:apply_local_spm_fix]
11
11
  builder.targets = params[:targets]
12
- builder.use_frameworks = params[:use_frameworks] ? true : false
12
+ builder.use_frameworks = params[:use_frameworks]
13
+ if params[:platform]
14
+ builder.platform = params[:platform].reduce([]) do |content, pair|
15
+ content += [":#{pair[0]}", pair[1]]
16
+ end
17
+ end
18
+
13
19
  output = builder.build_pod_file_string
14
20
  File.write("#{params[:folder]}/Podfile", output)
15
21
 
@@ -36,13 +42,15 @@ module Fastlane
36
42
  FastlaneCore::ConfigItem.new(key: :use_frameworks,
37
43
  env_name: "POD_FILE_GENERATOR_VERSION",
38
44
  description: "Version String",
45
+ is_string: false,
39
46
  default_value: true,
40
47
  optional: true),
41
48
  FastlaneCore::ConfigItem.new(key: :apply_local_spm_fix,
42
49
  env_name: "POD_LOCAL_SPM",
43
50
  description: "Use local spm",
44
- optional: true,
45
- type: String),
51
+ is_string: false,
52
+ default_value: false,
53
+ optional: true),
46
54
  FastlaneCore::ConfigItem.new(key: :targets,
47
55
  description: "Targets",
48
56
  optional: false,
@@ -51,7 +59,13 @@ module Fastlane
51
59
  env_name: "POD_FILE_GENERATOR_FOLDER",
52
60
  description: "Folder for the file String",
53
61
  optional: false,
54
- type: String)
62
+ type: String),
63
+ FastlaneCore::ConfigItem.new(key: :platform,
64
+ env_name: "POD_FILE_GENERATOR_PLATFORM",
65
+ description: "Platform",
66
+ default_value: {ios: "14.0"},
67
+ optional: true,
68
+ type: Hash)
55
69
 
56
70
  ]
57
71
  end
@@ -25,6 +25,11 @@ module Fastlane
25
25
  builder.platform = params[:platform].reduce([]) do |content, pair|
26
26
  content += pair
27
27
  end
28
+ (params[:subspecs]).each do |dep|
29
+ puts(dep)
30
+ builder.add_subspec(dep[:name], dep[:local_files], dep[:dependencies])
31
+ end
32
+ builder.static_framework = params[:static_framework]
28
33
 
29
34
  output = builder.build_pod_spec_string
30
35
  File.write("#{params[:folder]}/#{params[:name]}.podspec", output)
@@ -118,7 +123,17 @@ module Fastlane
118
123
  description: "Local spm dependencies",
119
124
  default_value: [],
120
125
  optional: true,
121
- type: Array)
126
+ type: Array),
127
+ FastlaneCore::ConfigItem.new(key: :subspecs,
128
+ description: "Additional subspecs",
129
+ default_value: [],
130
+ optional: true,
131
+ type: Array),
132
+ FastlaneCore::ConfigItem.new(key: :static_framework,
133
+ description: "Static Framework",
134
+ default_value: false,
135
+ optional: true,
136
+ is_string: false)
122
137
 
123
138
  ]
124
139
  end
@@ -3,16 +3,19 @@
3
3
  class PodFileBuilder
4
4
  attr_writer :use_frameworks,
5
5
  :targets,
6
- :apply_local_spm_fix
6
+ :apply_local_spm_fix,
7
+ :platform
7
8
 
8
9
  def initialize
9
10
  @use_frameworks = true
10
11
  @targets = []
11
12
  @apply_local_spm_fix = false
13
+ @platform = nil
12
14
  end
13
15
 
14
16
  def build_pod_file_string
15
17
  [use_frameworks_string,
18
+ platform,
16
19
  apply_local_spm_fix_string,
17
20
  targets_string,
18
21
  ].compact
@@ -27,6 +30,10 @@ class PodFileBuilder
27
30
  end
28
31
  end
29
32
 
33
+ def platform
34
+ return nil unless @platform
35
+ "platform #{@platform.join(", ")}"
36
+ end
30
37
  def create_target_string(target)
31
38
  start = "target '#{target[:name]}' do"
32
39
  dependencies = target[:dependencies].map do |dependency|
@@ -42,6 +49,7 @@ class PodFileBuilder
42
49
 
43
50
  def apply_local_spm_fix_string
44
51
  return "plugin 'fastlane-plugin-pod_spec_generator'" if @apply_local_spm_fix
52
+
45
53
  return nil
46
54
  end
47
55
  def use_frameworks_string
@@ -14,7 +14,8 @@ class PodSpecBuilder
14
14
  :source_files,
15
15
  :source,
16
16
  :dependencies,
17
- :spm_local_dependencies
17
+ :spm_local_dependencies,
18
+ :static_framework
18
19
 
19
20
 
20
21
  def initialize
@@ -32,15 +33,18 @@ class PodSpecBuilder
32
33
  @source_files = nil
33
34
  @source = nil
34
35
  @spm_local_dependencies = []
36
+ @static_framework = false
35
37
  end
36
38
 
37
39
  def build_pod_spec_string
38
40
  [start_of_spec,
39
41
  podspec_content_setting_string,
42
+ static_framework_string,
40
43
  generate_dependencies(@dependencies),
44
+ subscpecs_string,
41
45
  generate_local_spm_dependencies(@spm_local_dependencies),
42
46
  end_of_spec
43
- ].reject { |s| s.empty? }.join("\n")
47
+ ].compact.reject { |s| s.empty? }.join("\n")
44
48
  end
45
49
 
46
50
  def add_dependency(name, version = nil)
@@ -72,13 +76,15 @@ class PodSpecBuilder
72
76
  hash = {}
73
77
  instance_variables.reject { |var| exclude(var) }
74
78
  .each { |var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
75
-
76
79
  hash.compact.reject { |_k, v| v.empty? }
77
80
  end
78
81
 
79
-
82
+ def static_framework_string
83
+ return "\ts.static_framework = true" if @static_framework
84
+ nil
85
+ end
80
86
  def exclude(variable)
81
- %w[@subspecs @dependencies @spm_local_dependencies].include? variable.to_s
87
+ %w[@subscpecs @dependencies @spm_local_dependencies @static_framework].include? variable.to_s
82
88
  end
83
89
  def content(items)
84
90
  items.reject(&:empty?).reduce(String.new) do |content, item|
@@ -86,8 +92,6 @@ class PodSpecBuilder
86
92
  end
87
93
  end
88
94
 
89
-
90
-
91
95
  def subscpecs_string
92
96
  @subscpecs.reduce(String.new) do |content, subscpec|
93
97
  content += "#{subspec_string(subscpec)}\n"
@@ -95,16 +99,14 @@ class PodSpecBuilder
95
99
  end
96
100
 
97
101
  def subspec_string(sub)
98
- "
99
- s.subspec '#{sub[:name]}' do |s|
100
- #{generate_dependencies(sub[:dependencies])}
101
- end
102
- "
102
+ "\n\ts.subspec '#{sub[:name]}' do |s|"\
103
+ "\n\t\ts.source_files = #{sub[:local_files]}#{generate_dependencies(sub[:dependencies],"\t")}" \
104
+ "\n\tend"
103
105
  end
104
106
 
105
- def generate_dependencies(dependencies)
107
+ def generate_dependencies(dependencies, allignment = "")
106
108
  dependencies.reduce(String.new) do |content, dep|
107
- dependency = "\n\ts.dependency '#{dep[:name]}'"
109
+ dependency = "\n#{allignment}\ts.dependency '#{dep[:name]}'"
108
110
  vers = dep[:version] ? "'#{dep[:version]}'" : nil
109
111
  out = [dependency, vers].compact.join(", ~>")
110
112
  content += "#{out}"
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module PodSpecGenerator
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-pod_spec_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Crowe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods