prolog_mqi 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8abe4438970b7b52d37ea9a90606f117ec3da035979338ed5b3dae270480eee
4
- data.tar.gz: 59a42726e7e3caf68180cee92bba94c33a76935d36ffca278dc7e3dc690e159d
3
+ metadata.gz: c140e8137101d2baf02d0a584c067e9eab8129848c9180c0b4f0385afe24b916
4
+ data.tar.gz: ccd2b9ef79061e9c5eff1fb2292f2a8c8f986b50d302f7c4b7a7d1447ba6d71e
5
5
  SHA512:
6
- metadata.gz: 84e2d5b237865b9cf9fe3d9f5a8fab0db15d3b30e2a6eb2d6bf3cf301be9c042bcc20b848e3585ecc2c0751b1a1b86f97bc7997709193552a1bc7002393844a7
7
- data.tar.gz: 41c934900602039472f413fc0ee31b6beeaf0b3a51466af41173ebbb51cba0ee57cf9bc31c6c644345f7f5702a551c314906f2fce09caeea69c477401036cfe1
6
+ metadata.gz: 3891f27ddd92e97506998ba3ee15bf273bd575e846a478dba657307bbf4d3adea65e7a135ea992aa5c5dd9f668184255e472ddb42ecee9efc1a96c033e30351c
7
+ data.tar.gz: 6d21ed8b6dc2efd65132df959ae904625780c6138e50d3a3c2c598aa74371337d5d30516f0fee40d800a981d0918e8696e015d25a1c4dbc70b3a88beda63807c
data/.rubocop.yml CHANGED
File without changes
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -9,8 +9,14 @@ Rake::TestTask.new(:test) do |t|
9
9
  t.test_files = FileList['test/**/test_*.rb']
10
10
  end
11
11
 
12
+ Rake::TestTask.new(:bench) do |t|
13
+ t.libs << 'test'
14
+ t.libs << 'lib'
15
+ t.test_files = FileList['test/**/bench_*.rb']
16
+ end
17
+
12
18
  require 'rubocop/rake_task'
13
19
 
14
20
  RuboCop::RakeTask.new
15
21
 
16
- task default: %i[test rubocop]
22
+ task default: %i[test bench rubocop]
File without changes
File without changes
@@ -6,7 +6,7 @@ module PrologMQI
6
6
  @timeout = timeout
7
7
 
8
8
  @process = nil
9
- @unix_domain_socket = nil
9
+ @socket = nil
10
10
  @running = false
11
11
  end
12
12
 
@@ -22,8 +22,9 @@ module PrologMQI
22
22
  end
23
23
 
24
24
  def start
25
- # Start prolog process
25
+ raise LaunchError, 'PrologMQI is already running' if running?
26
26
 
27
+ # Start prolog process
27
28
  @stdin, @stdout, @stderr, @process =
28
29
  Open3.popen3('swipl', '--quiet', '-g', 'mqi_start', '-t', 'halt', '--', '--write_connection_values=true',
29
30
  '--create_unix_domain_socket=true')
@@ -39,6 +40,7 @@ module PrologMQI
39
40
  end
40
41
 
41
42
  # Authenticate
43
+ @running = true
42
44
  write(password)
43
45
  read
44
46
  end
@@ -64,13 +66,13 @@ module PrologMQI
64
66
  @socket.write(message)
65
67
  end
66
68
 
67
- def stop(kill: false)
69
+ def stop
68
70
  @socket.close
69
71
  @stdin.close
70
72
  @stdout.close
71
73
  @stderr.close
72
- @process.kill if kill
73
- @process.close
74
+ @process.kill
75
+ @running = false
74
76
  end
75
77
  end
76
78
  end
@@ -29,7 +29,12 @@ module PrologMQI
29
29
  end
30
30
 
31
31
  def args
32
- @term['args']
32
+ @term['args'].map do |arg|
33
+ next nil if arg == 'nil'
34
+ next arg.to_i if arg.is_a?(String) && arg.to_i.to_s == arg
35
+
36
+ arg
37
+ end
33
38
  end
34
39
  end
35
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrologMQI
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.2'
5
5
  end
data/lib/prolog_mqi.rb CHANGED
File without changes
data/prolog_mqi.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Delton Ding']
9
9
  spec.email = ['shenghao.ding@yetanother.ai']
10
10
 
11
- spec.summary = 'Write a short summary, because RubyGems requires one.'
12
- spec.description = 'Write a longer description or delete this line.'
11
+ spec.summary = 'Yet Another Prolog Interface for Ruby.'
12
+ spec.description = 'A PrologMQI implementation in Ruby.'
13
13
  spec.homepage = 'https://github.com/yet-another-ai/prologmqi.rb'
14
14
  spec.license = 'MIT'
15
15
  spec.required_ruby_version = '>= 3.0.0'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prolog_mqi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delton Ding
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-01 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Write a longer description or delete this line.
13
+ description: A PrologMQI implementation in Ruby.
14
14
  email:
15
15
  - shenghao.ding@yetanother.ai
16
16
  executables: []
@@ -20,7 +20,6 @@ files:
20
20
  - ".rubocop.yml"
21
21
  - CODE_OF_CONDUCT.md
22
22
  - Gemfile
23
- - Gemfile.lock
24
23
  - LICENSE
25
24
  - LICENSE.txt
26
25
  - README.md
@@ -39,7 +38,7 @@ metadata:
39
38
  homepage_uri: https://github.com/yet-another-ai/prologmqi.rb
40
39
  source_code_uri: https://github.com/yet-another-ai/prologmqi.rb
41
40
  rubygems_mfa_required: 'true'
42
- post_install_message:
41
+ post_install_message:
43
42
  rdoc_options: []
44
43
  require_paths:
45
44
  - lib
@@ -54,8 +53,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
53
  - !ruby/object:Gem::Version
55
54
  version: '0'
56
55
  requirements: []
57
- rubygems_version: 3.4.10
58
- signing_key:
56
+ rubygems_version: 3.4.12
57
+ signing_key:
59
58
  specification_version: 4
60
- summary: Write a short summary, because RubyGems requires one.
59
+ summary: Yet Another Prolog Interface for Ruby.
61
60
  test_files: []
data/Gemfile.lock DELETED
@@ -1,54 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- prolog_mqi (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.2)
10
- json (2.6.3)
11
- language_server-protocol (3.17.0.3)
12
- minitest (5.18.1)
13
- parallel (1.23.0)
14
- parser (3.2.2.3)
15
- ast (~> 2.4.1)
16
- racc
17
- racc (1.7.1)
18
- rainbow (3.1.1)
19
- rake (13.0.6)
20
- regexp_parser (2.8.1)
21
- rexml (3.2.5)
22
- rubocop (1.53.1)
23
- json (~> 2.3)
24
- language_server-protocol (>= 3.17.0)
25
- parallel (~> 1.10)
26
- parser (>= 3.2.2.3)
27
- rainbow (>= 2.2.2, < 4.0)
28
- regexp_parser (>= 1.8, < 3.0)
29
- rexml (>= 3.2.5, < 4.0)
30
- rubocop-ast (>= 1.28.0, < 2.0)
31
- ruby-progressbar (~> 1.7)
32
- unicode-display_width (>= 2.4.0, < 3.0)
33
- rubocop-ast (1.29.0)
34
- parser (>= 3.2.1.0)
35
- rubocop-minitest (0.31.0)
36
- rubocop (>= 1.39, < 2.0)
37
- rubocop-rake (0.6.0)
38
- rubocop (~> 1.0)
39
- ruby-progressbar (1.13.0)
40
- unicode-display_width (2.4.2)
41
-
42
- PLATFORMS
43
- x86_64-linux
44
-
45
- DEPENDENCIES
46
- minitest (~> 5.0)
47
- prolog_mqi!
48
- rake (~> 13.0)
49
- rubocop
50
- rubocop-minitest
51
- rubocop-rake
52
-
53
- BUNDLED WITH
54
- 2.4.10