bel 0.3.2-x64-mingw32 → 0.3.3-x64-mingw32

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +1 -1
  4. data/bel.gemspec +4 -4
  5. data/ext/mri/extconf.rb +20 -6
  6. data/lib/bel.rb +4 -3
  7. data/lib/bel/libbel.rb +141 -177
  8. data/lib/bel/libbel/bel_ast_structs.rb +150 -148
  9. data/lib/bel/libbel/bel_token.rb +29 -27
  10. data/lib/bel/libbel/bel_token_list.rb +28 -26
  11. data/lib/bel/{2.0 → libbel/ext/2.0}/libbel.so +0 -0
  12. data/lib/bel/{2.1 → libbel/ext/2.1}/libbel.so +0 -0
  13. data/lib/bel/{2.2 → libbel/ext/2.2}/libbel.so +0 -0
  14. data/lib/bel/libbel/ext/java/darwin/x86_64/libbel.bundle +0 -0
  15. data/lib/bel/libbel/ext/java/linux/x86_64/libbel.so +0 -0
  16. data/lib/bel/libbel/ext/java/mswin/i686/2.0/libbel.so +0 -0
  17. data/lib/bel/libbel/ext/java/mswin/i686/2.1/libbel.so +0 -0
  18. data/lib/bel/libbel/ext/java/mswin/i686/2.2/libbel.so +0 -0
  19. data/lib/bel/libbel/ext/java/mswin/x86_64/2.0/libbel.so +0 -0
  20. data/lib/bel/libbel/ext/java/mswin/x86_64/2.1/libbel.so +0 -0
  21. data/lib/bel/libbel/ext/java/mswin/x86_64/2.2/libbel.so +0 -0
  22. data/lib/bel/libbel/ext/mingw/i686/2.0/libbel.so +0 -0
  23. data/lib/bel/libbel/ext/mingw/i686/2.1/libbel.so +0 -0
  24. data/lib/bel/libbel/ext/mingw/i686/2.2/libbel.so +0 -0
  25. data/lib/bel/libbel/ext/mingw/x86_64/2.0/libbel.so +0 -0
  26. data/lib/bel/libbel/ext/mingw/x86_64/2.1/libbel.so +0 -0
  27. data/lib/bel/libbel/ext/mingw/x86_64/2.2/libbel.so +0 -0
  28. data/lib/bel/libbel/library_load_error.rb +30 -0
  29. data/lib/bel/libbel/library_resolver.rb +103 -0
  30. data/lib/bel/libbel/node_test.rb +29 -27
  31. data/lib/bel/libbel/node_transformation.rb +24 -22
  32. data/lib/bel/libbel/node_traversal.rb +79 -77
  33. data/lib/bel/libbel/platform_support_error.rb +23 -0
  34. data/lib/bel/version.rb +1 -1
  35. metadata +23 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bf833ee1a0b785b9f6b8f465127642c23424751
4
- data.tar.gz: 2d73e08feffa2f234bfb9a1fc0a57a50c759d37f
3
+ metadata.gz: 6289572fa7b3143e26f810a1eafb1c0aba04d6ce
4
+ data.tar.gz: e23d121d97eb104122798b2d8d9cf7ca6e5aa5bd
5
5
  SHA512:
