fastlane-plugin-ios_flavors 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/ios_flavors/actions/create_ipa_flavors.rb +45 -12
- data/lib/fastlane/plugin/ios_flavors/actions/create_sim_flavors.rb +123 -0
- data/lib/fastlane/plugin/ios_flavors/helper/ios_flavors_helper.rb +0 -33
- data/lib/fastlane/plugin/ios_flavors/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7142da69c9365ae2ddb0529d0193a9c624d91d382c3d50de05730d140c3e5c23
|
4
|
+
data.tar.gz: ee07e9021165000d8b7c0a284f5855b93a4e0c8a75d9ada213ada9bc896406b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 155d51aa457a53bdba92352e32a0f72538ae6685546c580fcbcd7c7e3f5d2bc9a3b4de95b7e6c619f840027946fcf277a5b9d94081af96631dd2538c6f3c4ce4
|
7
|
+
data.tar.gz: c73c7ac047f47f6d10937045875e92fa4b06ddd01f222624f6e062d8bdf40208a7d306f021638223c2dc0c22118274c16414f92af332a25494b5d8b858e54d48
|
@@ -4,8 +4,8 @@ require_relative '../helper/ios_flavors_helper'
|
|
4
4
|
module Fastlane
|
5
5
|
module Actions
|
6
6
|
module SharedValues
|
7
|
-
|
8
|
-
|
7
|
+
IOS_FLAVORS_IPA_INPUT = :IOS_FLAVORS_IPA_INPUT
|
8
|
+
IOS_FLAVORS_IPA_OUTPUT = :IOS_FLAVORS_IPA_OUTPUT
|
9
9
|
IOS_FLAVORS_SIGNING_IDENTITY = :IOS_FLAVORS_SIGNING_IDENTITY
|
10
10
|
IOS_FLAVORS_PROVISIONING_PROFILE = :IOS_FLAVORS_PROVISIONING_PROFILE
|
11
11
|
end
|
@@ -13,7 +13,7 @@ module Fastlane
|
|
13
13
|
class CreateIpaFlavorsAction < Action
|
14
14
|
def self.run(params)
|
15
15
|
Helper::IOSFlavorsHelper.verify_dependencies
|
16
|
-
params =
|
16
|
+
params = parse_params(params)
|
17
17
|
create_flavors_from(ipa: params[:ipa], target_plist: params[:target_plist])
|
18
18
|
end
|
19
19
|
|
@@ -27,8 +27,8 @@ module Fastlane
|
|
27
27
|
|
28
28
|
def self.output
|
29
29
|
[
|
30
|
-
['
|
31
|
-
['
|
30
|
+
['IOS_FLAVORS_IPA_INPUT', 'The input .ipa file'],
|
31
|
+
['IOS_FLAVORS_IPA_OUTPUT', 'The output directory containing flavors'],
|
32
32
|
['IOS_FLAVORS_SIGNING_IDENTITY', 'The signing identity used to sign flavors'],
|
33
33
|
['IOS_FLAVORS_PROVISIONING_PROFILE', 'The provisioning profile used to sign flavors']
|
34
34
|
]
|
@@ -43,7 +43,7 @@ module Fastlane
|
|
43
43
|
type: String),
|
44
44
|
|
45
45
|
FastlaneCore::ConfigItem.new(key: :flavors,
|
46
|
-
env_name: "
|
46
|
+
env_name: "IOS_FLAVORS_DIRECTORY",
|
47
47
|
description: "The directory containing .plist files to use to create your flavors",
|
48
48
|
default_value: "fastlane/flavors",
|
49
49
|
optional: true,
|
@@ -81,9 +81,42 @@ module Fastlane
|
|
81
81
|
[:ios].include?(platform)
|
82
82
|
end
|
83
83
|
|
84
|
+
def self.parse_params(params)
|
85
|
+
ipa = params[:ipa] || lane_context[SharedValues::IPA_OUTPUT_PATH]
|
86
|
+
flavors = params[:flavors] || 'flavors'
|
87
|
+
output_directory = params[:output_directory] || 'build_output/flavors'
|
88
|
+
target_plist = params[:target_plist] || 'Info.plist'
|
89
|
+
signing_identity = params[:signing_identity]
|
90
|
+
provisioning_profile = params[:provisioning_profile] || Helper::IOSFlavorsHelper.locate_installed_provisioning_profile_for_ipa(params[:ipa]) || lane_context[SharedValues::SIGH_PROFILE_PATH]
|
91
|
+
|
92
|
+
raise "You must supply an :ipa (can be omitted if using 'ipa')" unless ipa
|
93
|
+
raise 'You must supply a :flavors directory of .plist files.' unless flavors
|
94
|
+
raise 'You must supply a :target_plist to be replaced in the :ipa.' unless target_plist
|
95
|
+
raise 'You must supply a :signing_identity' unless signing_identity
|
96
|
+
raise "Could not locate a :provisioning_profile for the :ipa provided." unless provisioning_profile
|
97
|
+
|
98
|
+
raise "#{ipa} not found." unless File.file?(ipa)
|
99
|
+
raise "#{flavors} not found." unless Dir.exist?(flavors)
|
100
|
+
# TODO: Add check for signing_identity validity?
|
101
|
+
raise "#{provisioning_profile} not found." unless File.file?(provisioning_profile)
|
102
|
+
|
103
|
+
lane_context[SharedValues::IOS_FLAVORS_IPA_INPUT] = File.expand_path(flavors)
|
104
|
+
lane_context[SharedValues::IOS_FLAVORS_IPA_OUTPUT] = File.expand_path(output_directory)
|
105
|
+
lane_context[SharedValues::IOS_FLAVORS_SIGNING_IDENTITY] = signing_identity
|
106
|
+
lane_context[SharedValues::IOS_FLAVORS_PROVISIONING_PROFILE] = File.expand_path(provisioning_profile)
|
107
|
+
|
108
|
+
return {
|
109
|
+
ipa: File.expand_path(ipa),
|
110
|
+
flavors: flavors,
|
111
|
+
target_plist: target_plist,
|
112
|
+
signing_identity: signing_identity,
|
113
|
+
provisioning_profile: provisioning_profile
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
84
117
|
def self.create_flavors_from(ipa:, target_plist:)
|
85
|
-
input_directory =
|
86
|
-
output_directory =
|
118
|
+
input_directory = lane_context[SharedValues::IOS_FLAVORS_IPA_INPUT]
|
119
|
+
output_directory = lane_context[SharedValues::IOS_FLAVORS_IPA_OUTPUT]
|
87
120
|
|
88
121
|
FileUtils.mkdir_p(output_directory)
|
89
122
|
|
@@ -93,9 +126,9 @@ module Fastlane
|
|
93
126
|
end
|
94
127
|
|
95
128
|
def self.create_flavor_ipa(ipa:, plist:, target_plist:)
|
96
|
-
output_directory =
|
97
|
-
signing_identity =
|
98
|
-
provisioning_profile =
|
129
|
+
output_directory = lane_context[SharedValues::IOS_FLAVORS_IPA_OUTPUT]
|
130
|
+
signing_identity = lane_context[SharedValues::IOS_FLAVORS_SIGNING_IDENTITY]
|
131
|
+
provisioning_profile = lane_context[SharedValues::IOS_FLAVORS_PROVISIONING_PROFILE]
|
99
132
|
|
100
133
|
expanded = {
|
101
134
|
plist: File.expand_path(plist)
|
@@ -107,7 +140,7 @@ module Fastlane
|
|
107
140
|
UI.header "Flavor: #{output_filename}"
|
108
141
|
|
109
142
|
UI.message "Copying #{ipa} to #{output_ipa}"
|
110
|
-
FileUtils.
|
143
|
+
FileUtils.cp_r(ipa, output_ipa, remove_destination: true)
|
111
144
|
|
112
145
|
UI.message "Replacing #{target_plist} with #{plist}"
|
113
146
|
other_action.act(
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/ios_flavors_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
IOS_FLAVORS_APP_INPUT = :IOS_FLAVORS_APP_INPUT
|
8
|
+
IOS_FLAVORS_APP_OUTPUT = :IOS_FLAVORS_APP_OUTPUT
|
9
|
+
end
|
10
|
+
|
11
|
+
class CreateSimFlavorsAction < Action
|
12
|
+
def self.run(params)
|
13
|
+
Helper::IOSFlavorsHelper.verify_dependencies
|
14
|
+
params = parse_params(params)
|
15
|
+
create_flavors_from(app: params[:app], target_plist: params[:target_plist])
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.description
|
19
|
+
"Create multiple build flavors of an iOS .app (for the simulator) using a directory of .plist files"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.authors
|
23
|
+
["Zachary Davison"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.output
|
27
|
+
[
|
28
|
+
['IOS_FLAVORS_APP_INPUT', 'The input .app file'],
|
29
|
+
['IOS_FLAVORS_APP_OUTPUT', 'The output directory containing flavors']
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.available_options
|
34
|
+
[
|
35
|
+
FastlaneCore::ConfigItem.new(key: :app,
|
36
|
+
env_name: "IOS_FLAVORS_APP",
|
37
|
+
description: "The .app file to use as a basis for creating your flavors",
|
38
|
+
optional: false,
|
39
|
+
type: String),
|
40
|
+
|
41
|
+
FastlaneCore::ConfigItem.new(key: :flavors,
|
42
|
+
env_name: "IOS_FLAVORS_DIRECTORY",
|
43
|
+
description: "The directory containing .plist files to use to create your flavors",
|
44
|
+
default_value: "fastlane/flavors",
|
45
|
+
optional: true,
|
46
|
+
type: String),
|
47
|
+
|
48
|
+
FastlaneCore::ConfigItem.new(key: :output_directory,
|
49
|
+
env_name: "IOS_FLAVORS_OUTPUT",
|
50
|
+
description: "The output flavors directory",
|
51
|
+
default_value: "fastlane/build_output/flavors",
|
52
|
+
optional: true,
|
53
|
+
type: String),
|
54
|
+
|
55
|
+
FastlaneCore::ConfigItem.new(key: :target_plist,
|
56
|
+
env_name: "IOS_FLAVORS_TARGET_PLIST",
|
57
|
+
description: "The name of the .plist file to overwrite with your flavor .plist",
|
58
|
+
default_value: "Info.plist",
|
59
|
+
optional: true,
|
60
|
+
type: String)
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.is_supported?(platform)
|
65
|
+
[:ios].include?(platform)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.parse_params(params)
|
69
|
+
app = params[:app]
|
70
|
+
flavors = params[:flavors] || 'flavors'
|
71
|
+
output_directory = params[:output_directory] || 'build_output/flavors'
|
72
|
+
target_plist = params[:target_plist] || 'Info.plist'
|
73
|
+
|
74
|
+
raise "You must supply an :app." unless app
|
75
|
+
raise 'You must supply a :flavors directory of .plist files.' unless flavors
|
76
|
+
raise 'You must supply a :target_plist to be replaced in the :app.' unless target_plist
|
77
|
+
|
78
|
+
raise "#{app} not found." unless Dir.exist?(app)
|
79
|
+
raise "#{flavors} not found." unless Dir.exist?(flavors)
|
80
|
+
|
81
|
+
lane_context[SharedValues::IOS_FLAVORS_APP_INPUT] = File.expand_path(flavors)
|
82
|
+
lane_context[SharedValues::IOS_FLAVORS_APP_OUTPUT] = File.expand_path(output_directory)
|
83
|
+
|
84
|
+
return {
|
85
|
+
app: File.expand_path(app),
|
86
|
+
flavors: flavors,
|
87
|
+
target_plist: target_plist
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.create_flavors_from(app:, target_plist:)
|
92
|
+
input_directory = Actions.lane_context[SharedValues::IOS_FLAVORS_APP_INPUT]
|
93
|
+
output_directory = Actions.lane_context[SharedValues::IOS_FLAVORS_APP_OUTPUT]
|
94
|
+
|
95
|
+
FileUtils.mkdir_p(output_directory)
|
96
|
+
|
97
|
+
Dir["#{input_directory}/*.plist"].each do |flavor|
|
98
|
+
self.create_flavor_app(app: app, plist: flavor, target_plist: target_plist)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.create_flavor_app(app:, plist:, target_plist:)
|
103
|
+
output_directory = Actions.lane_context[SharedValues::IOS_FLAVORS_APP_OUTPUT]
|
104
|
+
|
105
|
+
expanded = {
|
106
|
+
plist: File.expand_path(plist)
|
107
|
+
}
|
108
|
+
|
109
|
+
output_filename = File.basename(plist, '.plist')
|
110
|
+
output_app = "#{output_directory}/#{output_filename}.app"
|
111
|
+
|
112
|
+
UI.header "Flavor: #{output_filename}"
|
113
|
+
|
114
|
+
UI.message "Copying #{app} to #{output_app}"
|
115
|
+
FileUtils.cp_r(app, output_app, remove_destination: true)
|
116
|
+
|
117
|
+
UI.message "Replacing #{output_app}/#{target_plist} with #{plist}"
|
118
|
+
FileUtils.cp_r(expanded[:plist],"#{output_app}/#{target_plist}", remove_destination: true)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
@@ -12,39 +12,6 @@ module Fastlane
|
|
12
12
|
raise 'fastlane-plugin-act is required.' unless defined?(Fastlane::Actions::ActAction)
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.parse_params(params)
|
16
|
-
ipa = params[:ipa] || Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH]
|
17
|
-
flavors = params[:flavors] || 'flavors'
|
18
|
-
output_directory = params[:output_directory] || 'build_output/flavors'
|
19
|
-
target_plist = params[:target_plist] || 'Info.plist'
|
20
|
-
signing_identity = params[:signing_identity]
|
21
|
-
provisioning_profile = params[:provisioning_profile] || locate_installed_provisioning_profile_for_ipa(params[:ipa]) || Actions.lane_context[Actions::SharedValues::SIGH_PROFILE_PATH]
|
22
|
-
|
23
|
-
raise "You must supply an :ipa (can be omitted if using 'ipa')" unless ipa
|
24
|
-
raise 'You must supply a :flavors directory of .plist files.' unless flavors
|
25
|
-
raise 'You must supply a :target_plist to be replaced in the :ipa.' unless flavors
|
26
|
-
raise 'You must supply a :signing_identity' unless signing_identity
|
27
|
-
raise "Could not locate a :provisioning_profile for the :ipa provided." unless provisioning_profile
|
28
|
-
|
29
|
-
raise "#{ipa} not found." unless File.file?(ipa)
|
30
|
-
raise "#{flavors} not found." unless Dir.exist?(flavors)
|
31
|
-
# TODO: Add check for signing_identity validity?
|
32
|
-
raise "#{provisioning_profile} not found." unless File.file?(provisioning_profile)
|
33
|
-
|
34
|
-
Actions.lane_context[Actions::SharedValues::IOS_FLAVORS_INPUT] = File.expand_path(flavors)
|
35
|
-
Actions.lane_context[Actions::SharedValues::IOS_FLAVORS_OUTPUT] = File.expand_path(output_directory)
|
36
|
-
Actions.lane_context[Actions::SharedValues::IOS_FLAVORS_SIGNING_IDENTITY] = signing_identity
|
37
|
-
Actions.lane_context[Actions::SharedValues::IOS_FLAVORS_PROVISIONING_PROFILE] = File.expand_path(provisioning_profile)
|
38
|
-
|
39
|
-
return {
|
40
|
-
ipa: File.expand_path(ipa),
|
41
|
-
flavors: flavors,
|
42
|
-
target_plist: target_plist,
|
43
|
-
signing_identity: signing_identity,
|
44
|
-
provisioning_profile: provisioning_profile
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
15
|
def self.locate_installed_provisioning_profile_for_ipa(path)
|
49
16
|
|
50
17
|
working_directory = Dir.pwd
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-ios_flavors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Davison
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- README.md
|
161
161
|
- lib/fastlane/plugin/ios_flavors.rb
|
162
162
|
- lib/fastlane/plugin/ios_flavors/actions/create_ipa_flavors.rb
|
163
|
+
- lib/fastlane/plugin/ios_flavors/actions/create_sim_flavors.rb
|
163
164
|
- lib/fastlane/plugin/ios_flavors/helper/ios_flavors_helper.rb
|
164
165
|
- lib/fastlane/plugin/ios_flavors/version.rb
|
165
166
|
homepage: https://github.com/zdavison/fastlane-plugin-ios_flavors
|