Git Product home page Git Product logo

Comments (15)

cupcakearmy avatar cupcakearmy commented on August 16, 2024 2

Included in brew now :)

from autorestic.

sebdanielsson avatar sebdanielsson commented on August 16, 2024 1

Found some docs here:
https://docs.brew.sh/Adding-Software-to-Homebrew#writing-the-formula

I've never packaged any software but if you don't have a Mac I could give it a try?

For reference here is the formula for restic on homebrew-core:
https://github.com/Homebrew/homebrew-core/blob/7beae5ab57c65249403699b2b0700fbccf14e6cb/Formula/restic.rb

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024 1
class Autorestic < Formula
  desc "High level CLI utility for restic"
  homepage "https://autorestic.vercel.app/"
  url "https://github.com/cupcakearmy/autorestic/archive/v1.0.8.tar.gz"
  # sha256 "cb3b6614aa4ca7f56192a9d9cfbd46acd8abdad2338cf2f3e2496a859d78f905"
  license "Apache-2.0"
  head "https://github.com/cupcakearmy/autorestic.git"


  depends_on "go" => :build
  depends_on "restic"

  def install
    ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"

    system "go", "build", "-o", "autorestic", "./main.go"
    
    mkdir "completions"
    system "bash", "-c", "./autorestic completion bash > completions/autorestic_bash"
    system "bash", "-c", "./autorestic completion zsh > completions/autorestic_zsh"
    system "bash", "-c", "./autorestic completion fish > completions/autorestic_fish"
    bash_completion.install "completions/autorestic_bash"
    zsh_completion.install "completions/autorestic_zsh"
    fish_completion.install "completions/autorestic_fish"

    bin.install "autorestic"
  end

  test do
  end
end

This works, now I just have to sign the tarball

from autorestic.

sebdanielsson avatar sebdanielsson commented on August 16, 2024 1

You the boss😃

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

Any suggestions / help is welcomed

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

Ye just read the same docs. I develop mainly on MacOS but I don't have a lot of time the next week, so if you would either draft or even release the Brew version I would be very grateful. Otherwise I'll do it whenever I find time 🙂

from autorestic.

sebdanielsson avatar sebdanielsson commented on August 16, 2024

I've done some experimenting and so far I've encountered two warnings:

No checksum was provided for this resource.

Probably just need to start adding a SHA256 checksum at each release to that Homebrew doesn't warn.

And this error when trying to build it:

➜ brew install --build-from-source autorestic
==> Downloading https://github.com/cupcakearmy/autorestic/archive/v1.0.7.tar.gz
==> Downloading from https://codeload.github.com/cupcakearmy/autorestic/tar.gz/v1.0.7
######################################################################## 100.0%
==> go run build/build.go
Error: An exception occurred within a child process:
  Errno::ENOENT: No such file or directory - autorestic

Here is the /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/autorestic.rb


class Autorestic < Formula
    desc "High level CLI utility for restic"
    homepage "https://autorestic.vercel.app/"
    url "https://github.com/cupcakearmy/autorestic/archive/v1.0.7.tar.gz"
    sha256 "cb3b6614aa4ca7f56192a9d9cfbd46acd8abdad2338cf2f3e2496a859d78f905"
    license "Apache-2.0"
    head "https://github.com/cupcakearmy/autorestic.git"
  
    depends_on "go" => :build
  
    def install
      ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"
  
      system "go", "run", "build/build.go"
  
      bin.install "autorestic"
    end
  
    test do
      system "autorestic", "help"
    end
end

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

Thanks for going ahead with it!
I would not suggest do build it from source thought as go is not installed y default on MacOS. I'll add checksums for each binary today/tomorrow

from autorestic.

sebdanielsson avatar sebdanielsson commented on August 16, 2024

I believe with Homebrew you must build it from source. Pretty sure the same is true for Nix packet manager.☺️

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

About the build error, I'm no expert with Go (yet) but that sounds like an issue with gopath goroot.

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

Also we could put restic as a dependency

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

I see, restic also builds from source. Then it's probably the way to go :)

from autorestic.

sebdanielsson avatar sebdanielsson commented on August 16, 2024

This is as far as I got. Since I'm not a developer and don't have real experience with building apps I can't help more than this😊

class Autorestic < Formula
  desc "High level CLI utility for restic"
  homepage "https://autorestic.vercel.app/"
  url "https://github.com/cupcakearmy/autorestic/archive/v1.0.7.tar.gz"
  sha256 "cb3b6614aa4ca7f56192a9d9cfbd46acd8abdad2338cf2f3e2496a859d78f905"
  license "Apache-2.0"
  head "https://github.com/cupcakearmy/autorestic.git"

  depends_on "go" => :build
  depends_on "restic"

  def install
    ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"
    ENV["CGO_ENABLED"] = "0"

    system "go", "run", "build/build.go"

    bin.install "autorestic"
  end

  test do
    system "#{bin}/autorestic", "help"
  end
end

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

Thanks you! I'll pick up from there when I find time :)

from autorestic.

cupcakearmy avatar cupcakearmy commented on August 16, 2024

Had a lot of help from the brew people, the final file looks quite different xD
https://github.com/Homebrew/homebrew-core/blob/a4115aa6ed5e71025eb069662d34a99a12eb0c55/Formula/autorestic.rb

from autorestic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.