diff options
| author | theirix | 2014-09-23 00:13:00 +0400 |
|---|---|---|
| committer | Mike McQuaid | 2014-12-29 11:52:23 +0000 |
| commit | 9a33db91828759ebf18cab85cc46ef80c7a7acf2 (patch) | |
| tree | feadf98f16acdfeb2e6fa18ece3ca433c4659f3d /Library/Formula | |
| parent | 42ba3b8ccb986a8655c0caf1387f547d6edb22a5 (diff) | |
| download | homebrew-9a33db91828759ebf18cab85cc46ef80c7a7acf2.tar.bz2 | |
snappystream 0.1.2 (new formula)
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/snappystream.rb | 43 |
1 files changed, 43 insertions, 0 deletions
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 <iostream> + #include <fstream> + #include <iterator> + #include <algorithm> + #include <snappystream.hpp> + + int main() + { + { std::ofstream ofile("snappy-file.dat"); + snappy::oSnappyStream osnstrm(ofile); + std::cin >> std::noskipws; + std::copy(std::istream_iterator<char>(std::cin), std::istream_iterator<char>(), std::ostream_iterator<char>(osnstrm)); + } + { std::ifstream ifile("snappy-file.dat"); + snappy::iSnappyStream isnstrm(ifile); + isnstrm >> std::noskipws; + std::copy(std::istream_iterator<char>(isnstrm), std::istream_iterator<char>(), std::ostream_iterator<char>(std::cout)); + } + } + EOS + system ENV.cxx, "testsnappystream.cxx", "-lsnappy", "-lsnappystream", "-o", "testsnappystream" + system "./testsnappystream < #{__FILE__} > out.dat && diff #{__FILE__} out.dat" + end +end |
