fastlane-plugin-xcode_tools_select 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 11168772c79fb04670894af4e7ced06f8279858a335fdd287071d7d650f6be49
4
+ data.tar.gz: 86298169a4b7d9591048d4c483bfdcb44dc1c468555d4f28015441bb5702172d
5
+ SHA512:
6
+ metadata.gz: 93cb4efa6a9c516c4f0823729f956fc304da7d6de2bad2a8a928d627f5b6fc5d2384f38188eb59b5202920834be027e3bf1527b3d19ed2b750cfc0edf3c7b4f2
7
+ data.tar.gz: 23a45c28b143b173b87564538f09c2a5657c834b05c2b71e6ac09afd20e75c2c9b5bb23882bb0014f8882946e32f9175d75c82b895343ea382b6343b1ac70ac7
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Vincent HO-SUNE
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.
@@ -0,0 +1,47 @@
1
+ # xcode_tools_select plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xcode_tools_select)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-xcode_tools_select`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin xcode_tools_select
11
+ ```
12
+
13
+ ## About xcode_tools_select
14
+
15
+ When you have multiple Xcode installed, you can use this plugin to select which version of Xcode to build with.
16
+
17
+ add this line in your fastlane/Fastfile before the building section
18
+
19
+ ```
20
+ xcode_tools_select(version: "[VERSION]")
21
+ ```
22
+
23
+
24
+ ## Example
25
+
26
+ 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`.
27
+
28
+ To select Xcode 10.+ to compile:
29
+ ```
30
+ xcode_tools_select(version: "10.*")
31
+ ```
32
+
33
+ ## Issues and Feedback
34
+
35
+ For any other issues and feedback about this plugin, please submit it to this repository.
36
+
37
+ ## Troubleshooting
38
+
39
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
40
+
41
+ ## Using _fastlane_ Plugins
42
+
43
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
44
+
45
+ ## About _fastlane_
46
+
47
+ _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,16 @@
1
+ require 'fastlane/plugin/xcode_tools_select/version'
2
+
3
+ module Fastlane
4
+ module XcodeToolsSelect
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::XcodeToolsSelect.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,73 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/xcode_tools_select_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class XcodeToolsSelectAction < Action
7
+ def self.run(params)
8
+ required_version = params[:version]
9
+
10
+ UI.message("Search for Xcode Command Line Tools with version: #{required_version}")
11
+
12
+ # Search for Xcode paths
13
+ output = Actions.sh_no_action("mdfind -0 'kMDItemCFBundleIdentifier = 'com.apple.dt.Xcode' && kMDItemVersion = '#{required_version}''", log: false)
14
+
15
+ UI.user_error!("Xcode matching version `#{required_version}` not found !") unless !output.empty?
16
+
17
+ paths = output.split("\0")
18
+ paths.each do |line|
19
+ UI.message("found: #{line} ")
20
+ end
21
+
22
+ # Select the first matching one
23
+ xcode_path = paths.first
24
+ xcode_tools_path = File.join(xcode_path, "/Contents/Developer")
25
+
26
+ # Verify that the path exists
27
+ UI.user_error!("Path '#{xcode_tools_path}' doesn't exist") unless Dir.exist?(xcode_tools_path)
28
+
29
+ # Get the exact Version found
30
+ itemVersion = Actions.sh_no_action("mdls -name 'kMDItemVersion' -raw #{xcode_path}", log: false)
31
+
32
+ UI.message("Setting Xcode version #{itemVersion} to #{xcode_tools_path} for all build steps")
33
+
34
+ ENV["DEVELOPER_DIR"] = xcode_tools_path
35
+
36
+ end
37
+
38
+ def self.description
39
+ "Set the [version] of the default Xcode Command Line Tools path to use."
40
+ end
41
+
42
+ def self.authors
43
+ ["Vincent HO-SUNE"]
44
+ end
45
+
46
+ def self.available_options
47
+ [
48
+ FastlaneCore::ConfigItem.new(key: :version,
49
+ env_name: "XCODE_TOOLS_SELECT_VERSION",
50
+ description: "Version of Xcode to select",
51
+ optional: false,
52
+ type: String)
53
+ ]
54
+ end
55
+
56
+ def self.is_supported?(platform)
57
+ [:ios, :mac].include?(platform)
58
+ true
59
+ end
60
+
61
+ def self.example_code
62
+ [
63
+ 'xcode_tools_select(version: "10.*")'
64
+ ]
65
+ end
66
+
67
+ def self.category
68
+ :building
69
+ end
70
+
71
+ end
72
+ end
73
+ 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 XcodeToolsSelectHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::XcodeToolsSelectHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the xcode_tools_select plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module XcodeToolsSelect
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-xcode_tools_select
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vincent HO-SUNE
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-12-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Sets the DEVELOPER_DIR environment, used by fastlane to run Xcode command
14
+ line tools, to a specific Xcode version found on the current system.
15
+ email: vhosune@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE
21
+ - README.md
22
+ - lib/fastlane/plugin/xcode_tools_select.rb
23
+ - lib/fastlane/plugin/xcode_tools_select/actions/xcode_tools_select_action.rb
24
+ - lib/fastlane/plugin/xcode_tools_select/helper/xcode_tools_select_helper.rb
25
+ - lib/fastlane/plugin/xcode_tools_select/version.rb
26
+ homepage: https://github.com/vhosune/fastlane-plugin-xcode_tools_select
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.0.6
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Set the [version] of the default Xcode Command Line Tools path to use.
49
+ test_files: []