scenic 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.hound.yml +2 -4
- data/.rubocop.yml +129 -0
- data/.travis.yml +11 -17
- data/Appraisals +14 -21
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +3 -7
- data/Gemfile +1 -1
- data/NEWS.md +41 -11
- data/README.md +27 -22
- data/Rakefile +2 -2
- data/gemfiles/rails42.gemfile +1 -1
- data/gemfiles/rails50.gemfile +1 -1
- data/gemfiles/rails51.gemfile +1 -1
- data/gemfiles/rails52.gemfile +8 -0
- data/gemfiles/rails_edge.gemfile +3 -3
- data/lib/generators/scenic/materializable.rb +9 -0
- data/lib/generators/scenic/model/model_generator.rb +2 -2
- data/lib/generators/scenic/view/USAGE +1 -0
- data/lib/generators/scenic/view/templates/db/migrate/create_view.erb +1 -1
- data/lib/generators/scenic/view/templates/db/migrate/update_view.erb +1 -1
- data/lib/generators/scenic/view/view_generator.rb +14 -6
- data/lib/scenic/adapters/postgres/refresh_dependencies.rb +12 -2
- data/lib/scenic/adapters/postgres/views.rb +10 -1
- data/lib/scenic/adapters/postgres.rb +15 -5
- data/lib/scenic/schema_dumper.rb +2 -2
- data/lib/scenic/statements.rb +24 -6
- data/lib/scenic/version.rb +1 -1
- data/lib/scenic/view.rb +1 -2
- data/scenic.gemspec +22 -23
- data/spec/acceptance/user_manages_views_spec.rb +2 -1
- data/spec/dummy/app/models/application_record.rb +5 -0
- data/spec/generators/scenic/model/model_generator_spec.rb +1 -1
- data/spec/generators/scenic/view/view_generator_spec.rb +1 -1
- data/spec/scenic/adapters/postgres/refresh_dependencies_spec.rb +60 -26
- data/spec/scenic/adapters/postgres_spec.rb +2 -2
- data/spec/scenic/definition_spec.rb +1 -1
- data/spec/scenic/schema_dumper_spec.rb +17 -2
- data/spec/scenic/statements_spec.rb +48 -13
- data/spec/spec_helper.rb +1 -1
- data/spec/support/generator_spec_setup.rb +1 -1
- metadata +15 -14
- data/gemfiles/rails40.gemfile +0 -8
- data/gemfiles/rails41.gemfile +0 -8
- data/gemfiles/rails42_with_fg_rails.gemfile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4f976353b8ba2818670c650b1ee7af50aff76955d94375db07b78377ca1dea10
|
4
|
+
data.tar.gz: 4756b733801359a9a542cf6cb0a2216086c3b1c8fad50489044202c5b801d1e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af4652c0978530b0b54de384ffc02ded0587c8361be9cfaf619c0dd2996fd4a6cd0f3fe6fe949bcb51bb5b10320763b5501a0838ac4b4578e74617c9bcf45068
|
7
|
+
data.tar.gz: b31585a640b9ea5a51586cbfda42b62a4ad90e458a04730b9ee9a8376a62f63095beae991b9c67aa8c3bd8d23bb2d91a64986d18b41a6ef7b79ca7a9ee120a52
|
data/.gitignore
CHANGED
data/.hound.yml
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.3.0
|
3
|
+
Exclude:
|
4
|
+
- "tmp/**/*"
|
5
|
+
- "bin/*"
|
6
|
+
- "spec/dummy/**/*"
|
7
|
+
|
8
|
+
Bundler/OrderedGems:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Gemspec/OrderedDependencies:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Layout/AlignParameters:
|
15
|
+
Enabled: true
|
16
|
+
EnforcedStyle: with_fixed_indentation
|
17
|
+
Layout/ConditionPosition:
|
18
|
+
Enabled: false
|
19
|
+
Layout/DotPosition:
|
20
|
+
EnforcedStyle: leading
|
21
|
+
Layout/ExtraSpacing:
|
22
|
+
Enabled: true
|
23
|
+
Layout/IndentAssignment:
|
24
|
+
Enabled: False
|
25
|
+
Layout/MultilineOperationIndentation:
|
26
|
+
Enabled: true
|
27
|
+
EnforcedStyle: indented
|
28
|
+
Layout/MultilineMethodCallIndentation:
|
29
|
+
Enabled: true
|
30
|
+
EnforcedStyle: indented
|
31
|
+
|
32
|
+
Lint/AmbiguousOperator:
|
33
|
+
Enabled: true
|
34
|
+
Lint/AmbiguousRegexpLiteral:
|
35
|
+
Enabled: true
|
36
|
+
Lint/DuplicatedKey:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
Metrics/ClassLength:
|
40
|
+
Enabled: false
|
41
|
+
Metrics/ModuleLength:
|
42
|
+
Enabled: false
|
43
|
+
Metrics/AbcSize:
|
44
|
+
Enabled: false
|
45
|
+
Metrics/BlockLength:
|
46
|
+
CountComments: true # count full line comments?
|
47
|
+
Max: 25
|
48
|
+
ExcludedMethods: []
|
49
|
+
Exclude:
|
50
|
+
- "spec/**/*"
|
51
|
+
- "*.gemspec"
|
52
|
+
Metrics/CyclomaticComplexity:
|
53
|
+
Enabled: false
|
54
|
+
Metrics/LineLength:
|
55
|
+
Max: 80
|
56
|
+
Metrics/MethodLength:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Security/Eval:
|
60
|
+
Enabled: true
|
61
|
+
Exclude:
|
62
|
+
- "spec/scenic/schema_dumper_spec.rb"
|
63
|
+
Style/BlockDelimiters:
|
64
|
+
Enabled: false
|
65
|
+
Style/CollectionMethods:
|
66
|
+
Enabled: true
|
67
|
+
PreferredMethods:
|
68
|
+
find: find
|
69
|
+
inject: reduce
|
70
|
+
collect: map
|
71
|
+
find_all: select
|
72
|
+
Style/ConditionalAssignment:
|
73
|
+
Enabled: false
|
74
|
+
Style/ClassAndModuleChildren:
|
75
|
+
Enabled: true
|
76
|
+
Exclude:
|
77
|
+
- "spec/**/*"
|
78
|
+
Style/Documentation:
|
79
|
+
Enabled: false
|
80
|
+
Style/FrozenStringLiteralComment:
|
81
|
+
Description: >-
|
82
|
+
Add the frozen_string_literal comment to the top of files
|
83
|
+
to help transition from Ruby 2.3.0 to Ruby 3.0.
|
84
|
+
Enabled: false
|
85
|
+
Style/GuardClause:
|
86
|
+
Enabled: false
|
87
|
+
Style/IfUnlessModifier:
|
88
|
+
Enabled: false
|
89
|
+
Style/Lambda:
|
90
|
+
Enabled: false
|
91
|
+
Style/NumericLiterals:
|
92
|
+
Enabled: false
|
93
|
+
Style/OneLineConditional:
|
94
|
+
Enabled: false
|
95
|
+
Style/PercentLiteralDelimiters:
|
96
|
+
Enabled: false
|
97
|
+
Style/StringLiterals:
|
98
|
+
EnforcedStyle: double_quotes
|
99
|
+
Enabled: true
|
100
|
+
Style/TrailingCommaInArguments:
|
101
|
+
Description: 'Checks for trailing comma in argument lists.'
|
102
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
103
|
+
EnforcedStyleForMultiline: comma
|
104
|
+
SupportedStylesForMultiline:
|
105
|
+
- comma
|
106
|
+
- consistent_comma
|
107
|
+
- no_comma
|
108
|
+
Enabled: true
|
109
|
+
Style/TrailingCommaInArrayLiteral:
|
110
|
+
Description: 'Checks for trailing comma in array literals.'
|
111
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
112
|
+
EnforcedStyleForMultiline: comma
|
113
|
+
SupportedStylesForMultiline:
|
114
|
+
- comma
|
115
|
+
- consistent_comma
|
116
|
+
- no_comma
|
117
|
+
Enabled: true
|
118
|
+
Style/TrailingCommaInHashLiteral:
|
119
|
+
Description: 'Checks for trailing comma in hash literals.'
|
120
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
121
|
+
EnforcedStyleForMultiline: comma
|
122
|
+
SupportedStylesForMultiline:
|
123
|
+
- comma
|
124
|
+
- consistent_comma
|
125
|
+
- no_comma
|
126
|
+
Enabled: true
|
127
|
+
Style/WordArray:
|
128
|
+
Enabled: false
|
129
|
+
|
data/.travis.yml
CHANGED
@@ -5,6 +5,7 @@ before_install:
|
|
5
5
|
- "echo 'gem: --no-document' > ~/.gemrc"
|
6
6
|
- git config --global user.name 'Travis CI'
|
7
7
|
- git config --global user.email 'travis-ci@example.com'
|
8
|
+
- gem update --system
|
8
9
|
branches:
|
9
10
|
only:
|
10
11
|
- master
|
@@ -17,28 +18,21 @@ notifications:
|
|
17
18
|
- false
|
18
19
|
sudo: false
|
19
20
|
rvm:
|
20
|
-
- 2.
|
21
|
-
- 2.3
|
22
|
-
- 2.
|
23
|
-
- 2.
|
21
|
+
- 2.6.1
|
22
|
+
- 2.5.3
|
23
|
+
- 2.4.5
|
24
|
+
- 2.3.8
|
24
25
|
gemfile:
|
25
|
-
- gemfiles/rails40.gemfile
|
26
|
-
- gemfiles/rails41.gemfile
|
27
26
|
- gemfiles/rails42.gemfile
|
28
27
|
- gemfiles/rails50.gemfile
|
29
28
|
- gemfiles/rails51.gemfile
|
29
|
+
- gemfiles/rails52.gemfile
|
30
30
|
- gemfiles/rails_edge.gemfile
|
31
31
|
matrix:
|
32
|
-
exclude:
|
33
|
-
- rvm: 2.4.1
|
34
|
-
gemfile: gemfiles/rails40.gemfile
|
35
|
-
- rvm: 2.4.1
|
36
|
-
gemfile: gemfiles/rails41.gemfile
|
37
|
-
- rvm: 2.1.8
|
38
|
-
gemfile: gemfiles/rails50.gemfile
|
39
|
-
- rvm: 2.1.8
|
40
|
-
gemfile: gemfiles/rails51.gemfile
|
41
|
-
- rvm: 2.1.8
|
42
|
-
gemfile: gemfiles/rails_edge.gemfile
|
43
32
|
allow_failures:
|
44
33
|
- gemfile: gemfiles/rails_edge.gemfile
|
34
|
+
exclude:
|
35
|
+
- rvm: 2.3.8
|
36
|
+
gemfile: gemfiles/rails_edge.gemfile
|
37
|
+
- rvm: 2.4.5
|
38
|
+
gemfile: gemfiles/rails_edge.gemfile
|
data/Appraisals
CHANGED
@@ -1,31 +1,24 @@
|
|
1
|
-
if RUBY_VERSION < "2.4.0"
|
2
|
-
appraise "rails40" do
|
3
|
-
gem "activerecord", "~> 4.0.0"
|
4
|
-
gem "railties", "~> 4.0.0"
|
5
|
-
end
|
6
|
-
|
7
|
-
appraise "rails41" do
|
8
|
-
gem "activerecord", "~> 4.1.0"
|
9
|
-
gem "railties", "~> 4.1.0"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
1
|
appraise "rails42" do
|
14
2
|
gem "activerecord", "~> 4.2.0"
|
15
3
|
gem "railties", "~> 4.2.0"
|
16
4
|
end
|
17
5
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
6
|
+
appraise "rails50" do
|
7
|
+
gem "activerecord", "~> 5.0.0"
|
8
|
+
gem "railties", "~> 5.0.0"
|
9
|
+
end
|
23
10
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
11
|
+
appraise "rails51" do
|
12
|
+
gem "activerecord", "~> 5.1.0"
|
13
|
+
gem "railties", "~> 5.1.0"
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise "rails52" do
|
17
|
+
gem "activerecord", "~> 5.2.0"
|
18
|
+
gem "railties", "~> 5.2.0"
|
19
|
+
end
|
28
20
|
|
21
|
+
if RUBY_VERSION >= "2.5.0"
|
29
22
|
appraise "rails-edge" do
|
30
23
|
gem "rails", git: "https://github.com/rails/rails"
|
31
24
|
gem "arel", git: "https://github.com/rails/arel"
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and
|
9
|
+
expression, level of experience, education, socio-economic status, nationality,
|
10
|
+
personal appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at derekprior@gmail.com. All complaints
|
59
|
+
will be reviewed and investigated and will result in a response that is deemed
|
60
|
+
necessary and appropriate to the circumstances. The project team is obligated to
|
61
|
+
maintain confidentiality with regard to the reporter of an incident. Further
|
62
|
+
details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
71
|
+
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
data/CONTRIBUTING.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
# Contributing
|
2
2
|
|
3
3
|
We love contributions from everyone. By participating in this project, you
|
4
|
-
agree to abide by
|
4
|
+
agree to abide by our [code of conduct].
|
5
5
|
|
6
|
-
[code of conduct]:
|
7
|
-
|
8
|
-
We expect everyone to follow the code of conduct anywhere in thoughtbot's
|
9
|
-
project codebases, issue trackers, chatrooms, and mailing lists.
|
6
|
+
[code of conduct]: CODE_OF_CONDUCT.md
|
10
7
|
|
11
8
|
## Contributing Code
|
12
9
|
|
@@ -15,10 +12,9 @@ project codebases, issue trackers, chatrooms, and mailing lists.
|
|
15
12
|
application database.
|
16
13
|
3. Run `bin/appraisal rake` to verify that the tests pass against all
|
17
14
|
supported versions of Rails.
|
18
|
-
4. Make your change with new passing tests, following
|
15
|
+
4. Make your change with new passing tests, following existing style.
|
19
16
|
5. Write a [good commit message], push your fork, and submit a pull request.
|
20
17
|
|
21
|
-
[style guide]: https://github.com/thoughtbot/guides/tree/master/style
|
22
18
|
[good commit message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
23
19
|
|
24
20
|
Others will give constructive feedback. This is a time for discussion and
|
data/Gemfile
CHANGED
data/NEWS.md
CHANGED
@@ -3,7 +3,35 @@
|
|
3
3
|
The noteworthy changes for each Scenic version are included here. For a complete
|
4
4
|
changelog, see the [CHANGELOG] for each version via the version links.
|
5
5
|
|
6
|
-
[CHANGELOG]: https://github.com/
|
6
|
+
[CHANGELOG]: https://github.com/scenic-views/scenic/commits/master
|
7
|
+
|
8
|
+
## [1.5.0] - February 8, 2019
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- `create_view` can now be passed `materialized: { no_data: true }` to create
|
13
|
+
the materialized view without populating it. Generators have been updated to
|
14
|
+
accept a `--no-data` option.
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- Passing `cascade: true` when refreshing a materialized view will no longer
|
19
|
+
error when the view in question has no dependencies.
|
20
|
+
- Fixed runtime deprecation warnings when using `pg` 0.21 and newer.
|
21
|
+
- Fixed a cascading refresh issue when the name of the view to trigger the
|
22
|
+
refresh is a substring of one of its dependencies.
|
23
|
+
|
24
|
+
|
25
|
+
[1.5.0]: https://github.com/scenic-views/scenic/compare/v1.4.1...v1.5.0
|
26
|
+
|
27
|
+
## [1.4.1] - December 15, 2017
|
28
|
+
|
29
|
+
### Fixed
|
30
|
+
|
31
|
+
- View migrations created under Rails 5 and newer will use the current migration
|
32
|
+
version in the generated migration class rather than always using `5.0`.
|
33
|
+
|
34
|
+
[1.4.1]: https://github.com/scenic-views/scenic/compare/v1.4.0...v1.4.1
|
7
35
|
|
8
36
|
## [1.4.0] - May 11, 2017
|
9
37
|
|
@@ -23,6 +51,8 @@ changelog, see the [CHANGELOG] for each version via the version links.
|
|
23
51
|
and newer apps.
|
24
52
|
- Using the `scenic:model` generator will no longer create a fixture or factory.
|
25
53
|
|
54
|
+
[1.4.0]: https://github.com/scenic-views/scenic/compare/v1.3.0...v1.4.0
|
55
|
+
|
26
56
|
## [1.3.0] - May 27, 2016
|
27
57
|
|
28
58
|
### Added
|
@@ -37,7 +67,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
|
|
37
67
|
attempt to insert model code into the pluralized model file.
|
38
68
|
* Convert shell-based smoke tests to RSpec syntax.
|
39
69
|
|
40
|
-
[1.3.0]: https://github.com/
|
70
|
+
[1.3.0]: https://github.com/scenic-views/scenic/compare/v1.2.0...v1.3.0
|
41
71
|
|
42
72
|
## [1.2.0] - February 5, 2016
|
43
73
|
|
@@ -57,7 +87,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
|
|
57
87
|
`db/schema.rb` file under Rails 5 beta 1 and beta 2. This is fixed on Rails
|
58
88
|
master.
|
59
89
|
|
60
|
-
[1.2.0]: https://github.com/
|
90
|
+
[1.2.0]: https://github.com/scenic-views/scenic/compare/v1.1.1...v1.2.0
|
61
91
|
|
62
92
|
## [1.1.1] - January 29, 2016
|
63
93
|
|
@@ -66,7 +96,7 @@ master.
|
|
66
96
|
closed` error. This has been fixed by ensuring we grab a fresh connection for
|
67
97
|
all operations.
|
68
98
|
|
69
|
-
[1.1.1]: https://github.com/
|
99
|
+
[1.1.1]: https://github.com/scenic-views/scenic/compare/v1.1.0...v1.1.1
|
70
100
|
|
71
101
|
## [1.1.0] - January 8, 2016
|
72
102
|
|
@@ -86,7 +116,7 @@ master.
|
|
86
116
|
- Fixed inability to dump materialized views in Rails 5.0.0.beta1.
|
87
117
|
|
88
118
|
[supported versions of Postgres]: http://www.postgresql.org/support/versioning/
|
89
|
-
[1.1.0]: https://github.com/
|
119
|
+
[1.1.0]: https://github.com/scenic-views/scenic/compare/v1.0.0...v1.1.0
|
90
120
|
|
91
121
|
## [1.0.0] - November 23, 2015
|
92
122
|
|
@@ -101,8 +131,8 @@ master.
|
|
101
131
|
- Eliminated `alias_method_chain` deprecation when running with Rails master
|
102
132
|
(5.0).
|
103
133
|
|
104
|
-
[materialized views]:https://github.com/
|
105
|
-
[1.0.0]: https://github.com/
|
134
|
+
[materialized views]:https://github.com/scenic-views/scenic/blob/v1.0.0/README.md
|
135
|
+
[1.0.0]: https://github.com/scenic-views/scenic/compare/v0.3.0...v1.0.0
|
106
136
|
|
107
137
|
## [0.3.0] - January 23, 2015
|
108
138
|
|
@@ -114,14 +144,14 @@ master.
|
|
114
144
|
- We avoid dumping views that belong to Postgres extensions.
|
115
145
|
- `db/schema.rb` is prettier thanks to a blank line after each view definition.
|
116
146
|
|
117
|
-
[0.3.0]: https://github.com/
|
147
|
+
[0.3.0]: https://github.com/scenic-views/scenic/compare/v0.2.1...v0.3.0
|
118
148
|
|
119
149
|
## [0.2.1] - January 5, 2015
|
120
150
|
|
121
151
|
### Fixed
|
122
152
|
- View generator will now create `db/views` directory if necessary.
|
123
153
|
|
124
|
-
[0.2.1]: https://github.com/
|
154
|
+
[0.2.1]: https://github.com/scenic-views/scenic/compare/v0.2.0...v0.2.1
|
125
155
|
|
126
156
|
## [0.2.0] - August 11, 2014
|
127
157
|
|
@@ -131,7 +161,7 @@ master.
|
|
131
161
|
### Fixed
|
132
162
|
- Raise an error if view definition is empty.
|
133
163
|
|
134
|
-
[0.2.0]: https://github.com/
|
164
|
+
[0.2.0]: https://github.com/scenic-views/scenic/compare/v0.1.0...v0.2.0
|
135
165
|
|
136
166
|
## [0.1.0] - August 4, 2014
|
137
167
|
|
@@ -144,4 +174,4 @@ definition files.
|
|
144
174
|
|
145
175
|
In short, go add a view to your app.
|
146
176
|
|
147
|
-
[0.1.0]: https://github.com/
|
177
|
+
[0.1.0]: https://github.com/scenic-views/scenic/compare/8599daa132880cd6c07efb0395c0fb023b171f47...v0.1.0
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Scenic
|
2
2
|
|
3
|
-
![Scenic Landscape](https://images.
|
3
|
+
![Scenic Landscape](https://user-images.githubusercontent.com/152152/49344534-a8817480-f646-11e8-8431-3d95d349c070.png)
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/
|
6
|
-
[![
|
7
|
-
[![
|
5
|
+
[![Build Status](https://travis-ci.org/scenic-views/scenic.svg?branch=master)](https://travis-ci.org/scenic-views/scenic)
|
6
|
+
[![Documentation Quality](http://inch-ci.org/github/scenic-views/scenic.svg?branch=master)](http://inch-ci.org/github/scenic-views/scenic)
|
7
|
+
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|
8
8
|
|
9
9
|
Scenic adds methods to `ActiveRecord::Migration` to create and manage database
|
10
10
|
views in Rails.
|
@@ -21,6 +21,12 @@ Scenic ships with support for PostgreSQL. The adapter is configurable (see
|
|
21
21
|
`Scenic::Configuration`) and has a minimal interface (see
|
22
22
|
`Scenic::Adapters::Postgres`) that other gems can provide.
|
23
23
|
|
24
|
+
## So how do I install this?
|
25
|
+
|
26
|
+
If you're using Postgres, Add `gem "scenic"` to your Gemfile and run `bundle
|
27
|
+
install`. If you're using something other than Postgres, check out the available
|
28
|
+
[third party adapters](https://github.com/scenic-views/scenic#faqs).
|
29
|
+
|
24
30
|
## Great, how do I create a view?
|
25
31
|
|
26
32
|
You've got this great idea for a view you'd like to call `search_results`. You
|
@@ -132,8 +138,6 @@ no different than a table.
|
|
132
138
|
class SearchResult < ActiveRecord::Base
|
133
139
|
belongs_to :searchable, polymorphic: true
|
134
140
|
|
135
|
-
private
|
136
|
-
|
137
141
|
# this isn't strictly necessary, but it will prevent
|
138
142
|
# rails from calling save, which would fail anyway.
|
139
143
|
def readonly?
|
@@ -198,6 +202,7 @@ Scenic gives you `drop_view` too:
|
|
198
202
|
```ruby
|
199
203
|
def change
|
200
204
|
drop_view :search_results, revert_to_version: 2
|
205
|
+
drop_view :materialized_admin_reports, revert_to_version: 3, materialized: true
|
201
206
|
end
|
202
207
|
```
|
203
208
|
|
@@ -231,31 +236,31 @@ add_column :posts, :title, :string
|
|
231
236
|
update_view :posts_with_aggregate_data, version: 2, revert_to_version: 2
|
232
237
|
```
|
233
238
|
|
234
|
-
**When will you support MySQL?**
|
239
|
+
**When will you support MySQL, SQLite, or other databases?**
|
235
240
|
|
236
|
-
We have no plans to add first-party
|
237
|
-
(the maintainers) do not currently have a use for
|
238
|
-
maintaining a library effectively requires regular use
|
239
|
-
not in a good position to support MySQL
|
241
|
+
We have no plans to add first-party adapters for other relational databases at
|
242
|
+
this time because we (the maintainers) do not currently have a use for them.
|
243
|
+
It's our experience that maintaining a library effectively requires regular use
|
244
|
+
of its features. We're not in a good position to support MySQL, SQLite or other
|
245
|
+
database users.
|
240
246
|
|
241
247
|
Scenic *does* support configuring different database adapters and should be
|
242
248
|
extendable with adapter libraries. If you implement such an adapter, we're happy
|
243
249
|
to review and link to it. We're also happy to make changes that would better
|
244
250
|
accommodate adapter gems.
|
245
251
|
|
252
|
+
We are aware of the following existing adapter libraries for Scenic which may
|
253
|
+
meet your needs:
|
254
|
+
|
255
|
+
* [scenic_sqlite_adapter](https://github.com/pdebelak/scenic_sqlite_adapter)
|
256
|
+
* [scenic-mysql_adapter](https://github.com/EmpaticoOrg/scenic-mysql_adapter)
|
257
|
+
* [scenic-sqlserver-adapter](https://github.com/ClickMechanic/scenic_sqlserver_adapter)
|
258
|
+
* [scenic-oracle_enhanced_adapter](https://github.com/PMACS/scenic_oracle_enhanced_adapter)
|
259
|
+
|
246
260
|
## About
|
247
261
|
|
248
|
-
Scenic is maintained by [Derek Prior]
|
249
|
-
|
250
|
-
thoughtbot, inc.
|
262
|
+
Scenic is maintained by [Derek Prior], [Caleb Thompson], and you, our
|
263
|
+
contributors.
|
251
264
|
|
252
265
|
[Derek Prior]: http://prioritized.net
|
253
266
|
[Caleb Thompson]: http://calebthompson.io
|
254
|
-
|
255
|
-
![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
|
256
|
-
|
257
|
-
We love open source software! See [our other projects][community] or [hire
|
258
|
-
us][hire] to help build your product.
|
259
|
-
|
260
|
-
[community]: https://thoughtbot.com/community?utm_source=github
|
261
|
-
[hire]: https://thoughtbot.com/hire-us?utm_source=github
|
data/Rakefile
CHANGED
data/gemfiles/rails42.gemfile
CHANGED
data/gemfiles/rails50.gemfile
CHANGED
data/gemfiles/rails51.gemfile
CHANGED
data/gemfiles/rails_edge.gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "rails", :
|
6
|
-
gem "arel", :
|
5
|
+
gem "rails", git: "https://github.com/rails/rails"
|
6
|
+
gem "arel", git: "https://github.com/rails/arel"
|
7
7
|
|
8
|
-
gemspec :
|
8
|
+
gemspec path: "../"
|
@@ -10,6 +10,11 @@ module Scenic
|
|
10
10
|
required: false,
|
11
11
|
desc: "Makes the view materialized",
|
12
12
|
default: false
|
13
|
+
class_option :no_data,
|
14
|
+
type: :boolean,
|
15
|
+
required: false,
|
16
|
+
desc: "Adds WITH NO DATA when materialized view creates/updates",
|
17
|
+
default: false
|
13
18
|
end
|
14
19
|
|
15
20
|
private
|
@@ -17,6 +22,10 @@ module Scenic
|
|
17
22
|
def materialized?
|
18
23
|
options[:materialized]
|
19
24
|
end
|
25
|
+
|
26
|
+
def no_data?
|
27
|
+
options[:no_data]
|
28
|
+
end
|
20
29
|
end
|
21
30
|
end
|
22
31
|
end
|
@@ -8,7 +8,7 @@ module Scenic
|
|
8
8
|
# @api private
|
9
9
|
class ModelGenerator < Rails::Generators::NamedBase
|
10
10
|
include Scenic::Generators::Materializable
|
11
|
-
source_root File.expand_path("
|
11
|
+
source_root File.expand_path("templates", __dir__)
|
12
12
|
|
13
13
|
def invoke_rails_model_generator
|
14
14
|
invoke "model",
|
@@ -35,7 +35,7 @@ module Scenic
|
|
35
35
|
|
36
36
|
def evaluate_template(source)
|
37
37
|
source = File.expand_path(find_in_source_paths(source.to_s))
|
38
|
-
context = instance_eval("binding")
|
38
|
+
context = instance_eval("binding", __FILE__, __LINE__)
|
39
39
|
ERB.new(
|
40
40
|
::File.binread(source),
|
41
41
|
nil,
|