kern 0.5.0 → 0.7.0

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +13 -2
  4. data/README.md +15 -13
  5. data/Rakefile +3 -3
  6. data/app/assets/builds/tailwind.kern.css +1749 -0
  7. data/app/controllers/kern/billing_profiles/subscriptions_controller.rb +37 -0
  8. data/app/controllers/kern/billing_profiles/subscriptions_controller.rb.tt +37 -0
  9. data/app/controllers/kern/settings/subscriptions_controller.rb +6 -0
  10. data/app/controllers/kern/signups_controller.rb +1 -1
  11. data/app/models/billing_profile/subscription.rb +16 -0
  12. data/app/models/billing_profile.rb +7 -0
  13. data/app/models/session.rb +1 -1
  14. data/app/models/signup.rb +1 -1
  15. data/app/models/user.rb +1 -1
  16. data/app/models/workspace/access.rb +3 -0
  17. data/app/models/workspace/access.rb.tt +10 -0
  18. data/app/models/workspace/billable.rb +16 -0
  19. data/app/models/workspace/feature_access.rb +28 -0
  20. data/app/models/workspace/members.rb +9 -7
  21. data/app/models/workspace/setup.rb +5 -3
  22. data/app/models/workspace.rb +2 -0
  23. data/app/views/components/_dialog.html.erb +36 -0
  24. data/app/views/kern/pages/welcome.html.erb +10 -6
  25. data/app/views/kern/settings/_cards.html.erb +11 -3
  26. data/app/views/kern/settings/subscriptions/_plan.html.erb +35 -0
  27. data/app/views/kern/settings/subscriptions/show.html.erb +11 -0
  28. data/app/views/kern/settings/users/show.html.erb +2 -2
  29. data/app/views/kern/signups/new.html.erb +2 -0
  30. data/app/views/layouts/kern/application.html.erb +4 -2
  31. data/app/views/layouts/kern/application.html.erb.tt +2 -1
  32. data/app/views/layouts/kern/auth.html.erb +2 -2
  33. data/app/webhooks/stripe/base.rb +31 -0
  34. data/app/webhooks/stripe/checkout_session_completed.rb +46 -0
  35. data/app/webhooks/stripe/customer_subscription_deleted.rb +20 -0
  36. data/app/webhooks/stripe/customer_subscription_updated.rb +33 -0
  37. data/bin/release +2 -3
  38. data/config/initializers/stripe.rb +5 -0
  39. data/config/initializers/stripe.rb.tt +3 -0
  40. data/config/routes.rb +4 -0
  41. data/db/migrate/20250101000007_create_billing_profiles.rb +14 -0
  42. data/db/migrate/20250101000008_create_billing_profile_subscriptions.rb +20 -0
  43. data/lib/generators/kern/feature/USAGE +1 -0
  44. data/lib/generators/kern/feature/feature_generator.rb +82 -19
  45. data/lib/generators/kern/install/install_generator.rb +43 -7
  46. data/lib/generators/kern/install/templates/POST_INSTALL +25 -0
  47. data/lib/generators/kern/install/templates/configurations/plans.yml +43 -0
  48. data/lib/generators/kern/install/templates/configurations/stripe.yml +11 -0
  49. data/lib/generators/kern/layouts/layouts_generator.rb +12 -0
  50. data/lib/kern/version.rb +1 -1
  51. metadata +27 -5
  52. data/app/assets/builds/tailwind.css +0 -2
  53. data/lib/generators/kern/views/USAGE +0 -22
  54. data/lib/generators/kern/views/views_generator.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51b072139e6f1ddd51d9f6ed4d54b6b86766cbebe5c47ba442bdf3e6b7dc4682
4
- data.tar.gz: faa1c2937aff2ae45731f0f519d010a216215c5b1d1f61786aa53205872cb286
3
+ metadata.gz: d18817224e28d4f7ed96d2d6c805ee1a9a5ab6afc6c6b052ed661d0ac35949bc
4
+ data.tar.gz: 4261479514032c6e87caccd6b59c9e7d5fbfa3ab68a9a903d808f0021121e4a1
5
5
  SHA512:
