tiny-queries 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tiny-queries.rb +5 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bf0331cd6adcb6dbb92d0d0063ba268a5242bb8
|
4
|
+
data.tar.gz: 417a71cbe7afbc9aa2defdcb4940f30528d6e12a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffc6a20808fb93700c5864d99fa8407c2bc083b54d988efe2f4f8160807b61d580bb7c03f1922431d89aa3ea470174bfbb161a9cf0454f574e15675eb88c8c9e
|
7
|
+
data.tar.gz: 99ebfffd2a28050dc4710be0f8e6a96565cfb52d57bd1969d01d5fadc81623376c4eaa2ab666a641df0e50ac081bd6ac12abfcc3905410c7e1e474ade0d25deb
|
data/lib/tiny-queries.rb
CHANGED
@@ -9,7 +9,7 @@ class TinyQueries
|
|
9
9
|
# >> result = tq.run("my-query")
|
10
10
|
#
|
11
11
|
|
12
|
-
# :connector should be set to
|
12
|
+
# :connector should be set to the path to connector.php
|
13
13
|
attr_accessor :connector
|
14
14
|
|
15
15
|
# :globals is a hash to be used for global query parameters
|
@@ -30,22 +30,18 @@ class TinyQueries
|
|
30
30
|
|
31
31
|
# Check if connector is set
|
32
32
|
if @connector.nil?
|
33
|
-
raise "You need to set connector first - calling queries without connector is not supported yet"
|
33
|
+
raise "You need to set a PHP-connector first - calling queries without connector is not supported yet"
|
34
34
|
end
|
35
35
|
|
36
36
|
if params.class != Hash
|
37
37
|
raise "Parameters should be passed as a Hash"
|
38
38
|
end
|
39
39
|
|
40
|
-
#
|
41
|
-
|
42
|
-
@connector +
|
43
|
-
" \"" + term + "\"" +
|
44
|
-
" \"" + JSON.generate( params ).gsub(/\"/,"\\\"") + "\"" +
|
45
|
-
" \"" + JSON.generate( @globals ).gsub(/\"/,"\\\"") + "\""
|
40
|
+
# For backwards compatibility check if there is "php " prepended to @connector and remove it
|
41
|
+
@connector = @connector.sub(/^php\s+/, '');
|
46
42
|
|
47
43
|
# Execute the command and capture the output
|
48
|
-
json =
|
44
|
+
json = exec "php", @connector, term, JSON.generate( params ), JSON.generate( @globals );
|
49
45
|
|
50
46
|
result = JSON.parse( json )
|
51
47
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny-queries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wouter Diesveld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem can be used to connect with the PHP TinyQueries client libs
|
14
14
|
email: wouter@tinyqueries.com
|