updateable_views_inheritance 1.4.3 → 1.4.4

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: d1310b2e6e48b891171acd2c8eaebb3f194ee6cd9fac97ebbaa5a6eca5cc7ceb
4
- data.tar.gz: 0d240ed0c411840f800e0e01a52e05933c5e64903d4ec648a39279fb358c8c53
3
+ metadata.gz: 5a592cb214e5825bb4af87c5412ae3f91730d0e3882931f71bd16378ace7640a
4
+ data.tar.gz: 2fbf14052dde92e69724d574c0b5fb7b4d79297928220bc8bee5851cc8ee60ad
5
5
  SHA512:
6
- metadata.gz: fdddba487660479c4ed5530764be9bee03aa13bea8ff658319d48938c34e8a276c9e5f7ba6d9769111a4c2e93e1d0b35632ccd111811402eb9188fce12e20d56
7
- data.tar.gz: 4a50e703717eb50314beed8563134dc20cdd430533aead0398c42c7fd2082b63b00375dc0db39b012688d0d6ec6ad3a1b49c7a5b9e2873a90b556bdcada6515c
6
+ metadata.gz: b4da55b7632575a0fba84248130308890f56dd726e6aaec835d3423b874a959d88ecf51dbf482795ba97869e5255411b9599b0117df61c6e70b3f095322c23fe
7
+ data.tar.gz: edd29da257c91e7d8a53df032bc70dd2317c78433637649e23285118b058109116259ed22efc86b8495f44301c5c6831c125e26565c1aa203ad00663205c8f6c
data/.deepsource.toml ADDED
@@ -0,0 +1,8 @@
1
+ version = 1
2
+
3
+ [[analyzers]]
4
+ name = "ruby"
5
+
6
+ [[analyzers]]
7
+ name = "test-coverage"
8
+ enabled = true
@@ -0,0 +1,66 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Build
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ services:
23
+ postgres:
24
+ image: postgres:9.6.24
25
+ ports:
26
+ - "5432:5432"
27
+ env:
28
+ POSTGRES_DB: updateable_views_inheritance_test
29
+ POSTGRES_USER: postgres
30
+ POSTGRES_PASSWORD: postgres
31
+ strategy:
32
+ matrix:
33
+ ruby-version: ['2.7']
34
+ env:
35
+ DATABASE_URL: "postgres://postgres:postgres@localhost:5432/updateable_views_inheritance_test"
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ with:
39
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of Sonar analysis
40
+
41
+ - name: Set up Ruby
42
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
43
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
44
+ # uses: ruby/setup-ruby@v1
45
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
46
+ with:
47
+ ruby-version: ${{ matrix.ruby-version }}
48
+ bundler: 1.17.3 # temporary set until rails 5 upgrade
49
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
50
+
51
+ - name: Run tests
52
+ run: bundle exec rake 2>/dev/null # disable warnings until ruby 3 upgrade
53
+
54
+ # From https://stackoverflow.com/questions/74199483/sonarcloud-ci-cant-find-source-files-for-ruby-simplecov-coverage
55
+ - name: Fix code coverage paths for DeepSource
56
+ working-directory: ./coverage
57
+ run: |
58
+ sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' .resultset.json
59
+
60
+ - name: Report test coverage to DeepSource
61
+ uses: deepsourcelabs/test-coverage-action@master
62
+ with:
63
+ key: ruby
64
+ coverage-file: ./coverage/.resultset.json
65
+ dsn: ${{ secrets.DEEPSOURCE_DSN }}
66
+
data/.gitignore CHANGED
@@ -1,5 +1,7 @@
1
1
  .bundle/
2
2
  .byebug_history
3
+ *.gem
4
+ coverage
3
5
  Gemfile.lock