6
- metadata.gz: 0d3ebbe105034fd6f4fcedfeda2df9e5a177ffdc9e358a996a3bf28cff52b9a70506cee37bbc6a90749029e6d84102c2f9e9fbb4d3fb6c10be6cce56cba5596f
7
- data.tar.gz: 768a29e1c27f2d72caff3700ebd14dea167be3b4bc534b9a74a980180d8f04fe1ac99578e1fc80fa959e84e3cda49e5defd8b7c77995fa2d1d0b6418ebe05b60
6
+ metadata.gz: b68dd99d028916c30b5b44f5b85a7890cfade3185bb4ec6ca26a061f3d6027ddede1476b41cbc1189bd15df2d24d1aa6852731a4d702558e5c1807e85b54d977
7
+ data.tar.gz: 2d00f1333f735d2ef44d10f72d9a560b2cd074596527f3fb67a074f23b46ba9c5cb8574defb555ca2844f3a590dfb9d00d50814d85326d94d6cc158c73ac41e8
data/Gemfile CHANGED
@@ -10,6 +10,8 @@ gem "puma"
10
10
  gem "sqlite3"
11
11
  gem "tailwindcss-rails"
12
12
  gem "turbo-rails"
13
+ gem "stripe"
14
+ gem "rails_vault"
13
15
 
14
16
  group :development do
15
17
  gem "standard", "~> 1.50.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kern (0.5.0)
4
+ kern (0.7.0)
5
5
  rails (>= 8.0.0)
6
6
 
7
7
  GEM
@@ -194,6 +194,9 @@ GEM
194
194
  rails-html-sanitizer (1.6.2)
195
195
  loofah (~> 2.21)
196
196
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
197
+ rails_vault (0.1.0)
198
+ rails (>= 7.2.2)
199
+ store_attribute (>= 1.3)
197
200
  railties (8.1.1)
198
201
  actionpack (= 8.1.1)
199
202
  activesupport (= 8.1.1)
@@ -252,7 +255,10 @@ GEM
252
255
  standard-performance (1.9.0)
253
256
  lint_roller (~> 1.1)
254
257
  rubocop-performance (~> 1.26.0)
258
+ store_attribute (2.0.1)
259
+ activerecord (>= 6.1)
255
260
  stringio (3.1.9)
261
+ stripe (18.0.1)
256
262
  tailwindcss-rails (4.4.0)
257
263
  railties (>= 7.0.0)
258
264
  tailwindcss-ruby (~> 4.0)
@@ -300,9 +306,11 @@ DEPENDENCIES
300
306
  propshaft
301
307
  puma
302
308
  rails (~> 8.1.0)
309
+ rails_vault
303
310
  rake (~> 13.3.0)
304
311
  sqlite3
305
312
  standard (~> 1.50.0)
313
+ stripe
306
314
  tailwindcss-rails
307
315
  turbo-rails
308
316
 
@@ -337,7 +345,7 @@ CHECKSUMS
337
345
  io-console (0.8.1) sha256=1e15440a6b2f67b6ea496df7c474ed62c860ad11237f29b3bd187f054b925fcb
338
346
  irb (1.15.3) sha256=4349edff1efa7ff7bfd34cb9df74a133a588ba88c2718098b3b4468b81184aaa
339
347
  json (2.17.1) sha256=e0e4824541336a44915436f53e7ea74c687314fb8f88080fa1456f6a34ead92e
340
- kern (0.5.0)
348
+ kern (0.7.0)
341
349
  language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
342
350
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
343
351
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
@@ -375,6 +383,7 @@ CHECKSUMS
375
383
  rails (8.1.1) sha256=877509b7aef309239978685883097d2c03e21383a50a3f78882cf9b3b5c136f7
376
384
  rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d
377
385
  rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560
386
+ rails_vault (0.1.0) sha256=ac98a27a1ef563735948ba5278ec2da8d2cebfab843bea8ee27dfdcbbe79dda5
378
387
  railties (8.1.1) sha256=fb0c7038b147bea41bf6697fa443ff1c5c47d3bb1eedd9ecf1bceeb90efcb868
379
388
  rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
380
389
  rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
@@ -397,7 +406,9 @@ CHECKSUMS
397
406
  standard (1.50.0) sha256=b6c67f61fd6cedeec90ee338c6e913d9ccc4c467660ad1575da8aa6ba10f4aec
398
407
  standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
399
408
  standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
409
+ store_attribute (2.0.1) sha256=643655e4800655b58379e8b01bd524f5586093a9d88698483ac8762cda25b5ab
400
410
  stringio (3.1.9) sha256=c111af13d3a73eab96a3bc2655ecf93788d13d28cb8e25c1dcbff89ace885121
411
+ stripe (18.0.1) sha256=9be1f8e286b9046591496d09b83c48b3c5256b9864d67076baac3985d0cc4f22
401
412
  tailwindcss-rails (4.4.0) sha256=efa2961351a52acebe616e645a81a30bb4f27fde46cc06ce7688d1cd1131e916
402
413
  tailwindcss-ruby (4.1.16) sha256=d30e4713152bb89ebe1fddb5b5f9b31d7755bf5576453e601eb58b19174c48c0
403
414
  tailwindcss-ruby (4.1.16-aarch64-linux-gnu) sha256=916554206b47b4218ba9130ee369687a6546fba0224b7168f118e4f955b2f97e
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Kern
2
2
 
3
- Rails engine that handles the SaaS foundation: authentication, team invitations, subscription/billing, and common partials. Skip the boilerplate and start shipping the actual product. Launch faster.
3
+ Rails engine that handles the SaaS foundation: authentication, team invitations, subscription/billing, and common partials. Skip the boilerplate and start shipping the actual product.
4
4
 
5
5
 
6
6
  <table>
@@ -15,6 +15,11 @@ Rails engine that handles the SaaS foundation: authentication, team invitations,
15
15
  <img src="https://raw.githubusercontent.com/Rails-Designer/kern/HEAD/.github/kern__dashboard.jpg" alt="Dashboard" width="400">
16
16
  </a>
17
17
  </td>
18
+ <td>
19
+ <a href="https://raw.githubusercontent.com/Rails-Designer/kern/HEAD/.github/kern__subscriptions.jpg" target="_blank">
20
+ <img src="https://raw.githubusercontent.com/Rails-Designer/kern/HEAD/.github/kern__subscriptions.jpg" alt="Subscriptions" width="400">
21
+ </a>
22
+ </td>
18
23
  </tr>
19
24
  </table>
20
25
 
@@ -72,10 +77,7 @@ Kern works out of the box after installation. All features are available immedia
72
77
 
73
78
  ### Generators
74
79
 
75
- If you want to customize any available view or feature, you can run:
76
-
77
- - `bin/rails generate kern:views`;
78
- - `bin/rails generate kern:feature`.
80
+ If you want to customize any available feature (e.g. sign up, log in, etc.), you can run: `bin/rails generate kern:feature`.
79
81
 
80
82
  Append `--help` to see the generator's help.
81
83
 
@@ -105,12 +107,12 @@ Update user's email and password.
105
107
 
106
108
  ### Multi-tenancy
107
109
 
108
- By default a `Workspace` record is created upon sign up. Each user is associated to it using a `Member` join table. Next to that: each `Member` can have multiple `Role`'s you can use to determine if they are authorized.
110
+ By default a `Workspace` record is created upon sign up. Each `User` is associated to it using a `Member` join table. Each `Member` can have multiple `Role`'s you can use to authorize if they should have access (`Current.member.has_role? :owner`).
109
111
 
110
112
 
111
113
  ### Billing & subscriptions using Stripe
112
114
 
113
- Following [Rails Designer's Stripe Billing set up](https://railsdesigner.com/saas/billing-with-stripe/), offer subscriptions right away.
115
+ Following [Rails Designer's Stripe Billing set up](https://railsdesigner.com/saas/billing-with-stripe/), offer subscriptions right away. Just update `config/configurations/plans.yml` and add your Stripe API key and Signing secret to your credentials.
114
116
 
115
117
 
116
118
  ### Team invitations
@@ -118,7 +120,7 @@ Following [Rails Designer's Stripe Billing set up](https://railsdesigner.com/saa
118
120
  Add more users to your `Workspace`, update roles or remove them again.
119
121
 
120
122
 
121
- ### Form Builder
123
+ ### Form builder
122
124
 
123
125
  Pulled from [Rails Designer's Components](https://railsdesigner.com/components/), the included Form Builder lets you quicly build beautiful forms. Including a magic `input` helper that works like this:
124
126
 
@@ -131,13 +133,13 @@ Pulled from [Rails Designer's Components](https://railsdesigner.com/components/)
131
133
  ```
132
134
 
133
135
 
134
- ### Component Helper
136
+ ### Component helper
135
137
 
136
138
  Some basic components are included like:
137
139
 
138
140
  - container; keep all your app's content in check
139
141
  - heading; have consistent headings for each screen
140
- - enhanced dialog element (works with Turbo Frames and can be shown as a `modal` or a `slider`)
142
+ - enhanced dialog element (works with Turbo Frames and, includes `centered` or a `drawer` variants)
141
143
  - flash messages (notifiy your users from the bottom-right)
142
144
 
143
145
  These are built using vanilla Rails, as [described in this article]() (`component` helper included).
@@ -155,17 +157,17 @@ When using Turbo Stream responses, use `turbo_stream.notify "Updated"` to notifi
155
157
 
156
158
  ## Rails Icons support
157
159
 
158
- The application/dashboard layout and the Form Builder have support for [Rails Icons](https://github.com/Rails-Desiger/rails_icons).
160
+ The application/dashboard layout and the Form Builder have optional support for [Rails Icons](https://github.com/Rails-Desiger/rails_icons). Run `bin/rails generate rails_icons:install --libraries=phosphor` to enable them.
159
161
 
160
162
 
161
163
  ### Sluggable concern
162
164
 
163
- If you do not want to expose the record's primary key, use the `Sluggable` concern. Include it in the model, make sure it has a (unique) `slug` column, and look up records now using `ModelName.sluggable.find(params[:id])`.
165
+ If you do not want to expose the record's primary key, use the `Sluggable` concern. Include it in the model, make sure it has a (unique) `slug` column, and look up records using `ModelName.sluggable.find(params[:id])`.
164
166
 
165
167
 
166
168
  ### Configuration
167
169
 
168
- Little syntactic sugar on top of Rails' `config_for` as explained [in this article](https://railsdesigner.com/saas/configuration/). Keep configuration together in, e.g. `config/configuration/urls.yml` and call each value like `Config::Urls.docs`.^
170
+ Little syntactic sugar on top of Rails' `config_for` as explained [in this article](https://railsdesigner.com/saas/configuration/). Keep configuration together in, e.g. `config/configuration/urls.yml` and call each value like `Config::Urls.docs`.
169
171
 
170
172
 
171
173
  ## Contributing
data/Rakefile CHANGED
@@ -16,12 +16,12 @@ namespace :assets do
16
16
  desc "Build Tailwind CSS for distribution"
17
17
  task :precompile do
18
18
  Dir.chdir("test/dummy") do
19
- sh "bin/rails tailwindcss:build"
19
+ sh "bundle exec tailwindcss -i app/assets/tailwind/application.css -o app/assets/builds/tailwind.kern.css"
20
20
 
21
21
  FileUtils.mkdir_p "../../app/assets/builds"
22
22
  FileUtils.cp(
23
- "app/assets/builds/tailwind.css",
24
- "../../app/assets/builds/tailwind.css"
23
+ "app/assets/builds/tailwind.kern.css",
24
+ "../../app/assets/builds/tailwind.kern.css"
25
25
  )
26
26
  end
27
27
  end