2015-06-03 00:52:15 +00:00
|
|
|
class Bltool < Formula
|
2015-08-01 09:35:45 +00:00
|
|
|
desc "Tool for command-line interaction with backloggery.com"
|
2015-06-03 00:52:15 +00:00
|
|
|
homepage "https://github.com/ToxicFrog/bltool"
|
2016-06-20 04:29:11 +00:00
|
|
|
url "https://github.com/ToxicFrog/bltool/releases/download/v0.2.2/bltool-0.2.2.zip"
|
|
|
|
sha256 "613151a5d86a80f8b2f4a71da3aa93f56649ab19ff1597eed2a96fb43e3cdcd4"
|
2015-06-03 00:52:15 +00:00
|
|
|
|
|
|
|
head do
|
|
|
|
url "https://github.com/ToxicFrog/bltool.git"
|
|
|
|
depends_on "leiningen" => :build
|
|
|
|
end
|
|
|
|
|
2016-04-09 08:25:26 +00:00
|
|
|
bottle :unneeded
|
|
|
|
|
2015-06-03 00:52:15 +00:00
|
|
|
def install
|
|
|
|
if build.head?
|
|
|
|
system "lein", "uberjar"
|
|
|
|
bltool_jar = Dir["target/bltool-*-standalone.jar"][0]
|
|
|
|
else
|
|
|
|
bltool_jar = "bltool.jar"
|
|
|
|
end
|
|
|
|
|
|
|
|
libexec.install bltool_jar
|
|
|
|
bin.write_jar_script libexec/File.basename(bltool_jar), "bltool"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-06-20 04:29:11 +00:00
|
|
|
(testpath/"test.edn").write <<-EOS.undent
|
2015-06-03 00:52:15 +00:00
|
|
|
[{:id "12527736",
|
|
|
|
:name "Assassin's Creed",
|
|
|
|
:platform "360",
|
|
|
|
:progress "unfinished"}]
|
|
|
|
EOS
|
|
|
|
|
2016-06-20 04:29:11 +00:00
|
|
|
system bin/"bltool", "--from", "edn",
|
|
|
|
"--to", "text",
|
|
|
|
"--input", "test.edn",
|
|
|
|
"--output", "test.txt"
|
2015-06-03 00:52:15 +00:00
|
|
|
|
2016-06-20 04:29:11 +00:00
|
|
|
assert_match /12527736\s+360\s+unfinished\s+Assassin/, File.read("test.txt")
|
2015-06-03 00:52:15 +00:00
|
|
|
end
|
|
|
|
end
|