infrataster-plugin-mysql 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 452d34f669b5675004391c38b3c07c8e11ecec8d
4
- data.tar.gz: da620d5a6c0c84257f865a9fec176dcb4bf7766e
3
+ metadata.gz: 112ae7613fec3a4d9e4a20d0f50fd2da8ce2664c
4
+ data.tar.gz: f6cf21d0bf9311a9ebc05ff4b880df054e688bce
5
5
  SHA512:
6
- metadata.gz: 32cbcc3bd074c57e314e7ff80112609a9287bb8ab932189c590f0c9a5c73ab7a033426846b3698943daede33063b584957279feb48b26cec9664a1b05b5340bd
7
- data.tar.gz: dde3ff0d88f79c0e8e244d2cb067d83051d0c393530daf28b3bf895d407a8c11f12c5d92f009fba4a0ad01b1e7612ef616d2c301b8fa5c1a5cb50cd7935b8b24
6
+ metadata.gz: 13db7b39805a7c4ee747799bb9ad9d440d1950c172fa2bc6d35d5d84b755e92e34ca9678b848a86325606e7983e95faa58bcde830e2eb93f075ed87a4348b4e3
7
+ data.tar.gz: 28ed99ff2ac6789c1044507024b60beb73cb168d2881ece194d5c510d8d56912c87caeb7a63f265926d1a508ae088572428a8f4b9a7ed69131775bdae4fb53d3
data/README.md CHANGED
@@ -29,12 +29,12 @@ describe server(:db) do
29
29
  end
30
30
  ```
31
31
 
32
- You can specify username and password by options passed to `Infrataster::Server.define`:
32
+ You can specify username, password and database by options passed to `Infrataster::Server.define`:
33
33
 
34
34
  ```ruby
35
35
  Infrataster::Server.define(
36
36
  # ...
37
- mysql: {user: 'app', password: 'app'}
37
+ mysql: {user: 'app', password: 'app', database: 'myapp'}
38
38
  )
39
39
  ```
40
40
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "infrataster-plugin-mysql"
4
- spec.version = '0.2.0'
4
+ spec.version = '0.2.1'
5
5
  spec.authors = ["Ryota Arai"]
6
6
  spec.email = ["ryota.arai@gmail.com"]
7
7
  spec.summary = %q{MySQL plugin for Infrataster}
@@ -11,12 +11,15 @@ module Infrataster
11
11
  end
12
12
 
13
13
  server.forward_port(options[:port]) do |address, new_port|
14
- client = Mysql2::Client.new(
15
- host: address,
16
- port: new_port,
17
- username: options[:user],
18
- password: options[:password],
19
- )
14
+ mysql_options = {
15
+ host: address, port: new_port,
16
+ username: options[:user], password: options[:password]
17
+ }
18
+ if options.key?(:database)
19
+ mysql_options[:database] = options[:database]
20
+ end
21
+ client = Mysql2::Client.new(mysql_options)
22
+
20
23
  client.xquery(resource.query, *resource.params)
21
24
  end
22
25
  end
@@ -17,3 +17,12 @@ describe server(:db) do
17
17
  end
18
18
  end
19
19
 
20
+ describe server(:db_database_name) do
21
+ describe mysql_query('SELECT User, Host FROM user WHERE User=? AND Host=?', 'app', '%') do
22
+ it 'binds arguments to query' do
23
+ row = results.first
24
+ expect(row['User']).to eq 'app'
25
+ expect(row['Host']).to eq '%'
26
+ end
27
+ end
28
+ end
@@ -8,6 +8,13 @@ Infrataster::Server.define(
8
8
  mysql: {user: 'app', password: 'app'},
9
9
  )
10
10
 
11
+ Infrataster::Server.define(
12
+ :db_database_name,
13
+ '192.168.44.20',
14
+ vagrant: true,
15
+ mysql: {user: 'app', password: 'app', database: 'mysql'},
16
+ )
17
+
11
18
  RSpec.configure do |config|
12
19
  config.treat_symbols_as_metadata_keys_with_true_values = true
13
20
  config.run_all_when_everything_filtered = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infrataster-plugin-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: infrataster
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.4.5
128
+ rubygems_version: 2.6.8
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: MySQL plugin for Infrataster