4
6
  html/*
5
7
  pkg/*
@@ -0,0 +1,6 @@
1
+ {
2
+ "sonarlint.connectedMode.project": {
3
+ "connectionId": "tutuf",
4
+ "projectKey": "tutuf_updateable_views_inheritance"
5
+ }
6
+ }
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.4.4 (09 October 2024)
2
+
3
+ Bugfixes:
4
+
5
+ - Quote table and column names.
6
+
1
7
  ## 1.4.3 (01 October 2024)
2
8
 
3
9
  Features:
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Class Table Inheritance
2
2
 
3
+ [![Build](https://github.com/tutuf/updateable_views_inheritance/actions/workflows/build.yml/badge.svg)](https://github.com/tutuf/updateable_views_inheritance/actions?query=workflow:build)
4
+ [![Coverage](https://app.deepsource.com/gh/tutuf/updateable_views_inheritance.svg/?label=code+coverage&show_trend=true&token=AMfm8-_-qDZoknMh9-8IYp3R)](https://app.deepsource.com/gh/tutuf/updateable_views_inheritance/)
5
+
3
6
  Class Table Inheritance for ActiveRecord using updateable views
4
7
 
5
8
  More about the pattern on
data/Rakefile CHANGED
@@ -24,14 +24,14 @@ end
24
24
  namespace :test do
25
25
  desc 'Build the test database'
26
26
  task :create_database do
27
- %x( createdb updateable_views_inheritance_test )
27
+ %x( createdb updateable_views_inheritance_test ) unless ENV['CI']
28
28
  end
29
29
 
30
30
  desc 'Drop the test database'
31
31
  task :drop_database do
32
- %x( dropdb updateable_views_inheritance_test )
32
+ %x( dropdb updateable_views_inheritance_test ) unless ENV['CI']
33
33
  end
34
34
 
35
35
  desc 'Rebuild the test database'
36
36
  task :rebuild_database => [:drop_database, :create_database]
37
- end
37
+ end
@@ -91,9 +91,9 @@ module ActiveRecord #:nodoc:
91
91
  end
92
92
  if pk
93
93
  if sequence
94
- select_value <<-end_sql, 'Reset sequence'
94
+ select_value <<-SQL, 'Reset sequence'
95
95
  SELECT setval('#{sequence}', (SELECT COALESCE(MAX(#{pk})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{table}), false)
96
- end_sql
96
+ SQL
97
97
  else
98
98
  @logger.warn "#{table} has primary key #{pk} with no default sequence" if @logger
99
99
  end
@@ -109,7 +109,7 @@ module ActiveRecord #:nodoc:
109
109
  # Returns a relation's primary key and belonging sequence. If +relation+ is a table the result is its PK and sequence.
110
110
  # When it is a view, PK and sequence of the table at the root of the inheritance chain are returned.
111
111
  def pk_and_sequence_for(relation)
112
- result = query(<<-end_sql, 'PK')[0]
112
+ result = query(<<-SQL, 'PK')[0]
113
113
  SELECT attr.attname
114
114
  FROM pg_attribute attr,
115
115
  pg_constraint cons
@@ -117,7 +117,7 @@ module ActiveRecord #:nodoc:
117
117
  AND cons.conrelid = '#{relation}'::regclass
118
118
  AND cons.contype = 'p'
119
119
  AND attr.attnum = ANY(cons.conkey)
120
- end_sql
120
+ SQL
121
121
  if result.nil? or result.empty?
122
122
  parent = parent_table(relation)
123
123
  pk_and_sequence_for(parent) if parent
@@ -156,11 +156,11 @@ module ActiveRecord #:nodoc:
156
156
 
157
157
  # Recursively delete +parent_relation+ (if it is a view) and the children views the depend on it.
158
158
  def remove_parent_and_children_views(parent_relation)
159
- children_views = query(<<-end_sql).map{|row| row[0]}
159
+ children_views = query(<<-SQL).map{|row| row[0]}
160
160
  SELECT child_aggregate_view
161
161
  FROM updateable_views_inheritance
162
162
  WHERE parent_relation = '#{parent_relation}'
163
- end_sql
163
+ SQL
164
164
  children_views.each do |cv|
165
165
  remove_parent_and_children_views(cv)
166
166
  # drop the view only if it wasn't dropped beforehand in recursive call from other method.
@@ -179,18 +179,18 @@ module ActiveRecord #:nodoc:
179
179
  def rebuild_parent_and_children_views(parent_relation)
180
180
  # Current implementation is not very efficient - it can drop and recreate one and the same view in the bottom of the hierarchy many times.
181
181
  remove_parent_and_children_views(parent_relation)
182
- children = query(<<-end_sql)
182
+ children = query(<<-SQL)
183
183
  SELECT parent_relation, child_aggregate_view, child_relation
184
184
  FROM updateable_views_inheritance
185
185
  WHERE parent_relation = '#{parent_relation}'
186
- end_sql
186
+ SQL
187
187
 
188
188
  #if the parent is in the middle of the inheritance chain, it's a view that should be rebuilt as well
189
- parent = query(<<-end_sql)[0]
189
+ parent = query(<<-SQL)[0]
190
190
  SELECT parent_relation, child_aggregate_view, child_relation
191
191
  FROM updateable_views_inheritance
192
192
  WHERE child_aggregate_view = '#{parent_relation}'
193
- end_sql
193
+ SQL
194
194
  create_child_view(parent[0], parent[1], parent[2]) if (parent && !parent.empty?)
195
195
 
196
196
  children.each do |child|
@@ -227,11 +227,11 @@ module ActiveRecord #:nodoc:
227
227
  quoted_inheritance_column = quote_column_name(parent_klass_name.inheritance_column)
228
228
  queries = relations.map{|rel| generate_single_table_inheritanche_union_clause(rel, sorted_column_names, conflict_column_names, columns_hash, quoted_inheritance_column)}
229
229
  unioin_clauses = queries.join("\n UNION ")
230
- execute <<-end_sql
230
+ execute <<-SQL
231
231
  CREATE VIEW #{sti_aggregate_view} AS (
232
232
  #{unioin_clauses}
233
233
  )
234
- end_sql
234
+ SQL
235
235
  end
236
236
 
237
237
  # Recreates the Single_Table_Inheritanche-like aggregate view +sti_aggregate_view+
@@ -304,15 +304,15 @@ module ActiveRecord #:nodoc:
304
304
 
305
305
  def do_create_child_view(parent_table, parent_columns, parent_pk, child_view, child_columns, child_pk, child_table)
306
306
  view_columns = parent_columns + child_columns
307
- execute <<-end_sql
308
- CREATE OR REPLACE VIEW #{child_view} AS (
307
+ execute(<<~SQL)
308
+ CREATE OR REPLACE VIEW #{quote_column_name(child_view)} AS (
309
309
  SELECT parent.#{parent_pk},
310
- #{ view_columns.join(",") }
310
+ #{ view_columns.map { |col| quote_column_name(col) }.join(",") }
311
311
  FROM #{parent_table} parent
312
312
  INNER JOIN #{child_table} child
313
313
  ON ( parent.#{parent_pk}=child.#{child_pk} )
314
314
  )
315
- end_sql
315
+ SQL
316
316
  end
317
317
 
318
318
  # Creates rules for +INSERT+, +UPDATE+ and +DELETE+ on the view
@@ -320,41 +320,46 @@ module ActiveRecord #:nodoc:
320
320
  # insert
321
321
  # NEW.#{parent_pk} can be explicitly specified and when it is null every call to it increments the sequence.
322
322
  # Setting the sequence to its value (explicitly supplied or the default) covers both cases.
323
- execute <<-end_sql
323
+ execute(<<~SQL)
324
324
  CREATE OR REPLACE RULE #{quote_column_name("#{child_view}_insert")} AS
325
- ON INSERT TO #{child_view} DO INSTEAD (
325
+ ON INSERT TO #{quote_column_name(child_view)} DO INSTEAD (
326
326
  INSERT INTO #{parent_table}
327
- ( #{ [parent_pk, parent_columns].flatten.join(", ") } )
328
- VALUES( DEFAULT #{ parent_columns.empty? ? '' : ' ,' + parent_columns.collect{ |col| "NEW." + col}.join(", ") } ) ;
327
+ ( #{ [parent_pk, parent_columns].flatten.map { |col| quote_column_name(col) }.join(", ") } )
328
+ VALUES( DEFAULT #{ parent_columns.empty? ? '' : ' ,' + parent_columns.collect{ |col| "NEW.#{quote_column_name(col)}" }.join(", ") } ) ;
329
329
  INSERT INTO #{child_table}
330
- ( #{ [child_pk, child_columns].flatten.join(",")} )
331
- VALUES( currval('#{parent_pk_seq}') #{ child_columns.empty? ? '' : ' ,' + child_columns.collect{ |col| "NEW." + col}.join(", ") } )
330
+ ( #{ [child_pk, child_columns].flatten.map { |col| quote_column_name(col) }.join(",")} )
331
+ VALUES( currval('#{parent_pk_seq}') #{ child_columns.empty? ? '' : ' ,' + child_columns.collect{ |col| "NEW.#{quote_column_name(col)}" }.join(", ") } )
332
332
  #{insert_returning_clause(parent_pk, child_pk, child_view)}
333
333
  )
334
- end_sql
334
+ SQL
335
335
 
336
336
  # delete
337
- execute <<-end_sql
338
- CREATE OR REPLACE RULE #{quote_column_name("#{child_view}_delete")} AS
339
- ON DELETE TO #{child_view} DO INSTEAD
340
- DELETE FROM #{parent_table} WHERE #{parent_pk} = OLD.#{parent_pk}
341
- end_sql
337
+ execute(<<~SQL)
338
+ CREATE OR REPLACE RULE #{quote_column_name("#{child_view}_delete")} AS
339
+ ON DELETE TO #{quote_column_name(child_view)} DO INSTEAD
340
+ DELETE FROM #{parent_table} WHERE #{parent_pk} = OLD.#{parent_pk}
341
+ SQL
342
342
 
343
343
  # update
344
- execute <<-end_sql
344
+ execute(<<~SQL)
345
345
  CREATE OR REPLACE RULE #{quote_column_name("#{child_view}_update")} AS
346
- ON UPDATE TO #{child_view} DO INSTEAD (
347
- #{ parent_columns.empty? ? '':
348
- "UPDATE #{parent_table}
349
- SET #{ parent_columns.collect{ |col| col + "= NEW." + col }.join(", ") }
350
- WHERE #{parent_pk} = OLD.#{parent_pk};"}
351
- #{ child_columns.empty? ? '':
352
- "UPDATE #{child_table}
353
- SET #{ child_columns.collect{ |col| col + " = NEW." + col }.join(", ") }
354
- WHERE #{child_pk} = OLD.#{parent_pk}"
355
- }
346
+ ON UPDATE TO #{quote_column_name(child_view)} DO INSTEAD (
347
+ #{ if parent_columns.empty?
348
+ ''
349
+ else
350
+ "UPDATE #{parent_table}
351
+ SET #{ parent_columns.map { |col| "#{quote_column_name(col)} = NEW.#{quote_column_name(col)}" }.join(', ')}
352
+ WHERE #{parent_pk} = OLD.#{parent_pk};"
353
+ end }
354
+ #{ if child_columns.empty?
355
+ ''
356
+ else
357
+ "UPDATE #{child_table}
358
+ SET #{ child_columns.map { |col| "#{quote_column_name(col)} = NEW.#{quote_column_name(col)}" }.join(', ')}
359
+ WHERE #{child_pk} = OLD.#{parent_pk}"
360
+ end }
356
361
  )
357
- end_sql
362
+ SQL
358
363
  end
359
364
 
360
365
  def insert_returning_clause(parent_pk, child_pk, child_view)
@@ -383,11 +388,11 @@ module ActiveRecord #:nodoc:
383
388
 
384
389
  def parent_table(relation)
385
390
  if table_exists?('updateable_views_inheritance')
386
- res = query(<<-end_sql, 'Parent relation')[0]
391
+ res = query(<<-SQL, 'Parent relation')[0]
387
392
  SELECT parent_relation
388
393
  FROM updateable_views_inheritance
389
394
  WHERE child_aggregate_view = '#{relation}'
390
- end_sql
395
+ SQL
391
396
  res[0] if res
392
397
  end
393
398
  end
@@ -403,11 +408,11 @@ module ActiveRecord #:nodoc:
403
408
  # ]
404
409
  def get_view_hierarchy_for(parent_relation)
405
410
  hierarchy = []
406
- children = query(<<-end_sql)
411
+ children = query(<<-SQL)
407
412
  SELECT parent_relation, child_aggregate_view, child_relation
408
413
  FROM updateable_views_inheritance
409
414
  WHERE parent_relation = '#{parent_relation}'
410
- end_sql
415
+ SQL
411
416
  children.each do |child|
412
417
  hierarchy << [child[1], *get_view_hierarchy_for(child[1])]
413
418
  end
@@ -1,3 +1,3 @@
1
1
  module UpdateableViewsInheritance
2
- VERSION = "1.4.3"
2
+ VERSION = "1.4.4"
3
3
  end
data/test/content_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
1
+ require_relative 'test_helper'
2
2
 
3
3
  class UpdateableViewsInheritanceContentTest < ActiveSupport::TestCase
4
4
  def setup
@@ -6,6 +6,7 @@ class UpdateableViewsInheritanceContentTest < ActiveSupport::TestCase
6
6
  ActiveRecord::FixtureSet.reset_cache
7
7
  end
8
8
 
9
+
9
10
  def test_find
10
11
  ActiveRecord::FixtureSet.create_fixtures(File.dirname(__FILE__) + '/fixtures/', :steam_locomotives)
11
12
  locomotive = Locomotive.find(1)
@@ -2,3 +2,4 @@ test:
2
2
  adapter: postgresql
3
3
  database: updateable_views_inheritance_test
4
4
  min_messages: ERROR
5
+ host: localhost
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
1
+ require_relative 'test_helper'
2
2
  require 'generators/updateable_views_inheritance/install_generator'
3
3
 
4
4
  class InstallGeneratorTest < Rails::Generators::TestCase
@@ -10,4 +10,4 @@ class InstallGeneratorTest < Rails::Generators::TestCase
10
10
  run_generator
11
11
  assert_migration 'db/migrate/create_updateable_views_inheritance.rb'
12
12
  end
13
- end
13
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
1
+ require_relative 'test_helper'
2
2
 
3
3
  class InstantiationTest < ActiveSupport::TestCase
4
4
  def setup
@@ -8,21 +8,20 @@ class InstantiationTest < ActiveSupport::TestCase
8
8
  ActiveRecord::FixtureSet.create_fixtures(File.dirname(__FILE__) + '/fixtures/', f)
9
9
  end
10
10
  @connection = ActiveRecord::Base.connection
11
+
12
+ Locomotive.disable_inheritance_instantiation = true
13
+ ElectricLocomotive.disable_inheritance_instantiation = false
11
14
  end
12
15
 
13
16
  def teardown
17
+ Locomotive.disable_inheritance_instantiation = false
14
18
  ActiveRecord::FixtureSet.reset_cache
15
19
  end
16
20
 
17
- class ::Locomotive < ActiveRecord::Base
18
- self.disable_inheritance_instantiation = true
19
- end
20
-
21
- class ::ElectricLocomotive < Locomotive
22
- self.disable_inheritance_instantiation = false
23
- end
24
-
25
21
  def test_setting_disable_inheritance_instantiation_does_not_load_child_columns
22
+ unless Locomotive.first
23
+ puts "num locomotives:", @connection.select_one("SELECT count(id) FROM locomotives")
24
+ end
26
25
  assert_equal %w[id max_speed name type],
27
26
  Locomotive.first.attributes.keys.sort
28
27
  end
@@ -35,6 +34,5 @@ class InstantiationTest < ActiveSupport::TestCase
35
34
  def test_disable_inheritance_instantiatioon_not_set_loads_child_attributes
36
35
  assert_equal %w[id name number_of_gears number_of_wheels vehicle_type],
37
36
  Bicycle.first.attributes.keys.sort
38
-
39
37
  end
40
38
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
1
+ require_relative 'test_helper'
2
2
 
3
3
  class UpdateableViewsInheritanceMigrationTest < ActiveSupport::TestCase
4
4
  # We use transactional fixtures - migration from the setup is rolled back by Rails on teardown
@@ -17,7 +17,7 @@ class UpdateableViewsInheritanceMigrationTest < ActiveSupport::TestCase
17
17
  assert_equal %w(electricity_consumption id max_speed name type),
18
18
  @connection.columns(:electric_locomotives).map{ |c| c.name }.sort
19
19
  end
20
-
20
+
21
21
  def test_drop_child
22
22
  ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/', 3)
23
23
  ActiveRecord::Migrator.down(File.dirname(__FILE__) + '/fixtures/migrations/', 2)
@@ -27,4 +27,4 @@ class UpdateableViewsInheritanceMigrationTest < ActiveSupport::TestCase
27
27
  steam_locomotives_data
28
28
  updateable_views_inheritance), @connection.tables.sort
29
29
  end
30
- end
30
+ end
data/test/schema_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
1
+ require_relative 'test_helper'
2
2
 
3
3
  class UpdateableViewsInheritanceSchemaTest < ActiveSupport::TestCase
4
4
  def setup
@@ -14,7 +14,6 @@ class UpdateableViewsInheritanceSchemaTest < ActiveSupport::TestCase
14
14
  assert_equal 'id', @connection.primary_key(:maglev_locomotives), "Wrong or no primary key for child aggregate view"
15
15
  end
16
16
 
17
-
18
17
  def test_content_columns
19
18
  assert !SteamLocomotive.content_columns.map(&:name).include?("id")
20
19
  end
@@ -239,4 +238,17 @@ class UpdateableViewsInheritanceSchemaTest < ActiveSupport::TestCase
239
238
  UseExistingTable.up
240
239
  assert @connection.columns(:diesel_locomotives).map(&:name).include?("num_cylinders")
241
240
  end
241
+
242
+ class ReservedSQLWords < ActiveRecord::Migration
243
+ def self.up
244
+ create_child(:table, parent: :locomotives) do |t|
245
+ t.integer :column
246
+ end
247
+ end
248
+ end
249
+
250
+ def test_reserved_words_in_tables_and_columns
251
+ ReservedSQLWords.up
252
+ assert @connection.columns(:table).map(&:name).include?("column")
253
+ end
242
254
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'test_helper')
1
+ require_relative 'test_helper'
2
2
 
3
3
  class SingleTableInheritanceAggregateViewTest < ActiveSupport::TestCase
4
4
  def setup
data/test/test_helper.rb CHANGED
@@ -1,6 +1,27 @@
1
1
  # Configure Rails Environment
2
2
  ENV["RAILS_ENV"] = "test"
3
3
 
4
+ # test coverage
5
+ require 'simplecov'
6
+ require 'simplecov_json_formatter'
7
+
8
+ SimpleCov.start 'rails' do
9
+ if ENV['CI']
10
+ formatter SimpleCov::Formatter::JSONFormatter
11
+ else
12
+ formatter SimpleCov::Formatter::MultiFormatter.new([
13
+ SimpleCov::Formatter::SimpleFormatter,
14
+ SimpleCov::Formatter::HTMLFormatter
15
+ ])
16
+ end
17
+
18
+ track_files "lib/**/*.rb"
19
+ # repeat the add_filter values in sonar-project.properties file
20
+ # otherwise sonarcloud does not calculate properly the coverage ratio
21
+ add_filter "lib/generators/updateable_views_inheritance/templates/create_updateable_views_inheritance.rb"
22
+ add_filter "lib/updateable_views_inheritance/version.rb"
23
+ end
24
+
4
25
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
26
  require 'rails/test_help'
