From 5bb202152a45c1fdf5fb97f6e18f680a4735bb8f Mon Sep 17 00:00:00 2001 From: Michael Gardner Date: Sat, 25 Nov 2017 08:25:48 -0800 Subject: [PATCH 1/3] browserpass 2.0.8 (new formula) This is the native messaging component of browserpass, a password management WebExtension for browsers like Chrome & Firefox. It uses password stores created by `pass` (https://www.passwordstore.org/). --- Formula/browserpass.rb | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Formula/browserpass.rb diff --git a/Formula/browserpass.rb b/Formula/browserpass.rb new file mode 100644 index 0000000000000..23d8f1c91ec90 --- /dev/null +++ b/Formula/browserpass.rb @@ -0,0 +1,54 @@ +class Browserpass < Formula + desc "Native component for Chrome & Firefox password management add-on" + homepage "https://github.com/dannyvankooten/browserpass" + url "https://github.com/dannyvankooten/browserpass/archive/2.0.8.tar.gz" + sha256 "1747fc24e51128811eb679b43ab23a8cce6ac566620112f0ca9fa129ace4a928" + + depends_on "dep" => :build + depends_on "go" => :build + depends_on "node" => :build + depends_on "yarn" => :build + + def install + ENV["GOPATH"] = buildpath + (buildpath/"src/github.com/dannyvankooten/browserpass").install buildpath.children + cd "src/github.com/dannyvankooten/browserpass" do + system "make", "deps" + system "make", "js" + system "make", "browserpass-darwinx64" + mkdir "out" + mkdir "out/bin" + mkdir "out/share" + cp "browserpass-darwinx64", "out/bin/browserpass" + cp "install.sh", "out/bin/browserpass-setup" + cp "firefox/host.json", "out/share/firefox-host.json" + cp "chrome/host.json", "out/share/chrome-host.json" + cp "chrome/policy.json", "out/share/chrome-policy.json" + dir = csh_quote(HOMEBREW_PREFIX) + inreplace "out/bin/browserpass-setup", /^(BIN_DIR=).*$/, "\\1\"#{dir}/bin\"" + inreplace "out/bin/browserpass-setup", /^(JSON_DIR=).*$/, "\\1\"#{dir}/share/browserpass\"" + bin.install Dir["out/bin/*"] + pkgshare.install Dir["out/share/*"] + ohai "#{Tty.magenta}** To complete installation of browserpass, do the following:#{Tty.reset}" + puts "(1) Install the browserpass-ce add-on in your browser." + puts " - Chrome: https://chrome.google.com/webstore/detail/browserpass-ce/naepdomgkenhinolocfifgehidddafch" + puts " - Firefox: https://addons.mozilla.org/en-US/firefox/addon/browserpass-ce/" + puts "(2) Run `browserpass-setup` to install browser-specific manifest files." + ohai "#{Tty.magenta}** The add-on will not work otherwise!#{Tty.reset}" + end + end + + test do + mkdir "#{ENV["HOME"]}/.password-store" + json = { :action => "search", :domain => "test" } + msg = JSON.generate(json) + Open3.popen3("#{bin}/browserpass") do |stdin, stdout, _| + stdin.write([msg.bytesize].pack("L")) + stdin.write(msg) + stdin.close + len = stdout.read(4).unpack("L")[0] + result = JSON.parse(stdout.read(len)) + assert_equal(result, []) + end + end +end From ce0ae92f462e6081476926fde2a849bb4860dbbc Mon Sep 17 00:00:00 2001 From: Michael Gardner Date: Sat, 25 Nov 2017 09:07:47 -0800 Subject: [PATCH 2/3] simplify installation by using deps-inclusive release archive --- Formula/browserpass.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Formula/browserpass.rb b/Formula/browserpass.rb index 23d8f1c91ec90..17daea4996b56 100644 --- a/Formula/browserpass.rb +++ b/Formula/browserpass.rb @@ -1,20 +1,16 @@ class Browserpass < Formula desc "Native component for Chrome & Firefox password management add-on" homepage "https://github.com/dannyvankooten/browserpass" - url "https://github.com/dannyvankooten/browserpass/archive/2.0.8.tar.gz" - sha256 "1747fc24e51128811eb679b43ab23a8cce6ac566620112f0ca9fa129ace4a928" + url "https://github.com/dannyvankooten/browserpass/releases/download/2.0.8/browserpass-src.tar.gz" + version "2.0.8" + sha256 "5df921f0cfb3ebb0b4c867af08bf69f5cfef30d16101e35fba4c0ce3a558bb51" - depends_on "dep" => :build depends_on "go" => :build - depends_on "node" => :build - depends_on "yarn" => :build def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/dannyvankooten/browserpass").install buildpath.children cd "src/github.com/dannyvankooten/browserpass" do - system "make", "deps" - system "make", "js" system "make", "browserpass-darwinx64" mkdir "out" mkdir "out/bin" From e8608f20cbdf1c5a10bc3415fad741ff7883dffa Mon Sep 17 00:00:00 2001 From: Michael Gardner Date: Sat, 25 Nov 2017 13:28:42 -0800 Subject: [PATCH 3/3] add missing deps: gpg, pinentry-mac --- Formula/browserpass.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Formula/browserpass.rb b/Formula/browserpass.rb index 17daea4996b56..43cc295364cc0 100644 --- a/Formula/browserpass.rb +++ b/Formula/browserpass.rb @@ -6,6 +6,8 @@ class Browserpass < Formula sha256 "5df921f0cfb3ebb0b4c867af08bf69f5cfef30d16101e35fba4c0ce3a558bb51" depends_on "go" => :build + depends_on "gnupg" => :run + depends_on "pinentry-mac" => :run def install ENV["GOPATH"] = buildpath