scenic 1.4.1 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +78 -0
  3. data/.hound.yml +2 -4
  4. data/.rubocop.yml +129 -0
  5. data/{NEWS.md → CHANGELOG.md} +80 -15
  6. data/CODE_OF_CONDUCT.md +76 -0
  7. data/CONTRIBUTING.md +7 -9
  8. data/Gemfile +13 -1
  9. data/LICENSE.txt +1 -1
  10. data/README.md +22 -20
  11. data/Rakefile +2 -2
  12. data/SECURITY.md +14 -0
  13. data/bin/setup +9 -4
  14. data/lib/generators/scenic/materializable.rb +9 -0
  15. data/lib/generators/scenic/model/model_generator.rb +2 -2
  16. data/lib/generators/scenic/view/USAGE +1 -0
  17. data/lib/generators/scenic/view/templates/db/migrate/create_view.erb +1 -1
  18. data/lib/generators/scenic/view/templates/db/migrate/update_view.erb +1 -1
  19. data/lib/generators/scenic/view/view_generator.rb +18 -8
  20. data/lib/scenic/adapters/postgres.rb +19 -6
  21. data/lib/scenic/adapters/postgres/refresh_dependencies.rb +21 -7
  22. data/lib/scenic/adapters/postgres/views.rb +10 -1
  23. data/lib/scenic/command_recorder.rb +2 -1
  24. data/lib/scenic/command_recorder/statement_arguments.rb +9 -1
  25. data/lib/scenic/configuration.rb +1 -1
  26. data/lib/scenic/definition.rb +1 -1
  27. data/lib/scenic/schema_dumper.rb +2 -2
  28. data/lib/scenic/statements.rb +24 -6
  29. data/lib/scenic/version.rb +1 -1
  30. data/lib/scenic/view.rb +1 -2
  31. data/scenic.gemspec +21 -23
  32. data/spec/acceptance/user_manages_views_spec.rb +2 -1
  33. data/spec/dummy/app/models/application_record.rb +5 -0
  34. data/spec/dummy/config/database.yml +5 -0
  35. data/spec/generators/scenic/model/model_generator_spec.rb +1 -1
  36. data/spec/generators/scenic/view/view_generator_spec.rb +10 -4
  37. data/spec/scenic/adapters/postgres/refresh_dependencies_spec.rb +66 -26
  38. data/spec/scenic/adapters/postgres_spec.rb +23 -3
  39. data/spec/scenic/command_recorder_spec.rb +15 -1
  40. data/spec/scenic/definition_spec.rb +7 -1
  41. data/spec/scenic/schema_dumper_spec.rb +17 -2
  42. data/spec/scenic/statements_spec.rb +48 -13
  43. data/spec/spec_helper.rb +1 -1
  44. data/spec/support/generator_spec_setup.rb +1 -1
  45. metadata +22 -40
  46. data/.travis.yml +0 -44
  47. data/Appraisals +0 -33
  48. data/bin/appraisal +0 -16
  49. data/gemfiles/rails40.gemfile +0 -8
  50. data/gemfiles/rails41.gemfile +0 -8
  51. data/gemfiles/rails42.gemfile +0 -8
  52. data/gemfiles/rails50.gemfile +0 -8
  53. data/gemfiles/rails51.gemfile +0 -8
  54. data/gemfiles/rails_edge.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: e93cc4bb35daed3860cfabd944a9e8bfba6ef4adb48ea03c16fc75f7a0be22df
4
+ data.tar.gz: 733141c2c27baa2c09dec37acbaf006e3b9f5c746076b8da7508cec9ba7fff55
5
5
  SHA512:
