tiny-queries 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny-queries.rb +5 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bfea6638e0f3531ea94a77ab21ee4b8b3965798
4
- data.tar.gz: 17fa0fbea0c0830f694aebaf63d5e07055d250fa
3
+ metadata.gz: 9bf0331cd6adcb6dbb92d0d0063ba268a5242bb8
4
+ data.tar.gz: 417a71cbe7afbc9aa2defdcb4940f30528d6e12a
5
5
  SHA512:
6
- metadata.gz: 5f0ae2122529cd6d73e8b2eead9167a1efbbeedc014d45749be5d7dd77af0174466e7011b0eb21c05d300a77819e32c9aef82df2eba253da0b6c84780cee6db8
7
- data.tar.gz: 026a1d4a6f55981a8b4d88e267b32d6cb0e036c1590532df8072fca0381ecfbcc5f54521dfc5cd3d9b7201fd9e2e5c0eb0294293b1ada0e00f374240c2cbb640
6
+ metadata.gz: ffc6a20808fb93700c5864d99fa8407c2bc083b54d988efe2f4f8160807b61d580bb7c03f1922431d89aa3ea470174bfbb161a9cf0454f574e15675eb88c8c9e
7
+ data.tar.gz: 99ebfffd2a28050dc4710be0f8e6a96565cfb52d57bd1969d01d5fadc81623376c4eaa2ab666a641df0e50ac081bd6ac12abfcc3905410c7e1e474ade0d25deb
@@ -9,7 +9,7 @@ class TinyQueries
9
9
  # >> result = tq.run("my-query")
10
10
  #
11
11
 
12
- # :connector should be set to an executable TinyQueries connector
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
- # Create command
41
- command =
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 = `#{command}`
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.3
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: 2015-08-05 00:00:00.000000000 Z
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