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

WIP #125

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

WIP #125

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
Expand All @@ -28,7 +28,7 @@ jobs:

build-macos:
needs: tap_syntax
runs-on: macos-12
runs-on: macos-latest
name: Build formula on macOS
if: github.event_name == 'pull_request'

Expand Down
50 changes: 26 additions & 24 deletions Formula/ironfish.rb
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
URL = "https://releases.ironfish.network/ironfish-cli-64c70d2.tar.gz".freeze
SHA = "9df1950383d56dda263551671b720c607b4f0a1536e5cda4868409e586202264".freeze
VERSION = "104".freeze
VERSION = "1.14.0".freeze

Check warning on line 1 in Formula/ironfish.rb

View workflow job for this annotation

GitHub Actions / Build formula on macOS

No bottle built for ironfish!

ironfish has unbottled dependencies, so a bottle will not be built.
NPM_URL = "https://registry.npmjs.org/ironfish/-/ironfish-#{VERSION}.tgz".freeze
NPM_SHA = "907295644713ab8ece8b9d0ad6fc6cf10f916e977db185d654ba3ca7109e59f9".freeze
GITHUB_URL = "https://github.com/iron-fish/ironfish/archive/refs/tags/v#{VERSION}.tar.gz"
GITHUB_SHA = "ec2a52a1129c86746bc0e422515e12ca1cce2994ae2656ad0652a1dafa6341b8"

require "language/node"

class Ironfish < Formula
desc "Everything you need to get started with Iron Fish"
homepage "https://ironfish.network/"
url URL
version VERSION
sha256 SHA
url NPM_URL
sha256 NPM_SHA
license "MPL-2.0"
version_scheme 1
version_scheme 2

head "https://github.com/iron-fish/homebrew-brew.git"
depends_on "rust" => :build
depends_on "yarn" => :build
depends_on "node@20"

depends_on "node@18"
resource "source" do
url GITHUB_URL
sha256 GITHUB_SHA
end

def install
if OS.linux?
odie "Homebrew builds are not yet supported on Linux. " \
"However, you can build from source by following the steps in our GitHub README: " \
"https://github.com/iron-fish/ironfish#install"
end
system "npm", "install", *Language::Node.std_npm_install_args(libexec) - ["--build-from-source"]
rm_f libexec/"lib/node_modules/ironfish/node_modules/" \
"@ironfish/rust-nodejs-darwin-arm64/ironfish-rust-nodejs.darwin-arm64.node"

if Hardware::CPU.arm?
odie "Homebrew builds are not yet supported on M1/Apple Silicon. " \
"However, you can build from source by following the steps in our GitHub README: " \
"https://github.com/iron-fish/ironfish#install"
resource("source").stage do
system "yarn"
cp Dir["ironfish-rust-nodejs/*.node"], "#{libexec}/lib/node_modules/ironfish/node_modules/@ironfish/rust-nodejs"
end

inreplace "bin/ironfish", /^CLIENT_HOME=/,
"export IRONFISH_OCLIF_CLIENT_HOME=#{lib/"client"}/ironfish-cli\nCLIENT_HOME="
inreplace "bin/ironfish", "\"$DIR/node\"", "#{Formula["node@18"].bin}/node"
inreplace libexec/"lib/node_modules/ironfish/bin/run", "env node", "env #{Formula["node@18"].bin}/node"

libexec.install Dir["*"]
bin.install_symlink libexec/"bin/ironfish"
bin.install_symlink libexec/"lib/node_modules/ironfish/bin/run" => "ironfish"
end

test do
system bin/"ironfish", "version"
system bin/"ironfish", "-d=.", "wallet:create", "test"
end
end