6
- metadata.gz: ae4faa886ffb7206a3ecd393e35b8db14cc393512f10f03b459610c5e5adb10a4f932ebf7c255af421949180048cd137398065b25f593686f286f56e15bdaf7f
7
- data.tar.gz: 3fd626600f95296defa7cd9caaad902d1b89c9007eb4b027d250dcb9866343f155db6dbf8c06b4aaa942e341a61710d255dbff75da1ba5dcd72c00b248a97515
6
+ metadata.gz: 45191843b2feb1597827b4a71d8d34cb426aeb200f775b0b888f163cfb02ee36a356e9697c286a17a909406ce2fad4c0d71e0293dc5cecbda1777d2b522b9df0
7
+ data.tar.gz: b6c650f5be7c718250c88ec6e6ddd801b2c8b884e11b316c5ef04711667eee87a0a7573dd6bfc3ddf706f809e986208c402b5af6fa792a8f8df9d7abec655fe7
@@ -0,0 +1,78 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: master
6
+ pull_request:
7
+ branches: "*"
8
+
9
+ jobs:
10
+ build:
11
+ name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
12
+
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby: ["2.7","2.4"]
17
+ rails: ["5.2", "6.0", "master"]
18
+ exclude:
19
+ - ruby: "2.4"
20
+ rails: "6.0"
21
+ - ruby: "2.4"
22
+ rails: "master"
23
+ include:
24
+ - rails: "master"
25
+ continue-on-error: true
26
+
27
+ runs-on: ubuntu-latest
28
+
29
+ services:
30
+ postgres:
31
+ image: postgres
32
+ env:
33
+ POSTGRES_USER: "postgres"
34
+ POSTGRES_PASSWORD: "postgres"
35
+ ports:
36
+ - 5432:5432
37
+ options: >-
38
+ --health-cmd pg_isready
39
+ --health-interval 10s
40
+ --health-timeout 5s
41
+ --health-retries 5
42
+
43
+ env:
44
+ RAILS_VERSION: ${{ matrix.rails }}
45
+ POSTGRES_USER: "postgres"
46
+ POSTGRES_PASSWORD: "postgres"
47
+
48
+ steps:
49
+ - name: Checkout
50
+ uses: actions/checkout@v2
51
+
52
+ - name: Install Ruby ${{ matrix.ruby }}
53
+ uses: ruby/setup-ruby@v1.14.1
54
+ with:
55
+ ruby-version: ${{ matrix.ruby }}
56
+
57
+ - name: Install dependent libraries
58
+ run: sudo apt-get install libpq-dev
59
+
60
+ - name: Generate lockfile
61
+ run: bundle lock
62
+
63
+ - name: Cache dependencies
64
+ uses: actions/cache@v1
65
+ with:
66
+ path: vendor/bundle
67
+ key: bundle-${{ hashFiles('Gemfile.lock') }}
68
+
69
+ - name: Set up Scenic
70
+ run: bin/setup
71
+
72
+ - name: Run fast tests
73
+ run: bundle exec rake spec
74
+ continue-on-error: ${{ matrix.continue-on-error }}
75
+
76
+ - name: Run acceptance tests
77
+ run: bundle exec rake spec:acceptance
78
+ continue-on-error: ${{ matrix.continue-on-error }}
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
+
@@ -1,9 +1,74 @@
1
- # News
1
+ # Changelog
2
2
 
3
3
  The noteworthy changes for each Scenic version are included here. For a complete
4
- changelog, see the [CHANGELOG] for each version via the version links.
4
+ changelog, see the [commits] for each version via the version links.
5
5
 
