2017-05-28 07:18:01 +00:00
|
|
|
class Fsql < Formula
|
|
|
|
desc "Search through your filesystem with SQL-esque queries."
|
|
|
|
homepage "https://github.com/kshvmdn/fsql"
|
2017-07-02 05:44:45 +00:00
|
|
|
url "https://github.com/kshvmdn/fsql/archive/v0.3.1.tar.gz"
|
|
|
|
sha256 "b88110426a60aa2c48f7b4e52e117a899d43d1bba2614346b729234cd4bd9184"
|
2017-05-28 07:18:01 +00:00
|
|
|
|
2017-05-28 09:51:49 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2017-07-02 06:28:36 +00:00
|
|
|
sha256 "ef29b4aeaeb30416b1969391049f557c3c7edc5b818d41c1693f2f73639b42af" => :sierra
|
|
|
|
sha256 "7cd4ee8016d85649bd0bbdc4ea24ab571d022d5e62b5f8e0d90d7ee6bbd4dd52" => :el_capitan
|
|
|
|
sha256 "627a98cf5a27228b7f471b90925dbdc9734c9697c147f37767ae9572838dd984" => :yosemite
|
2017-05-28 09:51:49 +00:00
|
|
|
end
|
|
|
|
|
2017-05-28 07:18:01 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
(buildpath/"src/github.com/kshvmdn").mkpath
|
|
|
|
ln_s buildpath, buildpath/"src/github.com/kshvmdn/fsql"
|
2017-06-09 06:25:35 +00:00
|
|
|
system "go", "build", "-o", bin/"fsql", "github.com/kshvmdn/fsql/cmd/fsql"
|
2017-05-28 07:18:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"bar.txt").write("hello")
|
|
|
|
(testpath/"foo/baz.txt").write("world")
|
2017-06-09 06:25:35 +00:00
|
|
|
cmd = "#{bin}/fsql SELECT FULLPATH\\(name\\) FROM foo"
|
2017-07-02 06:24:22 +00:00
|
|
|
assert_match %r{^foo\s+foo/baz.txt$}, shell_output(cmd)
|
2017-06-09 06:25:35 +00:00
|
|
|
cmd = "#{bin}/fsql SELECT name FROM . WHERE name = bar.txt"
|
|
|
|
assert_equal "bar.txt", shell_output(cmd).chomp
|
|
|
|
cmd = "#{bin}/fsql SELECT name FROM . WHERE FORMAT\\(size\, GB\\) \\> 500"
|
|
|
|
assert_equal "", shell_output(cmd)
|
2017-05-28 07:18:01 +00:00
|
|
|
end
|
|
|
|
end
|