Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "upb"]
path = upb
url = https://github.com/haberman/upb
13 changes: 12 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,18 @@ python_EXTRA_DIST= \
python/stubout.py \
python/README.txt

all_EXTRA_DIST=$(java_EXTRA_DIST) $(python_EXTRA_DIST)
ruby_EXTRA_DIST= \
ruby/ext/defs.c \
ruby/ext/encode_decode.c \
ruby/ext/extconf.rb \
ruby/ext/message.c \
ruby/ext/protobuf.c \
ruby/ext/protobuf.h \
ruby/ext/repeated_field.c \
ruby/ext/storage.c \
ruby/ext/test.rb

all_EXTRA_DIST=$(java_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST)

EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
autogen.sh \
Expand Down
4 changes: 4 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ sed -i -e 's/RuntimeLibrary="5"/RuntimeLibrary="3"/g;
# TODO(kenton): Remove the ",no-obsolete" part and fix the resulting warnings.
autoreconf -f -i -Wall,no-obsolete

# pull down git submodules.
git submodule init
git submodule update

rm -rf autom4te.cache config.h.in~
exit 0
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ AC_CONFIG_MACRO_DIR([m4])
AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., make dist)])
case "$DIST_LANG" in
"") DIST_LANG=cpp ;;
all | cpp | java | python | javanano) ;;
all | cpp | java | python | javanano | ruby) ;;
*) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;;
esac
AC_SUBST(DIST_LANG)
Expand Down
34 changes: 34 additions & 0 deletions ruby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This directory contains the Ruby extension that implements Protocol Buffers
functionality in Ruby.

The Ruby extension makes use of generated Ruby code that defines message and
enum types in a Ruby DSL. You may write definitions in this DSL directly, but
we recommend using protoc's Ruby generation support with .proto files. The
build process in this directory only installs the extension; you need to
install protoc as well to have Ruby code generation functionality.

Installation
------------

To build this Ruby extension, you will need:

* Rake
* Bundler
* Ruby development headers
* a C compiler
* the upb submodule

First, ensure that upb/ is checked out:

$ cd .. # top level protobuf directory
$ git submodule init
$ git submodule update

Then install the required Ruby gems:

$ sudo gem install bundler rake rake-compiler rspec rubygems-tasks

Then build the Gem:

$ rake gem
$ gem install pkg/protobuf-$VERSION.gem
37 changes: 37 additions & 0 deletions ruby/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
require "rake/extensiontask"
require "rake/testtask"

spec = Gem::Specification.new do |s|
s.name = "protobuf"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name collides with already existing and maintained since 2011 project - https://github.com/localshred/protobuf. Can we change it to google-protobuf for example and host on rubygems.org?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads-up. I think Chris will follow up with a PR to rename this to something that doesn't collide with pre-existing work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, PR coming for this.

s.version = "2.6.2"
s.licenses = ["BSD"]
s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format."
s.authors = ["Protobuf Authors"]
s.email = "[email protected]"

s.files = ["lib/protobuf_c.so", "lib/protobuf.rb"]
end

Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
ext.lib_dir = "lib"
ext.config_script = "extconf.rb"
end

Rake::TestTask.new(:test => :build) do |t|
t.test_files = FileList["tests/*.rb"]
end

task :chmod do
File.chmod(0755, "lib/protobuf_c.so")
end

Gem::PackageTask.new(spec) do |pkg|
end
task :package => :chmod
task :gem => :chmod

task :build => [:clean, :compile]
task :default => [:build]

# vim:sw=2:et
Loading