gratan 0.1.9 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8629e3700e4f0fe06c6bd8bf9280c9cf02ea02e
4
- data.tar.gz: 6f7907b86cd2ce4542fec2fb280fcd9500cc8e58
3
+ metadata.gz: e6c3096bfdfeb9445c63ceec07cbdfa922f12bb5
4
+ data.tar.gz: abd97c6f20d52b0400e6f9bc5c4c79f4bbe0febe
5
5
  SHA512:
6
- metadata.gz: 8c3138738f653f0054c5945e2cf59f8797eea7d6a15e0318b286b05a31830346544200f95af02ca1382e23955c050779e69094496ab56521b3b7ec312ad84790
7
- data.tar.gz: 9a32dedcd234244f009bf6be01556c68fc7049240444b10745c8c62e0281c82b54441fa8b97613c8e102e7854f4d2de2d42f955ff264d52f98b8b7007feebc1a
6
+ metadata.gz: da931e7f22cac224bd4ef1cdeae20b6d57c640713a5c1f0ffff9f01fc21872e1ff6b1464b641d9ea04e80c2d065c75359b9ad9b7cac78c5acf835a3d8db00ec4
7
+ data.tar.gz: 42ce86462837e8dfbfcc75b0141bdc3bb68f1cda393798401066f5db57d6894895a01a53f793615c75ca707275a6415ef0a75084a1115a9a7fe4a3691495e217
@@ -2,10 +2,12 @@ class Gratan::Identifier::Auto
2
2
  def initialize(output, options = {})
3
3
  @options = options
4
4
 
5
- if output == '-'
6
- @output = $stdout
7
- else
8
- @output = open(output, 'w')
5
+ unless @options[:dry_run]
6
+ if output == '-'
7
+ @output = $stdout
8
+ else
9
+ @output = open(output, 'w')
10
+ end
9
11
  end
10
12
  end
11
13
 
@@ -22,7 +24,9 @@ class Gratan::Identifier::Auto
22
24
  end
23
25
 
24
26
  def puts_password(user, host, password)
25
- @output.puts("#{user}@#{host},#{password}")
26
- @output.flush
27
+ if @output
28
+ @output.puts("#{user}@#{host},#{password}")
29
+ @output.flush
30
+ end
27
31
  end
28
32
  end
@@ -1,3 +1,3 @@
1
1
  module Gratan
2
- VERSION = '0.1.9'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -36,6 +36,40 @@ end
36
36
  end
37
37
  end
38
38
 
39
+ context 'when create user with auto identify (dry-run)' do
40
+ let(:auto_identifier) do
41
+ identifier = Gratan::Identifier::Auto.new('/dev/null')
42
+ allow(identifier).to receive(:mkpasswd) { 'foobarzoo' }
43
+ identifier
44
+ end
45
+
46
+ subject { client(identifier: auto_identifier, dry_run: true) }
47
+
48
+ it do
49
+ apply(subject) {
50
+ <<-RUBY
51
+ user 'scott', 'localhost' do
52
+ on '*.*' do
53
+ grant 'SELECT'
54
+ grant 'INSERT'
55
+ grant 'UPDATE'
56
+ grant 'DELETE'
57
+ end
58
+
59
+ on 'test.*' do
60
+ grant 'SELECT'
61
+ grant 'INSERT'
62
+ grant 'UPDATE'
63
+ grant 'DELETE'
64
+ end
65
+ end
66
+ RUBY
67
+ }
68
+
69
+ expect(show_grants).to match_array []
70
+ end
71
+ end
72
+
39
73
  context 'when create user with csv identify' do
40
74
  let(:csv_identifier) do
41
75
  identifier = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gratan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara