scenic-cascade 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e010bca8b6f02381affd7c850ede8e7acae433e954eecb9b32ce470a8b7e6b4
4
- data.tar.gz: a94efebeb831520dae0617e239cbbc04d76a2bf534566b425660aaac48a9612c
3
+ metadata.gz: ea827703e734f29926dce60d10c981aaf1f2c25da8e4aba28988e80899fdb6ad
4
+ data.tar.gz: 73cfb21d49275a218353d91090ea3e5b7b97c3d0d23b9a4900675c8f7625fcfb
5
5
  SHA512:
6
- metadata.gz: 5bd1f8ea0884e2658f273d0a59f76fa98bafa7c81486a9cae7e9f5ab25637b34b235ba56faa7411febca5b1ddf024f7d23ccb28726bb37604fdff43dfd6936db
7
- data.tar.gz: 4f721cdb87bc744afe6d92f66e3a4456e2a775b6da664b9384c4ae412178417fbc98aebc6d4518aa4c9f454ace61c3a72aa87b9b9c147654a9d9ac4d4cf74cc4
6
+ metadata.gz: fa06bc234127080963c60a281b5e5a0721c438377df3249c123816b7f9d41662f174b825d809435618f660bd742693a8a74cac8e105c170099723c837757c746
7
+ data.tar.gz: 25bc8589c1bfd12043e2ec95aa0c5a534b9608c3dd4e47008430a12b331f6bd096b8977968f985dce4692c01e3b56e1e157587852b78786d6406e613da0cf396
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.4.12
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
1
8
  ## [Unreleased]
2
9
 
3
- ## [0.1.0] - 2022-07-08
10
+ ## [0.1.1] - 2026-10-30
11
+
12
+ ### Fixed
13
+
14
+ - Restore cascading migrations for deep dependency chains and views reached through multiple paths.
15
+
16
+ ## [0.1.0] - 2023-12-11
17
+
18
+ ### Added
19
+
20
+ - Initial release of the cascading Scenic view migration generator.
4
21
 
5
- - Initial release
22
+ [Unreleased]: https://github.com/akiomik/scenic-cascade/compare/v0.1.1...HEAD
23
+ [0.1.1]: https://github.com/akiomik/scenic-cascade/compare/v0.1.0...v0.1.1
24
+ [0.1.0]: https://github.com/akiomik/scenic-cascade/releases/tag/v0.1.0
data/Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
- FROM ruby:3.1-alpine
1
+ FROM ruby:3.4-alpine
2
2
  WORKDIR /scenic-cascade
3
- RUN apk add --no-cache bash gcc git libc6-compat make musl-dev postgresql-dev tzdata
3
+ RUN apk add --no-cache bash gcc git libc6-compat linux-headers make musl-dev postgresql-dev tzdata yaml-dev
4
4
  COPY . .
5
5
  RUN bin/setup
6
- CMD ["rake"]
6
+ CMD ["bundle", "exec", "rake"]
data/Gemfile CHANGED
@@ -7,13 +7,22 @@ gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
9
 
10
+ # type checking
10
11
  gem 'steep', require: false
11
12
 
13
+ # testing
14
+ gem 'activerecord', '~> 7.1.0'
12
15
  gem 'ammeter', '~> 1.1'
13
16
  gem 'database_cleaner-active_record', '~> 2.0'
17
+ # Nokogiri 1.19 drops Ruby 3.1, which remains in the CI matrix.
18
+ gem 'nokogiri', '~> 1.18.0'
14
19
  gem 'pg', '~> 1.0'
20
+ gem 'railties', '~> 7.1.0'
15
21
  gem 'rspec', '~> 3.0'
22
+ gem 'simplecov', require: false
23
+ gem 'simplecov-cobertura', '~> 3.2', require: false
16
24
 
25
+ # linting
17
26
  gem 'rubocop', '~> 1.21', require: false
18
27
  gem 'rubocop-performance', '~> 1.14', require: false
19
28
  gem 'rubocop-rake', '~> 0.6', require: false