6
- [CHANGELOG]: https://github.com/thoughtbot/scenic/commits/master
6
+ [commits]: https://github.com/scenic-views/scenic/commits/master
7
+
8
+ ## [1.5.4] - September 16, 2020
9
+
10
+ [1.5.4]: https://github.com/scenic-views/scenic/compare/v1.5.3...v1.5.4
11
+
12
+ ### Fixed
13
+
14
+ - Added missing changelog for v1.5.3.
15
+
16
+ ## [1.5.3] - September 15, 2020
17
+
18
+ [1.5.3]: https://github.com/scenic-views/scenic/compare/v1.5.2...v1.5.3
19
+
20
+ ### Fixed
21
+
22
+ - `scenic-oracle_enhanced_adapter` has been pulled from rubygems.
23
+ `scenic-oracle_adapter` is a current, maintained alternative.
24
+ - Updated code snippets - since Rails 5.0, all models inherit from
25
+ ApplicationRecord (#302)
26
+ - Update Caleb's last name
27
+
28
+ ### Added
29
+
30
+ - Add Security Policy
31
+
32
+ ## [1.5.2] - February 6, 2020
33
+
34
+ ### Fixed
35
+
36
+ - The schema statement `create_view` is now reversible when passed a `version`
37
+ argument.
38
+ - Calling `refresh_materialized_view` with both `concurrently` and `cascade` set
39
+ to `true` now correctly cascades the concurrent refresh to dependent views.
40
+ - File generation and lookup now operates correctly for schema-qualified names
41
+ like `warehouse.archived_posts`.
42
+
43
+ [1.5.2]: https://github.com/scenic-views/scenic/compare/v1.5.1...v1.5.2
44
+
45
+ ## [1.5.1] - February 10, 2019
46
+
47
+ ### Fixed
48
+
49
+ - Passing `no_data: true` when creating a materialized view would error if the
50
+ corresponding SQL file had statement-terminating semicolon.
51
+
52
+ [1.5.1]: https://github.com/scenic-views/scenic/compare/v1.5.0...v1.5.1
53
+
54
+ ## [1.5.0] - February 8, 2019
55
+
56
+ ### Added
57
+
58
+ - `create_view` can now be passed `materialized: { no_data: true }` to create
59
+ the materialized view without populating it. Generators have been updated to
60
+ accept a `--no-data` option.
61
+
62
+ ### Fixed
63
+
64
+ - Passing `cascade: true` when refreshing a materialized view will no longer
65
+ error when the view in question has no dependencies.
66
+ - Fixed runtime deprecation warnings when using `pg` 0.21 and newer.
67
+ - Fixed a cascading refresh issue when the name of the view to trigger the
68
+ refresh is a substring of one of its dependencies.
69
+
70
+
71
+ [1.5.0]: https://github.com/scenic-views/scenic/compare/v1.4.1...v1.5.0
7
72
 
8
73
  ## [1.4.1] - December 15, 2017
9
74
 
@@ -12,7 +77,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
12
77
  - View migrations created under Rails 5 and newer will use the current migration
13
78
  version in the generated migration class rather than always using `5.0`.
14
79
 
15
- [1.4.1]: https://github.com/thoughtbot/scenic/compare/v1.4.0...v1.4.1
80
+ [1.4.1]: https://github.com/scenic-views/scenic/compare/v1.4.0...v1.4.1
16
81
 
17
82
  ## [1.4.0] - May 11, 2017
18
83
 
@@ -32,7 +97,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
32
97
  and newer apps.
33
98
  - Using the `scenic:model` generator will no longer create a fixture or factory.
34
99
 
35
- [1.4.0]: https://github.com/thoughtbot/scenic/compare/v1.3.0...v1.4.0
100
+ [1.4.0]: https://github.com/scenic-views/scenic/compare/v1.3.0...v1.4.0
36
101
 
37
102
  ## [1.3.0] - May 27, 2016
38
103
 
@@ -48,7 +113,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
48
113
  attempt to insert model code into the pluralized model file.
49
114
  * Convert shell-based smoke tests to RSpec syntax.
50
115
 
51
- [1.3.0]: https://github.com/thoughtbot/scenic/compare/v1.2.0...v1.3.0
116
+ [1.3.0]: https://github.com/scenic-views/scenic/compare/v1.2.0...v1.3.0
52
117
 
53
118
  ## [1.2.0] - February 5, 2016
54
119
 
@@ -68,7 +133,7 @@ changelog, see the [CHANGELOG] for each version via the version links.
68
133
  `db/schema.rb` file under Rails 5 beta 1 and beta 2. This is fixed on Rails
69
134
  master.
70
135
 
71
- [1.2.0]: https://github.com/thoughtbot/scenic/compare/v1.1.1...v1.2.0
136
+ [1.2.0]: https://github.com/scenic-views/scenic/compare/v1.1.1...v1.2.0
72
137
 
73
138
  ## [1.1.1] - January 29, 2016
74
139
 
@@ -77,7 +142,7 @@ master.
77
142
  closed` error. This has been fixed by ensuring we grab a fresh connection for
78
143
  all operations.
79
144
 
80
- [1.1.1]: https://github.com/thoughtbot/scenic/compare/v1.1.0...v1.1.1
145
+ [1.1.1]: https://github.com/scenic-views/scenic/compare/v1.1.0...v1.1.1
81
146
 
82
147
  ## [1.1.0] - January 8, 2016
83
148
 
@@ -97,7 +162,7 @@ master.
97
162
  - Fixed inability to dump materialized views in Rails 5.0.0.beta1.
98
163
 
99
164
  [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
165
+ [1.1.0]: https://github.com/scenic-views/scenic/compare/v1.0.0...v1.1.0
101
166
 
102
167
  ## [1.0.0] - November 23, 2015
103
168
 
@@ -112,8 +177,8 @@ master.
112
177
  - Eliminated `alias_method_chain` deprecation when running with Rails master
113
178
  (5.0).
114
179
 
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
180
+ [materialized views]:https://github.com/scenic-views/scenic/blob/v1.0.0/README.md
181
+ [1.0.0]: https://github.com/scenic-views/scenic/compare/v0.3.0...v1.0.0
117
182
 
118
183
  ## [0.3.0] - January 23, 2015
119
184
 
@@ -125,14 +190,14 @@ master.
125
190
  - We avoid dumping views that belong to Postgres extensions.
126
191
  - `db/schema.rb` is prettier thanks to a blank line after each view definition.
127
192
 
128
- [0.3.0]: https://github.com/thoughtbot/scenic/compare/v0.2.1...v0.3.0
193
+ [0.3.0]: https://github.com/scenic-views/scenic/compare/v0.2.1...v0.3.0
129
194
 
130
195
  ## [0.2.1] - January 5, 2015
131
196
 
132
197
  ### Fixed
133
198
  - View generator will now create `db/views` directory if necessary.
134
199
 
135
- [0.2.1]: https://github.com/thoughtbot/scenic/compare/v0.2.0...v0.2.1
200
+ [0.2.1]: https://github.com/scenic-views/scenic/compare/v0.2.0...v0.2.1
136
201
 
137
202
  ## [0.2.0] - August 11, 2014
138
203
 
@@ -142,7 +207,7 @@ master.
142
207
  ### Fixed
143
208
  - Raise an error if view definition is empty.
144
209
 
145
- [0.2.0]: https://github.com/thoughtbot/scenic/compare/v0.1.0...v0.2.0
210
+ [0.2.0]: https://github.com/scenic-views/scenic/compare/v0.1.0...v0.2.0
146
211
 
147
212
  ## [0.1.0] - August 4, 2014
148
213
 
@@ -155,4 +220,4 @@ definition files.
155
220
 
156
221
  In short, go add a view to your app.
157
222
 
158
- [0.1.0]: https://github.com/thoughtbot/scenic/compare/8599daa132880cd6c07efb0395c0fb023b171f47...v0.1.0
223
+ [0.1.0]: https://github.com/scenic-views/scenic/compare/8599daa132880cd6c07efb0395c0fb023b171f47...v0.1.0
@@ -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