posgra 0.1.1 → 0.1.2

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: a9ee6f48faa2e876c6077d8fa8470ea2c923cb15
4
- data.tar.gz: d178b484899df16095545fbacabd944807c4472b
3
+ metadata.gz: 45bd0c913db79c0e2a8dfceec4ef29a7e50d1091
4
+ data.tar.gz: 608f5d5835f1ef67ed1eec25d13e929115b83819
5
5
  SHA512:
6
- metadata.gz: 47e4b6b06a85789e5144b42bd977c28f7cca36876c6b56c384ed46e317705b70557dac3461d0393cd0a5cd01e0142f7274858b3f93965420257b19164a7983a8
7
- data.tar.gz: 91f3f70b90c9c449d3be4b2eeff6a98c51a70a73d44027ab0588d6d75459b0d6beb5f722d9484695ab5205f4cce50ef5bab9580df8bb3afabd920fb7f402f89d
6
+ metadata.gz: 0dee75ac4f30b22324282b739a9c5c9d1da5780f3ac8ae6a6459dfb6928e54d4fd880ea02e5874058f8d66f5404bdf0ee1acd5a86a62f529393017a58bcd1d75
7
+ data.tar.gz: 7ea2c5b16447487660a6373cba514e385bee0f2b42c0abefb44091e98c975412dd0f4e8f6d3e93e23ba54c114c67f4fb8374e87dd71ee8ab3d89de27216fa7a8
data/README.md CHANGED
@@ -61,6 +61,13 @@ posgra grant apply --dry-run pg_grants.rb
61
61
  posgra grant apply pg_grants.rb
62
62
  ```
63
63
 
64
+ ### for Redshift
65
+
66
+ ```sh
67
+ export POSGRA_DEFAULT_ACL_PRIVS=arwdRxt
68
+ posgra grant export pg_grants.rb
69
+ ```
70
+
64
71
  ## DSL Example
65
72
 
66
73
  ### Role
@@ -31,7 +31,7 @@ module Posgra::CLI::Helper
31
31
  end
32
32
  end
33
33
 
34
- client_options[:identifier] = Posgra::Identifier::Auto.new(options['account-output'])
34
+ client_options[:identifier] = Posgra::Identifier::Auto.new(options['account-output'], client_options)
35
35
  Posgra::Client.new(client_options)
36
36
  end
37
37
  end
data/lib/posgra/driver.rb CHANGED
@@ -2,7 +2,8 @@ class Posgra::Driver
2
2
  include Posgra::Logger::Helper
3
3
  include Posgra::Utils::Helper
4
4
 
5
- DEFAULT_ACL = '{%s=arwdDxt/%s}'
5
+ DEFAULT_ACL_PRIVS = ENV['POSGRA_DEFAULT_ACL_PRIVS'] || 'arwdDxt'
6
+ DEFAULT_ACL = "{%s=#{DEFAULT_ACL_PRIVS}/%s}"
6
7
 
7
8
  PRIVILEGE_TYPES = {
8
9
  'a' => 'INSERT',
@@ -13,6 +14,10 @@ class Posgra::Driver
13
14
  'x' => 'REFERENCES',
14
15
  't' => 'TRIGGER',
15
16
  'U' => 'USAGE',
17
+ 'R' => 'RULE',
18
+ 'X' => 'EXECUTE',
19
+ 'C' => 'CREATE',
20
+ 'T' => 'TEMPORARY',
16
21
  }
17
22
 
18
23
  def initialize(client, options = {})
@@ -13,7 +13,20 @@ class Posgra::Identifier::Auto
13
13
  private
14
14
 
15
15
  def mkpasswd(len = 8)
16
- [*1..9, *'A'..'Z', *'a'..'z'].shuffle.slice(0, len).join
16
+ sources = [
17
+ (1..9).to_a,
18
+ ('A'..'Z').to_a,
19
+ ('a'..'z').to_a,
20
+ ].shuffle
21
+
22
+ passwd = []
23
+
24
+ len.times do |i|
25
+ src = sources[i % sources.length]
26
+ passwd << src.shuffle.shift
27
+ end
28
+
29
+ passwd.join
17
30
  end
18
31
 
19
32
  def puts_password(user, password)
@@ -1,3 +1,3 @@
1
1
  module Posgra
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posgra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - winebarrel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-30 00:00:00.000000000 Z
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg