fastlane-plugin-convert_xcodeproj 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: df9789bc4c732164c309e8e01448e71e778e3bb92de6b28e27e9e80636ff1910
4
+ data.tar.gz: 6bd4417c9a8827be2b473f459a4e036d7c3e567dfea94a68d4e398f466584528
5
+ SHA512:
6
+ metadata.gz: e6db4321f74f8da8470796ee141aa5d909f3cb5de3da419e7374266a3065ce8b12ec539f145ee100df5da59ed4603c0ae0cc7d735839a018c51c3336c106c88d
7
+ data.tar.gz: 2843613840cf1302e0377930572c82dbf285f33bada7bc834f984db7b76233cfe2b0cb2307808c96bc816bae43e28f015d2fd8cb8e848ff7143a599734d292de
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 caselett
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,37 @@
1
+ # convert_xcodeproj plugin
2
+
3
+ A [fastlane](https://fastlane.tools) plugin that converts an Xcode project between the `pbxproj` and `xcproj` (JSON) formats.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ fastlane add_plugin convert_xcodeproj
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ruby
14
+ # Switch to the other format (auto-detected)
15
+ convert_xcodeproj
16
+
17
+ # Convert a specific project to a specific format
18
+ convert_xcodeproj(xcodeproj: "MyApp.xcodeproj", format: "xcproj")
19
+ ```
20
+
21
+ ## Options
22
+
23
+ | Option | Description | Default |
24
+ |-------------|-----------------------------------------------------------------------------|----------------------------------|
25
+ | `xcodeproj` | Path to the `.xcodeproj`. Env: `FL_CONVERT_XCODEPROJ` | The `.xcodeproj` in the current folder |
26
+ | `format` | `pbxproj` (or `default`), `xcproj` (or `json`) | The opposite of the current format |
27
+
28
+ ## Run tests
29
+
30
+ ```bash
31
+ bundle install
32
+ bundle exec rspec
33
+ ```
34
+
35
+ ## License
36
+
37
+ MIT
@@ -0,0 +1,72 @@
1
+ module Fastlane
2
+ module Actions
3
+ class ConvertXcodeprojAction < Action
4
+ require 'pathname'
5
+ require 'shellwords'
6
+
7
+ def self.run(params)
8
+ xcodeproj = params[:xcodeproj] || Dir["*.xcodeproj"].first
9
+ UI.user_error!("Could not find an Xcode project in '#{Dir.pwd}'") if xcodeproj.nil?
10
+
11
+ path = Pathname.pwd + xcodeproj
12
+ UI.user_error!("Could not find Xcode project at path '#{path}'") unless path.exist?
13
+
14
+ format = target_format(params[:format], path)
15
+
16
+ Actions.sh("xcodebuild -project #{path.to_s.shellescape} -convert-project #{format}")
17
+ end
18
+
19
+ # Maps user-facing aliases to xcodebuild formats. When no format is given,
20
+ # toggles to the opposite of the project's current format.
21
+ def self.target_format(format, path)
22
+ case format
23
+ when "default" then return "pbxproj"
24
+ when "json" then return "xcproj"
25
+ when String then return format
26
+ end
27
+
28
+ project_file = Dir.entries(path).find { |file| file.end_with?(".pbxproj", ".xcproj") }
29
+ case project_file
30
+ when /\.pbxproj\z/i then "xcproj"
31
+ when /\.xcproj\z/i then "pbxproj"
32
+ else UI.user_error!("Could not detect project format in '#{path}', please pass :format")
33
+ end
34
+ end
35
+
36
+ def self.description
37
+ "Converts xcodeproj from xcproj to pbxproj and from pbxproj to xcproj formats"
38
+ end
39
+
40
+ def self.details
41
+ "Converts xcodeproj from xcproj to pbxproj and from pbxproj to xcproj formats"
42
+ end
43
+
44
+ def self.available_options
45
+ [
46
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
47
+ env_name: "FL_CONVERT_XCODEPROJ",
48
+ 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",
49
+ optional: true,
50
+ verify_block: proc do |value|
51
+ UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
52
+ UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
53
+ end),
54
+ FastlaneCore::ConfigItem.new(key: :format,
55
+ optional: true,
56
+ description: "Specify the desired format pbxproj (default) or xcproj (json)",
57
+ verify_block: proc do |value|
58
+ UI.user_error!("Please pass the correct format") if !%w[pbxproj xcproj default json].include? value
59
+ end)
60
+ ]
61
+ end
62
+
63
+ def self.authors
64
+ ["caselett"]
65
+ end
66
+
67
+ def self.is_supported?(platform)
68
+ %i[ios mac].include? platform
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module ConvertXcodeproj
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/convert_xcodeproj/version'
2
+
3
+ module Fastlane
4
+ module ConvertXcodeproj
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::ConvertXcodeproj.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-convert_xcodeproj
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - caselett
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ email: romashenko.sergey@gmail.com
13
+ executables: []
14
+ extensions: []
15
+ extra_rdoc_files: []
16
+ files:
17
+ - LICENSE
18
+ - README.md
19
+ - lib/fastlane/plugin/convert_xcodeproj.rb
20
+ - lib/fastlane/plugin/convert_xcodeproj/actions/convert_xcodeproj_action.rb
21
+ - lib/fastlane/plugin/convert_xcodeproj/version.rb
22
+ homepage: https://github.com/caselett/fastlane-plugin-convert_xcodeproj
23
+ licenses:
24
+ - MIT
25
+ metadata:
26
+ rubygems_mfa_required: 'true'
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '2.4'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 4.0.16
42
+ specification_version: 4
43
+ summary: Converts xcodeproj from xcproj to pbxproj and from pbxproj to xcproj formats
44
+ test_files: []