barthes 0.0.27 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ require 'mysql2'
2
+ require 'barthes/client/rdb'
3
+
4
+ class Barthes::Client::Mysql < Barthes::Client::Rdb
5
+ def initialize(env)
6
+ @client = Mysql2::Client.new(
7
+ host: env['host'],
8
+ username: env['user'],
9
+ password: env['password'],
10
+ database: env['database']
11
+ )
12
+ end
13
+
14
+ def execute_query(query)
15
+ @client.query(query)
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ require 'pg'
2
+ require 'barthes/client/rdb'
3
+
4
+ class Barthes::Client::Pgsql < Barthes::Client::Rdb
5
+ def initialize(env)
6
+ @client = PG::connect(
7
+ host: env['host'],
8
+ user: env['user'],
9
+ password: env['password'],
10
+ dbname: env['database'],
11
+ sslmode: 'disable'
12
+ )
13
+ end
14
+
15
+ def execute_query(query)
16
+ @client.exec(query)
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module Barthes
2
+ module Client
3
+ class Rdb
4
+ def action(params)
5
+ result = []
6
+ response = execute_query(params['query'])
7
+ if response
8
+ response.each do |row|
9
+ result << row
10
+ end
11
+ end
12
+ result
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Barthes
2
- VERSION = "0.0.27"
2
+ VERSION = "0.0.28"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barthes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -210,6 +210,9 @@ files:
210
210
  - lib/barthes/cache.rb
211
211
  - lib/barthes/cli.rb
212
212
  - lib/barthes/client/httparty.rb
213
+ - lib/barthes/client/mysql.rb
214
+ - lib/barthes/client/pgsql.rb
215
+ - lib/barthes/client/rdb.rb
213
216
  - lib/barthes/config.rb
214
217
  - lib/barthes/reporter.rb
215
218
  - lib/barthes/reporter/default.rb
@@ -229,12 +232,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
232
  - - ! '>='
230
233
  - !ruby/object:Gem::Version
231
234
  version: '0'
235
+ segments:
236
+ - 0
237
+ hash: -3666814344530002559
232
238
  required_rubygems_version: !ruby/object:Gem::Requirement
233
239
  none: false
234
240
  requirements:
235
241
  - - ! '>='
236
242
  - !ruby/object:Gem::Version
237
243
  version: '0'
244
+ segments:
245
+ - 0
246
+ hash: -3666814344530002559
238
247
  requirements: []
239
248
  rubyforge_project:
240
249
  rubygems_version: 1.8.24