data/Gemfile.lock CHANGED
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scenic-cascade (0.1.0)
4
+ scenic-cascade (0.1.1)
5
5
  scenic (~> 1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  abbrev (0.1.1)
11
- actionpack (7.1.2)
12
- actionview (= 7.1.2)
13
- activesupport (= 7.1.2)
11
+ actionpack (7.1.6)
12
+ actionview (= 7.1.6)
13
+ activesupport (= 7.1.6)
14
+ cgi
14
15
  nokogiri (>= 1.8.5)
15
16
  racc
16
17
  rack (>= 2.2.4)
@@ -18,27 +19,31 @@ GEM
18
19
  rack-test (>= 0.6.3)
19
20
  rails-dom-testing (~> 2.2)
20
21
  rails-html-sanitizer (~> 1.6)
21
- actionview (7.1.2)
22
- activesupport (= 7.1.2)
22
+ actionview (7.1.6)
23
+ activesupport (= 7.1.6)
23
24
  builder (~> 3.1)
25
+ cgi
24
26
  erubi (~> 1.11)
25
27
  rails-dom-testing (~> 2.2)
26
28
  rails-html-sanitizer (~> 1.6)
27
- activemodel (7.1.2)
28
- activesupport (= 7.1.2)
29
- activerecord (7.1.2)
30
- activemodel (= 7.1.2)
31
- activesupport (= 7.1.2)
29
+ activemodel (7.1.6)
30
+ activesupport (= 7.1.6)
31
+ activerecord (7.1.6)
32
+ activemodel (= 7.1.6)
33
+ activesupport (= 7.1.6)
32
34
  timeout (>= 0.4.0)
33
- activesupport (7.1.2)
35
+ activesupport (7.1.6)
34
36
  base64
37
+ benchmark (>= 0.3)
35
38
  bigdecimal
36
39
  concurrent-ruby (~> 1.0, >= 1.0.2)
37
40
  connection_pool (>= 2.2.5)
38
41
  drb
39
42
  i18n (>= 1.6, < 2)
43
+ logger (>= 1.4.2)
40
44
  minitest (>= 5.1)
41
45
  mutex_m
46
+ securerandom (>= 0.3)
42
47
  tzinfo (~> 2.0)
43
48
  ammeter (1.1.6)
44
49
  activesupport (>= 3.0)
@@ -46,17 +51,20 @@ GEM
46
51
  rspec-rails (>= 2.2)
47
52
  ast (2.4.2)
48
53
  base64 (0.2.0)
54
+ benchmark (0.5.0)
49
55
  bigdecimal (3.1.4)
50
56
  builder (3.2.4)
51
- concurrent-ruby (1.2.2)
57
+ cgi (0.5.2)
58
+ concurrent-ruby (1.3.7)
52
59
  connection_pool (2.4.1)
53
- crass (1.0.6)
60
+ crass (1.0.8)
54
61
  csv (3.2.8)
55
62
  database_cleaner-active_record (2.1.0)
56
63
  activerecord (>= 5.a)
57
64
  database_cleaner-core (~> 2.0.0)
58
65
  database_cleaner-core (2.0.1)
59
66
  diff-lcs (1.5.0)
67
+ docile (1.4.0)
60
68
  drb (2.2.0)
61
69
  ruby2_keywords
62
70
  erubi (1.12.0)
@@ -74,23 +82,23 @@ GEM
74
82
  rb-fsevent (~> 0.10, >= 0.10.3)
75
83
  rb-inotify (~> 0.9, >= 0.9.10)
76
84
  logger (1.6.0)
77
- loofah (2.22.0)
85
+ loofah (2.25.2)
78
86
  crass (~> 1.0.2)
79
87
  nokogiri (>= 1.12.0)
80
88
  minitest (5.20.0)
81
89
  mutex_m (0.2.0)
82
- nokogiri (1.15.5-aarch64-linux)
90
+ nokogiri (1.18.10-aarch64-linux-musl)
83
91
  racc (~> 1.4)
84
- nokogiri (1.15.5-arm64-darwin)
92
+ nokogiri (1.18.10-arm64-darwin)
85
93
  racc (~> 1.4)
86
- nokogiri (1.15.5-x86_64-linux)
94
+ nokogiri (1.18.10-x86_64-linux-gnu)
87
95
  racc (~> 1.4)
88
96
  parallel (1.23.0)
89
97
  parser (3.2.2.4)
90
98
  ast (~> 2.4.1)
91
99
  racc
92
100
  pg (1.5.4)
93
- psych (5.1.1.1)
101
+ psych (5.1.2)
94
102
  stringio
95
103
  racc (1.7.3)
96
104
  rack (3.0.8)
@@ -108,13 +116,15 @@ GEM
108
116
  rails-html-sanitizer (1.6.0)
109
117
  loofah (~> 2.21)
110
118
  nokogiri (~> 1.14)
111
- railties (7.1.2)
112
- actionpack (= 7.1.2)
113
- activesupport (= 7.1.2)
119
+ railties (7.1.6)
120
+ actionpack (= 7.1.6)
121
+ activesupport (= 7.1.6)
122
+ cgi
114
123
  irb
115
124
  rackup (>= 1.0.0)
116
125
  rake (>= 12.2)
117
126
  thor (~> 1.0, >= 1.2.2)
127
+ tsort (>= 0.2)
118
128
  zeitwerk (~> 2.6)
119
129
  rainbow (3.1.1)
120
130
  rake (13.1.0)
@@ -123,12 +133,12 @@ GEM
123
133
  ffi (~> 1.0)
124
134
  rbs (3.3.2)
125
135
  abbrev
126
- rdoc (6.6.1)
136
+ rdoc (6.6.3.1)
127
137
  psych (>= 4.0.0)
128
138
  regexp_parser (2.8.3)
129
139
  reline (0.4.1)
130
140
  io-console (~> 0.5)
131
- rexml (3.2.6)
141
+ rexml (3.4.4)
132
142
  rspec (3.12.0)
133
143
  rspec-core (~> 3.12.0)
134
144
  rspec-expectations (~> 3.12.0)
@@ -178,10 +188,19 @@ GEM
178
188
  rubocop-factory_bot (~> 2.22)
179
189
  ruby-progressbar (1.13.0)
180
190
  ruby2_keywords (0.0.5)
181
- scenic (1.7.0)
191
+ scenic (1.9.0)
182
192
  activerecord (>= 4.0.0)
183
193
  railties (>= 4.0.0)
184
194
  securerandom (0.3.0)
195
+ simplecov (0.22.0)
196
+ docile (~> 1.1)
197
+ simplecov-html (~> 0.11)
198
+ simplecov_json_formatter (~> 0.1)
199
+ simplecov-cobertura (3.2.0)
200
+ rexml
201
+ simplecov (~> 0.19)
202
+ simplecov-html (0.12.3)
203
+ simplecov_json_formatter (0.1.4)
185
204
  steep (1.6.0)
186
205
  activesupport (>= 5.1)
187
206
  concurrent-ruby (>= 1.1.10)
@@ -197,16 +216,17 @@ GEM
197
216
  securerandom (>= 0.1)
198
217
  strscan (>= 1.0.0)
199
218
  terminal-table (>= 2, < 4)
200
- stringio (3.1.0)
201
- strscan (3.0.7)
219
+ stringio (3.2.0)
220
+ strscan (3.1.0)
202
221
  terminal-table (3.0.2)
203
222
  unicode-display_width (>= 1.1.1, < 3)
204
- thor (1.3.0)
223
+ thor (1.4.0)
205
224
  timeout (0.4.1)
225
+ tsort (0.2.0)
206
226
  tzinfo (2.0.6)
207
227
  concurrent-ruby (~> 1.0)
208
228
  unicode-display_width (2.5.0)
209
- webrick (1.8.1)
229
+ webrick (1.8.2)
210
230
  zeitwerk (2.6.12)
211
231
 
212
232
  PLATFORMS
@@ -215,9 +235,12 @@ PLATFORMS
215
235
  x86_64-linux
216
236
 
217
237
  DEPENDENCIES
238
+ activerecord (~> 7.1.0)
218
239
  ammeter (~> 1.1)
219
240
  database_cleaner-active_record (~> 2.0)
241
+ nokogiri (~> 1.18.0)
220
242
  pg (~> 1.0)
243
+ railties (~> 7.1.0)
221
244
  rake (~> 13.0)
222
245
  rspec (~> 3.0)
223
246
  rubocop (~> 1.21)
@@ -225,6 +248,8 @@ DEPENDENCIES
225
248
  rubocop-rake (~> 0.6)
226
249
  rubocop-rspec (~> 2.12)
227
250
  scenic-cascade!
251
+ simplecov
252
+ simplecov-cobertura (~> 3.2)
228
253
  steep
229
254
 
230
255
  BUNDLED WITH
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # scenic-cascade
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/scenic-cascade.svg)](https://badge.fury.io/rb/scenic-cascade)
3
4
  [![Ruby](https://github.com/akiomik/scenic-cascade/actions/workflows/ci.yml/badge.svg)](https://github.com/akiomik/scenic-cascade/actions/workflows/ci.yml)
5
+ [![codecov](https://codecov.io/gh/akiomik/scenic-cascade/graph/badge.svg?token=SEHF4ZDZIY)](https://codecov.io/gh/akiomik/scenic-cascade)
4
6
 
5
7
  `scenic-cascade` is a [scenic](https://github.com/scenic-views/scenic) migration file generator that supports cascading view updates.
6
8
 
@@ -82,9 +84,9 @@ end
82
84
 
83
85
  ## Development
84
86
 
85
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
87
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
86
88
 
87
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
89
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update `version.rb`, `Gemfile.lock`, and `CHANGELOG.md`, then publish a GitHub Release with a matching `vX.Y.Z` tag. The [publish workflow](.github/workflows/publish.yml) builds and pushes the gem to [rubygems.org](https://rubygems.org).
88
90
 
89
91
  ## Contributing
90
92
 
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'generators/scenic/view/view_generator'
4
+ require 'scenic/cascade'
5
+ require 'scenic/cascade/view_with_version'
4
6
 
5
7
  module Scenic
6
8
  module Generators
@@ -25,12 +27,15 @@ module Scenic
25
27
  return @dependents if @dependents.present?
26
28
 
27
29
  deps = Scenic::Cascade.view_dependents_of(plural_name, recursive: true)
28
- @dependents ||= deps.map do |dep|
29
- name = dep.from.name
30
- version = Scenic::Cascade.find_latest_definition_of(name).version.to_i
31
- is_materialized = dep.from.materialized?
32
- Scenic::Cascade::ViewWithVersion.new(name: name, version: version, materialized: is_materialized)
33
- end.uniq
30
+ views = deps.map { |dep| view_with_version_for(dep) }
31
+ # The last visit follows every prerequisite, even when names sort in the opposite order.
32
+ @dependents = views.reverse.uniq { |view| [view.name, view.version, view.materialized?] }.reverse
33
+ end
34
+
35
+ def view_with_version_for(dep)
36
+ name = dep.from.name
37
+ version = Scenic::Cascade.find_latest_definition_of(name).version.to_i
38
+ Scenic::Cascade::ViewWithVersion.new(name: name, version: version, materialized: dep.from.materialized?)
34
39
  end
35
40
  end
36
41
  end
@@ -42,7 +42,7 @@ module Scenic
42
42
  return dependencies unless recursive
43
43
 
44
44
  dependencies.flat_map do |dependency|
45
- [dependency, *view_dependencies_of(dependency.to.name)]
45
+ [dependency, *view_dependencies_of(dependency.to.name, recursive: true)]
46
46
  end
47
47
  end
48
48
  end
@@ -42,7 +42,7 @@ module Scenic
42
42
  return dependencies unless recursive
43
43
 
44
44
  dependencies.flat_map do |dependency|
45
- [dependency, *view_dependents_of(dependency.from.name)]
45
+ [dependency, *view_dependents_of(dependency.from.name, recursive: true)]
46
46
  end
47
47
  end
48
48
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scenic
4
4
  module Cascade
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'view'
4
+
3
5
  module Scenic
4
6
  module Cascade
5
7
  # Represents a view with version
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_record'
4
+ # Scenic 1.9 uses TSort while loading but does not require it.
5
+ require 'tsort'
4
6
  require 'scenic'
5
7
 
6
8
  require_relative 'cascade/version'
data/rbs_collection.yaml CHANGED
@@ -13,3 +13,10 @@ gems:
13
13
  # It's unnecessary if you don't use rbs as a library.
14
14
  - name: rbs
15
15
  ignore: true
16
+ # Racc is not used directly, and its current signatures require a newer RBS parser.
17
+ - name: racc
18
+ ignore: true
19
+ # The CGI gem's signatures depend on StringIO signatures absent from RBS 3.3.2.
20
+ # CGI is not used by this library directly.
21
+ - name: cgi
22
+ ignore: true
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scenic-cascade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akiomi Kamakura
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: scenic
@@ -79,7 +78,6 @@ metadata:
79
78
  source_code_uri: https://github.com/akiomik/scenic-cascade
80
79
  changelog_uri: https://github.com/akiomik/scenic-cascade/blob/main/CHANGELOG.md
81
80
  rubygems_mfa_required: 'true'
82
- post_install_message:
83
81
  rdoc_options: []
84
82
  require_paths:
85
83
  - lib
@@ -94,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
92
  - !ruby/object:Gem::Version
95
93
  version: '0'
96
94
  requirements: []
97
- rubygems_version: 3.4.10
98
- signing_key:
95
+ rubygems_version: 3.6.9
99
96
  specification_version: 4
100
97
  summary: A migration scenic file generator that supports cascading view updates
101
98
  test_files: []