ilios 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5dee1fc3383cb4e1c7ee917e6b582456b02ef3e1121ca62b65ad5f94e827706
4
- data.tar.gz: c6f7a9a6ae097cc74a644ec2d1d4d1b8fadcfc09697db4a537ab6e500ed8e6ef
3
+ metadata.gz: 7841d4ad68b5090cc50963acc2e6f8b7962d87fce97d662f21d2e162665494de
4
+ data.tar.gz: 9a185b594c0406c369fa65d62bc05251e6f9dee221497a19cd940235fc38308c
5
5
  SHA512:
6
- metadata.gz: 372a423c84b1a61457f2be6f7a7f639664d5854a0b274cb77936052e0ea2da29c5af61c36202d9363c9e7c1f4e39258480ecfe81e875f32bc3fad6c70b072b69
7
- data.tar.gz: fa5a1d64b04fc51b1a831204af7d82154c72631f0276fee2ebfcf0641af3b82940664793c995365551312c5d8ad56ccc16fc640dbb9577410d8671c7c3d17d09
6
+ metadata.gz: 846bd0ef0240d01fa0fbfe1cd12b3cbb4e4430b864f745de00efd3ed9f98651444be936ab06dd693259e184219a0bfcecf570d820da0422f7bd332b6346d3fed
7
+ data.tar.gz: 1d5b1bd0537ab97f3c8cb4d4aa35ced037cd1a8a7c88bee18ce57ad16e8938e6edee741fb0c2eddb4697950ae1916af2da8a3b346ad452dd9c41ef0f83d73f6f
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-cassandra-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-cassandra-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: 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,13 +4,11 @@ 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
- CASSANDRA_CPP_DRIVER_INSTALL_PATH = File.expand_path('cpp-driver')
12
- LIBUV_INSTALL_PATH = File.expand_path('libuv')
13
-
14
12
  def num_cpu_cores
15
13
  cores =
16
14
  begin
@@ -25,40 +23,72 @@ def num_cpu_cores
25
23
  cores.positive? ? cores : 1
26
24
  end
27
25
 
28
- unless find_executable('cmake')
29
- puts '--------------------------------------------------'
30
- puts 'Error: cmake is required to build this gem'
31
- puts '--------------------------------------------------'
32
- raise
33
- end
26
+ module LibuvInstaller
27
+ LIBUV_INSTALL_PATH = File.expand_path('libuv')
28
+ private_constant :LIBUV_INSTALL_PATH
29
+
30
+ @@special_install_path = nil
34
31
 
35
- unless File.exist?(LIBUV_INSTALL_PATH)
36
32
  class LibuvRecipe < MiniPortileCMake
37
33
  def configure_prefix
38
34
  "-DCMAKE_INSTALL_PREFIX=#{LIBUV_INSTALL_PATH}"
39
35
  end
40
36
  end
41
37
 
42
- libuv_recipe = LibuvRecipe.new('libuv', Ilios::LIBUV_VERSION, make_command: "make -j #{num_cpu_cores}")
43
- libuv_recipe.files << {
44
- url: "https://github.com/libuv/libuv/archive/v#{Ilios::LIBUV_VERSION}.tar.gz"
45
- }
46
- libuv_recipe.cook
47
- if RUBY_PLATFORM.include?('darwin')
48
- unless find_executable('install_name_tool')
49
- puts '------------------------------------------------------'
50
- puts 'Error: install_name_tool is required to build this gem'
51
- puts '------------------------------------------------------'
52
- raise
38
+ def self.install
39
+ return if install_from_package
40
+
41
+ install_from_source
42
+ end
43
+
44
+ def self.install_from_package
45
+ NativePackageInstaller.install(
46
+ arch_linux: 'libuv',
47
+ alt_linux: 'libuv',
48
+ debian: 'libuv1-dev',
49
+ freebsd: 'libuv',
50
+ gentoo_linux: 'libuv',
51
+ homebrew: 'libuv',
52
+ macports: 'libuv',
53
+ redhat: 'libuv-devel'
54
+ )
55
+ end
56
+
57
+ def self.install_from_source
58
+ unless File.exist?(LIBUV_INSTALL_PATH)
59
+ libuv_recipe = LibuvRecipe.new('libuv', Ilios::LIBUV_VERSION, make_command: "make -j #{num_cpu_cores}")
60
+ libuv_recipe.files << {
61
+ url: "https://github.com/libuv/libuv/archive/v#{Ilios::LIBUV_VERSION}.tar.gz"
62
+ }
63
+ libuv_recipe.cook
64
+ if RUBY_PLATFORM.include?('darwin')
65
+ xsystem(
66
+ "install_name_tool -id #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib"
67
+ )
68
+ end
53
69
  end
54
- xsystem("install_name_tool -id #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib #{LIBUV_INSTALL_PATH}/lib/libuv.1.dylib")
70
+ @@special_install_path = LIBUV_INSTALL_PATH
71
+
72
+ FileUtils.rm_rf('ports')
73
+ FileUtils.rm_rf('tmp')
74
+
75
+ $CPPFLAGS += " -I#{LIBUV_INSTALL_PATH}/include"
76
+ $LDFLAGS += " -L#{LIBUV_INSTALL_PATH}/lib -Wl,-rpath,#{LIBUV_INSTALL_PATH}/lib -luv"
77
+ end
78
+
79
+ def self.special_install_path
80
+ @@special_install_path
55
81
  end
