rucy 0.1.18 → 0.1.23
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/rucy2rdoc +9 -9
- data/include/rucy/ruby.h +5 -0
- data/lib/rucy/module.rb +5 -5
- data/lib/rucy/rake.rb +3 -3
- data/rucy.gemspec +2 -2
- data/test/test_class.rb +21 -21
- data/test/test_exception.rb +7 -7
- data/test/test_function.rb +6 -6
- data/test/test_struct.rb +4 -4
- data/test/test_value.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b2ee08464989008f1c0570feb063721ce374d5ff8e2f7b0ce7853d996d0b389
|
4
|
+
data.tar.gz: 5fd32ea836009f89e089158d18b7dc6dc84ef8fa477a47dbd67680213f78e296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2313127d50985a157caf5cc775b5d3b258184081404226e4ae237d404b4d4c4ce9209615125a1ceef4838fe139f98723da721eb17e869819d7c760b2c1905bab
|
7
|
+
data.tar.gz: 6219e8bd78e6fc909876efefaad9de757b99020f2c676dd8b33321063f236ccdff062026d1c44ae1c51b4a8ea5100db97d660c94addddd6dde8e039881aca8bc
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.23
|
data/bin/rucy2rdoc
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
class Parser
|
5
5
|
|
6
|
-
def initialize
|
6
|
+
def initialize(lines)
|
7
7
|
@funs = {}
|
8
8
|
@lines = lines
|
9
9
|
end
|
10
10
|
|
11
|
-
def parse
|
11
|
+
def parse()
|
12
12
|
parse_functions @lines
|
13
13
|
parse_Init @lines
|
14
14
|
@lines
|
@@ -16,7 +16,7 @@ class Parser
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def process_lines
|
19
|
+
def process_lines(lines, regexp, &block)
|
20
20
|
lines.gsub! regexp do |str|
|
21
21
|
params = $~[1..-1]
|
22
22
|
params.unshift str
|
@@ -24,7 +24,7 @@ class Parser
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def parse_functions
|
27
|
+
def parse_functions(lines)
|
28
28
|
re = %r{
|
29
29
|
(?:RUCY_)?DEF(\d+|N|_ALLOC)\( (\w+) \s* ((?:\, \s* \w+)*) \s* \) \s*
|
30
30
|
(\{ \s*
|
@@ -50,7 +50,7 @@ class Parser
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def parse_Init
|
53
|
+
def parse_Init(lines)
|
54
54
|
re = %r{
|
55
55
|
Init_(\w*) \s* \( \s* \) \s*
|
56
56
|
\{ \s*
|
@@ -64,7 +64,7 @@ class Parser
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def parse_module_and_class
|
67
|
+
def parse_module_and_class(lines)
|
68
68
|
re = %r{
|
69
69
|
(\w+) \s* \= \s*
|
70
70
|
(?: (\w+) \s* \. )? \s* (define_(?:module|class)) \s*
|
@@ -79,7 +79,7 @@ class Parser
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
def parse_methods
|
82
|
+
def parse_methods(lines)
|
83
83
|
re = %r{
|
84
84
|
(\w+) \s* \. \s* (define_\w+) \s*
|
85
85
|
\( \s* (?: (\"\w+(?:\=|\?\!)?\") \s* \, \s* )? (\w+) \s* \) \s* ;
|
@@ -100,11 +100,11 @@ class Parser
|
|
100
100
|
end# Parser
|
101
101
|
|
102
102
|
|
103
|
-
def usage
|
103
|
+
def usage()
|
104
104
|
"rucy2rdoc FILE"
|
105
105
|
end
|
106
106
|
|
107
|
-
def main
|
107
|
+
def main(argv)
|
108
108
|
if path = argv.shift
|
109
109
|
print Parser.new(File.read path).parse
|
110
110
|
else
|
data/include/rucy/ruby.h
CHANGED
data/lib/rucy/module.rb
CHANGED
@@ -8,23 +8,23 @@ module Rucy
|
|
8
8
|
|
9
9
|
module_function
|
10
10
|
|
11
|
-
def name
|
11
|
+
def name()
|
12
12
|
super.split('::')[-2]
|
13
13
|
end
|
14
14
|
|
15
|
-
def version
|
15
|
+
def version()
|
16
16
|
open(root_dir 'VERSION') {|f| f.readline.chomp}
|
17
17
|
end
|
18
18
|
|
19
|
-
def root_dir
|
19
|
+
def root_dir(path = '')
|
20
20
|
File.expand_path "../../#{path}", __dir__
|
21
21
|
end
|
22
22
|
|
23
|
-
def inc_dir
|
23
|
+
def inc_dir()
|
24
24
|
root_dir 'include'
|
25
25
|
end
|
26
26
|
|
27
|
-
def lib_dir
|
27
|
+
def lib_dir()
|
28
28
|
root_dir 'lib'
|
29
29
|
end
|
30
30
|
|
data/lib/rucy/rake.rb
CHANGED
@@ -10,15 +10,15 @@ module Rucy
|
|
10
10
|
module Rake
|
11
11
|
|
12
12
|
|
13
|
-
def rdoc
|
13
|
+
def rdoc()
|
14
14
|
env :RDOC, 'rdoc'# 'yardoc'
|
15
15
|
end
|
16
16
|
|
17
|
-
def rucy2rdoc
|
17
|
+
def rucy2rdoc()
|
18
18
|
env :RUCY2RDOC, 'rucy2rdoc'
|
19
19
|
end
|
20
20
|
|
21
|
-
def generate_documents
|
21
|
+
def generate_documents()
|
22
22
|
rdocdir = ".doc/#{ext_dir}"
|
23
23
|
srcs = FileList["#{ext_dir}/**/*.{#{src_exts.join ','}}"]
|
24
24
|
rdocs = Hash[srcs.map{|path| [path, "#{rdocdir}/#{File.basename path}"]}]
|
data/rucy.gemspec
CHANGED
@@ -26,9 +26,9 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.homepage = "https://github.com/xord/rucy"
|
27
27
|
|
28
28
|
s.platform = Gem::Platform::RUBY
|
29
|
-
s.required_ruby_version = '
|
29
|
+
s.required_ruby_version = '>= 2.6.0'
|
30
30
|
|
31
|
-
s.add_runtime_dependency 'xot', '~> 0.1.
|
31
|
+
s.add_runtime_dependency 'xot', '~> 0.1.23'
|
32
32
|
|
33
33
|
s.files = `git ls-files`.split $/
|
34
34
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/test/test_class.rb
CHANGED
@@ -6,11 +6,11 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class Temp < Rucy::Tester::Sub
|
8
8
|
|
9
|
-
def name
|
9
|
+
def name()
|
10
10
|
"Temp::name"
|
11
11
|
end
|
12
12
|
|
13
|
-
def name_overridable
|
13
|
+
def name_overridable()
|
14
14
|
"Temp::name_overridable"
|
15
15
|
end
|
16
16
|
|
@@ -21,33 +21,33 @@ class TestClass < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
include Rucy::Tester
|
23
23
|
|
24
|
-
def base
|
25
|
-
Base.new
|
24
|
+
def base(*args)
|
25
|
+
Base.new(*args)
|
26
26
|
end
|
27
27
|
|
28
|
-
def sub
|
29
|
-
Sub.new
|
28
|
+
def sub(*args)
|
29
|
+
Sub.new(*args)
|
30
30
|
end
|
31
31
|
|
32
|
-
def temp
|
33
|
-
Temp.new
|
32
|
+
def temp(*args)
|
33
|
+
Temp.new(*args)
|
34
34
|
end
|
35
35
|
|
36
|
-
def base_raw
|
37
|
-
Base.new_raw
|
36
|
+
def base_raw(*args)
|
37
|
+
Base.new_raw(*args)
|
38
38
|
end
|
39
39
|
|
40
|
-
def sub_raw
|
41
|
-
Sub.new_raw
|
40
|
+
def sub_raw(*args)
|
41
|
+
Sub.new_raw(*args)
|
42
42
|
end
|
43
43
|
|
44
|
-
def last_log
|
44
|
+
def last_log(pattern = nil)
|
45
45
|
logs = Rucy::Tester.all_logs
|
46
46
|
logs.select! {|o| o =~ pattern} if pattern
|
47
47
|
logs.last
|
48
48
|
end
|
49
49
|
|
50
|
-
def test_is_kind_of_base
|
50
|
+
def test_is_kind_of_base()
|
51
51
|
assert_kind_of Base, base
|
52
52
|
assert_kind_of Base, base_raw
|
53
53
|
|
@@ -69,7 +69,7 @@ class TestClass < Test::Unit::TestCase
|
|
69
69
|
assert_not sub_raw.kind_of?(Temp)
|
70
70
|
end
|
71
71
|
|
72
|
-
def test_name
|
72
|
+
def test_name()
|
73
73
|
assert_equal "Base::name", base .name
|
74
74
|
assert_equal "Base::name", base_raw.name
|
75
75
|
assert_equal "Sub::name", sub .name
|
@@ -77,7 +77,7 @@ class TestClass < Test::Unit::TestCase
|
|
77
77
|
assert_equal "Temp::name", temp .name
|
78
78
|
end
|
79
79
|
|
80
|
-
def test_name_overridable
|
80
|
+
def test_name_overridable()
|
81
81
|
assert_equal "Base::name_overridable", base .name_overridable
|
82
82
|
assert_equal "Base::name_overridable", base_raw.name_overridable
|
83
83
|
assert_equal "Sub::name_overridable", sub .name_overridable
|
@@ -85,7 +85,7 @@ class TestClass < Test::Unit::TestCase
|
|
85
85
|
assert_equal "Temp::name_overridable", temp .name_overridable
|
86
86
|
end
|
87
87
|
|
88
|
-
def test_call_name
|
88
|
+
def test_call_name()
|
89
89
|
assert_equal "Base::name", base .call_name
|
90
90
|
assert_equal "Base::name", base_raw.call_name
|
91
91
|
assert_equal "Sub::name", sub .call_name
|
@@ -93,7 +93,7 @@ class TestClass < Test::Unit::TestCase
|
|
93
93
|
assert_equal "Sub::name", temp .call_name# "Sub" instead of "Temp"!
|
94
94
|
end
|
95
95
|
|
96
|
-
def test_call_name_overridable
|
96
|
+
def test_call_name_overridable()
|
97
97
|
assert_equal "Base::name_overridable", base .call_name_overridable
|
98
98
|
assert_equal "Base::name_overridable", base_raw.call_name_overridable
|
99
99
|
assert_equal "Sub::name_overridable", sub .call_name_overridable
|
@@ -101,9 +101,9 @@ class TestClass < Test::Unit::TestCase
|
|
101
101
|
assert_equal "Temp::name_overridable", temp .call_name_overridable
|
102
102
|
end
|
103
103
|
|
104
|
-
def test_gc
|
105
|
-
def simple_objs
|
106
|
-
def gc
|
104
|
+
def test_gc()
|
105
|
+
def simple_objs(name, n = 10) ([nil] * n).map {SimpleObj.new name} end
|
106
|
+
def gc() GC.start end
|
107
107
|
rt = Rucy::Tester
|
108
108
|
|
109
109
|
gc
|
data/test/test_exception.rb
CHANGED
@@ -8,31 +8,31 @@ class TestException < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
include Rucy::Tester
|
10
10
|
|
11
|
-
def test_raise_ruby_exception
|
11
|
+
def test_raise_ruby_exception()
|
12
12
|
assert_raise(StandardError) {raise_ruby_exception}
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_raise_in_eval
|
15
|
+
def test_raise_in_eval()
|
16
16
|
assert_raise(RuntimeError) {raise_in_eval}
|
17
17
|
end
|
18
18
|
|
19
|
-
def test_throw_std_exception
|
19
|
+
def test_throw_std_exception()
|
20
20
|
assert_raise(Rucy::NativeError) {throw_std_exception}
|
21
21
|
end
|
22
22
|
|
23
|
-
def test_throw_std_runtime_error
|
23
|
+
def test_throw_std_runtime_error()
|
24
24
|
assert_raise(Rucy::NativeError) {throw_std_runtime_error}
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_throw_custom_exception
|
27
|
+
def test_throw_custom_exception()
|
28
28
|
assert_raise(Rucy::NativeError) {throw_custom_exception}
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_throw_std_string
|
31
|
+
def test_throw_std_string()
|
32
32
|
assert_raise(Rucy::NativeError) {throw_std_string}
|
33
33
|
end
|
34
34
|
|
35
|
-
def test_throw_cstring
|
35
|
+
def test_throw_cstring()
|
36
36
|
assert_raise(Rucy::NativeError) {throw_cstring}
|
37
37
|
end
|
38
38
|
|
data/test/test_function.rb
CHANGED
@@ -8,27 +8,27 @@ class TestFunction < Test::Unit::TestCase
|
|
8
8
|
|
9
9
|
include Rucy::Tester
|
10
10
|
|
11
|
-
def test_do_nothing_returns_nil
|
11
|
+
def test_do_nothing_returns_nil()
|
12
12
|
assert_equal nil, do_nothing
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_returns_nil
|
15
|
+
def test_returns_nil()
|
16
16
|
assert_equal nil, return_nil
|
17
17
|
end
|
18
18
|
|
19
|
-
def test_return_int
|
19
|
+
def test_return_int()
|
20
20
|
assert_kind_of Integer, return_int
|
21
21
|
end
|
22
22
|
|
23
|
-
def test_return_float
|
23
|
+
def test_return_float()
|
24
24
|
assert_kind_of Float, return_float
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_return_string
|
27
|
+
def test_return_string()
|
28
28
|
assert_kind_of String, return_string
|
29
29
|
end
|
30
30
|
|
31
|
-
def test_check_arg_count
|
31
|
+
def test_check_arg_count()
|
32
32
|
assert_equal :ok, arg_count_must_1(:arg1)
|
33
33
|
assert_raise(ArgumentError) {arg_count_must_1}
|
34
34
|
assert_raises(ArgumentError) {arg_count_must_1 :arg1, :arg2}
|
data/test/test_struct.rb
CHANGED
@@ -6,20 +6,20 @@ require_relative 'helper'
|
|
6
6
|
|
7
7
|
class TestStruct < Test::Unit::TestCase
|
8
8
|
|
9
|
-
def setup
|
9
|
+
def setup()
|
10
10
|
@x = Rucy::Tester::Struct.new
|
11
11
|
end
|
12
12
|
|
13
|
-
def test_default_value_is_0
|
13
|
+
def test_default_value_is_0()
|
14
14
|
assert_equal 0, @x.num
|
15
15
|
end
|
16
16
|
|
17
|
-
def test_get_set_num
|
17
|
+
def test_get_set_num()
|
18
18
|
@x.num = 1
|
19
19
|
assert_equal 1, @x.num
|
20
20
|
end
|
21
21
|
|
22
|
-
def test_dup
|
22
|
+
def test_dup()
|
23
23
|
assert_equal 0, @x.num
|
24
24
|
x = @x.dup
|
25
25
|
@x.num = 1
|
data/test/test_value.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rucy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.23
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.23
|
27
27
|
description: This library helps you to develop Ruby Extension by C++.
|
28
28
|
email: xordog@gmail.com
|
29
29
|
executables:
|
@@ -31,12 +31,12 @@ executables:
|
|
31
31
|
extensions:
|
32
32
|
- Rakefile
|
33
33
|
extra_rdoc_files:
|
34
|
-
- ".doc/ext/rucy/
|
35
|
-
- ".doc/ext/rucy/tester.cpp"
|
34
|
+
- ".doc/ext/rucy/class.cpp"
|
36
35
|
- ".doc/ext/rucy/exception.cpp"
|
37
36
|
- ".doc/ext/rucy/function.cpp"
|
37
|
+
- ".doc/ext/rucy/struct.cpp"
|
38
|
+
- ".doc/ext/rucy/tester.cpp"
|
38
39
|
- ".doc/ext/rucy/value.cpp"
|
39
|
-
- ".doc/ext/rucy/class.cpp"
|
40
40
|
files:
|
41
41
|
- ".doc/ext/rucy/class.cpp"
|
42
42
|
- ".doc/ext/rucy/exception.cpp"
|
@@ -97,16 +97,16 @@ require_paths:
|
|
97
97
|
- lib
|
98
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 2.6.0
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
105
|
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.2.22
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: A Ruby C++ Extension Helper Library.
|