upl 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +77 -0
- data/History.txt +4 -0
- data/README.md +8 -0
- data/docker-compose.yml +7 -0
- data/lib/upl/extern.rb +13 -2
- data/lib/upl/query.rb +1 -1
- data/lib/upl/runtime.rb +1 -0
- data/lib/upl/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 933b536ad1c58be9cf92e474272904b5752d9eef7f3004be1ec35a5623438aa6
|
4
|
+
data.tar.gz: 2d212a7ea47101d3fd9255b8b53bffcb8bf4ce8f15989b7a34a66dbc39b09cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b2a3376e96852df1e690e40f89d784c7f5100bf72b628264dec970b1b48b238cad425c5e51c469b7496d7bc7e8951eaa276285e40009cbf2d94bba9463d363
|
7
|
+
data.tar.gz: b1fa64877cf05ab1a507eb082c592494976d36611e534fb543b6e89854d9ba01326bf89c7ea035577d8e21111949ea3901c3e8da35bdf43c5fdec5acd0816818
|
@@ -0,0 +1,77 @@
|
|
1
|
+
name: rspecs
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch: {}
|
5
|
+
push:
|
6
|
+
branches: [test-workflow]
|
7
|
+
tags: v*
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
# note 20-Jul-2023 2.7.8 is EOL
|
15
|
+
ruby_version: ['2.7.8', '3.0.6', '3.1.4', '3.2.2']
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby_version }}
|
23
|
+
|
24
|
+
- run: bundle install
|
25
|
+
|
26
|
+
# install from ppa for up-to-date version
|
27
|
+
- name: update ubuntu packages
|
28
|
+
run: |
|
29
|
+
sudo apt-get update
|
30
|
+
|
31
|
+
# otherwise it prompts for timezone
|
32
|
+
sudo apt-get install -y tzdata
|
33
|
+
sudo apt-get install -y software-properties-common
|
34
|
+
|
35
|
+
- name: install swi-prolog from ppa
|
36
|
+
run: |
|
37
|
+
# Stable versions
|
38
|
+
sudo apt-add-repository -y ppa:swi-prolog/stable
|
39
|
+
sudo apt-get update
|
40
|
+
sudo apt-get install -y swi-prolog-nox
|
41
|
+
|
42
|
+
# Development versions
|
43
|
+
# sudo apt-add-repository ppa:swi-prolog/devel
|
44
|
+
# sudo apt-get update
|
45
|
+
# sudo apt-get install -y swi-prolog-nox
|
46
|
+
|
47
|
+
- run: rspec
|
48
|
+
|
49
|
+
rspec-macos:
|
50
|
+
runs-on: macos-latest
|
51
|
+
strategy:
|
52
|
+
matrix:
|
53
|
+
# note 20-Jul-2023 2.7.8 is EOL
|
54
|
+
ruby_version: ['2.7.8', '3.0.6', '3.1.4', '3.2.2']
|
55
|
+
|
56
|
+
steps:
|
57
|
+
- name: install swi-prolog
|
58
|
+
run: |
|
59
|
+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
60
|
+
brew install swi-prolog
|
61
|
+
|
62
|
+
# for possible future debugging
|
63
|
+
# otool -L $(which swipl)
|
64
|
+
# swipl --dump-runtime-variables=sh
|
65
|
+
# env
|
66
|
+
# find /usr/local/Cellar/swi-prolog/9.0.4 -ls
|
67
|
+
# false
|
68
|
+
|
69
|
+
- uses: actions/checkout@v3
|
70
|
+
|
71
|
+
- uses: ruby/setup-ruby@v1
|
72
|
+
with:
|
73
|
+
ruby-version: ${{ matrix.ruby_version }}
|
74
|
+
|
75
|
+
- run: bundle install
|
76
|
+
|
77
|
+
- run: rspec
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
![rspecs](https://github.com/djellemah/upl/actions/workflows/build.yml/badge.svg)
|
2
|
+
|
1
3
|
# Upl
|
2
4
|
|
3
5
|
Use SWI-Prolog from ruby.
|
@@ -8,6 +10,12 @@ Define foreign predicates in ruby, so prolog can call back into ruby code.
|
|
8
10
|
|
9
11
|
Assert facts containing ruby objects, so prolog can query ruby data by calling ruby methods.
|
10
12
|
|
13
|
+
## versions
|
14
|
+
|
15
|
+
Works on ruby-2.7.8 ruby-3.0, ruby-3.1, ruby-3.2
|
16
|
+
|
17
|
+
and swipl-8.1.29 to swipl-9.1.2
|
18
|
+
|
11
19
|
## Tutorial
|
12
20
|
|
13
21
|
The query api always returns an ```Enumerable``` of all values which satisfy the query.
|
data/docker-compose.yml
ADDED
data/lib/upl/extern.rb
CHANGED
@@ -26,15 +26,26 @@ module Upl
|
|
26
26
|
# should result in something like
|
27
27
|
# /usr/lib64/swipl-7.7.18/lib/x86_64-linux/libswipl.so
|
28
28
|
# which should actually exist
|
29
|
-
def self.
|
29
|
+
def self.calculate_so_path
|
30
30
|
values = swipl_config_values
|
31
|
-
p =
|
31
|
+
p = if easy_so = values['PLLIBSWIPL']
|
32
|
+
Pathname easy_so
|
33
|
+
else
|
34
|
+
# figure it out the hard way - this was prior to 8.1 or thereabouts
|
35
|
+
Pathname "#{values['PLBASE']}/lib/#{values['PLARCH']}/#{values['PLLIB'].gsub('-l', 'lib')}.#{values['PLSOEXT']}"
|
36
|
+
end
|
32
37
|
p.realpath.to_s
|
33
38
|
rescue Errno::ENOENT => ex
|
34
39
|
puts "problem with library #{p.to_s}: #{ex.message}"
|
35
40
|
exit 1
|
36
41
|
end
|
37
42
|
|
43
|
+
# where is the so/dylib
|
44
|
+
# overridable by env var SWIPL_SO_PATH
|
45
|
+
def self.so_path
|
46
|
+
ENV['SWIPL_SO_PATH'] || calculate_so_path
|
47
|
+
end
|
48
|
+
|
38
49
|
if (version = swipl_config_values['PLVERSION']) < '80129'
|
39
50
|
raise "unsupported version <#{version}"
|
40
51
|
end
|
data/lib/upl/query.rb
CHANGED
data/lib/upl/runtime.rb
CHANGED
data/lib/upl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Anderson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,6 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/workflows/build.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rspec"
|
92
93
|
- ".travis.yml"
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- Rakefile
|
98
99
|
- bin/console
|
99
100
|
- bin/setup
|
101
|
+
- docker-compose.yml
|
100
102
|
- lib/upl.rb
|
101
103
|
- lib/upl/atom.rb
|
102
104
|
- lib/upl/dict.rb
|
@@ -118,7 +120,7 @@ licenses:
|
|
118
120
|
- MIT
|
119
121
|
metadata:
|
120
122
|
allowed_push_host: https://rubygems.org
|
121
|
-
post_install_message:
|
123
|
+
post_install_message:
|
122
124
|
rdoc_options: []
|
123
125
|
require_paths:
|
124
126
|
- lib
|
@@ -133,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
135
|
- !ruby/object:Gem::Version
|
134
136
|
version: '0'
|
135
137
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
138
|
+
rubygems_version: 3.4.6
|
139
|
+
signing_key:
|
138
140
|
specification_version: 4
|
139
141
|
summary: Access SWI-Prolog engine from ruby
|
140
142
|
test_files: []
|