-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create custom ruby script to print podspecs in a react native environ…
…ment
- Loading branch information
1 parent
7458515
commit 1d97b58
Showing
3 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# This file is a lightweight port of the `pod ipc spec` command. | ||
# It was built from scratch to imports some 3rd party functions before reading podspecs | ||
|
||
require 'cocoapods' | ||
require 'json' | ||
|
||
# Require 3rd party functions needed to parse podspecs. This code is copied from ios/Podfile | ||
def node_require(script) | ||
# Resolve script with node to allow for hoisting | ||
require Pod::Executable.execute_command('node', ['-p', | ||
"require.resolve( | ||
'#{script}', | ||
{paths: [process.argv[1]]}, | ||
)", __dir__]).strip | ||
end | ||
node_require('react-native/scripts/react_native_pods.rb') | ||
node_require('react-native-permissions/scripts/setup.rb') | ||
|
||
# Configure pod in silent mode | ||
Pod::Config.instance.silent = true | ||
|
||
# Process command-line arguments | ||
podspec_files = ARGV | ||
|
||
# Validate each podspec file | ||
podspec_files.each do |podspec_file| | ||
begin | ||
spec = Pod::Specification.from_file(podspec_file) | ||
puts(spec.to_pretty_json) | ||
rescue => e | ||
STDERR.puts "Failed to validate #{podspec_file}: #{e.message}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters