protobuf-closure-library 0.1.4 → 0.1.5

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/README.rst CHANGED
@@ -25,6 +25,7 @@ Usage
25
25
 
26
26
  ::
27
27
 
28
+ require 'protobuf-closure-library'
28
29
  ProtobufClosureLibrary::ProtocJs.compile input_proto_file,
29
30
  output_dir, optional_protoc_arg, ...
30
31
 
@@ -5,22 +5,12 @@ using namespace std;
5
5
  #include "rice/Class.hpp"
6
6
  #include "rice/Array.hpp"
7
7
  #include "rice/String.hpp"
8
- #include "rice/Exception.hpp"
9
8
  using namespace Rice;
10
9
 
11
10
  #include <google/protobuf/compiler/plugin.h>
12
11
  #include <google/protobuf/compiler/command_line_interface.h>
13
12
  #include "code_generator.h"
14
13
 
15
- class RuntimeException : public exception {
16
- public:
17
- RuntimeException(string ss) : s(ss) {};
18
- virtual ~RuntimeException() throw() {};
19
- virtual const char* what() const throw() { return s.c_str(); };
20
- private:
21
- string s;
22
- };
23
-
24
14
  void compile (Object ruby_bin, Object proto_file, Object args) {
25
15
  // Prepare protoc cli.
26
16
  sg::protobuf::js::CodeGenerator js_generator("js_plugin");
@@ -41,17 +31,18 @@ void compile (Object ruby_bin, Object proto_file, Object args) {
41
31
  stringstream cerr_buffer;
42
32
  streambuf *original_cerr_buffer = cerr.rdbuf(cerr_buffer.rdbuf());
43
33
 
34
+ // Run the compiler.
44
35
  int result = protoc_cli.Run((int) argv.size(), &argv[0]);
45
36
 
37
+ // Check for errors.
46
38
  if (result != 0) {
47
- // Use ostringstream to avoid segfault.
48
- ostringstream oss;
49
- oss <<
50
- "An error occured while running protoc:\n"
51
- "-- Protoc output ---------------------\n\n"
52
- << cerr_buffer.str() << endl <<
53
- "--------------------------------------\n";
54
- throw RuntimeException(oss.str());
39
+ string err = cerr_buffer.str();
40
+ rb_raise(rb_eRuntimeError,
41
+ "\nAn error occured while running protoc:\n"
42
+ "-- Protoc output ---------------------\n\n%s\n"
43
+ "--------------------------------------\n",
44
+ err.c_str()
45
+ );
55
46
  }
56
47
 
57
48
  // De-redirect cerr.
@@ -1,3 +1,3 @@
1
1
  module ProtobufClosureLibrary
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-closure-library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-12 00:00:00.000000000 Z
12
+ date: 2012-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rice
16
- requirement: &2164519240 !ruby/object:Gem::Requirement
16
+ requirement: &2169520160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164519240
24
+ version_requirements: *2169520160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &2164500680 !ruby/object:Gem::Requirement
27
+ requirement: &2169519740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2164500680
35
+ version_requirements: *2169519740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake-compiler
38
- requirement: &2164499260 !ruby/object:Gem::Requirement
38
+ requirement: &2169519320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164499260
46
+ version_requirements: *2169519320
47
47
  description: ! " A wrapper for native protocol buffer javascript compiler\n which
48
48
  generates closure library proto2 messages.\n"
49
49
  email:
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  segments:
87
87
  - 0
88
- hash: 4373249129295402986
88
+ hash: 1293859870650302432
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: 4373249129295402986
97
+ hash: 1293859870650302432
98
98
  requirements: []
99
99
  rubyforge_project: protobuf-closure-library
100
100
  rubygems_version: 1.8.10