kakasi 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +20 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +9 -0
- data/ext/kakasi-config/extconf.rb +17 -28
- data/kakasi.gemspec +1 -0
- data/lib/kakasi.rb +4 -9
- data/lib/kakasi/ffi.rb +5 -1
- data/lib/kakasi/fiddle.rb +5 -1
- data/lib/kakasi/platform.rb +59 -0
- data/lib/kakasi/version.rb +1 -1
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d07c817b6d00ce7eb000d93d9e9762b792ace073
|
4
|
+
data.tar.gz: b8130607990cd6249715a192ae7e4bed52ddf31a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48184c68e9d538bd79ffd63b8e8413b4f3f71ad8538db2cb523ec12e888ad2aa822101d5bc1d1c66b1784451e641670f5fc3f450452ec406bf9774d60e36b84e
|
7
|
+
data.tar.gz: 91d0cc0e73b284d0baff1eccfbf02d0613b2a5f16adeab3a131295354b64f859066aa40a5719d7594179a5712b4b22bd150eb77dc26d6506ff27a6faada67f9e
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1.2
|
7
|
+
- ruby-head
|
8
|
+
- jruby-19mode
|
9
|
+
- jruby-head
|
10
|
+
- rbx-2
|
11
|
+
script: rake test
|
12
|
+
matrix:
|
13
|
+
allow_failures:
|
14
|
+
- rvm: ruby-head
|
15
|
+
- rvm: jruby-head
|
16
|
+
before_install:
|
17
|
+
- sudo apt-get update -qq
|
18
|
+
- sudo apt-get install -y libkakasi2 libkakasi2-dev
|
19
|
+
before_script:
|
20
|
+
- rake compile
|
data/LICENSE.txt
CHANGED
data/Rakefile
CHANGED
@@ -19,7 +19,11 @@ module KakasiExtConf
|
|
19
19
|
},
|
20
20
|
|
21
21
|
ffi: ->{
|
22
|
-
|
22
|
+
if defined?(Rubinius)
|
23
|
+
FFI = Rubinius::FFI
|
24
|
+
else
|
25
|
+
require 'ffi'
|
26
|
+
end
|
23
27
|
extend FFI::Library
|
24
28
|
},
|
25
29
|
}.find { |impl, code|
|
@@ -36,46 +40,31 @@ module KakasiExtConf
|
|
36
40
|
|
37
41
|
print 'checking for kakasi... '
|
38
42
|
|
39
|
-
|
40
|
-
libfilename = RbConfig::CONFIG['LIBRUBY_SO'].tap { |so|
|
41
|
-
prefix = so[/\A(?:lib|)/]
|
42
|
-
suffix = so[/\.(?![0-9]+(?:\.|\z))[^.]+/] or raise 'failed to detect the file extension for dynamic libraries'
|
43
|
-
break prefix + 'kakasi' + suffix
|
44
|
-
}
|
43
|
+
require '../../lib/kakasi/platform.rb'
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
y << 'kakasi'
|
50
|
-
y << 'libkakasi'
|
51
|
-
y << libfilename
|
52
|
-
}.find { |lib|
|
53
|
-
begin
|
45
|
+
begin
|
46
|
+
libkakasi = Kakasi::Lib.try_load($LIBPATH) { |lib|
|
54
47
|
case default_impl
|
55
48
|
when :fiddle, :dl
|
56
49
|
dlload lib
|
57
50
|
when :ffi
|
58
51
|
ffi_lib lib
|
59
52
|
else
|
60
|
-
|
53
|
+
raise LoadError, 'NOTREACHED'
|
61
54
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
begin
|
69
|
-
puts 'FAILED!'
|
70
|
-
exit false
|
71
|
-
end
|
55
|
+
}
|
56
|
+
puts libkakasi
|
57
|
+
rescue LoadError
|
58
|
+
puts 'FAILED!'
|
59
|
+
exit false
|
60
|
+
end
|
72
61
|
|
73
62
|
'../../lib/kakasi/config.rb'.tap { |rb|
|
74
63
|
puts 'creating %s' % rb
|
75
64
|
File.open(File.expand_path(rb, File.dirname(__FILE__)), 'wt') { |f|
|
76
|
-
f.print <<-'EOF' % [
|
65
|
+
f.print <<-'EOF' % [$LIBPATH.inspect, default_impl.inspect]
|
77
66
|
module Kakasi
|
78
|
-
|
67
|
+
LIBPATH = %s unless defined?(LIBPATH)
|
79
68
|
IMPL = %s unless defined?(IMPL)
|
80
69
|
end
|
81
70
|
EOF
|
data/kakasi.gemspec
CHANGED
data/lib/kakasi.rb
CHANGED
@@ -3,19 +3,14 @@ require 'kakasi/version'
|
|
3
3
|
module Kakasi
|
4
4
|
case RUBY_ENGINE
|
5
5
|
when 'jruby'
|
6
|
-
|
7
|
-
IMPL = :ffi unless defined?(IMPL)
|
6
|
+
LIBPATH = [].freeze
|
7
|
+
IMPL = :ffi unless defined?(::Kakasi::IMPL)
|
8
8
|
else
|
9
9
|
begin
|
10
10
|
require 'kakasi/config'
|
11
11
|
rescue LoadError
|
12
|
-
|
13
|
-
|
14
|
-
prefix = so[/\A(?:lib|)/]
|
15
|
-
suffix = so[/\.(?![0-9]+(?:\.|\z))[^.]+/] or raise 'failed to detect the file extension for dynamic libraries'
|
16
|
-
break prefix + 'kakasi' + suffix
|
17
|
-
} unless defined?(LIBKAKASI)
|
18
|
-
IMPL = :ffi unless defined?(IMPL)
|
12
|
+
LIBPATH = [].freeze
|
13
|
+
IMPL = :ffi unless defined?(::Kakasi::IMPL)
|
19
14
|
end
|
20
15
|
end
|
21
16
|
|
data/lib/kakasi/ffi.rb
CHANGED
data/lib/kakasi/fiddle.rb
CHANGED
@@ -14,7 +14,11 @@ module Kakasi
|
|
14
14
|
raise 'Unsupported pointer size: %u' % SIZEOF_VOIDP
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
require 'kakasi/platform'
|
18
|
+
|
19
|
+
try_load { |lib|
|
20
|
+
dlload lib
|
21
|
+
}
|
18
22
|
|
19
23
|
extern 'int kakasi_getopt_argv(int, char **)'
|
20
24
|
extern 'char *kakasi_do(char *)'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Kakasi
|
2
|
+
module Lib
|
3
|
+
if defined?(::FFI::Platform)
|
4
|
+
LIBPREFIX = ::FFI::Platform::LIBPREFIX
|
5
|
+
LIBSUFFIX = ::FFI::Platform::LIBSUFFIX
|
6
|
+
else
|
7
|
+
LIBPREFIX =
|
8
|
+
case RbConfig::CONFIG['host_os']
|
9
|
+
when /mingw|mswin/i
|
10
|
+
''.freeze
|
11
|
+
when /cygwin/i
|
12
|
+
'cyg'.freeze
|
13
|
+
else
|
14
|
+
'lib'.freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
LIBSUFFIX =
|
18
|
+
case RbConfig::CONFIG['host_os']
|
19
|
+
when /darwin/i
|
20
|
+
'dylib'.freeze
|
21
|
+
when /mingw|mswin|cygwin/i
|
22
|
+
'dll'.freeze
|
23
|
+
else
|
24
|
+
'so'.freeze
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
DEFLIBPATH =
|
29
|
+
begin
|
30
|
+
[RbConfig::CONFIG['libir']] |
|
31
|
+
case RbConfig::CONFIG['host_os']
|
32
|
+
when /mingw|mswin/i
|
33
|
+
[]
|
34
|
+
else
|
35
|
+
%w[/lib /usr/lib]
|
36
|
+
end
|
37
|
+
end.freeze
|
38
|
+
|
39
|
+
def self.map_library_name(name)
|
40
|
+
"#{LIBPREFIX}#{name}.#{LIBSUFFIX}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.try_load(libpath = LIBPATH)
|
44
|
+
basename = map_library_name('kakasi')
|
45
|
+
(libpath | DEFLIBPATH).each { |dir|
|
46
|
+
begin
|
47
|
+
filename = File.join(dir, basename)
|
48
|
+
yield filename
|
49
|
+
return filename
|
50
|
+
rescue LoadError, StandardError
|
51
|
+
next
|
52
|
+
end
|
53
|
+
}
|
54
|
+
|
55
|
+
yield basename
|
56
|
+
return basename
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/kakasi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kakasi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori MUSHA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: A Ruby binding for KAKASI implemented with Fiddle/DL/FFI
|
56
70
|
email:
|
57
71
|
- knu@idaemons.org
|
@@ -61,6 +75,7 @@ extensions:
|
|
61
75
|
extra_rdoc_files: []
|
62
76
|
files:
|
63
77
|
- ".gitignore"
|
78
|
+
- ".travis.yml"
|
64
79
|
- Gemfile
|
65
80
|
- LICENSE.txt
|
66
81
|
- README.md
|
@@ -71,6 +86,7 @@ files:
|
|
71
86
|
- lib/kakasi/dl.rb
|
72
87
|
- lib/kakasi/ffi.rb
|
73
88
|
- lib/kakasi/fiddle.rb
|
89
|
+
- lib/kakasi/platform.rb
|
74
90
|
- lib/kakasi/version.rb
|
75
91
|
- test/helper.rb
|
76
92
|
- test/test_kakasi.rb
|
@@ -94,10 +110,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
110
|
version: '0'
|
95
111
|
requirements: []
|
96
112
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.2.2
|
98
114
|
signing_key:
|
99
115
|
specification_version: 4
|
100
116
|
summary: A Ruby binding for KAKASI implemented with FFI
|
101
117
|
test_files:
|
102
118
|
- test/helper.rb
|
103
119
|
- test/test_kakasi.rb
|
120
|
+
has_rdoc:
|