* initial build ready (i think)

This commit is contained in:
Seth Call 2012-07-30 23:00:33 -05:00
commit 6ea02c11d3
9 changed files with 102 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
target
*.swp
*~
bin
.bundle

1
.rvmrc Normal file
View File

@ -0,0 +1 @@
rvm use ruby-1.9.3@jam-pb --create

3
Gemfile Normal file
View File

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'ruby_protobuf', '0.4.11'

10
Gemfile.lock Normal file
View File

@ -0,0 +1,10 @@
GEM
remote: https://rubygems.org/
specs:
ruby_protobuf (0.4.11)
PLATFORMS
ruby
DEPENDENCIES
ruby_protobuf (= 0.4.11)

15
README.md Normal file
View File

@ -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

20
build Executable file
View File

@ -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

23
build_protoc Executable file
View File

@ -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

21
build_rprotoc Executable file
View File

@ -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

4
src/login.pb Normal file
View File

@ -0,0 +1,4 @@
message Login {
required string session_id = 1;
required string username = 2;
}