views 0.0.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/generators/view/templates/migration.rb +5 -0
- data/lib/generators/{views → view}/templates/view.sql +0 -0
- data/lib/generators/view/view_generator.rb +24 -0
- data/lib/views.rb +7 -50
- data/lib/views/extensions/active_record/abstract_adapter.rb +17 -0
- data/lib/views/extensions/active_record/command_recorder.rb +26 -0
- data/lib/views/extensions/active_record/postgresql_adapter.rb +39 -0
- data/lib/views/extensions/active_record/schema_dumper.rb +28 -0
- data/lib/views/railtie.rb +17 -0
- data/lib/views/version.rb +3 -1
- 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 +2 -1
- data/test/dummy/config/database.yml +2 -5
- 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/initializers/mime_types.rb +1 -1
- data/test/dummy/config/secrets.yml +2 -2
- data/test/dummy/db/migrate/20161125151623_create_guitars_view.rb +5 -0
- data/test/dummy/db/schema.rb +3 -1
- data/test/dummy/db/views/guitars.sql +2 -2
- data/test/dummy/log/development.log +2897 -24
- data/test/dummy/log/test.log +1545 -915
- 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/{generators_test.rb → generator_test.rb} +4 -4
- data/test/migration_test.rb +20 -0
- data/test/task_test.rb +25 -0
- metadata +19 -10
- data/lib/generators/views/view_generator.rb +0 -15
- data/lib/tasks/views.rake +0 -7
- data/test/tasks_test.rb +0 -28
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>
|
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'rails/generators'
|
3
|
-
require 'generators/
|
3
|
+
require 'generators/view/view_generator'
|
4
4
|
|
5
|
-
class
|
6
|
-
|
7
|
-
tests Views::Generators::ViewGenerator
|
5
|
+
class GeneratorTest < Rails::Generators::TestCase
|
8
6
|
destination Rails.root.join('tmp')
|
9
7
|
|
10
8
|
teardown do
|
@@ -12,8 +10,10 @@ class GeneratorsTest < Rails::Generators::TestCase
|
|
12
10
|
end
|
13
11
|
|
14
12
|
test 'file generation' do
|
13
|
+
self.class.tests Views::Generators::ViewGenerator
|
15
14
|
run_generator %w(guitars)
|
16
15
|
assert_file 'db/views/guitars.sql'
|
16
|
+
assert_migration 'db/migrate/create_guitars_view.rb'
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MigrationTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'create and drop' do
|
6
|
+
ActiveRecord::Migration.verbose = false
|
7
|
+
paths = Rails.application.paths['db/migrate'].to_a
|
8
|
+
assert_nothing_raised do
|
9
|
+
ActiveRecord::Migrator.migrate paths, 0
|
10
|
+
ActiveRecord::Migrator.migrate paths, nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'change' do
|
15
|
+
assert_nothing_raised do
|
16
|
+
ActiveRecord::Migration.change_view :guitars
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/test/task_test.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TaskTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
setup do
|
6
|
+
Dummy::Application.load_tasks
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'load' do
|
10
|
+
silence_stream(STDOUT) do
|
11
|
+
Rake::Task['db:reset'].invoke
|
12
|
+
end
|
13
|
+
assert_equal 'guitars', ActiveRecord::Base.connection.views.first['name']
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'dump' do
|
17
|
+
path = Rails.root.join('db/schema.rb')
|
18
|
+
FileUtils.rm_rf path
|
19
|
+
silence_stream(STDOUT) do
|
20
|
+
Rake::Task['db:schema:dump'].invoke
|
21
|
+
end
|
22
|
+
assert_includes File.read(path), 'create_view "guitars", force: true'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: views
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 4.0.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathías Montossi
|
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
|
@@ -60,17 +60,22 @@ dependencies:
|
|
60
60
|
version: '1.1'
|
61
61
|
description: Simple way to manage database views in rails.
|
62
62
|
email:
|
63
|
-
- mmontossi@
|
63
|
+
- mmontossi@gmail.com
|
64
64
|
executables: []
|
65
65
|
extensions: []
|
66
66
|
extra_rdoc_files: []
|
67
67
|
files:
|
68
68
|
- MIT-LICENSE
|
69
69
|
- Rakefile
|
70
|
-
- lib/generators/
|
71
|
-
- lib/generators/
|
72
|
-
- lib/
|
70
|
+
- lib/generators/view/templates/migration.rb
|
71
|
+
- lib/generators/view/templates/view.sql
|
72
|
+
- lib/generators/view/view_generator.rb
|
73
73
|
- lib/views.rb
|
74
|
+
- lib/views/extensions/active_record/abstract_adapter.rb
|
75
|
+
- lib/views/extensions/active_record/command_recorder.rb
|
76
|
+
- lib/views/extensions/active_record/postgresql_adapter.rb
|
77
|
+
- lib/views/extensions/active_record/schema_dumper.rb
|
78
|
+
- lib/views/railtie.rb
|
74
79
|
- lib/views/version.rb
|
75
80
|
- test/dummy/Rakefile
|
76
81
|
- test/dummy/app/assets/javascripts/application.js
|
@@ -104,6 +109,7 @@ files:
|
|
104
109
|
- test/dummy/config/routes.rb
|
105
110
|
- test/dummy/config/secrets.yml
|
106
111
|
- test/dummy/db/migrate/20161017172847_create_products.rb
|
112
|
+
- test/dummy/db/migrate/20161125151623_create_guitars_view.rb
|
107
113
|
- test/dummy/db/schema.rb
|
108
114
|
- test/dummy/db/views/guitars.sql
|
109
115
|
- test/dummy/log/development.log
|
@@ -112,8 +118,9 @@ files:
|
|
112
118
|
- test/dummy/public/422.html
|
113
119
|
- test/dummy/public/500.html
|
114
120
|
- test/dummy/public/favicon.ico
|
115
|
-
- test/
|
116
|
-
- test/
|
121
|
+
- test/generator_test.rb
|
122
|
+
- test/migration_test.rb
|
123
|
+
- test/task_test.rb
|
117
124
|
- test/test_helper.rb
|
118
125
|
homepage: https://github.com/mmontossi/views
|
119
126
|
licenses:
|
@@ -171,6 +178,7 @@ test_files:
|
|
171
178
|
- test/dummy/config/secrets.yml
|
172
179
|
- test/dummy/config.ru
|
173
180
|
- test/dummy/db/migrate/20161017172847_create_products.rb
|
181
|
+
- test/dummy/db/migrate/20161125151623_create_guitars_view.rb
|
174
182
|
- test/dummy/db/schema.rb
|
175
183
|
- test/dummy/db/views/guitars.sql
|
176
184
|
- test/dummy/log/development.log
|
@@ -180,6 +188,7 @@ test_files:
|
|
180
188
|
- test/dummy/public/500.html
|
181
189
|
- test/dummy/public/favicon.ico
|
182
190
|
- test/dummy/Rakefile
|
183
|
-
- test/
|
184
|
-
- test/
|
191
|
+
- test/generator_test.rb
|
192
|
+
- test/migration_test.rb
|
193
|
+
- test/task_test.rb
|
185
194
|
- test/test_helper.rb
|