fastlane-plugin-ci_apps 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 99a8b05838270c80209d4b9ba4427186d9892d96d0eeadfa8dfc014a82e1493e
4
+ data.tar.gz: fb9d3b7f682795e787daa6e166f581d83d127d33580aa9ebc1e216bd9d1fd468
5
+ SHA512:
6
+ metadata.gz: a6653e536d7c83200729d4cedc03aeba454f08eab076c9eacae481af58830e40cb1f319c7a9ac361580897764dae28f1c6ec181bf8892725e26545ce02f4eb59
7
+ data.tar.gz: 4d09758375e728ed2a8f6665631117f60f92b8e31cbc4818ff4b0f2e562fce47955bb8af3b4924a9172aa03a314e3e7580738869a41471865f8a3f48a8575ac2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 JiaqiangSong <songjiaqiang@faceu.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # ci_apps plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-ci_apps)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-ci_apps`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin ci_apps
11
+ ```
12
+
13
+ ## About ci_apps
14
+
15
+ Config multiple apps of CI
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
+
23
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,47 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/ci_apps_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class CiAppsAction < Action
7
+ def self.run(params)
8
+ UI.message("The ci_apps plugin is working!")
9
+ end
10
+
11
+ def self.description
12
+ "Config multiple apps of CI"
13
+ end
14
+
15
+ def self.authors
16
+ ["JiaqiangSong"]
17
+ end
18
+
19
+ def self.return_value
20
+ # If your method provides a return value, you can describe here what it does
21
+ end
22
+
23
+ def self.details
24
+ # Optional:
25
+ "Config multiple apps of CI"
26
+ end
27
+
28
+ def self.available_options
29
+ [
30
+ # FastlaneCore::ConfigItem.new(key: :your_option,
31
+ # env_name: "CI_APPS_YOUR_OPTION",
32
+ # description: "A description of your option",
33
+ # optional: false,
34
+ # type: String)
35
+ ]
36
+ end
37
+
38
+ def self.is_supported?(platform)
39
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
40
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
41
+ #
42
+ # [:ios, :mac, :android].include?(platform)
43
+ true
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,125 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_CI_APP_CUSTOM_VALUE = :GET_CI_APP_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetCiAppAction < Action
8
+ require 'xcodeproj'
9
+ require 'pathname'
10
+
11
+ def self.run(params)
12
+ ciApps = get_ci_apps(params)
13
+ ciApps.each do |app|
14
+ if app["APP_ID"] == params[:app_id] then
15
+ return app
16
+ end
17
+ end
18
+ end
19
+
20
+ def self.find_project(params)
21
+ project = Xcodeproj::Project.open(params[:xcodeproj])
22
+ project
23
+ end
24
+
25
+ def self.find_target(params)
26
+ project = find_project(params)
27
+ if params[:target]
28
+ target = project.targets.detect { |t| t.name == params[:target] }
29
+ target
30
+ else
31
+ # firstly we are trying to find modern application target
32
+ target = project.targets.detect do |t|
33
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
34
+ t.product_type == 'com.apple.product-type.application'
35
+ end
36
+ target = project.targets[0] if target.nil?
37
+ target
38
+ end
39
+ end
40
+
41
+ def self.find_info(params, is_absolute=false)
42
+ project = find_project(params)
43
+ target = find_target(params)
44
+ buildConfiguration = target.build_settings("Release")
45
+ filePath = buildConfiguration["INFOPLIST_FILE"]
46
+ if is_absolute then
47
+ filePath = File.join(Pathname.new(project.path).parent.to_path, filePath)
48
+ end
49
+ filePath
50
+ end
51
+
52
+ def self.get_ci_apps(params)
53
+ infoPlistPath = find_info(params)
54
+ info = Xcodeproj::Plist.read_from_path(infoPlistPath)
55
+ ciAPPs = info["CI_APPS"]
56
+ ciAPPs
57
+ end
58
+
59
+ #####################################################
60
+ # @!group Documentation
61
+ #####################################################
62
+
63
+ def self.description
64
+ "A short description with <= 80 characters of what this action does"
65
+ end
66
+
67
+ def self.details
68
+ # Optional:
69
+ # this is your chance to provide a more detailed description of this action
70
+ "You can use this action to do cool things..."
71
+ end
72
+
73
+ def self.available_options
74
+ [
75
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
76
+ env_name: "FL_GET_CI_APP_PROJECT",
77
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
78
+ optional: true,
79
+ verify_block: proc do |value|
80
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
81
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
82
+ end),
83
+ FastlaneCore::ConfigItem.new(key: :target,
84
+ env_name: "FL_GET_CI_APP_TARGET",
85
+ conflicting_options: [:scheme],
86
+ description: "Specify a specific target if you have multiple per project, optional"),
87
+ FastlaneCore::ConfigItem.new(key: :app_id,
88
+ env_name: "FL_GET_CI_APP_APP_ID",
89
+ description: "You must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
90
+ optional: false)
91
+ ]
92
+ end
93
+
94
+ def self.output
95
+ # Define the shared values you are going to provide
96
+ # Example
97
+ [
98
+ ['GET_CI_APP_CUSTOM_VALUE', 'A description of what this value contains']
99
+ ]
100
+ end
101
+
102
+ def self.return_value
103
+ # If your method provides a return value, you can describe here what it does
104
+ end
105
+
106
+ def self.authors
107
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
108
+ ["Your GitHub/Twitter Name"]
109
+ end
110
+
111
+ def self.is_supported?(platform)
112
+ # you can do things like
113
+ #
114
+ # true
115
+ #
116
+ # platform == :ios
117
+ #
118
+ # [:ios, :mac].include?(platform)
119
+ #
120
+
121
+ platform == :ios
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,135 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_CI_APP_VALUE_CUSTOM_VALUE = :GET_CI_APP_VALUE_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetCiAppValueAction < Action
8
+ require 'xcodeproj'
9
+ require 'pathname'
10
+
11
+ def self.run(params)
12
+ ciApp = get_ci_app(params)
13
+ ci_value = ciApp[params[:ci_key]]
14
+ ci_value
15
+ end
16
+
17
+ def self.find_project(params)
18
+ project = Xcodeproj::Project.open(params[:xcodeproj])
19
+ project
20
+ end
21
+
22
+ def self.find_target(params)
23
+ project = find_project(params)
24
+ if params[:target]
25
+ target = project.targets.detect { |t| t.name == params[:target] }
26
+ target
27
+ else
28
+ # firstly we are trying to find modern application target
29
+ target = project.targets.detect do |t|
30
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
31
+ t.product_type == 'com.apple.product-type.application'
32
+ end
33
+ target = project.targets[0] if target.nil?
34
+ target
35
+ end
36
+ end
37
+
38
+ def self.find_info(params, is_absolute=false)
39
+ project = find_project(params)
40
+ target = find_target(params)
41
+ buildConfiguration = target.build_settings("Release")
42
+ filePath = buildConfiguration["INFOPLIST_FILE"]
43
+ if is_absolute then
44
+ filePath = File.join(Pathname.new(project.path).parent.to_path, filePath)
45
+ end
46
+ filePath
47
+ end
48
+
49
+ def self.get_ci_apps(params)
50
+ infoPlistPath = find_info(params)
51
+ info = Xcodeproj::Plist.read_from_path(infoPlistPath)
52
+ ciAPPs = info["CI_APPS"]
53
+ ciAPPs
54
+ end
55
+
56
+ def self.get_ci_app(params)
57
+ ciApps = get_ci_apps(params)
58
+ ciApps.each do |app|
59
+ if app["APP_ID"] == params[:app_id] then
60
+ return app
61
+ end
62
+ end
63
+ end
64
+
65
+ #####################################################
66
+ # @!group Documentation
67
+ #####################################################
68
+
69
+ def self.description
70
+ "A short description with <= 80 characters of what this action does"
71
+ end
72
+
73
+ def self.details
74
+ # Optional:
75
+ # this is your chance to provide a more detailed description of this action
76
+ "You can use this action to do cool things..."
77
+ end
78
+
79
+ def self.available_options
80
+ [
81
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
82
+ env_name: "FL_GET_CI_APP_VALUE_PROJECT",
83
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
84
+ optional: true,
85
+ verify_block: proc do |value|
86
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
87
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
88
+ end),
89
+ FastlaneCore::ConfigItem.new(key: :target,
90
+ env_name: "FL_GET_CI_APP_VALUE_TARGET",
91
+ conflicting_options: [:scheme],
92
+ description: "Specify a specific target if you have multiple per project, optional"),
93
+ FastlaneCore::ConfigItem.new(key: :app_id,
94
+ env_name: "FL_GET_CI_APP_VALUE_APP_ID",
95
+ description: "You must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
96
+ optional: false),
97
+ FastlaneCore::ConfigItem.new(key: :ci_key,
98
+ env_name: "FL_GET_CI_APP_VALUE_CI_KEY",
99
+ description: "You must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
100
+ optional: false)
101
+ ]
102
+ end
103
+
104
+ def self.output
105
+ # Define the shared values you are going to provide
106
+ # Example
107
+ [
108
+ ['GET_CI_APP_VALUE_CUSTOM_VALUE', 'A description of what this value contains']
109
+ ]
110
+ end
111
+
112
+ def self.return_value
113
+ # If your method provides a return value, you can describe here what it does
114
+ end
115
+
116
+ def self.authors
117
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
118
+ ["Your GitHub/Twitter Name"]
119
+ end
120
+
121
+ def self.is_supported?(platform)
122
+ # you can do things like
123
+ #
124
+ # true
125
+ #
126
+ # platform == :ios
127
+ #
128
+ # [:ios, :mac].include?(platform)
129
+ #
130
+
131
+ platform == :ios
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,112 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_CI_APPS_CUSTOM_VALUE = :GET_CI_APPS_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetCiAppsAction < Action
8
+ require 'xcodeproj'
9
+ require 'pathname'
10
+
11
+ def self.run(params)
12
+ infoPlistPath = find_info(params)
13
+ info = Xcodeproj::Plist.read_from_path(infoPlistPath)
14
+ ciAPPs = info["CI_APPS"]
15
+ ciAPPs
16
+ end
17
+
18
+ def self.find_project(params)
19
+ project = Xcodeproj::Project.open(params[:xcodeproj])
20
+ project
21
+ end
22
+
23
+ def self.find_target(params)
24
+ project = find_project(params)
25
+ if params[:target]
26
+ target = project.targets.detect { |t| t.name == params[:target] }
27
+ target
28
+ else
29
+ # firstly we are trying to find modern application target
30
+ target = project.targets.detect do |t|
31
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
32
+ t.product_type == 'com.apple.product-type.application'
33
+ end
34
+ target = project.targets[0] if target.nil?
35
+ target
36
+ end
37
+ end
38
+
39
+ def self.find_info(params, is_absolute=false)
40
+ project = find_project(params)
41
+ target = find_target(params)
42
+ buildConfiguration = target.build_settings("Release")
43
+ filePath = buildConfiguration["INFOPLIST_FILE"]
44
+ if is_absolute then
45
+ filePath = File.join(Pathname.new(project.path).parent.to_path, filePath)
46
+ end
47
+ filePath
48
+ end
49
+
50
+ #####################################################
51
+ # @!group Documentation
52
+ #####################################################
53
+
54
+ def self.description
55
+ "A short description with <= 80 characters of what this action does"
56
+ end
57
+
58
+ def self.details
59
+ # Optional:
60
+ # this is your chance to provide a more detailed description of this action
61
+ "You can use this action to do cool things..."
62
+ end
63
+
64
+ def self.available_options
65
+ [
66
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
67
+ env_name: "FL_GET_CI_APPS_PROJECT",
68
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
69
+ optional: true,
70
+ verify_block: proc do |value|
71
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
72
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
73
+ end),
74
+ FastlaneCore::ConfigItem.new(key: :target,
75
+ env_name: "FL_GET_CI_APPS_TARGET",
76
+ conflicting_options: [:scheme],
77
+ description: "Specify a specific target if you have multiple per project, optional"),
78
+ ]
79
+ end
80
+
81
+ def self.output
82
+ # Define the shared values you are going to provide
83
+ # Example
84
+ [
85
+ ['GET_CI_APPS_CUSTOM_VALUE', 'A description of what this value contains']
86
+ ]
87
+ end
88
+
89
+ def self.return_value
90
+ # If your method provides a return value, you can describe here what it does
91
+ end
92
+
93
+ def self.authors
94
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
95
+ ["Your GitHub/Twitter Name"]
96
+ end
97
+
98
+ def self.is_supported?(platform)
99
+ # you can do things like
100
+ #
101
+ # true
102
+ #
103
+ # platform == :ios
104
+ #
105
+ # [:ios, :mac].include?(platform)
106
+ #
107
+
108
+ platform == :ios
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,133 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_EMTITLEMENTS_PLIST_FILE_PATH_CUSTOM_VALUE = :GET_EMTITLEMENTS_PLIST_FILE_PATH_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetEmtitlementsPlistFilePathAction < Action
8
+ require 'xcodeproj'
9
+ require 'pathname'
10
+
11
+ def self.run(params)
12
+ project = find_project(params)
13
+ target = find_target(params)
14
+ buildConfiguration = target.build_settings("Release")
15
+ filePath = buildConfiguration["CODE_SIGN_ENTITLEMENTS"]
16
+ if params[:is_absolute] then
17
+ filePath = File.join(Pathname.new(project.path).parent.to_path, filePath)
18
+ end
19
+ filePath
20
+ end
21
+
22
+ def self.find_project(params)
23
+ project = Xcodeproj::Project.open(params[:xcodeproj])
24
+ project
25
+ end
26
+
27
+ def self.find_target(params)
28
+ project = find_project(params)
29
+ if params[:target]
30
+ target = project.targets.detect { |t| t.name == params[:target] }
31
+ target
32
+ else
33
+ # firstly we are trying to find modern application target
34
+ target = project.targets.detect do |t|
35
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
36
+ t.product_type == 'com.apple.product-type.application'
37
+ end
38
+ target = project.targets[0] if target.nil?
39
+ target
40
+ end
41
+ end
42
+
43
+ #####################################################
44
+ # @!group Documentation
45
+ #####################################################
46
+
47
+ def self.description
48
+ "A short description with <= 80 characters of what this action does"
49
+ end
50
+
51
+ def self.details
52
+ # Optional:
53
+ # this is your chance to provide a more detailed description of this action
54
+ "You can use this action to do cool things..."
55
+ end
56
+
57
+ def self.available_options
58
+ # Define all options your action supports.
59
+
60
+ # Below a few examples
61
+ [
62
+ FastlaneCore::ConfigItem.new(key: :api_token,
63
+ env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_API_TOKEN", # The name of the environment variable
64
+ description: "API Token for GetEmtitlementsPlistFilePathAction", # a short description of this parameter
65
+ verify_block: proc do |value|
66
+ UI.user_error!("No API token for GetEmtitlementsPlistFilePathAction given, pass using `api_token: 'token'`") unless (value and not value.empty?)
67
+ # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
68
+ end),
69
+ FastlaneCore::ConfigItem.new(key: :development,
70
+ env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_DEVELOPMENT",
71
+ description: "Create a development certificate instead of a distribution one",
72
+ is_string: false, # true: verifies the input is a string, false: every kind of value
73
+ default_value: false) # the default value if the user didn't provide one
74
+ ]
75
+ end
76
+ def self.available_options
77
+ # Define all options your action supports.
78
+
79
+ # Below a few examples
80
+ [
81
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
82
+ env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_XCODEPROJ",
83
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
84
+ optional: true,
85
+ verify_block: proc do |value|
86
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
87
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
88
+ end),
89
+ FastlaneCore::ConfigItem.new(key: :target,
90
+ env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_TARGET",
91
+ conflicting_options: [:scheme],
92
+ description: "Specify a specific target if you have multiple per project, optional"),
93
+ FastlaneCore::ConfigItem.new(key: :is_absolute,
94
+ env_name: "FL_GET_EMTITLEMENTS_PLIST_FILE_PATH_IS_ABSOLUTE",
95
+ description: "Specify a specific target if you have multiple per project, optional",
96
+ optional: true,
97
+ is_string: false,
98
+ default_value: false)
99
+ ]
100
+ end
101
+
102
+ def self.output
103
+ # Define the shared values you are going to provide
104
+ # Example
105
+ [
106
+ ['GET_EMTITLEMENTS_PLIST_FILE_PATH_CUSTOM_VALUE', 'A description of what this value contains']
107
+ ]
108
+ end
109
+
110
+ def self.return_value
111
+ # If your method provides a return value, you can describe here what it does
112
+ end
113
+
114
+ def self.authors
115
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
116
+ ["Your GitHub/Twitter Name"]
117
+ end
118
+
119
+ def self.is_supported?(platform)
120
+ # you can do things like
121
+ #
122
+ # true
123
+ #
124
+ # platform == :ios
125
+ #
126
+ # [:ios, :mac].include?(platform)
127
+ #
128
+
129
+ platform == :ios
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,117 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_EXTENSIONS_CUSTOM_VALUE = :GET_EXTENSIONS_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetExtensionsAction < Action
8
+ require 'xcodeproj'
9
+
10
+ def self.run(params)
11
+
12
+
13
+ end
14
+
15
+ def self.find_project(params)
16
+ project = Xcodeproj::Project.open(params[:xcodeproj])
17
+ project
18
+ end
19
+
20
+ def self.find_target(params)
21
+ project = find_project(params)
22
+ if params[:target]
23
+ target = project.targets.detect { |t| t.name == params[:target] }
24
+ target
25
+ else
26
+ # firstly we are trying to find modern application target
27
+ target = project.targets.detect do |t|
28
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
29
+ t.product_type == 'com.apple.product-type.application'
30
+ end
31
+ target = project.targets[0] if target.nil?
32
+ target
33
+ end
34
+ end
35
+
36
+ def self.get_ci_apps(params)
37
+ infoPlistPath = find_info(params)
38
+ info = Xcodeproj::Plist.read_from_path(infoPlistPath)
39
+ ciAPPs = info["CI_APPS"]
40
+ ciAPPs
41
+ end
42
+
43
+ def self.get_ci_app(params)
44
+ ciApps = get_ci_apps(params)
45
+ ciApps.each do |app|
46
+ if app["APP_ID"] == params[:app_id] then
47
+ return app
48
+ end
49
+ end
50
+ end
51
+
52
+ #####################################################
53
+ # @!group Documentation
54
+ #####################################################
55
+
56
+ def self.description
57
+ "A short description with <= 80 characters of what this action does"
58
+ end
59
+
60
+ def self.details
61
+ # Optional:
62
+ # this is your chance to provide a more detailed description of this action
63
+ "You can use this action to do cool things..."
64
+ end
65
+
66
+ def self.available_options
67
+ # Define all options your action supports.
68
+
69
+ # Below a few examples
70
+ [
71
+ FastlaneCore::ConfigItem.new(key: :project,
72
+ env_name: "FL_GET_EXTENSIONS_PROJECT_PATH", # The name of the environment variable
73
+ description: "API Token for GetExtensionsAction", # a short description of this parameter
74
+ verify_block: proc do |value|
75
+ UI.user_error!("No API token for GetExtensionsAction given, pass using `api_token: 'token'`") unless (value and not value.empty?)
76
+ # UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
77
+ end),
78
+ FastlaneCore::ConfigItem.new(key: :target,
79
+ env_name: "FL_GET_EXTENSIONS_TARGET_NAME",
80
+ description: "Create a development certificate instead of a distribution one",
81
+ is_string: false, # true: verifies the input is a string, false: every kind of value
82
+ default_value: false) # the default value if the user didn't provide one
83
+ ]
84
+ end
85
+
86
+ def self.output
87
+ # Define the shared values you are going to provide
88
+ # Example
89
+ [
90
+ ['GET_EXTENSIONS_CUSTOM_VALUE', 'A description of what this value contains']
91
+ ]
92
+ end
93
+
94
+ def self.return_value
95
+ # If your method provides a return value, you can describe here what it does
96
+ end
97
+
98
+ def self.authors
99
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
100
+ ["Your GitHub/Twitter Name"]
101
+ end
102
+
103
+ def self.is_supported?(platform)
104
+ # you can do things like
105
+ #
106
+ # true
107
+ #
108
+ # platform == :ios
109
+ #
110
+ # [:ios, :mac].include?(platform)
111
+ #
112
+
113
+ platform == :ios
114
+ end
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,115 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_INFO_PLIST_FILE_PATH_CUSTOM_VALUE = :GET_INFO_PLIST_FILE_PATH_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetInfoPlistFilePathAction < Action
8
+ require 'xcodeproj'
9
+ require 'pathname'
10
+
11
+ def self.run(params)
12
+ project = find_project(params)
13
+ target = find_target(params)
14
+ buildConfiguration = target.build_settings("Release")
15
+ filePath = buildConfiguration["INFOPLIST_FILE"]
16
+ if params[:is_absolute] then
17
+ filePath = File.join(Pathname.new(project.path).parent.to_path, filePath)
18
+ end
19
+ filePath
20
+ end
21
+
22
+ def self.find_project(params)
23
+ project = Xcodeproj::Project.open(params[:xcodeproj])
24
+ project
25
+ end
26
+
27
+ def self.find_target(params)
28
+ project = find_project(params)
29
+ if params[:target]
30
+ target = project.targets.detect { |t| t.name == params[:target] }
31
+ target
32
+ else
33
+ # firstly we are trying to find modern application target
34
+ target = project.targets.detect do |t|
35
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
36
+ t.product_type == 'com.apple.product-type.application'
37
+ end
38
+ target = project.targets[0] if target.nil?
39
+ target
40
+ end
41
+ end
42
+
43
+ #####################################################
44
+ # @!group Documentation
45
+ #####################################################
46
+
47
+ def self.description
48
+ "A short description with <= 80 characters of what this action does"
49
+ end
50
+
51
+ def self.details
52
+ # Optional:
53
+ # this is your chance to provide a more detailed description of this action
54
+ "You can use this action to do cool things..."
55
+ end
56
+
57
+
58
+ def self.available_options
59
+ # Define all options your action supports.
60
+
61
+ # Below a few examples
62
+ [
63
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
64
+ env_name: "FL_INFO_PLIST_PROJECT",
65
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
66
+ optional: true,
67
+ verify_block: proc do |value|
68
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
69
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
70
+ end),
71
+ FastlaneCore::ConfigItem.new(key: :target,
72
+ env_name: "FL_INFO_PLIST_TARGET",
73
+ conflicting_options: [:scheme],
74
+ description: "Specify a specific target if you have multiple per project, optional"),
75
+ FastlaneCore::ConfigItem.new(key: :is_absolute,
76
+ env_name: "FL_INFO_PLIST_TARGET",
77
+ description: "Specify a specific target if you have multiple per project, optional",
78
+ optional: true,
79
+ is_string: false,
80
+ default_value: false)
81
+ ]
82
+ end
83
+
84
+ def self.output
85
+ # Define the shared values you are going to provide
86
+ # Example
87
+ [
88
+ ['GET_INFO_PLIST_FILE_PATH_CUSTOM_VALUE', 'A description of what this value contains']
89
+ ]
90
+ end
91
+
92
+ def self.return_value
93
+ # If your method provides a return value, you can describe here what it does
94
+ end
95
+
96
+ def self.authors
97
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
98
+ ["Your GitHub/Twitter Name"]
99
+ end
100
+
101
+ def self.is_supported?(platform)
102
+ # you can do things like
103
+ #
104
+ # true
105
+ #
106
+ # platform == :ios
107
+ #
108
+ # [:ios, :mac].include?(platform)
109
+ #
110
+
111
+ platform == :ios
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,105 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ GET_TARGET_TYPE_CUSTOM_VALUE = :GET_TARGET_TYPE_CUSTOM_VALUE
5
+ end
6
+
7
+ class GetTargetTypeAction < Action
8
+ require 'xcodeproj'
9
+
10
+ def self.run(params)
11
+ unless params[:xcodeproj]
12
+ if Helper.test?
13
+ params[:xcodeproj] = "/tmp/fastlane/tests/fastlane/bundle.xcodeproj"
14
+ else
15
+ params[:xcodeproj] = Dir["*.xcodeproj"][0] unless params[:xcodeproj]
16
+ end
17
+ end
18
+
19
+ target = find_target(params)
20
+ targetType = target.product_type
21
+ targetType
22
+ end
23
+
24
+ def self.find_target(params)
25
+ project = Xcodeproj::Project.open(params[:xcodeproj])
26
+ if params[:target]
27
+ target = project.targets.detect { |t| t.name == params[:target] }
28
+ target
29
+ else
30
+ # firstly we are trying to find modern application target
31
+ target = project.targets.detect do |t|
32
+ t.kind_of?(Xcodeproj::Project::Object::PBXNativeTarget) &&
33
+ t.product_type == 'com.apple.product-type.application'
34
+ end
35
+ target = project.targets[0] if target.nil?
36
+ target
37
+ end
38
+ end
39
+
40
+ #####################################################
41
+ # @!group Documentation
42
+ #####################################################
43
+
44
+ def self.description
45
+ "A short description with <= 80 characters of what this action does"
46
+ end
47
+
48
+ def self.details
49
+ # Optional:
50
+ # this is your chance to provide a more detailed description of this action
51
+ "You can use this action to do cool things..."
52
+ end
53
+
54
+ def self.available_options
55
+ # Define all options your action supports.
56
+
57
+ # Below a few examples
58
+ [
59
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
60
+ env_name: "FL_INFO_PLIST_PROJECT",
61
+ description: "Optional, you must specify the path to your main Xcode project if it is not in the project root directory or if you have multiple *.xcodeproj's in the root directory",
62
+ optional: true,
63
+ verify_block: proc do |value|
64
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
65
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
66
+ end),
67
+ FastlaneCore::ConfigItem.new(key: :target,
68
+ env_name: "FL_INFO_PLIST_TARGET",
69
+ conflicting_options: [:scheme],
70
+ description: "Specify a specific target if you have multiple per project, optional")
71
+ ]
72
+ end
73
+
74
+ def self.output
75
+ # Define the shared values you are going to provide
76
+ # Example
77
+ [
78
+ ['GET_TARGET_TYPE_CUSTOM_VALUE', 'A description of what this value contains']
79
+ ]
80
+ end
81
+
82
+ def self.return_value
83
+ # If your method provides a return value, you can describe here what it does
84
+ end
85
+
86
+ def self.authors
87
+ # So no one will ever forget your contribution to fastlane :) You are awesome btw!
88
+ ["Your GitHub/Twitter Name"]
89
+ end
90
+
91
+ def self.is_supported?(platform)
92
+ # you can do things like
93
+ #
94
+ # true
95
+ #
96
+ # platform == :ios
97
+ #
98
+ # [:ios, :mac].include?(platform)
99
+ #
100
+
101
+ platform == :ios
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class CiAppsHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::CiAppsHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the ci_apps plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module CiApps
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/ci_apps/version'
2
+
3
+ module Fastlane
4
+ module CiApps
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::CiApps.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-ci_apps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - JiaqiangSong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.114.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.114.0
139
+ description:
140
+ email: songjiaqiang@faceu.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/ci_apps.rb
148
+ - lib/fastlane/plugin/ci_apps/actions/ci_apps_action.rb
149
+ - lib/fastlane/plugin/ci_apps/actions/get_ci_app.rb
150
+ - lib/fastlane/plugin/ci_apps/actions/get_ci_app_value.rb
151
+ - lib/fastlane/plugin/ci_apps/actions/get_ci_apps.rb
152
+ - lib/fastlane/plugin/ci_apps/actions/get_emtitlements_plist_file_path.rb
153
+ - lib/fastlane/plugin/ci_apps/actions/get_extensions.rb
154
+ - lib/fastlane/plugin/ci_apps/actions/get_info_plist_file_path.rb
155
+ - lib/fastlane/plugin/ci_apps/actions/get_target_type.rb
156
+ - lib/fastlane/plugin/ci_apps/helper/ci_apps_helper.rb
157
+ - lib/fastlane/plugin/ci_apps/version.rb
158
+ homepage: https://github.com/SongJiaqiang/fastlane-plugin-ci_apps
159
+ licenses:
160
+ - MIT
161
+ metadata: {}
162
+ post_install_message:
163
+ rdoc_options: []
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ requirements: []
177
+ rubygems_version: 3.0.1
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: Config multiple apps of CI
181
+ test_files: []