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" sha256 "1db05b46904e0cc4d777edf3ea14665f6157ade0567359e28663b5b00f6fa59a" 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