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

zimfw 1.17.0 (new formula) #204464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
44 changes: 44 additions & 0 deletions Formula/z/zimfw.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class Zimfw < Formula
desc "Zsh plugin manager"
homepage "https://zimfw.sh"
url "https://github.com/zimfw/zimfw/releases/download/v1.17.0/zimfw.zsh.gz"
sha256 "31fa45e3f2d486d2f51de190b32280c0b4adad0b26673b8aac63ddf371eefd78"
license "MIT"

uses_from_macos "zsh" => :test

resource "zimrc" do
url "https://raw.githubusercontent.com/zimfw/install/f56ab9c93c8ebc906901001b4a672edc3cb643b2/src/templates/zimrc"
sha256 "3ab3f9563828a5f26ef012b480ff0ba84b7244aa81551c178388890e294ba6ca"
end

def install
share.install "zimfw.zsh"
resource("zimrc").stage do
(share/"examples").install "zimrc"
end
end

def caveats
<<~EOS
Get started with a sample configuration file:

cp -n #{opt_share}/examples/zimrc ${ZDOTDIR:-${HOME}}/.zimrc

Add the following to your .zshrc:

ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZIM_CONFIG_FILE:-${ZDOTDIR:-${HOME}}/.zimrc} ]]; then
source #{opt_share}/zimfw.zsh init -q
fi
# Initialize modules.
source ${ZIM_HOME}/init.zsh
EOS
end
Comment on lines +22 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the opt_share locations seem specific to Homebrew right? Maybe we can shorten this to:

Find an example in #{opt_share}/examples/zimr and source from #{opt_share}/zimfw.zsh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SMillerDev. I wanted to keep the instructions for a quick but complete setup. The snippet for the .zshrc file is unfortunately that long. I also like how the current instructions say the configuration must go specifically to ${ZDOTDIR:-${HOME}}/.zimrc, and the installation is useless without a configuration file.

Or maybe I should add the installation details to our own documentation in the zimfw repository and then the caveats here could look like just:

  To finish the set up, see:
    https://github.com/zimfw/zimfw#...
  Source from #{opt_share}/zimfw.zsh in your .zshrc.

And we can even remove the example configuration if the idea is to keep the instructions here to a minimum.

Let me know the preferred direction. Thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caveats are really only for instructions that are specific to the Homebrew install. The location of the files is specific, if you have documentation for the other parts I don't think they should be in the caveat.


test do
assert_match version.to_s,
shell_output("zsh -c 'source #{share}/zimfw.zsh version'")
end
end
Loading