forked from cstrahan/capnp-ruby
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(packing): add packing to string and file support (#1)
- Loading branch information
Showing
7 changed files
with
160 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM ubuntu:16.04 | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y software-properties-common python-software-properties | ||
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
RUN apt-get update | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install gcc-7 g++-7 git curl make libssl-dev libreadline-dev zlib1g-dev | ||
|
||
RUN update-alternatives --quiet \ | ||
--install /usr/bin/gcc gcc /usr/bin/gcc-7 10 \ | ||
--slave /usr/bin/g++ g++ /usr/bin/g++-7 \ | ||
--slave /usr/bin/gcov gcov /usr/bin/gcov-7 | ||
RUN update-alternatives --quiet --set gcc /usr/bin/gcc-7 | ||
|
||
RUN apt-get install -y bzip2 | ||
RUN apt-get install -y build-essential | ||
# ruby | ||
RUN git clone https://github.com/rbenv/rbenv.git /usr/local/.rbenv | ||
ENV PATH /usr/local/.rbenv/bin:$PATH | ||
RUN eval "$(rbenv init -)" | ||
|
||
RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | ||
RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | ||
RUN export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH" | ||
RUN rbenv install 2.4.1 && rbenv global 2.4.1 | ||
RUN apt-get install -y ruby-full | ||
|
||
RUN gem install bundler -v 1.16.0ex | ||
RUN rbenv rehash | ||
|
||
RUN curl -O https://capnproto.org/capnproto-c++-0.6.1.tar.gz \ | ||
&& tar zxf capnproto-c++-0.6.1.tar.gz \ | ||
&& cd capnproto-c++-0.6.1 \ | ||
&& ./configure \ | ||
&& make -j6 check \ | ||
&& make install | ||
|
||
RUN ln -sf /usr/bin/g++-7 /usr/bin/g++ && ln -sf /usr/bin/gcc-7 /usr/bin/gcc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "ruby_capn_proto.h" | ||
#include "rb_str_output_stream.h" | ||
|
||
namespace ruby_capn_proto { | ||
RbStrOutputStream::~RbStrOutputStream() noexcept(false) {} | ||
|
||
void RbStrOutputStream::write(const void *buffer, size_t size) | ||
{ | ||
const char *pos = reinterpret_cast<const char *>(buffer); | ||
rb_str_cat(str, pos, size); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef RB_STR_OUTPUT_STREAM_H | ||
#define RB_STR_OUTPUT_STREAM_H | ||
|
||
#include "ruby_capn_proto.h" | ||
#include "kj/io.h" | ||
|
||
namespace ruby_capn_proto | ||
{ | ||
class RbStrOutputStream : public kj::OutputStream { | ||
// An OutputStream wrapping string buffer | ||
|
||
public: | ||
explicit RbStrOutputStream(VALUE str) : str(str) {} | ||
KJ_DISALLOW_COPY(RbStrOutputStream); | ||
~RbStrOutputStream() noexcept(false); | ||
|
||
void write(const void *buffer, size_t size) override; | ||
|
||
private: | ||
VALUE str; | ||
}; | ||
} | ||
|
||
#endif /* RB_STR_OUTPUT_STREAM_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module CapnProto | ||
VERSION = "0.0.1.alpha.8" | ||
VERSION = "0.0.1.alpha.9" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters