prolego 0.0.7 → 0.0.8
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 +4 -4
- data/README.md +3 -2
- data/lib/prolego.rb +14 -7
- data/lib/prolego/version.rb +1 -1
- data/prolego-0.0.7.gem +0 -0
- metadata +4 -10
- data/prolego-0.0.1.gem +0 -0
- data/prolego-0.0.2.gem +0 -0
- data/prolego-0.0.3.gem +0 -0
- data/prolego-0.0.4.gem +0 -0
- data/prolego-0.0.5.gem +0 -0
- data/prolego-0.0.6.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebac753c6aff0e828b2268518735399d048eb7fd
|
4
|
+
data.tar.gz: f2327f8c1466de231eec9a5780dc646cf6ef7900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e8b547877eaf35cc86ed3d1eac741bca05544cfb7967b40908b56d906369cd2b327fd8599da0e2b88358525496cb3859cfeff2d4e30180bbe6a8a00f3bd771b
|
7
|
+
data.tar.gz: cce7fab73cad9b1a8d4f9f7fbee4fb1de1d081177da37eebad938b73a6aae01d29b67e7ae4c30544c5207c6e1968d8870c843970effa720ac9221d550e7d977e
|
data/README.md
CHANGED
@@ -37,12 +37,13 @@ argument list expects an **array**, so if you have arrays within your arguments,
|
|
37
37
|
nest them.
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
prolog.command "ce",["BS",["MATH 162","
|
40
|
+
prolog.command "ce",["BS",[["MATH 162","A"],["CE 160L","A"]]]
|
41
41
|
```
|
42
42
|
|
43
43
|
We have a special method called `epilog` to get our formatted output. This
|
44
44
|
splits our Prolog output for our application, based on the last command sent
|
45
|
-
from the current Prolegomenon object.
|
45
|
+
from the current Prolegomenon object. This expects lists to be returned. We are
|
46
|
+
using `writeq` to do this, then the gem parses them using the JSON gem.
|
46
47
|
|
47
48
|
```ruby
|
48
49
|
prolog.epilog
|
data/lib/prolego.rb
CHANGED
@@ -1,23 +1,30 @@
|
|
1
1
|
require "prolego/version"
|
2
2
|
require "json"
|
3
|
+
require "open3"
|
3
4
|
|
4
5
|
module Prolego
|
5
6
|
class Query
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
attr_reader :status, :whiny, :error
|
9
|
+
|
10
|
+
def initialize(filepath, whiny: false)
|
11
|
+
@file = filepath
|
12
|
+
@whiny = whiny
|
9
13
|
end
|
10
14
|
|
11
|
-
def command
|
12
|
-
|
15
|
+
def command(predicate, args)
|
16
|
+
command = "swipl -qf '#{@file}' -g '#{escape(predicate)}(#{escape(args)}),halt'"
|
17
|
+
@output, @error, status = Open3.capture3(command)
|
18
|
+
@status = status.exitstatus
|
13
19
|
end
|
14
20
|
|
15
|
-
def
|
16
|
-
arg.to_s.gsub
|
21
|
+
def escape(arg)
|
22
|
+
arg.to_s.gsub(/^\[|"|'|\]$/, "[" => "", "]" => "", "'" => "'\"'\"'", "\"" => "'\"'\"'")
|
17
23
|
end
|
18
24
|
|
19
25
|
def epilog
|
20
|
-
|
26
|
+
fail "Prolog exit status #{@status}. Check errors with query.error" if @status != 0 && whiny
|
27
|
+
JSON.parse @output.gsub("'", "\"") rescue @output
|
21
28
|
end
|
22
29
|
|
23
30
|
end
|
data/lib/prolego/version.rb
CHANGED
data/prolego-0.0.7.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prolego
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Piro-Rael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,12 +52,7 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- lib/prolego.rb
|
54
54
|
- lib/prolego/version.rb
|
55
|
-
- prolego-0.0.
|
56
|
-
- prolego-0.0.2.gem
|
57
|
-
- prolego-0.0.3.gem
|
58
|
-
- prolego-0.0.4.gem
|
59
|
-
- prolego-0.0.5.gem
|
60
|
-
- prolego-0.0.6.gem
|
55
|
+
- prolego-0.0.7.gem
|
61
56
|
- prolego.gemspec
|
62
57
|
homepage: https://github.com/rickpr/prolegomenon
|
63
58
|
licenses:
|
@@ -79,9 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
74
|
version: '0'
|
80
75
|
requirements: []
|
81
76
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.4.
|
77
|
+
rubygems_version: 2.4.7
|
83
78
|
signing_key:
|
84
79
|
specification_version: 4
|
85
80
|
summary: This gem interfaces Ruby with Prolog via the shell.
|
86
81
|
test_files: []
|
87
|
-
has_rdoc:
|
data/prolego-0.0.1.gem
DELETED
Binary file
|
data/prolego-0.0.2.gem
DELETED
Binary file
|
data/prolego-0.0.3.gem
DELETED
Binary file
|
data/prolego-0.0.4.gem
DELETED
Binary file
|
data/prolego-0.0.5.gem
DELETED
Binary file
|
data/prolego-0.0.6.gem
DELETED
Binary file
|