Skip to content

Commit

Permalink
flatbuffers 1.0.3 (new formula)
Browse files Browse the repository at this point in the history
Closes Homebrew/legacy-homebrew#36544.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
  • Loading branch information
alebcay authored and MikeMcQuaid committed Feb 5, 2015
1 parent 9186a8d commit 8594b51
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions Formula/flatbuffers.rb
@@ -0,0 +1,61 @@
class Flatbuffers < Formula
homepage "https://google.github.io/flatbuffers"
url "https://github.com/google/flatbuffers/archive/v1.0.3.tar.gz"
sha1 "8daba5be5436b7cb99f1883e3eb7f1c5da52d6b9"

depends_on "cmake" => :build

def install
system "cmake", "-G", "Unix Makefiles", *std_cmake_args
system "make", "install"
end

test do
def testfbs; <<-EOS.undent
// example IDL file
namespace MyGame.Sample;
enum Color:byte { Red = 0, Green, Blue = 2 }
union Any { Monster } // add more elements..
struct Vec3 {
x:float;
y:float;
z:float;
}
table Monster {
pos:Vec3;
mana:short = 150;
hp:short = 100;
name:string;
friendly:bool = false (deprecated);
inventory:[ubyte];
color:Color = Blue;
}
root_type Monster;
EOS
end
(testpath/"test.fbs").write(testfbs)

def testjson; <<-EOS.undent
{
pos: {
x: 1,
y: 2,
z: 3
},
hp: 80,
name: "MyMonster"
}
EOS
end
(testpath/"test.json").write(testjson)

system "flatc", "-c", "-b", "test.fbs", "test.json"
end
end

0 comments on commit 8594b51

Please sign in to comment.