Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebrew formula #17

Open
yahonda opened this issue Jun 4, 2024 · 3 comments
Open

Homebrew formula #17

yahonda opened this issue Jun 4, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@yahonda
Copy link
Member

yahonda commented Jun 4, 2024

I want the rails-new can be installed via Homebrew for macOS users.

Expected behavior

macOS users can create a new Rails application as follows.

% brew install rails-new
% rails-new myapp
@bweis
Copy link

bweis commented Jun 18, 2024

Took a crack at adding a formula and ran into a myriad of problems. :/

ruby

class RailsNew < Formula
  desc "Create Rails projects with Ruby installed"
  homepage "https://github.com/rails/rails-new"
  url "https://github.com/rails/rails-new/archive/refs/tags/v0.3.0.tar.gz"
  sha256 "a03c3f1530a28817d0989390be87ebc6a644f3eaa1a98dbb7420f7de3995c3f8"
  license "MIT"

  depends_on "rust" => :build
  depends_on :macos
  depends_on "docker" => :test
  depends_on "docker-credential-helper" => :test

  # Because of limitations with docker, use an alternative container runtime
  depends_on "colima" => :test

  def install
    system "cargo", "install", *std_cargo_args
  end

  test do
    assert_match version.to_s, shell_output(bin/"rails-new -V")
  end
end

If anyone want's to continue where I left off and hack away at it.

@rafaelfranca rafaelfranca added the enhancement New feature or request label Aug 14, 2024
@hachi8833
Copy link

I created the Fomulae for rails-new on my local /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/r/rails-new.rb via brew create --set-name "rails-new" "https://github.com/rails/rails-new/archive/refs/tags/v0.4.1.tar.gz", and then tweaked it as follows:

class RailsNew < Formula
  desc "Create Rails projects with Ruby installed"
  homepage "https://github.com/rails/rails-new"
  url "https://github.com/rails/rails-new/archive/refs/tags/v0.4.1.tar.gz"
  sha256 "d9c11267eb7c7a40a740768d09e5da60e07009d490d6561b734c35ac88095d51"
  license "MIT"

  depends_on "rust" => :build
  depends_on "docker" => :test
  depends_on "docker-credential-helper" => :test

  def install
    system "cargo", "install", *std_cargo_args
  end

  test do
    assert_match version.to_s, shell_output(bin/"rails-new -V")
  end
end

Running brew audit --new rails-new showed the following, which means the remaining step before sending the PR to Homebrew repo is just to bump the version from v0.4.0 to v1.0.0 or later when ready:

$ brew audit --new rails-new
rails-new
  * v0.4.1 is a GitHub pre-release.
Error: 1 problem in 1 formula detected.

Ref: https://zenn.dev/kou_pg_0131/articles/homebrew-add-formula

I look forward to the day to add the formula ❤️

@thomasgallagher
Copy link

+1 for this please.

Homebrew installation would vastly simplify the installation process, and also hopefully remove the trust based steps on MacOS (maybe I'm reaching here?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants