cachers 0.1.1 → 4.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -19
- data/lib/cachers/railtie.rb +8 -2
- data/lib/cachers/version.rb +3 -1
- data/lib/cachers.rb +1 -0
- data/lib/generators/{cachers → cacher}/cacher_generator.rb +3 -3
- data/lib/generators/{cachers → cacher}/templates/cacher.rb +0 -0
- data/lib/tasks/cachers.rake +3 -3
- data/test/dummy/app/cachers/user_cacher.rb +2 -2
- data/test/dummy/bin/bundle +1 -0
- data/test/dummy/bin/rails +1 -0
- data/test/dummy/bin/rake +1 -0
- data/test/dummy/bin/setup +1 -0
- data/test/dummy/config/database.yml.travis +2 -11
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/log/test.log +575 -976
- data/test/dummy/public/404.html +57 -63
- data/test/dummy/public/422.html +57 -63
- data/test/dummy/public/500.html +56 -62
- data/test/generator_test.rb +3 -4
- data/test/record_test.rb +7 -4
- data/test/task_test.rb +35 -0
- data/test/test_helper.rb +0 -7
- metadata +8 -12
- data/test/dummy/db/schema.rb +0 -25
- data/test/dummy/log/development.log +0 -35
- data/test/tasks_test.rb +0 -29
data/test/dummy/public/404.html
CHANGED
@@ -1,67 +1,61 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
div.dialog {
|
15
|
+
width: 95%;
|
16
|
+
max-width: 33em;
|
17
|
+
margin: 4em auto 0;
|
18
|
+
}
|
19
|
+
div.dialog > div {
|
20
|
+
border: 1px solid #CCC;
|
21
|
+
border-right-color: #999;
|
22
|
+
border-left-color: #999;
|
23
|
+
border-bottom-color: #BBB;
|
24
|
+
border-top: #B00100 solid 4px;
|
25
|
+
border-top-left-radius: 9px;
|
26
|
+
border-top-right-radius: 9px;
|
27
|
+
background-color: white;
|
28
|
+
padding: 7px 12% 0;
|
29
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
font-size: 100%;
|
33
|
+
color: #730E15;
|
34
|
+
line-height: 1.5em;
|
35
|
+
}
|
36
|
+
div.dialog > p {
|
37
|
+
margin: 0 0 1em;
|
38
|
+
padding: 1em;
|
39
|
+
background-color: #F7F7F7;
|
40
|
+
border: 1px solid #CCC;
|
41
|
+
border-right-color: #999;
|
42
|
+
border-left-color: #999;
|
43
|
+
border-bottom-color: #999;
|
44
|
+
border-bottom-left-radius: 4px;
|
45
|
+
border-bottom-right-radius: 4px;
|
46
|
+
border-top-color: #DADADA;
|
47
|
+
color: #666;
|
48
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
+
}
|
50
|
+
</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<div class="dialog">
|
54
|
+
<div>
|
55
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
56
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
57
|
+
</div>
|
58
|
+
<p>If you are the application owner check the logs for more information.</p>
|
63
59
|
</div>
|
64
|
-
|
65
|
-
</div>
|
66
|
-
</body>
|
60
|
+
</body>
|
67
61
|
</html>
|
data/test/dummy/public/422.html
CHANGED
@@ -1,67 +1,61 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>The change you wanted was rejected.</h1>
|
62
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
div.dialog {
|
15
|
+
width: 95%;
|
16
|
+
max-width: 33em;
|
17
|
+
margin: 4em auto 0;
|
18
|
+
}
|
19
|
+
div.dialog > div {
|
20
|
+
border: 1px solid #CCC;
|
21
|
+
border-right-color: #999;
|
22
|
+
border-left-color: #999;
|
23
|
+
border-bottom-color: #BBB;
|
24
|
+
border-top: #B00100 solid 4px;
|
25
|
+
border-top-left-radius: 9px;
|
26
|
+
border-top-right-radius: 9px;
|
27
|
+
background-color: white;
|
28
|
+
padding: 7px 12% 0;
|
29
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
font-size: 100%;
|
33
|
+
color: #730E15;
|
34
|
+
line-height: 1.5em;
|
35
|
+
}
|
36
|
+
div.dialog > p {
|
37
|
+
margin: 0 0 1em;
|
38
|
+
padding: 1em;
|
39
|
+
background-color: #F7F7F7;
|
40
|
+
border: 1px solid #CCC;
|
41
|
+
border-right-color: #999;
|
42
|
+
border-left-color: #999;
|
43
|
+
border-bottom-color: #999;
|
44
|
+
border-bottom-left-radius: 4px;
|
45
|
+
border-bottom-right-radius: 4px;
|
46
|
+
border-top-color: #DADADA;
|
47
|
+
color: #666;
|
48
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
+
}
|
50
|
+
</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<div class="dialog">
|
54
|
+
<div>
|
55
|
+
<h1>The change you wanted was rejected.</h1>
|
56
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
57
|
+
</div>
|
58
|
+
<p>If you are the application owner check the logs for more information.</p>
|
63
59
|
</div>
|
64
|
-
|
65
|
-
</div>
|
66
|
-
</body>
|
60
|
+
</body>
|
67
61
|
</html>
|
data/test/dummy/public/500.html
CHANGED
@@ -1,66 +1,60 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
<
|
58
|
-
<!-- This file lives in public/500.html -->
|
59
|
-
<div class="dialog">
|
60
|
-
<div>
|
61
|
-
<h1>We're sorry, but something went wrong.</h1>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
div.dialog {
|
15
|
+
width: 95%;
|
16
|
+
max-width: 33em;
|
17
|
+
margin: 4em auto 0;
|
18
|
+
}
|
19
|
+
div.dialog > div {
|
20
|
+
border: 1px solid #CCC;
|
21
|
+
border-right-color: #999;
|
22
|
+
border-left-color: #999;
|
23
|
+
border-bottom-color: #BBB;
|
24
|
+
border-top: #B00100 solid 4px;
|
25
|
+
border-top-left-radius: 9px;
|
26
|
+
border-top-right-radius: 9px;
|
27
|
+
background-color: white;
|
28
|
+
padding: 7px 12% 0;
|
29
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
font-size: 100%;
|
33
|
+
color: #730E15;
|
34
|
+
line-height: 1.5em;
|
35
|
+
}
|
36
|
+
div.dialog > p {
|
37
|
+
margin: 0 0 1em;
|
38
|
+
padding: 1em;
|
39
|
+
background-color: #F7F7F7;
|
40
|
+
border: 1px solid #CCC;
|
41
|
+
border-right-color: #999;
|
42
|
+
border-left-color: #999;
|
43
|
+
border-bottom-color: #999;
|
44
|
+
border-bottom-left-radius: 4px;
|
45
|
+
border-bottom-right-radius: 4px;
|
46
|
+
border-top-color: #DADADA;
|
47
|
+
color: #666;
|
48
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
49
|
+
}
|
50
|
+
</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<div class="dialog">
|
54
|
+
<div>
|
55
|
+
<h1>We're sorry, but something went wrong.</h1>
|
56
|
+
</div>
|
57
|
+
<p>If you are the application owner check the logs for more information.</p>
|
62
58
|
</div>
|
63
|
-
|
64
|
-
</div>
|
65
|
-
</body>
|
59
|
+
</body>
|
66
60
|
</html>
|
data/test/generator_test.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'rails/generators'
|
3
|
-
require 'generators/
|
3
|
+
require 'generators/cacher/cacher_generator'
|
4
4
|
|
5
5
|
class GeneratorsTest < Rails::Generators::TestCase
|
6
|
-
|
7
|
-
tests Cachers::Generators::CacherGenerator
|
8
6
|
destination Rails.root.join('tmp')
|
9
7
|
|
10
8
|
teardown do
|
11
9
|
FileUtils.rm_rf destination_root
|
12
10
|
end
|
13
11
|
|
14
|
-
test '
|
12
|
+
test 'cacher' do
|
13
|
+
self.class.tests Cachers::Generators::CacherGenerator
|
15
14
|
run_generator %w(user)
|
16
15
|
assert_file 'app/cachers/user_cacher.rb'
|
17
16
|
end
|
data/test/record_test.rb
CHANGED
@@ -2,19 +2,22 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class RecordTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
# NOTE: Callbacks not called in tests until rails 5
|
6
5
|
test 'callbacks' do
|
7
6
|
user = User.create(name: 'mike')
|
8
7
|
user.cache
|
9
|
-
key = "users/#{user.
|
10
|
-
assert_equal
|
8
|
+
key = "users/#{user.name}"
|
9
|
+
assert_equal user.id, $redis.get(key).to_i
|
11
10
|
|
12
11
|
user.update name: 'john'
|
12
|
+
old_key = key
|
13
|
+
key = "users/#{user.name}"
|
13
14
|
user.recache
|
14
|
-
|
15
|
+
assert_nil $redis.get(old_key)
|
16
|
+
assert_equal user.id, $redis.get(key).to_i
|
15
17
|
|
16
18
|
user.destroy
|
17
19
|
user.uncache
|
20
|
+
assert_nil $redis.get(old_key)
|
18
21
|
assert_nil $redis.get(key)
|
19
22
|
end
|
20
23
|
|
data/test/task_test.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TaskTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
setup do
|
6
|
+
load File.expand_path('../../lib/tasks/cachers.rake', __FILE__)
|
7
|
+
Rake::Task.define_task :environment
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'all' do
|
11
|
+
users = %w(mike john).map do |name|
|
12
|
+
User.create name: name
|
13
|
+
end
|
14
|
+
silence_stream(STDOUT) do
|
15
|
+
Rake::Task['cachers:cache'].invoke
|
16
|
+
end
|
17
|
+
users.each do |user|
|
18
|
+
assert_equal user.id, $redis.get("users/#{user.name}").to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
$redis.flushall
|
22
|
+
silence_stream(STDOUT) do
|
23
|
+
Rake::Task['cachers:recache'].invoke
|
24
|
+
end
|
25
|
+
users.each do |user|
|
26
|
+
assert_equal user.id, $redis.get("users/#{user.name}").to_i
|
27
|
+
end
|
28
|
+
|
29
|
+
silence_stream(STDOUT) do
|
30
|
+
Rake::Task['cachers:uncache'].invoke
|
31
|
+
end
|
32
|
+
assert_equal 0, $redis.keys.size
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -11,10 +11,3 @@ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
|
11
11
|
|
12
12
|
# Load support files
|
13
13
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
-
|
15
|
-
# Clear redis database
|
16
|
-
class ActiveSupport::TestCase
|
17
|
-
def teardown
|
18
|
-
$redis.flushall
|
19
|
-
end
|
20
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cachers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 4.0.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmontossi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,9 +58,9 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.2'
|
61
|
-
description:
|
61
|
+
description: Dedicated classes to abstract cache logic in rails.
|
62
62
|
email:
|
63
|
-
- mmontossi@
|
63
|
+
- mmontossi@gmail.com
|
64
64
|
executables: []
|
65
65
|
extensions: []
|
66
66
|
extra_rdoc_files: []
|
@@ -72,8 +72,8 @@ files:
|
|
72
72
|
- lib/cachers/concern.rb
|
73
73
|
- lib/cachers/railtie.rb
|
74
74
|
- lib/cachers/version.rb
|
75
|
-
- lib/generators/
|
76
|
-
- lib/generators/
|
75
|
+
- lib/generators/cacher/cacher_generator.rb
|
76
|
+
- lib/generators/cacher/templates/cacher.rb
|
77
77
|
- lib/tasks/cachers.rake
|
78
78
|
- test/dummy/Rakefile
|
79
79
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -109,8 +109,6 @@ files:
|
|
109
109
|
- test/dummy/config/routes.rb
|
110
110
|
- test/dummy/config/secrets.yml
|
111
111
|
- test/dummy/db/migrate/20160918232127_create_users.rb
|
112
|
-
- test/dummy/db/schema.rb
|
113
|
-
- test/dummy/log/development.log
|
114
112
|
- test/dummy/log/test.log
|
115
113
|
- test/dummy/public/404.html
|
116
114
|
- test/dummy/public/422.html
|
@@ -118,7 +116,7 @@ files:
|
|
118
116
|
- test/dummy/public/favicon.ico
|
119
117
|
- test/generator_test.rb
|
120
118
|
- test/record_test.rb
|
121
|
-
- test/
|
119
|
+
- test/task_test.rb
|
122
120
|
- test/test_helper.rb
|
123
121
|
homepage: https://github.com/mmontossi/cachers
|
124
122
|
licenses:
|
@@ -178,8 +176,6 @@ test_files:
|
|
178
176
|
- test/dummy/config/secrets.yml
|
179
177
|
- test/dummy/config.ru
|
180
178
|
- test/dummy/db/migrate/20160918232127_create_users.rb
|
181
|
-
- test/dummy/db/schema.rb
|
182
|
-
- test/dummy/log/development.log
|
183
179
|
- test/dummy/log/test.log
|
184
180
|
- test/dummy/public/404.html
|
185
181
|
- test/dummy/public/422.html
|
@@ -188,5 +184,5 @@ test_files:
|
|
188
184
|
- test/dummy/Rakefile
|
189
185
|
- test/generator_test.rb
|
190
186
|
- test/record_test.rb
|
191
|
-
- test/
|
187
|
+
- test/task_test.rb
|
192
188
|
- test/test_helper.rb
|
data/test/dummy/db/schema.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended that you check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(version: 20160918232127) do
|
15
|
-
|
16
|
-
# These are extensions that must be enabled in order to support this database
|
17
|
-
enable_extension "plpgsql"
|
18
|
-
|
19
|
-
create_table "users", force: :cascade do |t|
|
20
|
-
t.string "name"
|
21
|
-
t.datetime "created_at", null: false
|
22
|
-
t.datetime "updated_at", null: false
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
[1m[36m (19.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
2
|
-
[1m[35m (4.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
-
Migrating to CreateUsers (20160918232127)
|
5
|
-
[1m[35m (0.2ms)[0m BEGIN
|
6
|
-
[1m[36m (14.2ms)[0m [1mCREATE TABLE "users" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
7
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160918232127"]]
|
8
|
-
[1m[36m (6.4ms)[0m [1mCOMMIT[0m
|
9
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
10
|
-
[1m[36m (3.3ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
11
|
-
FROM pg_constraint c
|
12
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
13
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
14
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
15
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
16
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
17
|
-
WHERE c.contype = 'f'
|
18
|
-
AND t1.relname = 'users'
|
19
|
-
AND t3.nspname = ANY (current_schemas(false))
|
20
|
-
ORDER BY c.conname
|
21
|
-
[0m
|
22
|
-
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
23
|
-
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
24
|
-
[1m[36m (3.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
25
|
-
FROM pg_constraint c
|
26
|
-
JOIN pg_class t1 ON c.conrelid = t1.oid
|
27
|
-
JOIN pg_class t2 ON c.confrelid = t2.oid
|
28
|
-
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
29
|
-
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
30
|
-
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
31
|
-
WHERE c.contype = 'f'
|
32
|
-
AND t1.relname = 'users'
|
33
|
-
AND t3.nspname = ANY (current_schemas(false))
|
34
|
-
ORDER BY c.conname
|
35
|
-
[0m
|
data/test/tasks_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TasksTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
load File.expand_path('../../lib/tasks/cachers.rake', __FILE__)
|
7
|
-
Rake::Task.define_task :environment
|
8
|
-
end
|
9
|
-
|
10
|
-
test 'tasks' do
|
11
|
-
users = %w(mike john).map do |name|
|
12
|
-
User.create name: name
|
13
|
-
end
|
14
|
-
Rake::Task['cachers:cache'].invoke
|
15
|
-
users.each do |user|
|
16
|
-
assert_equal user.name, $redis.get("users/#{user.id}")
|
17
|
-
end
|
18
|
-
|
19
|
-
$redis.flushall
|
20
|
-
Rake::Task['cachers:recache'].invoke
|
21
|
-
users.each do |user|
|
22
|
-
assert_equal user.name, $redis.get("users/#{user.id}")
|
23
|
-
end
|
24
|
-
|
25
|
-
Rake::Task['cachers:uncache'].invoke
|
26
|
-
assert_equal 0, $redis.keys.size
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|