2016-07-19 21:34:51 +00:00
|
|
|
class MCli < Formula
|
|
|
|
desc "Swiss Army Knife for Mac OS X"
|
|
|
|
homepage "https://github.com/rgcr/m-cli"
|
2016-08-22 17:27:32 +00:00
|
|
|
url "https://github.com/rgcr/m-cli/archive/v0.1.8.tar.gz"
|
|
|
|
sha256 "1982992625a14cefc2af480656a9e672ab071b7172b4859fd21cdcb07294cc8a"
|
2016-08-08 20:19:36 +00:00
|
|
|
head "https://github.com/rgcr/m-cli.git"
|
2016-07-19 21:34:51 +00:00
|
|
|
|
2016-07-31 03:42:53 +00:00
|
|
|
bottle :unneeded
|
2016-07-30 19:40:43 +00:00
|
|
|
|
2016-07-19 21:34:51 +00:00
|
|
|
def install
|
|
|
|
prefix.install Dir["*"]
|
|
|
|
inreplace prefix/"m" do |s|
|
2016-08-03 19:10:50 +00:00
|
|
|
# Use absolute rather than relative path to plugins.
|
2016-07-19 21:34:51 +00:00
|
|
|
s.gsub! /^\[ -L.*|^\s+\|\| pushd.*|^popd.*/, ""
|
|
|
|
s.gsub! /MPATH=.*/, "MPATH=#{prefix}"
|
2016-08-03 19:10:50 +00:00
|
|
|
# Disable options "update" && "uninstall", they must be handled by brew
|
|
|
|
s.gsub! /update_mcli \&\&.*/, "printf \"Try: brew update && brew upgrade m-cli \\n\" && exit 0"
|
|
|
|
s.gsub! /uninstall_mcli \&\&.*/, "printf \"Try: brew uninstall m-cli \\n\" && exit 0"
|
2016-07-19 21:34:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
bin.install_symlink "#{prefix}/m" => "m"
|
|
|
|
bash_completion.install prefix/"completion/bash/m"
|
|
|
|
zsh_completion.install prefix/"completion/zsh/_m"
|
2016-08-16 03:21:48 +00:00
|
|
|
fish_completion.install prefix/"completion/fish/m.fish"
|
2016-07-19 21:34:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
output = pipe_output("#{bin}/m help 2>&1")
|
|
|
|
assert_no_match /.*No such file or directory.*/, output
|
|
|
|
assert_no_match /.*command not found.*/, output
|
2016-08-22 17:44:23 +00:00
|
|
|
assert_match /.*Swiss Army Knife for macOS.*/, output
|
2016-07-19 21:34:51 +00:00
|
|
|
end
|
|
|
|
end
|