capn_proto 0.0.1.alpha.1 → 0.0.1.alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,20 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - 2.0.0
7
+
8
+ compiler: gcc
9
+
10
+ before_install:
11
+ - sudo apt-get install autoconf automake libtool autotools-dev
12
+ - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
13
+ - sudo apt-get -qq update
14
+ - sudo apt-get -qq install g++-4.8 libstdc++-4.8-dev
15
+ - sudo update-alternatives --quiet --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60
16
+ --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
17
+ --slave /usr/bin/gcov gcov /usr/bin/gcov-4.8
18
+ - sudo update-alternatives --quiet --set gcc /usr/bin/gcc-4.8
19
+ - wget https://github.com/kentonv/capnproto/archive/master.zip && unzip master.zip && cd capnproto-master/c++ && ./setup-autotools.sh && autoreconf -i && ./configure && make -j6 check && sudo make install && sudo ldconfig && cd ../..
20
+ - export CXXFLAGS="-std=c++11"
data/README.md CHANGED
@@ -6,12 +6,14 @@
6
6
 
7
7
  This here is a [Ruby][ruby] wrapper for the official C++ implementation of [Cap'n Proto][capnp].
8
8
 
9
+ [![Build Status](https://travis-ci.org/cstrahan/capnp-ruby.png?branch=master)](https://travis-ci.org/cstrahan/capnp-ruby)
10
+
9
11
  # Installing
10
12
 
11
13
  First [install libcapnp][libcapnp-install], then install the gem:
12
14
 
13
15
  ```bash
14
- gem install capn_proto
16
+ gem install capn_proto --pre
15
17
  ```
16
18
 
17
19
  Remember to set the `CXX` and `CXXFLAGS` environment variables as necessary. As an OSX user, having followed the [instructions for installing libcapnp on OSX][libcapnp-install], the correct incantation is as follows:
@@ -19,18 +21,54 @@ Remember to set the `CXX` and `CXXFLAGS` environment variables as necessary. As
19
21
  ```bash
20
22
  export CXX=$HOME/clang-3.2/bin/clang++
21
23
  export CXXFLAGS="-std=c++11 -stdlib=libc++"
22
- gem install capn_proto
24
+ gem install capn_proto --pre
23
25
  ```
24
26
 
25
- # License
27
+ # Example
28
+
29
+ ```ruby
30
+ require 'capn_proto'
31
+
32
+ module AddressBook extend CapnProto::SchemaLoader
33
+ load_schema("addressbook.capnp")
34
+ end
35
+
36
+ def print_address_book(file)
37
+ addresses = AddressBook::AddressBook.read_from(file)
38
+
39
+ addresses.people.each do |person|
40
+ puts "#{person.name} : #{person.email}"
26
41
 
27
- The MIT License
42
+ person.phones.each do |phone|
43
+ puts "#{phone.type} : #{phone.number}"
44
+ end
45
+
46
+ which = person.employment.which
47
+
48
+ if which == "unemployed"
49
+ puts "unemployed"
50
+ elsif which == 'employer'
51
+ puts "employer: #{person.employment.employer}"
52
+ elsif which == "school"
53
+ puts "student at: #{person.employment.school}"
54
+ elsif which == "selfEmployed"
55
+ puts "self employed"
56
+ end
57
+ end
58
+ end
59
+
60
+ file = File.open("addressbook.bin", "rb")
61
+ print_address_book(file)
62
+ ```
28
63
 
29
64
  # Status
30
65
 
31
- - [x] Schema parsing (and recursive Module definition)
32
- - [x] Message reading
33
- - [ ] Message writing
66
+ What's implemented:
67
+ - Schema parsing/loading
68
+ - Message reading
69
+
70
+ What's to come:
71
+ - Message writing
34
72
 
35
73
  Proper support for [JRuby][jruby] will come after I implement support for Java.
36
74
 
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ Gem::PackageTask.new(GEMSPEC) do |pkg|
5
5
  end
6
6
 
7
7
  require 'rake/extensiontask'
8
- Rake::ExtensionTask.new('init', GEMSPEC) do |ext|
8
+ Rake::ExtensionTask.new('capn_proto', GEMSPEC) do |ext|
9
9
  ext.ext_dir = 'ext/capn_proto'
10
10
  ext.lib_dir = 'lib/capn_proto'
11
11
  ext.source_pattern = "*.{cc,h}"
@@ -27,7 +27,6 @@ namespace ruby_capn_proto {
27
27
  }
28
28
  case capnp::DynamicValue::LIST:
29
29
  return DynamicListReader::create(value.as<capnp::DynamicList>(), parent);
30
- // return Qnil;
31
30
  case capnp::DynamicValue::STRUCT:
32
31
  return DynamicStructReader::create(value.as<capnp::DynamicStruct>());
33
32
  case capnp::DynamicValue::ENUM:
@@ -13,7 +13,7 @@ $LDFLAGS += " -lcapnpc"
13
13
  $LDFLAGS += " -lcapnp"
14
14
  $LDFLAGS += " -lkj"
15
15
 
16
- create_makefile('ruby_capn_proto/init')
16
+ create_makefile('capn_proto/capn_proto')
17
17
 
18
18
  # HACK ATTACK
19
19
  # def inreplace(path, search, replace)
@@ -18,7 +18,7 @@ extern "C" {
18
18
  using namespace ruby_capn_proto;
19
19
 
20
20
  extern "C" {
21
- void Init_init() {
21
+ void Init_capn_proto() {
22
22
  SchemaParser::Init();
23
23
  SchemaNodeReader::Init();
24
24
  ParsedSchema::Init();
@@ -1,3 +1,3 @@
1
1
  module CapnProto
2
- VERSION = "0.0.1.alpha.1"
2
+ VERSION = "0.0.1.alpha.2"
3
3
  end
data/lib/capn_proto.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'capn_proto/init'
1
+ require 'capn_proto/capn_proto'
2
2
 
3
3
  module CapnProto
4
4
  ListNestedNodeReader.class_eval do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capn_proto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha.1
4
+ version: 0.0.1.alpha.2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -103,6 +103,7 @@ extensions:
103
103
  extra_rdoc_files: []
104
104
  files:
105
105
  - .gitignore
106
+ - .travis.yml
106
107
  - Gemfile
107
108
  - LICENSE
108
109
  - README.md
@@ -172,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  version: '0'
173
174
  segments:
174
175
  - 0
175
- hash: -2889828387253718151
176
+ hash: -555813977738220777
176
177
  required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  none: false
178
179
  requirements: