Skip to content

Commit 46f7abe

Browse files
authored
Merge pull request #1 from bibendi/feature/packwerk
Packwerk
2 parents 20c8c98 + 8245f71 commit 46f7abe

File tree

206 files changed

+2355
-1052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+2355
-1052
lines changed

.circleci/config.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ commands:
9090
executors:
9191
ruby:
9292
docker:
93-
- image: circleci/ruby:2.7.2-node
93+
- image: circleci/ruby:2.7.4
9494
environment:
9595
BUNDLE_PATH: /home/circleci/project/vendor/bundle
9696
BUNDLER_VERSION: 2.2.31
@@ -99,7 +99,7 @@ executors:
9999

100100
rails:
101101
docker:
102-
- image: circleci/ruby:2.7.2-node-browsers
102+
- image: circleci/ruby:2.7.4
103103
- image: timescale/timescaledb:2.1.0-pg13
104104
environment:
105105
POSTGRES_PASSWORD: password
@@ -239,6 +239,12 @@ jobs:
239239
- prepare_ruby_test_env
240240
- prepare_databases
241241
# run after tests to make sure that schema is up-to-date
242+
- run:
243+
name: Packwerk validate
244+
command: bundle exec packwerk validate
245+
- run:
246+
name: Packwerk check
247+
command: bundle exec packwerk check
242248
- run:
243249
name: Database Integrity check
244250
command: bundle exec rails db:validate_integrity
@@ -299,6 +305,9 @@ jobs:
299305
- engem:
300306
target: auth_by
301307
brakeman: true
308+
- engem:
309+
target: interests
310+
brakeman: true
302311
- save_cache:
303312
key: vic-bootsnap-v1-{{ .Branch }}-{{ .Revision }}
304313
paths:

.database_consistency.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ CoreBy::User:
1919
enabled: false
2020
index_users_on_unlock_token:
2121
enabled: false
22+
23+
# Basically, this model should be separate and don't use shared table with CoreBy::User model.
24+
AuthBy::User:
25+
enabled: false

.rubocop.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ require:
1010

1111
AllCops:
1212
Exclude:
13+
- '**/tmp/**/*'
14+
- '**/log/**/*'
1315
- 'db/schema.rb'
1416
- 'db/statistics_schema.rb'
1517

@@ -42,4 +44,4 @@ Lint/Env:
4244
- '**/testing/*.rb'
4345
- '**/spec/**/support/**/*'
4446
- 'lib/generators/**/*'
45-
- 'engines/core_by/app/models/core_by/direct_db.rb'
47+
- 'engines/core_by/public/models/core_by/sdk/application_direct_record.rb'

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.2
1+
2.7.4

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ group :development, :test do
8585
# == Security/Audit
8686
# Check for known CVE in gems
8787
gem "bundler-audit", require: false
88+
89+
# Linter to enforce boundaries
90+
gem "packwerk", require: false
8891
end
8992

9093
group :development do
@@ -134,12 +137,13 @@ def engine(name)
134137
end
135138

136139
# Add development deps to development and test groups
137-
gem "#{name}-dev", path: "engines/#{name}", group: [:development, :test]
140+
gem "#{name}-dev", path: "engines/#{name}"
138141
end
139142
end
140143
end
141144

142145
path "engines" do
143146
engine "core_by"
144147
engine "auth_by"
148+
engine "interests"
145149
end

Gemfile.lock

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ PATH
4646
rails (= 6.1.4.1)
4747
rails-i18n (~> 6.0)
4848
redis-mutex (~> 4.0)
49+
resonad (~> 1.4)
4950
schked (~> 0.3)
5051
core_by-dev (1.0.0)
5152
bootsnap (~> 1.4)
@@ -56,6 +57,21 @@ PATH
5657
common-testing
5758
rake (~> 13.0)
5859

60+
PATH
61+
remote: engines/interests
62+
specs:
63+
interests (1.0.0)
64+
core_by
65+
pg (~> 1.0)
66+
rails (= 6.1.4.1)
67+
interests-dev (1.0.0)
68+
bootsnap (~> 1.4)
69+
brakeman (~> 5.0)
70+
bundler (>= 2.0)
71+
common-rubocop
72+
common-testing
73+
rake (~> 13.0)
74+
5975
PATH
6076
remote: engines
6177
specs:
@@ -190,6 +206,14 @@ GEM
190206
ruby-next-core (>= 0.11.0)
191207
ast (2.4.2)
192208
bcrypt (3.1.16)
209+
better_html (1.0.16)
210+
actionview (>= 4.0)
211+
activesupport (>= 4.0)
212+
ast (~> 2.0)
213+
erubi (~> 1.4)
214+
html_tokenizer (~> 0.0.6)
215+
parser (>= 2.4)
216+
smart_properties
193217
bootsnap (1.9.1)
194218
msgpack (~> 1.0)
195219
brakeman (5.1.2)
@@ -203,6 +227,7 @@ GEM
203227
thor (>= 0.14.6)
204228
concurrent-ruby (1.1.9)
205229
connection_pool (2.2.5)
230+
constant_resolver (0.1.5)
206231
crass (1.0.6)
207232
database_consistency (1.1.6)
208233
activerecord (>= 3.2)
@@ -320,6 +345,7 @@ GEM
320345
google-protobuf (~> 3.17)
321346
googleapis-common-protos-types (~> 1.0)
322347
hiredis (0.6.3)
348+
html_tokenizer (0.0.7)
323349
httpclient (2.8.3)
324350
i18n (1.8.11)
325351
concurrent-ruby (~> 1.0)
@@ -372,6 +398,14 @@ GEM
372398
multi_xml (~> 0.5)
373399
rack (>= 1.2, < 3)
374400
os (1.1.4)
401+
packwerk (1.3.2)
402+
activesupport (>= 5.2)
403+
ast
404+
better_html
405+
constant_resolver
406+
parallel
407+
parser
408+
sorbet-runtime
375409
paper_trail (12.1.0)
376410
activerecord (>= 5.2)
377411
request_store (~> 1.1)
@@ -446,6 +480,7 @@ GEM
446480
uber (< 0.2.0)
447481
request_store (1.5.0)
448482
rack (>= 1.4)
483+
resonad (1.4.0)
449484
retriable (3.1.2)
450485
rexml (3.2.5)
451486
rspec (3.10.0)
@@ -531,9 +566,11 @@ GEM
531566
actionpack (>= 3.1)
532567
railties (>= 3.1)
533568
slim (>= 3.0, < 5.0)
569+
smart_properties (1.16.3)
534570
sniffer (0.4.0)
535571
active_attr (>= 0.10.2)
536572
anyway_config (>= 1.0)
573+
sorbet-runtime (0.5.9327)
537574
sorcery (0.16.1)
538575
bcrypt (~> 3.1)
539576
oauth (~> 0.5, >= 0.5.5)
@@ -615,10 +652,13 @@ DEPENDENCIES
615652
debug (~> 1.1)
616653
google-cloud-storage
617654
graphql-schema_comparator
655+
interests!
656+
interests-dev!
618657
jwt
619658
listen
620659
lograge
621660
newrelic_rpm
661+
packwerk
622662
pg
623663
puma (~> 5.2, >= 5.2.2)
624664
rack-attack
@@ -643,7 +683,7 @@ DEPENDENCIES
643683
yabeda-sidekiq
644684

645685
RUBY VERSION
646-
ruby 2.7.2p137
686+
ruby 2.7.4p191
647687

648688
BUNDLED WITH
649689
2.2.31
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

3-
class ApplicationController < CoreBy::BaseController
3+
class ApplicationController < CoreBy::SDK::ApplicationController
44
layout "application"
55
end

config/inflections.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# List your inflections in this file instead of `inflections.rb`
2+
# See steps to set up custom inflections:
3+
# https://github.com/Shopify/packwerk/blob/main/USAGE.md#Inflections
4+
5+
acronym:
6+
- GraphQL
7+
- JWT
8+
- JSON
9+
- URL
10+
- SDK
11+
- API
12+
13+
uncountable:
14+
- auth

config/initializers/lograge.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def append_info_to_payload(payload)
1313
end
1414
end
1515

16-
ActiveSupport.on_load("core_by/base_controller") { include LogrageContext }
17-
ActiveSupport.on_load("core_by/api/base_controller") { include LogrageContext }
16+
ActiveSupport.on_load("core_by/sdk/application_controller") { include LogrageContext }
17+
ActiveSupport.on_load("core_by/sdk/api_controller") { include LogrageContext }
1818

1919
Rails.application.configure do
2020
lograge_ignore_params = (%w[controller action format id graphql] + config.filter_parameters.map(&:to_s)).uniq

db/schema.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2021_02_24_091411) do
13+
ActiveRecord::Schema.define(version: 2021_11_22_064326) do
1414

1515
# These are extensions that must be enabled in order to support this database
1616
enable_extension "plpgsql"
@@ -56,6 +56,22 @@
5656
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
5757
end
5858

59+
create_table "interests", force: :cascade do |t|
60+
t.text "name", null: false
61+
t.datetime "created_at", precision: 6, null: false
62+
t.datetime "updated_at", precision: 6, null: false
63+
t.index ["name"], name: "index_interests_on_name", unique: true
64+
end
65+
66+
create_table "user_interests", force: :cascade do |t|
67+
t.bigint "user_id", null: false
68+
t.bigint "interest_id", null: false
69+
t.datetime "created_at", precision: 6, null: false
70+
t.datetime "updated_at", precision: 6, null: false
71+
t.index ["interest_id"], name: "index_user_interests_on_interest_id"
72+
t.index ["user_id", "interest_id"], name: "index_user_interests_on_user_id_and_interest_id", unique: true
73+
end
74+
5975
create_table "users", force: :cascade do |t|
6076
t.string "login"
6177
t.string "first_name"
@@ -102,4 +118,6 @@
102118

103119
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
104120
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
121+
add_foreign_key "user_interests", "interests", on_delete: :cascade
122+
add_foreign_key "user_interests", "users", on_delete: :cascade
105123
end

0 commit comments

Comments
 (0)