6
- metadata.gz: e5df2dbc07c414825258383b53569ec596ecb1bf8e8f56142b68741fb167a3716370b8d4ba583a3343815db3ca940947f88e10fd6618cd5d7b31a7f9221a795d
7
- data.tar.gz: d11e1a8a6c5ca6a3e42b7d3f6e9df1b413dbef5277a8073c290c8bd914b63948ac902be8faece67a524d337e63dc66e20d5191519330605057c2cf71007f515d
6
+ metadata.gz: d0ac2c4745eef30fbf1758d72a867d4ba439c1237c660e612ccaee9921ced7493dba6ec50872817bf7294b955ed13e2c1268d3e1b8b23642006a6fbedf41b3cb
7
+ data.tar.gz: a45322766823b1e3c57bca6322b1ad8fcb840a910682f52e19282719c8061981ab863357071fe174089392f6f64550c88e0420f32d11d73973ff21772a7e1e2c
data/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Change Log
2
+ All notable changes to bel.rb will be documented in this file. The curated log begins at changes to version 0.3.2.
3
+
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [0.3.3][0.3.3] - 2015-08-07
7
+ ### Fixed
8
+ - ResourceIndex integration test causes intermittent timeouts ([Issue #61][61]).
9
+ - Support running on JRuby, including libbel native library ([Issue #68][68]).
10
+
11
+ ## [0.3.2][0.3.2] - 2015-07-31
12
+ ### Fixed
13
+ - Allow whitespace (space/tab) within blank lines ([Issue #13][13]).
14
+ - Parse CRLF line terminators (i.e. Windows) when parsing BEL Script ([Issue #21][21]).
15
+ - Allow whitespace before BEL Script records ([Issue #25][25]).
16
+ - Support RDF conversion of unicode string literals ([Issue #40][40]).
17
+ - Support translation from and to RDF ([Issue #51][51]).
18
+ - (Regression) Unable to parse BEL files on Windows ([Issue #59][59]).
19
+ - RDF "hasConcept" property triple is missing namespace ([Issue #64][64]).
20
+
21
+ ### Changed
22
+ - Updates defined namespaces to reflect the [20150611][20150611] resources.
23
+ - Full support for all BEL functions and relationships during RDF conversion.
24
+
25
+ ### Added
26
+ - Development gem dependencies (i.e. byebug, pry, pry-byebug) for debugging.
27
+
28
+ [0.3.2]: https://github.com/OpenBEL/bel.rb/compare/0.3.1...0.3.2
29
+ [0.3.3]: https://github.com/OpenBEL/bel.rb/compare/0.3.2...0.3.3
30
+ [13]: https://github.com/OpenBEL/bel.rb/issues/13
31
+ [21]: https://github.com/OpenBEL/bel.rb/issues/21
32
+ [25]: https://github.com/OpenBEL/bel.rb/issues/25
33
+ [40]: https://github.com/OpenBEL/bel.rb/issues/40
34
+ [51]: https://github.com/OpenBEL/bel.rb/issues/51
35
+ [59]: https://github.com/OpenBEL/bel.rb/issues/59
36
+ [61]: https://github.com/OpenBEL/bel.rb/issues/61
37
+ [64]: https://github.com/OpenBEL/bel.rb/issues/64
38
+ [68]: https://github.com/OpenBEL/bel.rb/issues/68
39
+ [20150611]: http://resource.belframework.org/belframework/20150611/
data/README.md CHANGED
@@ -63,7 +63,7 @@ executable commands
63
63
  upgrade
64
64
 
65
65
 
66
- bel 0.3.2
66
+ bel 0.3.3
67
67
  Copyright (C) 2015 OpenBEL
68
68
  Apache License, Version 2.0, January 2004
69
69
  http://www.apache.org/licenses/
data/bel.gemspec CHANGED
@@ -25,9 +25,11 @@ Gem::Specification.new do |spec|
25
25
  'whayes@selventa.com'
26
26
  ]
27
27
  spec.files = [
28
- Dir.glob("lib/**/*.rb"),
29
- Dir.glob("ext/**/*.{c,h,def}"),
28
+ Dir.glob('lib/**/*.rb'),
29
+ Dir.glob('ext/**/*.{c,h,def}'),
30
+ Dir.glob('lib/bel/libbel/ext/{java,mingw}/**/*.{so,bundle}'),
30
31
  __FILE__,
32
+ 'CHANGELOG.md',
31
33
  'LICENSE',
32
34
  'INSTALL.md',
33
35
  'INSTALL_RUBY.md',
@@ -63,9 +65,7 @@ Gem::Specification.new do |spec|
63
65
  spec.add_development_dependency 'uuid', '~> 2.3'
64
66
 
65
67
  # development gems
66
- spec.add_development_dependency 'byebug', '~> 5.0'
67
68
  spec.add_development_dependency 'minitest', '~> 5.7'
68
- spec.add_development_dependency 'pry-byebug', '~> 3.2'
69
69
  spec.add_development_dependency 'rake', '~> 10.4'
70
70
  spec.add_development_dependency 'rake-compiler', '~> 0.9'
71
71
  spec.add_development_dependency 'rdoc', '~> 4.2'
data/ext/mri/extconf.rb CHANGED
@@ -1,8 +1,22 @@
1
- require 'mkmf'
1
+ if RUBY_PLATFORM =~ /java/i
2
2
 
3
- # if set in environment, set compiler for make
4
- # example:
5
- # CC=gcc-4.8 gem install bel.rb
6
- RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
3
+ # Don't do anything when run in JRuby; this allows gem installation to pass.
4
+ # We need to write a dummy Makefile so that RubyGems doesn't think compilation
5
+ # failed.
6
+ File.open('Makefile', 'w') do |f|
7
+ f.puts "all:"
8
+ f.puts "\t@true"
9
+ f.puts "install:"
10
+ f.puts "\t@true"
11
+ end
12
+ exit 0
13
+ else
7
14
 
8
- create_makefile('bel/libbel')
15
+ require 'mkmf'
16
+ # if set in environment, set compiler for make
17
+ # example:
18
+ # CC=gcc-4.8 gem install bel.rb
19
+ RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
20
+
21
+ create_makefile('bel/libbel/ext/libbel')
22
+ end
data/lib/bel.rb CHANGED
@@ -1,7 +1,4 @@
1
1
  require_relative 'bel/version'
2
- require_relative 'bel/libbel.rb'
3
- require_relative 'bel/parser'
4
- require_relative 'bel/completion'
5
2
  require_relative 'bel/language'
6
3
  require_relative 'bel/namespace'
7
4
  require_relative 'bel/util'
@@ -13,6 +10,10 @@ require_relative 'bel/format'
13
10
 
14
11
  require_relative 'bel/script'
15
12
 
13
+ require_relative 'bel/libbel.rb'
14
+ require_relative 'bel/parser'
15
+ require_relative 'bel/completion'
16
+
16
17
  include BEL::Language
17
18
  include BEL::Namespace
18
19
 
data/lib/bel/libbel.rb CHANGED
@@ -1,200 +1,164 @@
1
- module LibBEL
1
+ require_relative 'libbel/library_load_error'
2
+ require_relative 'libbel/library_resolver'
2
3
 
3
- class << self
4
+ module BEL
5
+ module LibBEL
4
6
 
5
- def rubinius?
6
- defined?(RUBY_ENGINE) && ("rbx" == RUBY_ENGINE)
7
- end
7
+ extend LibraryResolver
8
8
 
9
- # @api_private
10
- # Determines the correct extension path for your ruby version
11
- def extension_path(ruby_version = RUBY_VERSION)
12
- version =
13
- case ruby_version
14
- when /^2\.0/
15
- '2.0'
16
- when /^2\.1/
17
- '2.1'
18
- when /^2\.2/
19
- '2.2'
20
- else
21
- fail RuntimeError.new("Do not support Ruby #{RUBY_VERSION}.")
22
- end
9
+ class << self
23
10
 
24
- File.join(File.expand_path(File.dirname(__FILE__)), version)
25
- end
11
+ def rubinius?
12
+ defined?(RUBY_ENGINE) && ("rbx" == RUBY_ENGINE)
13
+ end
26
14
 
27
- # @api_private
28
- # Determine FFI constant for this ruby engine.
29
- def find_ffi
30
- if rubinius?
31
- # Use ffi gem instead of rubinius-bundled FFI
32
- # Rubinius 2.5.2 does not seem to support FFI::ManagedStruct
33
- require "ffi"
34
- ::FFI
35
- else # mri, jruby, etc
36
- require "ffi"
37
- ::FFI
15
+ # @api_private
16
+ # Determine FFI constant for this ruby engine.
17
+ def find_ffi
18
+ if rubinius?
19
+ # Use ffi gem instead of rubinius-bundled FFI
20
+ # Rubinius 2.5.2 does not seem to support FFI::ManagedStruct
21
+ require "ffi"
22
+ ::FFI
23
+ else # mri, jruby, etc
24
+ require "ffi"
25
+ ::FFI
26
+ end
38
27
  end
39
- end
40
28
 
41
- # @api_private
42
- # Extend with the correct ffi implementation.
43
- def load_ffi
44
- ffi_module = LibBEL::find_ffi
45
- extend ffi_module::Library
46
- ffi_module
47
- end
29
+ # @api_private
30
+ # Extend with the correct ffi implementation.
31
+ def load_ffi
32
+ ffi_module = BEL::LibBEL::find_ffi
33
+ extend ffi_module::Library
34
+ ffi_module
35
+ end
36
+
37
+ # @api_private
38
+ # Loads the libbel shared library.
39
+ def load_libBEL
40
+ ffi_module = find_ffi
41
+ extend ffi_module::Library
42
+
43
+ lib_path = resolve_library('libbel')
48
44
 
49
- # @api_private
50
- # Loads the libbel shared library.
51
- def load_libBEL
52
- ffi_module = find_ffi
53
- extend ffi_module::Library
54
-
55
- # libbel.so: Linux and MinGW
56
- # libbel.bundle: Mac OSX
57
- messages = []
58
- library_loaded = ['libbel.so', 'libbel.bundle'].map { |library_file|
59
- [
60
- library_file,
61
- File.join(
62
- File.expand_path(File.dirname(__FILE__)),
63
- library_file
64
- )
65
- ]
66
- }.any? do |library_file, library_path|
67
- # Try loading top-level shared library.
68
45
  begin
69
- ffi_lib library_path
46
+ ffi_lib lib_path
70
47
  true
71
- rescue LoadError => exception1
72
- # Try loading version-specific shared library.
73
- begin
74
- ffi_lib File.join(extension_path, library_file)
75
- true
76
- rescue LoadError => exception2
77
- messages << exception1.to_s
78
- messages << exception2.to_s
79
- false
80
- end
48
+ rescue LoadError => err
49
+ raise LibraryLoadError.new('libbel', err)
50
+ false
81
51
  end
82
52
  end
83
-
84
- if !library_loaded
85
- msg = messages.map { |msg| " #{msg}" }.join("\n")
86
- fail LoadError.new("Failed to load libbel library. Details:\n#{msg}")
87
- end
88
53
  end
89
- end
90
54
 
91
- # Constant holding the FFI module for this ruby engine.
92
- FFI = LibBEL::load_ffi
93
- LibBEL::load_libBEL
94
-
95
- # typedef enum bel_token_type
96
- enum :bel_token_type, [
97
- :IDENT, 0,
98
- :STRING,
99
- :O_PAREN,
100
- :C_PAREN,
101
- :COLON,
102
- :COMMA,
103
- :SPACES
104
- ]
105
-
106
- enum :bel_ast_node_type, [
107
- :BEL_TOKEN, 0,
108
- :BEL_VALUE
109
- ]
110
-
111
- enum :bel_ast_token_type, [
112
- :BEL_TOKEN_STATEMENT, 0,
113
- :BEL_TOKEN_SUBJECT,
114
- :BEL_TOKEN_OBJECT,
115
- :BEL_TOKEN_REL,
116
- :BEL_TOKEN_TERM,
117
- :BEL_TOKEN_ARG,
118
- :BEL_TOKEN_NV
119
- ]
120
-
121
- enum :bel_ast_value_type, [
122
- :BEL_VALUE_FX, 0,
123
- :BEL_VALUE_REL,
124
- :BEL_VALUE_PFX,
125
- :BEL_VALUE_VAL
126
- ]
127
-
128
- require_relative 'libbel/bel_ast_structs'
129
- require_relative 'libbel/bel_token'
130
- require_relative 'libbel/bel_token_iterator'
131
- require_relative 'libbel/bel_token_list'
132
-
133
- # bel ast
134
- attach_function :bel_ast_as_string, [:pointer ], :string
135
- attach_function :bel_copy_ast_node, [:pointer ], :pointer
136
- attach_function :bel_free_ast, [:pointer ], :void
137
- attach_function :bel_free_ast_node, [:pointer ], :void
138
- attach_function :bel_new_ast, [ ], :pointer
139
- attach_function :bel_new_ast_node_token, [:bel_ast_token_type ], :pointer
140
- attach_function :bel_new_ast_node_value, [:bel_ast_value_type, :string ], :pointer
141
- attach_function :bel_print_ast, [:pointer ], :void
142
- attach_function :bel_print_ast_node, [:pointer, :string ], :void
143
- attach_function :bel_set_value, [:pointer, :string ], :pointer
144
-
145
- # bel token
146
- attach_function :bel_new_token, [:bel_token_type, :pointer, :pointer, :pointer], :pointer
147
- attach_function :bel_new_token_iterator, [:pointer ], :pointer
148
- attach_function :bel_new_token_list, [:int ], :pointer
149
- attach_function :bel_print_token, [:pointer ], :void
150
- attach_function :bel_print_token_list, [:pointer ], :void
151
- attach_function :bel_token_iterator_end, [:pointer ], :int
152
- attach_function :bel_token_iterator_get, [:pointer ], :pointer
153
- attach_function :bel_token_iterator_next, [:pointer ], :void
154
- attach_function :free_bel_token, [:pointer ], :void
155
- attach_function :free_bel_token_iterator, [:pointer ], :void
156
- attach_function :free_bel_token_list, [:pointer ], :void
157
-
158
- # tokenize
159
- attach_function :bel_tokenize_term, [:string ], :pointer
160
-
161
- # parse
162
- attach_function :bel_parse_statement, [:string ], :pointer
163
- attach_function :bel_parse_term, [:string ], :pointer
164
-
165
- def self.parse_statement(bel_string)
166
- LibBEL::BelAst.new(LibBEL::bel_parse_statement(bel_string))
167
- end
55
+ # Constant holding the FFI module for this ruby engine.
56
+ FFI = BEL::LibBEL::load_ffi
57
+ BEL::LibBEL::load_libBEL
58
+
59
+ # typedef enum bel_token_type
60
+ enum :bel_token_type, [
61
+ :IDENT, 0,
62
+ :STRING,
63
+ :O_PAREN,
64
+ :C_PAREN,
65
+ :COLON,
66
+ :COMMA,
67
+ :SPACES
68
+ ]
69
+
70
+ enum :bel_ast_node_type, [
71
+ :BEL_TOKEN, 0,
72
+ :BEL_VALUE
73
+ ]
74
+
75
+ enum :bel_ast_token_type, [
76
+ :BEL_TOKEN_STATEMENT, 0,
77
+ :BEL_TOKEN_SUBJECT,
78
+ :BEL_TOKEN_OBJECT,
79
+ :BEL_TOKEN_REL,
80
+ :BEL_TOKEN_TERM,
81
+ :BEL_TOKEN_ARG,
82
+ :BEL_TOKEN_NV
83
+ ]
84
+
85
+ enum :bel_ast_value_type, [
86
+ :BEL_VALUE_FX, 0,
87
+ :BEL_VALUE_REL,
88
+ :BEL_VALUE_PFX,
89
+ :BEL_VALUE_VAL
90
+ ]
91
+
92
+ require_relative 'libbel/bel_ast_structs'
93
+ require_relative 'libbel/bel_token'
94
+ require_relative 'libbel/bel_token_iterator'
95
+ require_relative 'libbel/bel_token_list'
96
+
97
+ # bel ast
98
+ attach_function :bel_ast_as_string, [:pointer ], :string
99
+ attach_function :bel_copy_ast_node, [:pointer ], :pointer
100
+ attach_function :bel_free_ast, [:pointer ], :void
101
+ attach_function :bel_free_ast_node, [:pointer ], :void
102
+ attach_function :bel_new_ast, [ ], :pointer
103
+ attach_function :bel_new_ast_node_token, [:bel_ast_token_type ], :pointer
104
+ attach_function :bel_new_ast_node_value, [:bel_ast_value_type, :string ], :pointer
105
+ attach_function :bel_print_ast, [:pointer ], :void
106
+ attach_function :bel_print_ast_node, [:pointer, :string ], :void
107
+ attach_function :bel_set_value, [:pointer, :string ], :pointer
108
+
109
+ # bel token
110
+ attach_function :bel_new_token, [:bel_token_type, :pointer, :pointer, :pointer], :pointer
111
+ attach_function :bel_new_token_iterator, [:pointer ], :pointer
112
+ attach_function :bel_new_token_list, [:int ], :pointer
113
+ attach_function :bel_print_token, [:pointer ], :void
114
+ attach_function :bel_print_token_list, [:pointer ], :void
115
+ attach_function :bel_token_iterator_end, [:pointer ], :int
116
+ attach_function :bel_token_iterator_get, [:pointer ], :pointer
117
+ attach_function :bel_token_iterator_next, [:pointer ], :void
118
+ attach_function :free_bel_token, [:pointer ], :void
119
+ attach_function :free_bel_token_iterator, [:pointer ], :void
120
+ attach_function :free_bel_token_list, [:pointer ], :void
121
+
122
+ # tokenize
123
+ attach_function :bel_tokenize_term, [:string ], :pointer
124
+
125
+ # parse
126
+ attach_function :bel_parse_statement, [:string ], :pointer
127
+ attach_function :bel_parse_term, [:string ], :pointer
128
+
129
+ def self.parse_statement(bel_string)
130
+ BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_parse_statement(bel_string))
131
+ end
168
132
 
169
- def self.parse_term(bel_string)
170
- LibBEL::BelAst.new(LibBEL::bel_parse_term(bel_string))
171
- end
133
+ def self.parse_term(bel_string)
134
+ BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_parse_term(bel_string))
135
+ end
172
136
 
173
- def self.tokenize_term(bel_string)
174
- LibBEL::BelTokenList.new(self.bel_tokenize_term(bel_string))
175
- end
137
+ def self.tokenize_term(bel_string)
138
+ BEL::LibBEL::BelTokenList.new(self.bel_tokenize_term(bel_string))
139
+ end
176
140
 
177
- def self.copy_ast(bel_ast)
178
- copy_root = self.copy_ast_node(bel_ast.root)
179
- new_ast = LibBEL::BelAst.new(LibBEL::bel_new_ast())
180
- new_ast.root = copy_root
181
- new_ast
182
- end
141
+ def self.copy_ast(bel_ast)
142
+ copy_root = self.copy_ast_node(bel_ast.root)
143
+ new_ast = BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_new_ast())
144
+ new_ast.root = copy_root
145
+ new_ast
146
+ end
183
147
 
184
- def self.copy_ast_node(bel_ast_node)
185
- LibBEL::BelAstNode.new(LibBEL::bel_copy_ast_node(bel_ast_node))
186
- end
148
+ def self.copy_ast_node(bel_ast_node)
149
+ BEL::LibBEL::BelAstNode.new(BEL::LibBEL::bel_copy_ast_node(bel_ast_node))
150
+ end
187
151
 
188
- def self.print_ast(bel_ast)
189
- LibBEL::bel_print_ast(bel_ast)
190
- end
152
+ def self.print_ast(bel_ast)
153
+ BEL::LibBEL::bel_print_ast(bel_ast)
154
+ end
191
155
 
192
- def self.print_token(token)
193
- self.bel_print_token(token.pointer)
194
- end
156
+ def self.print_token(token)
157
+ self.bel_print_token(token.pointer)
158
+ end
195
159
 
196
- def self.print_token_list(list)
197
- self.bel_print_token_list(list.pointer)
160
+ def self.print_token_list(list)
161
+ self.bel_print_token_list(list.pointer)
162
+ end
198
163
  end
199
164
  end
200
-