6
27
  require 'updateable_views_inheritance'
@@ -21,10 +21,12 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "activerecord", "~> 4.2.8"
22
22
  s.add_dependency "pg", "~> 0.21"
23
23
 
24
- s.add_development_dependency 'minitest'
25
- s.add_development_dependency "rails", '= 4.2.11.1'
24
+ s.add_development_dependency 'bigdecimal', '1.3.5'
26
25
  s.add_development_dependency "bundler"
26
+ s.add_development_dependency "minitest"
27
+ s.add_development_dependency "rails", '= 4.2.11.1'
27
28
  s.add_development_dependency "rake"
28
- s.add_development_dependency 'bigdecimal', '1.3.5'
29
+ s.add_development_dependency "simplecov"
30
+ s.add_development_dependency "simplecov_json_formatter"
29
31
  s.add_development_dependency "solargraph"
30
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: updateable_views_inheritance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sava Chankov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-10-01 00:00:00.000000000 Z
12
+ date: 2024-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -39,6 +39,34 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0.21'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bigdecimal
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.3.5
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.3.5
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
42
70
  - !ruby/object:Gem::Dependency
43
71
  name: minitest
44
72
  requirement: !ruby/object:Gem::Requirement
@@ -68,7 +96,7 @@ dependencies:
68
96
  - !ruby/object:Gem::Version
