scenic 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/.hound.yml +2 -4
  3. data/.rubocop.yml +129 -0
  4. data/.travis.yml +11 -17
  5. data/Appraisals +14 -21
  6. data/CODE_OF_CONDUCT.md +76 -0
  7. data/CONTRIBUTING.md +3 -7
  8. data/Gemfile +1 -1
  9. data/NEWS.md +32 -13
  10. data/README.md +15 -16
  11. data/Rakefile +2 -2
  12. data/gemfiles/rails42.gemfile +1 -1
  13. data/gemfiles/rails50.gemfile +1 -1
  14. data/gemfiles/rails51.gemfile +1 -1
  15. data/gemfiles/rails52.gemfile +8 -0
  16. data/gemfiles/rails_edge.gemfile +3 -3
  17. data/lib/generators/scenic/materializable.rb +9 -0
  18. data/lib/generators/scenic/model/model_generator.rb +2 -2
  19. data/lib/generators/scenic/view/USAGE +1 -0
  20. data/lib/generators/scenic/view/templates/db/migrate/create_view.erb +1 -1
  21. data/lib/generators/scenic/view/templates/db/migrate/update_view.erb +1 -1
  22. data/lib/generators/scenic/view/view_generator.rb +13 -5
  23. data/lib/scenic/adapters/postgres.rb +14 -4
  24. data/lib/scenic/adapters/postgres/refresh_dependencies.rb +12 -2
  25. data/lib/scenic/adapters/postgres/views.rb +10 -1
  26. data/lib/scenic/schema_dumper.rb +2 -2
  27. data/lib/scenic/statements.rb +24 -6
  28. data/lib/scenic/version.rb +1 -1
  29. data/lib/scenic/view.rb +1 -2
  30. data/scenic.gemspec +22 -23
  31. data/spec/acceptance/user_manages_views_spec.rb +2 -1
  32. data/spec/dummy/app/models/application_record.rb +5 -0
  33. data/spec/generators/scenic/model/model_generator_spec.rb +1 -1
  34. data/spec/generators/scenic/view/view_generator_spec.rb +1 -1
  35. data/spec/scenic/adapters/postgres/refresh_dependencies_spec.rb +60 -26
  36. data/spec/scenic/adapters/postgres_spec.rb +2 -2
  37. data/spec/scenic/definition_spec.rb +1 -1
  38. data/spec/scenic/schema_dumper_spec.rb +17 -2
  39. data/spec/scenic/statements_spec.rb +48 -13
  40. data/spec/spec_helper.rb +1 -1
  41. data/spec/support/generator_spec_setup.rb +1 -1
  42. metadata +15 -13
  43. data/gemfiles/rails40.gemfile +0 -8
  44. data/gemfiles/rails41.gemfile +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b290ff753726250886a22d6d44016df9dbc430e2
4
- data.tar.gz: b21216f75c821900f63a945d3b1776377782ab2c
2
+ SHA256:
3
+ metadata.gz: 4f976353b8ba2818670c650b1ee7af50aff76955d94375db07b78377ca1dea10
4
+ data.tar.gz: 4756b733801359a9a542cf6cb0a2216086c3b1c8fad50489044202c5b801d1e2
5
5
  SHA512:
6
- metadata.gz: ae4faa886ffb7206a3ecd393e35b8db14cc393512f10f03b459610c5e5adb10a4f932ebf7c255af421949180048cd137398065b25f593686f286f56e15bdaf7f
7
- data.tar.gz: 3fd626600f95296defa7cd9caaad902d1b89c9007eb4b027d250dcb9866343f155db6dbf8c06b4aaa942e341a61710d255dbff75da1ba5dcd72c00b248a97515
6
+ metadata.gz: af4652c0978530b0b54de384ffc02ded0587c8361be9cfaf619c0dd2996fd4a6cd0f3fe6fe949bcb51bb5b10320763b5501a0838ac4b4578e74617c9bcf45068
7
+ data.tar.gz: b31585a640b9ea5a51586cbfda42b62a4ad90e458a04730b9ee9a8376a62f63095beae991b9c67aa8c3bd8d23bb2d91a64986d18b41a6ef7b79ca7a9ee120a52
data/.hound.yml CHANGED
@@ -1,4 +1,2 @@
1
- DotPosition:
2
- EnforcedStyle: leading
3
- Style/AlignParameters:
4
- EnforcedStyle: with_fixed_indentation
1
+ rubocop:
2
+ config_file: .rubocop.yml
@@ -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
+
@@ -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.4.1
21
- - 2.3.4
22
- - 2.2.7
23
- - 2.1.8
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
- if RUBY_VERSION > "2.2.0"
19
- appraise "rails50" do
20
- gem "activerecord", "~> 5.0.0"
21
- gem "railties", "~> 5.0.0"
22
- end
6
+ appraise "rails50" do
7
+ gem "activerecord", "~> 5.0.0"
8
+ gem "railties", "~> 5.0.0"
9
+ end
23
10
 
24
- appraise "rails51" do
25
- gem "activerecord", "~> 5.1.0"
26
- gem "railties", "~> 5.1.0"
27
- end
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"
@@ -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
@@ -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 the thoughtbot [code of conduct].
4
+ agree to abide by our [code of conduct].
5
5
 
6
- [code of conduct]: https://thoughtbot.com/open-source-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 the [style guide].
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
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in scenic.gemspec
4
4
  gemspec
