From 6ea02c11d33143c637cf7e56a2cfc602b7dfd174 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Mon, 30 Jul 2012 23:00:33 -0500 Subject: [PATCH] * initial build ready (i think) --- .gitignore | 5 +++++ .rvmrc | 1 + Gemfile | 3 +++ Gemfile.lock | 10 ++++++++++ README.md | 15 +++++++++++++++ build | 20 ++++++++++++++++++++ build_protoc | 23 +++++++++++++++++++++++ build_rprotoc | 21 +++++++++++++++++++++ src/login.pb | 4 ++++ 9 files changed, 102 insertions(+) create mode 100644 .gitignore create mode 100644 .rvmrc create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100755 build create mode 100755 build_protoc create mode 100755 build_rprotoc create mode 100644 src/login.pb diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..1caad971e --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +target +*.swp +*~ +bin +.bundle diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 000000000..5091144de --- /dev/null +++ b/.rvmrc @@ -0,0 +1 @@ +rvm use ruby-1.9.3@jam-pb --create diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..e13e6cff1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'ruby_protobuf', '0.4.11' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..59d0d0823 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,10 @@ +GEM + remote: https://rubygems.org/ + specs: + ruby_protobuf (0.4.11) + +PLATFORMS + ruby + +DEPENDENCIES + ruby_protobuf (= 0.4.11) diff --git a/README.md b/README.md new file mode 100644 index 000000000..612bb5adc --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +Jam-Pb (Protocol Buffers) +========================= + +Environment +----------- + +Download and install protoc 2.4.1 on the command-line: +http://code.google.com/p/protobuf/downloads/list + +Bash + +Building +-------- + +./build diff --git a/build b/build new file mode 100755 index 000000000..4021fc891 --- /dev/null +++ b/build @@ -0,0 +1,20 @@ +#!/bin/bash + +TARGET=target +SRC=src + +# clean +rm -rf $TARGET +# prep output +mkdir $TARGET + +# find all protocol buffer files in src directory +PROTO_FILES=`find src -name *.pb` + +# make variables available to sub-scripts +export SRC TARGET PROTO_FILES + +# cpp/java/python supported by protoc +./build_protoc +# ruby supported by rprotoc +./build_rprotoc diff --git a/build_protoc b/build_protoc new file mode 100755 index 000000000..b712a8115 --- /dev/null +++ b/build_protoc @@ -0,0 +1,23 @@ +#!/bin/bash + +# this build file uses protoc to build all protocol buffers +# http://code.google.com/p/protobuf/downloads/list + +TARGET_CPP="$TARGET/cpp" + +mkdir -p "$TARGET_CPP" + +PROTOC_ARGS="--cpp_out=$TARGET/cpp" + +# if you don't want to put protoc on the command line, +# then set a PROTOC environment variable +if [ -z $PROTOC] ; then + PROTOC="protoc" +fi + +command -v $PROTOC >/dev/null 2>&1 || { echo >&2 "protoc is required but not installed. Aborting."; exit 1; } + +# die on error at this point +set -e + +$PROTOC $PROTO_FILES --cpp_out=$TARGET/cpp --proto_path=$SRC diff --git a/build_rprotoc b/build_rprotoc new file mode 100755 index 000000000..ba33fb02a --- /dev/null +++ b/build_rprotoc @@ -0,0 +1,21 @@ +#!/bin/bash + +# ruby protocol buffers +# http://code.google.com/p/ruby-protobuf/ +RUBY_OUT=$TARGET/ruby + +# we exit with 0; treat ruby as optional at the moment +command -v "bundle" >/dev/null 2>&1 || { echo >&2 "bundle is required but not installed. Skipping ruby protocol buffers."; exit 0; } + +# creates a bin folder with 'rprotoc' command inside +bundle install --binstubs + +# die on error at this point +set -e + +for i in "${PROTO_FILES[@]}" +do + bin/rprotoc --proto_path $SRC --out $RUBY_OUT "$i" +done + + diff --git a/src/login.pb b/src/login.pb new file mode 100644 index 000000000..944f67584 --- /dev/null +++ b/src/login.pb @@ -0,0 +1,4 @@ +message Login { + required string session_id = 1; + required string username = 2; +}