aaf-gumboot 2.1.3 → 2.1.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.
- checksums.yaml +4 -4
- data/lib/gumboot/shared_examples/database_schema.rb +2 -0
- data/lib/gumboot/strap.rb +9 -2
- data/lib/gumboot/version.rb +1 -1
- data/spec/dummy/.rubocop.yml +0 -1
- data/spec/dummy/app/controllers/api/api_controller.rb +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/lib/gumboot/strap_spec.rb +14 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a713e915fc7a71196b7127e2a20f052e328fad64bc53c8c18ed4f9b77d1bbc0
|
4
|
+
data.tar.gz: 389bb5fb4cde9a1db6ab7027b8f3db37120adb29b41f0d5a3fc68a74dfe0b720
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bba367eadd046a177e1efae9c68b0dc875925e84500d9a2de0d52671e4ec27705a16e32134ee8e8bd2d540442eabafdb1356feddb01915ff675639febc7cfd3
|
7
|
+
data.tar.gz: e078a051b4e7f1cd7d4ac05b2f5fb380fc5cc353426fced3cf1ce72e60414fade87bfc6a5dec952a332a004fd91920422fb248722d8b8904014ca386274a831d
|
@@ -35,6 +35,7 @@ RSpec.shared_examples 'Database Schema' do
|
|
35
35
|
query('SHOW TABLE STATUS').each do |table|
|
36
36
|
table_name = table[:Name]
|
37
37
|
next if table_name == 'schema_migrations'
|
38
|
+
|
38
39
|
expect(table).to(
|
39
40
|
have_collations(%w[utf8_bin utf8mb4_bin], "`#{table_name}`")
|
40
41
|
)
|
@@ -47,6 +48,7 @@ RSpec.shared_examples 'Database Schema' do
|
|
47
48
|
except_column == column[:Field].to_sym
|
48
49
|
end
|
49
50
|
end
|
51
|
+
|
50
52
|
expect(column)
|
51
53
|
.to have_collations(%w[utf8_bin utf8mb4_bin],
|
52
54
|
" `#{table_name}`.`#{column[:Field]}`")
|
data/lib/gumboot/strap.rb
CHANGED
@@ -42,9 +42,14 @@ module Gumboot
|
|
42
42
|
"Ensuring access to `#{database}` for #{username} user is granted"
|
43
43
|
)
|
44
44
|
|
45
|
+
create_and_grant_user(client, database, username, password)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_and_grant_user(client, database, username, password)
|
49
|
+
client.query("CREATE USER IF NOT EXISTS '#{client.escape(username)}'" \
|
50
|
+
"@'localhost' IDENTIFIED BY '#{client.escape(password)}';")
|
45
51
|
client.query("GRANT ALL PRIVILEGES ON `#{database}`.* " \
|
46
|
-
"TO '#{client.escape(username)}'@'localhost'
|
47
|
-
"IDENTIFIED BY '#{client.escape(password)}'")
|
52
|
+
"TO '#{client.escape(username)}'@'localhost'")
|
48
53
|
end
|
49
54
|
|
50
55
|
def maintain_activerecord_schema
|
@@ -82,6 +87,7 @@ module Gumboot
|
|
82
87
|
|
83
88
|
dest = "config/#{file}"
|
84
89
|
next if File.exist?(dest)
|
90
|
+
|
85
91
|
FileUtils.ln_s(src, dest)
|
86
92
|
end
|
87
93
|
end
|
@@ -104,6 +110,7 @@ module Gumboot
|
|
104
110
|
raise("Missing dist config file: #{src}") unless File.exist?(src)
|
105
111
|
|
106
112
|
next if File.exist?(dest)
|
113
|
+
|
107
114
|
FileUtils.copy(src, dest)
|
108
115
|
end
|
109
116
|
end
|
data/lib/gumboot/version.rb
CHANGED
data/spec/dummy/.rubocop.yml
CHANGED
@@ -16,6 +16,7 @@ class ApplicationController < ActionController::Base
|
|
16
16
|
def subject
|
17
17
|
subject = session[:subject_id] && Subject.find_by(id: session[:subject_id])
|
18
18
|
return nil unless subject.try(:functioning?)
|
19
|
+
|
19
20
|
@subject = subject
|
20
21
|
end
|
21
22
|
|
@@ -38,6 +39,7 @@ class ApplicationController < ActionController::Base
|
|
38
39
|
|
39
40
|
def check_access!(action)
|
40
41
|
raise(Forbidden) unless subject.permits?(action)
|
42
|
+
|
41
43
|
@access_checked = true
|
42
44
|
end
|
43
45
|
|
@@ -73,11 +73,17 @@ RSpec.describe Gumboot::Strap do
|
|
73
73
|
|
74
74
|
it 'sets permissions for database users' do
|
75
75
|
expect(client).to receive(:query)
|
76
|
-
.with("
|
77
|
-
"IDENTIFIED BY 'one_password'").once
|
76
|
+
.with("CREATE USER IF NOT EXISTS 'one_user'@'localhost' " \
|
77
|
+
"IDENTIFIED BY 'one_password';").once
|
78
78
|
expect(client).to receive(:query)
|
79
|
-
.with("GRANT ALL PRIVILEGES ON `
|
80
|
-
|
79
|
+
.with("GRANT ALL PRIVILEGES ON `one_db`.* TO 'one_user'@'localhost'")
|
80
|
+
.once
|
81
|
+
expect(client).to receive(:query)
|
82
|
+
.with("CREATE USER IF NOT EXISTS 'two_user'@'localhost' " \
|
83
|
+
"IDENTIFIED BY 'two_password';").once
|
84
|
+
expect(client).to receive(:query)
|
85
|
+
.with("GRANT ALL PRIVILEGES ON `two_db`.* TO 'two_user'@'localhost'")
|
86
|
+
.once
|
81
87
|
|
82
88
|
allow(client).to receive(:query).with(match(/^CREATE DATABASE.*/))
|
83
89
|
|
@@ -107,9 +113,12 @@ RSpec.describe Gumboot::Strap do
|
|
107
113
|
end
|
108
114
|
|
109
115
|
it 'sets permission for the database user' do
|
116
|
+
expect(client).to receive(:query)
|
117
|
+
.with("CREATE USER IF NOT EXISTS 'test_user'@'localhost' " \
|
118
|
+
"IDENTIFIED BY 'test_password';").once
|
110
119
|
expect(client).to receive(:query)
|
111
120
|
.with('GRANT ALL PRIVILEGES ON `test_db`.* TO ' \
|
112
|
-
"'test_user'@'localhost'
|
121
|
+
"'test_user'@'localhost'").once
|
113
122
|
|
114
123
|
subject.ensure_database_user(opts)
|
115
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aaf-gumboot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bradley Beddoes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: accession
|