From 9a33db91828759ebf18cab85cc46ef80c7a7acf2 Mon Sep 17 00:00:00 2001 From: theirix Date: Tue, 23 Sep 2014 00:13:00 +0400 Subject: snappystream 0.1.2 (new formula) --- Library/Formula/snappystream.rb | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Library/Formula/snappystream.rb (limited to 'Library') diff --git a/Library/Formula/snappystream.rb b/Library/Formula/snappystream.rb new file mode 100644 index 000000000..c4ca4c3bd --- /dev/null +++ b/Library/Formula/snappystream.rb @@ -0,0 +1,43 @@ +require "formula" + +class Snappystream < Formula + homepage "https://github.com/hoxnox/snappystream" + url "https://github.com/hoxnox/snappystream/archive/0.1.2.tar.gz" + sha1 "40ceac66a58659d1827cc7375a72210bb84be9b3" + + head "https://github.com/hoxnox/snappystream.git" + + depends_on "cmake" => :build + depends_on "snappy" + + def install + system "cmake", ".", "-DBUILD_TESTS=ON", *std_cmake_args + system "make", "all", "test", "install" + end + + test do + (testpath/"testsnappystream.cxx").write <<-EOS.undent + #include + #include + #include + #include + #include + + int main() + { + { std::ofstream ofile("snappy-file.dat"); + snappy::oSnappyStream osnstrm(ofile); + std::cin >> std::noskipws; + std::copy(std::istream_iterator(std::cin), std::istream_iterator(), std::ostream_iterator(osnstrm)); + } + { std::ifstream ifile("snappy-file.dat"); + snappy::iSnappyStream isnstrm(ifile); + isnstrm >> std::noskipws; + std::copy(std::istream_iterator(isnstrm), std::istream_iterator(), std::ostream_iterator(std::cout)); + } + } + EOS + system ENV.cxx, "testsnappystream.cxx", "-lsnappy", "-lsnappystream", "-o", "testsnappystream" + system "./testsnappystream < #{__FILE__} > out.dat && diff #{__FILE__} out.dat" + end +end -- cgit v1.2.3