data/NEWS.md CHANGED
@@ -3,7 +3,26 @@
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/thoughtbot/scenic/commits/master
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
7
26
 
8
27
  ## [1.4.1] - December 15, 2017
9
28
 
@@ -12,7 +31,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
12
31
  - View migrations created under Rails 5 and newer will use the current migration
13
32
  version in the generated migration class rather than always using `5.0`.
14
33
 
15
- [1.4.1]: https://github.com/thoughtbot/scenic/compare/v1.4.0...v1.4.1
34
+ [1.4.1]: https://github.com/scenic-views/scenic/compare/v1.4.0...v1.4.1
16
35
 
17
36
  ## [1.4.0] - May 11, 2017
18
37
 
@@ -32,7 +51,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
32
51
  and newer apps.
33
52
  - Using the `scenic:model` generator will no longer create a fixture or factory.
34
53
 
35
- [1.4.0]: https://github.com/thoughtbot/scenic/compare/v1.3.0...v1.4.0
54
+ [1.4.0]: https://github.com/scenic-views/scenic/compare/v1.3.0...v1.4.0
36
55
 
37
56
  ## [1.3.0] - May 27, 2016
38
57
 
@@ -48,7 +67,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
48
67
  attempt to insert model code into the pluralized model file.
49
68
  * Convert shell-based smoke tests to RSpec syntax.
50
69
 
51
- [1.3.0]: https://github.com/thoughtbot/scenic/compare/v1.2.0...v1.3.0
70
+ [1.3.0]: https://github.com/scenic-views/scenic/compare/v1.2.0...v1.3.0
52
71
 
53
72
  ## [1.2.0] - February 5, 2016
54
73
 
@@ -68,7 +87,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
68
87
  `db/schema.rb` file under Rails 5 beta 1 and beta 2. This is fixed on Rails
69
88
  master.
70
89
 
71
- [1.2.0]: https://github.com/thoughtbot/scenic/compare/v1.1.1...v1.2.0
90
+ [1.2.0]: https://github.com/scenic-views/scenic/compare/v1.1.1...v1.2.0
72
91
 
73
92
  ## [1.1.1] - January 29, 2016
74
93
 
@@ -77,7 +96,7 @@ master.
77
96
  closed` error. This has been fixed by ensuring we grab a fresh connection for
78
97
  all operations.
79
98
 
80
- [1.1.1]: https://github.com/thoughtbot/scenic/compare/v1.1.0...v1.1.1
99
+ [1.1.1]: https://github.com/scenic-views/scenic/compare/v1.1.0...v1.1.1
81
100
 
82
101
  ## [1.1.0] - January 8, 2016
83
102
 
@@ -97,7 +116,7 @@ master.
97
116
  - Fixed inability to dump materialized views in Rails 5.0.0.beta1.
98
117
 
99
118
  [supported versions of Postgres]: http://www.postgresql.org/support/versioning/
100
- [1.1.0]: https://github.com/thoughtbot/scenic/compare/v1.0.0...v1.1.0
119
+ [1.1.0]: https://github.com/scenic-views/scenic/compare/v1.0.0...v1.1.0
101
120
 
102
121
  ## [1.0.0] - November 23, 2015
103
122
 
@@ -112,8 +131,8 @@ master.
112
131
  - Eliminated `alias_method_chain` deprecation when running with Rails master
113
132
  (5.0).
114
133
 
115
- [materialized views]:https://github.com/thoughtbot/scenic/blob/v1.0.0/README.md
116
- [1.0.0]: https://github.com/thoughtbot/scenic/compare/v0.3.0...v1.0.0
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
117
136
 
118
137
  ## [0.3.0] - January 23, 2015
119
138
 
@@ -125,14 +144,14 @@ master.
125
144
  - We avoid dumping views that belong to Postgres extensions.
126
145
  - `db/schema.rb` is prettier thanks to a blank line after each view definition.
127
146
 
128
- [0.3.0]: https://github.com/thoughtbot/scenic/compare/v0.2.1...v0.3.0
147
+ [0.3.0]: https://github.com/scenic-views/scenic/compare/v0.2.1...v0.3.0
129
148
 
130
149
  ## [0.2.1] - January 5, 2015
131
150
 
132
151
  ### Fixed
133
152
  - View generator will now create `db/views` directory if necessary.
134
153
 
135
- [0.2.1]: https://github.com/thoughtbot/scenic/compare/v0.2.0...v0.2.1
154
+ [0.2.1]: https://github.com/scenic-views/scenic/compare/v0.2.0...v0.2.1
136
155
 
137
156
  ## [0.2.0] - August 11, 2014
138
157
 
@@ -142,7 +161,7 @@ master.
142
161
  ### Fixed
143
162
  - Raise an error if view definition is empty.
144
163
 
145
- [0.2.0]: https://github.com/thoughtbot/scenic/compare/v0.1.0...v0.2.0
164
+ [0.2.0]: https://github.com/scenic-views/scenic/compare/v0.1.0...v0.2.0
146
165
 
147
166
  ## [0.1.0] - August 4, 2014
148
167
 
@@ -155,4 +174,4 @@ definition files.
155
174
 
156
175
  In short, go add a view to your app.
157
176
 
158
- [0.1.0]: https://github.com/thoughtbot/scenic/compare/8599daa132880cd6c07efb0395c0fb023b171f47...v0.1.0
177
+ [0.1.0]: https://github.com/scenic-views/scenic/compare/8599daa132880cd6c07efb0395c0fb023b171f47...v0.1.0