jfrog / cocoapods-art

CocoaPods Plugin to work against Artifactory Repository
Apache License 2.0
58 stars 28 forks source link

Support installing using brew #59

Open LeonidKokhnovich opened 2 years ago

LeonidKokhnovich commented 2 years ago

With the M1 Apple Silicon, you have to use brew for installing cocoapods for native installation. Due to that, installing cocoapods-art module using gem wouldn't be recognized by the cocoapods version installed through brew. It would be great to have a way to install cocoapods-art using brew to address the issue, what does everyone think about that?

rubenbacanu commented 2 years ago

I have the same issue with my M1! When I run "sudo gem install cocoapods-art", it said that was successfully installed. But when I run "pod install", I get this error: "Podfile requires that the plugin cocoapods-art be installed".

nadishan commented 2 years ago

Any update on this? Cannot use cocoapods-art on Apple chips and it is a major blocker for us.

aca-hakan-pinar commented 2 years ago

Same issue here...

Brent-rb commented 2 years ago

I had the same issue but I found a way to get it working. For this to work I have assumed you have already installed cocoapods via brew.

The following script will copy over the required files from the global Ruby installation:

#!/bin/zsh

RUBY_ROOT="/Library/Ruby/Gems/2.6.0"
COCOA_ROOT="/opt/homebrew/Cellar/cocoapods/1.11.3/libexec"

cp -R "$RUBY_ROOT/gems/$1" "$COCOA_ROOT/gems/"
cp "$RUBY_ROOT/specifications/$1.gemspec" "$COCOA_ROOT/specifications/"
sudo chown -R $USER "$COCOA_ROOT/gems/$1"
sudo chown $USER "$COCOA_ROOT/specifications/$1.gemspec"

Now you can verify if you have done everything correctly by running pod repo-art. It will give you some errors but that's ok, we will fix them afterwards. If it says repo-art not found you have done something wrong. (Maybe some of the copy commands made an additional directory or something)

To fix the errors we need to edit the $COCOA_ROOT/specifications/$1.gemspec . It should contain these lines at the beginning:

$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cocoapods_art'

Comment them out by adding a # before each line.

#lib = File.expand_path('../lib', __FILE__)
#$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
#require 'cocoapods_art'

The other edit we have to do is to change the version number from CocoaPodsArt::VERSION to a static version number. For me the version of cocoapods-art was 1.1.0 so I replaced it with '1.1.0'.

Now the command pod repo-art should run without issues. Hope this helps, had to do a lot of digging to figure this out!

emreond commented 2 years ago

Same issue here. Is there anyone solved the problem without modifying gem file)? Thank you.

rendomnet commented 1 year ago

Cant install cocoapods-art too. On Mac with M1 your script gives error: chown: /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/specifications/.gemspec: No such file or directory

miguelolmedoP commented 1 year ago

Cant install cocoapods-art too. On Mac with M1 your script gives error: chown: /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/specifications/.gemspec: No such file or directory

you must execute the script with an argument, in this case the name of the plugin -> Example: sh script-name.sh cocoapods-art-1.1.0

WeddMate-Apps commented 1 year ago

I used the script without success

cp: /Library/Ruby/Gems/2.6.1/gems/cocoapods-art-1.1.0: No such file or directory
cp: /Library/Ruby/Gems/2.6.1/specifications/cocoapods-art-1.1.0.gemspec: No such file or directory
chown: /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/gems/cocoapods-art-1.1.0: No such file or directory
chown: /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/specifications/cocoapods-art-1.1.0.gemspec: No such file or directory

the gem is not there so how can I copy it? I tired before

sudo gem install cocoapods-art

killianTrm commented 1 year ago

You must have cocoapods and cocoapods art installed with the same method

So you can install cocoapods and cocoapods with brew ( change your Path with .zshrc file if you do that and verify command « which pod » return the good one)

fast way: Ruby and Gem are already installed on your system by default so you can install cocoapods and cocoapods-art with gem

AkashSArjun commented 12 months ago

Hi @Brent-rb , I tried your solution but while executing cp "$RUBY_ROOT/specifications/$1.gemspec" "$COCOA_ROOT/specifications/" I am getting response like "cp: /Library/Ruby/Gems/2.6.0/specifications/.gemspec : No such file or directory" I have almost 40 files with the extension ".gemspec", could you please mention which file I have to copy or do I have to copy all the 40 files to the "$COCOA_ROOT/specifications/"?

sudo chown $USER "$COCOA_ROOT/specifications/$1.gemspec" chown: /opt/homebrew/Cellar/cocoapods/1.14.3/libexec/specifications/.gemspec: No such file or directory the above command also showing No such file or directory, do you have any alternative solution?

killianTrm commented 12 months ago

Hi @Brent-rb , I tried your solution but while executing cp "$RUBY_ROOT/specifications/$1.gemspec" "$COCOA_ROOT/specifications/" I am getting response like "cp: /Library/Ruby/Gems/2.6.0/specifications/.gemspec : No such file or directory" I have almost 40 files with the extension ".gemspec", could you please mention which file I have to copy or do I have to copy all the 40 files to the "$COCOA_ROOT/specifications/"?

sudo chown $USER "$COCOA_ROOT/specifications/$1.gemspec" chown: /opt/homebrew/Cellar/cocoapods/1.14.3/libexec/specifications/.gemspec: No such file or directory the above command also showing No such file or directory, do you have any alternative solution?

Don’t follow this instructions you not must copy this files. it’s not necessary If the command “pod” don’t give you “pod repo-art”, your installation is not good