56
82
  end
57
83
 
58
- unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
84
+ module CassandraDriverInstaller
85
+ CASSANDRA_CPP_DRIVER_INSTALL_PATH = File.expand_path('cpp-driver')
86
+ private_constant :CASSANDRA_CPP_DRIVER_INSTALL_PATH
87
+
59
88
  class CassandraRecipe < MiniPortileCMake
60
89
  def initialize(name, version, **kwargs)
61
- ENV['LIBUV_ROOT_DIR'] = LIBUV_INSTALL_PATH
90
+ ENV['LIBUV_ROOT_DIR'] = LibuvInstaller.special_install_path
91
+
62
92
  super(name, version, **kwargs)
63
93
  end
64
94
 
@@ -67,21 +97,68 @@ unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
67
97
  end
68
98
  end
69
99
 
70
- cassandra_recipe = CassandraRecipe.new('cpp-driver', Ilios::CASSANDRA_CPP_DRIVER_VERSION, make_command: "make -j #{num_cpu_cores}")
71
- cassandra_recipe.files << {
72
- url: "https://github.com/datastax/cpp-driver/archive/#{Ilios::CASSANDRA_CPP_DRIVER_VERSION}.tar.gz"
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")
100
+ def self.install
101
+ return if install_from_package
102
+
103
+ install_from_source
104
+ end
105
+
106
+ def self.install_from_package
107
+ # Install Cassandra C/C++ driver via MiniPortile2.
108
+ # It doesn't provide pre-built package in some official repository.
109
+ return unless NativePackageInstaller.install(homebrew: 'cassandra-cpp-driver')
110
+
111
+ path = `brew --prefix cassandra-cpp-driver`.strip
112
+ $CPPFLAGS += " -I#{path}/include"
113
+ $LDFLAGS += " -L#{path}/lib -Wl,-rpath,#{path}/lib -lcassandra"
114
+
115
+ true
116
+ end
117
+
118
+ def self.install_from_source
119
+ unless File.exist?(CASSANDRA_CPP_DRIVER_INSTALL_PATH)
120
+ cassandra_recipe = CassandraRecipe.new('cpp-driver', Ilios::CASSANDRA_CPP_DRIVER_VERSION, make_command: "make -j #{num_cpu_cores}")
121
+ cassandra_recipe.files << {
122
+ url: "https://github.com/datastax/cpp-driver/archive/#{Ilios::CASSANDRA_CPP_DRIVER_VERSION}.tar.gz"
123
+ }
124
+ cassandra_recipe.cook
125
+ if RUBY_PLATFORM.include?('darwin')
126
+ xsystem(
127
+ "install_name_tool -id #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib #{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib/libcassandra.2.dylib"
128
+ )
129
+ end
130
+ end
131
+ @@installed_path_from_source = CASSANDRA_CPP_DRIVER_INSTALL_PATH
132
+
133
+ FileUtils.rm_rf('ports')
134
+ FileUtils.rm_rf('tmp')
135
+
136
+ $CPPFLAGS += " -I#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/include"
137
+ $LDFLAGS += " -L#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -Wl,-rpath,#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -lcassandra"
77
138
  end
78
139
  end
79
140
 
80
- FileUtils.rm_rf('ports')
81
- FileUtils.rm_rf('tmp')
141
+ if (dir = with_config('--with-cassandra-driver-dir'))
142
+ $CPPFLAGS += " -I#{dir}/include"
143
+ $LDFLAGS += " -L#{dir}/lib -Wl,-rpath,#{dir}/lib -lcassandra"
144
+ else
145
+
146
+ unless find_executable('cmake')
147
+ puts '--------------------------------------------------'
148
+ puts 'Error: cmake is required to build this gem'
149
+ puts '--------------------------------------------------'
150
+ raise
151
+ end
152
+
153
+ if RUBY_PLATFORM.include?('darwin') && !find_executable('install_name_tool')
154
+ puts('------------------------------------------------------')
155
+ puts('Error: install_name_tool is required to build this gem')
156
+ puts('------------------------------------------------------')
157
+ raise
158
+ end
82
159
 
83
- $CPPFLAGS += " -I#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/include -I#{LIBUV_INSTALL_PATH}/include"
84
- $LDFLAGS += " -L#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -Wl,-rpath,#{CASSANDRA_CPP_DRIVER_INSTALL_PATH}/lib -lcassandra"
85
- $LDFLAGS += " -L#{LIBUV_INSTALL_PATH}/lib -Wl,-rpath,#{LIBUV_INSTALL_PATH}/lib -luv"
160
+ LibuvInstaller.install
161
+ CassandraDriverInstaller.install
162
+ end
86
163
 
87
164
  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
@@ -80,7 +80,6 @@ extern VALUE cQueue;
80
80
  extern VALUE id_cvar_config;
81
81
  extern VALUE id_shuffle;
82
82
  extern VALUE id_to_time;
83
- extern VALUE id_abort_on_exception_set;
84
83
  extern VALUE id_new;
85
84
  extern VALUE id_push;
86
85
  extern VALUE id_pop;
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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ilios
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.2'
5
5
  public_constant :VERSION
6
6
 
7
7
  CASSANDRA_CPP_DRIVER_VERSION = '2.17.1'
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.0
4
+ version: 0.3.2
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-24 00:00:00.000000000 Z
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.0
74
+ documentation_uri: https://www.rubydoc.info/gems/ilios/0.3.2
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