69
97
  version: 4.2.11.1
70
98
  - !ruby/object:Gem::Dependency
71
- name: bundler
99
+ name: rake
72
100
  requirement: !ruby/object:Gem::Requirement
73
101
  requirements:
74
102
  - - ">="
@@ -82,7 +110,7 @@ dependencies:
82
110
  - !ruby/object:Gem::Version
83
111
  version: '0'
84
112
  - !ruby/object:Gem::Dependency
85
- name: rake
113
+ name: simplecov
86
114
  requirement: !ruby/object:Gem::Requirement
87
115
  requirements:
88
116
  - - ">="
@@ -96,19 +124,19 @@ dependencies:
96
124
  - !ruby/object:Gem::Version
97
125
  version: '0'
98
126
  - !ruby/object:Gem::Dependency
99
- name: bigdecimal
127
+ name: simplecov_json_formatter
100
128
  requirement: !ruby/object:Gem::Requirement
101
129
  requirements:
102
- - - '='
130
+ - - ">="
103
131
  - !ruby/object:Gem::Version
104
- version: 1.3.5
132
+ version: '0'
105
133
  type: :development
106
134
  prerelease: false
107
135
  version_requirements: !ruby/object:Gem::Requirement
108
136
  requirements:
109
- - - '='
137
+ - - ">="
110
138
  - !ruby/object:Gem::Version
111
- version: 1.3.5
139
+ version: '0'
112
140
  - !ruby/object:Gem::Dependency
113
141
  name: solargraph
114
142
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +160,10 @@ executables: []
132
160
  extensions: []
133
161
  extra_rdoc_files: []
134
162
  files:
163
+ - ".deepsource.toml"
164
+ - ".github/workflows/build.yml"
135
165
  - ".gitignore"
166
+ - ".vscode/settings.json"
136
167
  - CHANGELOG.md
137
168
  - Gemfile
138
169
  - MIT-LICENSE