homebrew-core/Formula/envv.rb
2015-06-05 14:47:57 +01:00

35 lines
1.4 KiB
Ruby

class Envv < Formula
desc "Shell-independent handling of environment variables"
homepage "https://github.com/jakewendt/envv#readme"
url "https://github.com/jakewendt/envv/archive/v1.7.tar.gz"
sha1 "ec92fc104f9cdaee7d53bf2d20489c4746cfaec3"
bottle do
cellar :any
sha1 "f403ddfed11541ee58575fc089b947ba047471f7" => :yosemite
sha1 "cfb8db8045fa214b29a5bd37dfcb84f6c92c5338" => :mavericks
sha1 "a6ffa7d40799a58a4ad6643d93083194a6b2c090" => :mountain_lion
end
def install
system "make"
bin.install "envv"
man1.install "envv.1"
end
test do
ENV["mylist"] = "A:B:C"
assert_equal "mylist=A:C; export mylist", shell_output("#{bin}/envv del mylist B").strip
assert_equal "mylist=B:C; export mylist", shell_output("#{bin}/envv del mylist A").strip
assert_equal "mylist=A:B; export mylist", shell_output("#{bin}/envv del mylist C").strip
assert_equal "", shell_output("#{bin}/envv add mylist B").strip
assert_equal "mylist=B:A:C; export mylist", shell_output("#{bin}/envv add mylist B 1").strip
assert_equal "mylist=A:C:B; export mylist", shell_output("#{bin}/envv add mylist B 99").strip
assert_equal "mylist=A:B:C:D; export mylist", shell_output("#{bin}/envv add mylist D").strip
assert_equal "mylist=D:A:B:C; export mylist", shell_output("#{bin}/envv add mylist D 1").strip
assert_equal "mylist=A:B:D:C; export mylist", shell_output("#{bin}/envv add mylist D 3").strip
end
end