Skip to content

Commit ed8a0df

Browse files
author
dikakoko
committed
Add ruby checker
1 parent fd44393 commit ed8a0df

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

Formula/get_app.rb

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
class GetApp < Formula
22
desc "Get app from app store connect"
33
homepage "https://github.com/dikako/homebrew-app-store-connect"
4-
version "1.3"
4+
version "1.4"
55

6-
url "https://github.com/dikako/homebrew-app-store-connect/archive/refs/tags/1.3.zip", :using => :curl
6+
url "https://github.com/dikako/homebrew-app-store-connect/archive/refs/tags/1.4.zip", :using => :curl
7+
8+
depends_on "ruby@3" # Use Ruby 3 as a dependency
79

810
def install
9-
ruby_version = system("ruby -v")
10-
if ruby_version.nil?
11-
# Install rbenv
12-
system("echo 'install rbenv and ruby-3.0.0'")
13-
system("git clone https://github.com/rbenv/rbenv.git ~/.rbenv")
14-
system("echo 'eval \"$(~/.rbenv/bin/rbenv init - zsh)\"' >> ~/.zshrc")
15-
system("rbenv install 3.0.0")
16-
system("rbenv global 3.1.2")
17-
system("gem install bundler")
18-
system("bundle install")
19-
else
20-
system("echo 'Already install #{ruby_version}'")
21-
unless ruby_version =~ "3"
22-
system("echo 'install rbenv and ruby-3.0.0'")
23-
system("git clone https://github.com/rbenv/rbenv.git ~/.rbenv")
24-
system("echo 'eval \"$(~/.rbenv/bin/rbenv init - zsh)\"' >> ~/.zshrc")
25-
system("rbenv install 3.0.0")
26-
system("rbenv global 3.1.2")
27-
system("gem install bundler")
28-
system("bundle install")
29-
end
11+
# Check if Ruby 3 is not installed
12+
unless system("#{Formula["ruby@3"].opt_bin}/ruby --version | grep 'ruby 3'")
13+
opoo "Ruby 3 is not installed. Installing Ruby 3..."
14+
system "brew install ruby@3"
3015
end
3116

3217
bin.install "bin/get_app"
3318
end
19+
20+
test do
21+
system "#{bin}/get_app", "--version"
22+
end
3423
end

0 commit comments

Comments
 (0)