ilios 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/docker-compose.yml +4 -2
- data/ext/ilios/extconf.rb +112 -36
- data/ext/ilios/future.c +0 -1
- data/ext/ilios/ilios.c +0 -2
- data/ext/ilios/ilios.h +0 -1
- data/ilios.gemspec +2 -1
- data/lib/ilios/version.rb +1 -1
- metadata +17 -4
- data/Dockerfile +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97cd17ec9e27eba88f4200dc050417934daa8820a8c6621b47ffa0e76d4f38be
|
4
|
+
data.tar.gz: '0508e6e770984ba635caa2a587a69a7a2a0b7eedab2016dfa1292480ddf81ea6'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b882a9744b4cde1c74429c6a4ab3bc8de0338ac0e7b56a9bd657ad0c843a35c77deaa884e2a898c5b5ae5a4dff5c8d8aadfce30a4000dbf4df103e7376bd3b1c
|
7
|
+
data.tar.gz: 66757dbdfc249e68613f1ace36092520b8efad5d82db1f41a15ba8b0b2226502abd6bb288a9e7a73d6e82f7c0491bb2f86de3e977b4556cced7ae50c4feff439
|
data/README.md
CHANGED
@@ -16,6 +16,20 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
16
|
$ gem install ilios
|
17
17
|
```
|
18
18
|
|
19
|
+
This gem's installer will install the DataStax C/C++ Driver to the appropriate location automatically.
|
20
|
+
However, if you prefer to install the DataStax C/C++ Driver manually, you can do so by executing:
|
21
|
+
|
22
|
+
```sh
|
23
|
+
$ bundle config set --local build.ilios --with-cpp-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
|
24
|
+
$ bundle add ilios
|
25
|
+
```
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
```sh
|
30
|
+
$ gem install ilios -- --with-cpp-driver-dir=/path/to/cassandra-cpp-driver-installed-dir
|
31
|
+
```
|
32
|
+
|
19
33
|
## Requirements
|
20
34
|
|
21
35
|
- cmake (in order to build the DataStax C/C++ Driver and libuv)
|
data/docker-compose.yml
CHANGED
@@ -8,10 +8,12 @@ services:
|
|
8
8
|
- cassandra-data:/var/lib/cassandra
|
9
9
|
ilios:
|
10
10
|
build:
|
11
|
-
context:
|
12
|
-
dockerfile:
|
11
|
+
context: ./dockerfiles
|
12
|
+
dockerfile: ubuntu.dockerfile
|
13
13
|
depends_on:
|
14
14
|
- cassandra
|
15
|
+
environment:
|
16
|
+
CASSANDRA_HOST: cassandra
|
15
17
|
command: bash -c 'sleep infinity'
|
16
18
|
volumes:
|
17
19
|
- "./:/opt/ilios"
|
data/ext/ilios/extconf.rb
CHANGED
@@ -4,12 +4,24 @@ require File.expand_path('../../lib/ilios/version', __dir__)
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'mini_portile2'
|
6
6
|
require 'mkmf'
|
7
|
+
require 'native-package-installer'
|
7
8
|
|
8
9
|
have_func('malloc_usable_size')
|
9
10
|
have_func('malloc_size')
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
unless find_executable('cmake')
|
13
|
+
puts '--------------------------------------------------'
|
14
|
+
puts 'Error: cmake is required to build this gem'
|
15
|
+
puts '--------------------------------------------------'
|
16
|
+
raise
|
17
|
+
end
|
18
|
+
|
19
|
+
if RUBY_PLATFORM.include?('darwin') && !find_executable('install_name_tool')
|
20
|
+
puts('------------------------------------------------------')
|
21
|
+
puts('Error: install_name_tool is required to build this gem')
|
22
|
+
puts('------------------------------------------------------')
|
23
|
+
raise
|
24
|
+
end
|
13
25
|
|
14
26
|
def num_cpu_cores
|
15
27
|
cores =
|
@@ -25,40 +37,72 @@ def num_cpu_cores
|
|
25
37
|
cores.positive? ? cores : 1
|
26
38
|
end
|
27
39
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
40
|
+
module LibuvInstaller
|
41
|
+
LIBUV_INSTALL_PATH = File.expand_path('libuv')
|
42
|
+
private_constant :LIBUV_INSTALL_PATH
|
43
|
+
|
44
|
+
@@special_install_path = nil
|
34
45
|
|
35
|
-
unless File.exist?(LIBUV_INSTALL_PATH)
|
36
46
|
class LibuvRecipe < MiniPortileCMake
|
37
47
|
def configure_prefix
|
38
48
|
"-DCMAKE_INSTALL_PREFIX=#{LIBUV_INSTALL_PATH}"
|
39
49
|
end
|
40
50
|
end
|
41
51
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
def self.install
|
53
|
+
return if install_from_package
|
54
|
+
|
55
|
+
install_from_source
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.install_from_package
|
59
|
+
NativePackageInstaller.install(
|
60
|
+
arch_linux: 'libuv',
|
61
|
+
alt_linux: 'libuv',
|
62
|
+
debian: 'libuv1-dev',
|
63
|
+
freebsd: 'libuv',
|
64
|
+
gentoo_linux: 'libuv',
|
65
|
+
homebrew: 'libuv',
|
66
|
+
macports: 'libuv',
|
67
|
+
redhat: 'libuv-devel'
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.install_from_source
|
72
|
+
unless File.exist?(LIBUV_INSTALL_PATH)
|
73
|
+
libuv_recipe = LibuvRecipe.new('libuv', Ilios::LIBUV_VERSION, make_command: "make -j #{num_cpu_cores}")
|
74
|
+
libuv_recipe.files << {
|
75
|
+
url: "https://github.com/libuv/libuv/archive/v#{Ilios::LIBUV_VERSION}.tar.gz"
|
76
|
+
}
|
77
|
+
libuv_recipe.cook
|
78
|
+
if RUBY_PLATFORM.include?('darwin')
|
79
|
+
xsystem(
|
80
|
+
"install_name_tool -id #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib"
|
81
|
+
)
|
82
|
+
end
|
53
83
|
end
|
54
|
-
|
84
|
+
@@special_install_path = LIBUV_INSTALL_PATH
|
85
|
+
|
86
|
+
FileUtils.rm_rf('ports')
|
87
|
+
FileUtils.rm_rf('tmp')
|
88
|
+
|
89
|
+
$CPPFLAGS += " -I#{LIBUV_INSTALL_PATH}/include"
|
90
|
+
$LDFLAGS += " -L#{LIBUV_INSTALL_PATH}/lib -Wl,-rpath,#{LIBUV_INSTALL_PATH}/lib -luv"
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.special_install_path
|
94
|
+
@@special_install_path
|
55
95
|
end
|
56
96
|
end
|
57
97
|
|
58
|
-
|
98
|
+
module CassandraDriverInstaller
|
99
|
+
CASSANDRA_CPP_DRIVER_INSTALL_PATH = File.expand_path('cpp-driver')
|
100
|
+
private_constant :CASSANDRA_CPP_DRIVER_INSTALL_PATH
|
101
|
+
|
59
102
|
class CassandraRecipe < MiniPortileCMake
|
60
103
|
def initialize(name, version, **kwargs)
|
61
|
-
ENV['LIBUV_ROOT_DIR'] =
|
104
|
+
ENV['LIBUV_ROOT_DIR'] = LibuvInstaller.special_install_path
|
105
|
+
|
62
106
|
super(name, version, **kwargs)
|
63
107
|
end
|
64
108
|
|
@@ -67,21 +111,53 @@ unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
|
|
67
111
|
end
|
68
112
|
end
|
69
113
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
cassandra_recipe.cook
|
75
|
-
if RUBY_PLATFORM.include?('darwin')
|
76
|
-
xsystem("install_name_tool -id #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib")
|
114
|
+
def self.install
|
115
|
+
return if install_from_package
|
116
|
+
|
117
|
+
install_from_source
|
77
118
|
end
|
78
|
-
end
|
79
119
|
|
80
|
-
|
81
|
-
|
120
|
+
def self.install_from_package
|
121
|
+
# Install Cassandra C/C++ driver via MiniPortile2.
|
122
|
+
# It doesn't provide pre-built package in some official repository.
|
123
|
+
return unless NativePackageInstaller.install(homebrew: 'cassandra-cpp-driver')
|
82
124
|
|
83
|
-
|
84
|
-
$
|
85
|
-
$LDFLAGS += " -L#{
|
125
|
+
path = `brew --prefix cassandra-cpp-driver`.strip
|
126
|
+
$CPPFLAGS += " -I#{path}/include"
|
127
|
+
$LDFLAGS += " -L#{path}/lib -Wl,-rpath,#{path}/lib -lcassandra"
|
128
|
+
|
129
|
+
true
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.install_from_source
|
133
|
+
unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
|
134
|
+
cassandra_recipe = CassandraRecipe.new('cpp-driver', Ilios::CASSANDRA_CPP_DRIVER_VERSION, make_command: "make -j #{num_cpu_cores}")
|
135
|
+
cassandra_recipe.files << {
|
136
|
+
url: "https://github.com/datastax/cpp-driver/archive/#{Ilios::CASSANDRA_CPP_DRIVER_VERSION}.tar.gz"
|
137
|
+
}
|
138
|
+
cassandra_recipe.cook
|
139
|
+
if RUBY_PLATFORM.include?('darwin')
|
140
|
+
xsystem(
|
141
|
+
"install_name_tool -id #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib"
|
142
|
+
)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
@@installed_path_from_source = CASSANDRA_CPP_DRIVER_INSTALL_PATH
|
146
|
+
|
147
|
+
FileUtils.rm_rf('ports')
|
148
|
+
FileUtils.rm_rf('tmp')
|
149
|
+
|
150
|
+
$CPPFLAGS += " -I#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/include"
|
151
|
+
$LDFLAGS += " -L#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -Wl,-rpath,#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -lcassandra"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
if (dir = with_config('--with-cassandra-driver-dir'))
|
156
|
+
$CPPFLAGS += " -I#{dir}/include"
|
157
|
+
$LDFLAGS += " -L#{dir}/lib -Wl,-rpath,#{dir}/lib -lcassandra"
|
158
|
+
else
|
159
|
+
LibuvInstaller.install
|
160
|
+
CassandraDriverInstaller.install
|
161
|
+
end
|
86
162
|
|
87
163
|
create_makefile('ilios')
|
data/ext/ilios/future.c
CHANGED
@@ -34,7 +34,6 @@ static void future_thread_pool_init(future_thread_pool *pool)
|
|
34
34
|
pool->queue = rb_funcall(cQueue, id_new, 0);
|
35
35
|
for (int i = 0; i < THREAD_MAX; i++) {
|
36
36
|
pool->thread[i] = rb_thread_create(future_result_yielder_thread, (void*)pool);
|
37
|
-
rb_funcall(pool->thread[i], id_abort_on_exception_set, 1, Qtrue);
|
38
37
|
}
|
39
38
|
}
|
40
39
|
|
data/ext/ilios/ilios.c
CHANGED
@@ -15,7 +15,6 @@ VALUE cQueue;
|
|
15
15
|
VALUE id_cvar_config;
|
16
16
|
VALUE id_shuffle;
|
17
17
|
VALUE id_to_time;
|
18
|
-
VALUE id_abort_on_exception_set;
|
19
18
|
VALUE id_new;
|
20
19
|
VALUE id_push;
|
21
20
|
VALUE id_pop;
|
@@ -81,7 +80,6 @@ void Init_ilios(void)
|
|
81
80
|
id_cvar_config = rb_intern("@@config");
|
82
81
|
id_shuffle = rb_intern("shuffle");
|
83
82
|
id_to_time = rb_intern("to_time");
|
84
|
-
id_abort_on_exception_set = rb_intern("abort_on_exception=");
|
85
83
|
id_new = rb_intern("new");
|
86
84
|
id_push = rb_intern("push");
|
87
85
|
id_pop = rb_intern("pop");
|
data/ext/ilios/ilios.h
CHANGED
data/ilios.gemspec
CHANGED
@@ -28,11 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.files =
|
29
29
|
Dir.chdir(__dir__) do
|
30
30
|
`git ls-files -z`.split("\x0").reject do |f|
|
31
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:test|example)/|\.(?:git|editorconfig|rubocop.*))})
|
31
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|dockerfiles|example)/|\.(?:git|editorconfig|rubocop.*))})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
spec.require_paths = ['lib']
|
35
35
|
spec.extensions << 'ext/ilios/extconf.rb'
|
36
36
|
|
37
37
|
spec.add_runtime_dependency('mini_portile2', '~> 2.8')
|
38
|
+
spec.add_runtime_dependency('native-package-installer', '~> 1.1')
|
38
39
|
end
|
data/lib/ilios/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ilios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_portile2
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: native-package-installer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
27
41
|
description: Cassandra driver written by C language
|
28
42
|
email:
|
29
43
|
- watson1978@gmail.com
|
@@ -33,7 +47,6 @@ extensions:
|
|
33
47
|
extra_rdoc_files: []
|
34
48
|
files:
|
35
49
|
- ".yardopts"
|
36
|
-
- Dockerfile
|
37
50
|
- Gemfile
|
38
51
|
- README.md
|
39
52
|
- Rakefile
|
@@ -58,7 +71,7 @@ metadata:
|
|
58
71
|
homepage_uri: https://github.com/Watson1978/ilios
|
59
72
|
source_code_uri: https://github.com/Watson1978/ilios
|
60
73
|
bug_tracker_uri: https://github.com/Watson1978/ilios/issues
|
61
|
-
documentation_uri: https://www.rubydoc.info/gems/ilios/0.3.
|
74
|
+
documentation_uri: https://www.rubydoc.info/gems/ilios/0.3.1
|
62
75
|
rubygems_mfa_required: 'true'
|
63
76
|
post_install_message:
|
64
77
|
rdoc_options: []
|
data/Dockerfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
FROM ubuntu:22.04
|
2
|
-
|
3
|
-
RUN apt update && \
|
4
|
-
apt install -y tzdata sudo && \
|
5
|
-
apt install -y curl cmake make gcc g++ git bzip2 zlib1g-dev libgdbm-dev libreadline-dev libffi-dev libssl-dev libyaml-dev && \
|
6
|
-
git clone --depth 1 https://github.com/rbenv/ruby-build.git && \
|
7
|
-
cd ruby-build/bin && ./ruby-build 3.0.6 /usr/local
|
8
|
-
|
9
|
-
WORKDIR /opt/ilios
|