bullet_train 1.2.10 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/account/two_factors_controller.rb +21 -5
  3. data/app/controllers/turbo_devise_controller.rb +1 -1
  4. data/app/helpers/account/forms_helper.rb +3 -1
  5. data/app/javascript/controllers/clipboard_controller.js +1 -1
  6. data/app/javascript/controllers/connection_workflow_controller.js +7 -0
  7. data/app/javascript/controllers/desktop_menu_controller.js +26 -0
  8. data/app/javascript/controllers/index.js +4 -0
  9. data/app/javascript/index.js +2 -1
  10. data/app/javascript/support/turn.js +183 -0
  11. data/app/models/concerns/users/base.rb +1 -1
  12. data/app/views/account/invitations/_form.html.erb +2 -2
  13. data/app/views/account/memberships/_form.html.erb +2 -2
  14. data/app/views/account/memberships/_membership.html.erb +1 -1
  15. data/app/views/account/teams/_breadcrumbs.html.erb +12 -5
  16. data/app/views/account/teams/_team.html.erb +4 -4
  17. data/app/views/account/two_factors/verify.js.erb +1 -0
  18. data/app/views/devise/registrations/_two_factor.html.erb +29 -8
  19. data/app/views/devise/sessions/new.html.erb +4 -2
  20. data/app/views/layouts/docs.html.erb +7 -7
  21. data/config/locales/en/teams.en.yml +2 -0
  22. data/config/locales/en/users.en.yml +8 -1
  23. data/config/routes.rb +3 -1
  24. data/docs/action-models.md +5 -5
  25. data/docs/api/versioning.md +0 -2
  26. data/docs/api.md +4 -4
  27. data/docs/application-options.md +1 -1
  28. data/docs/billing/usage.md +94 -16
  29. data/docs/field-partials.md +20 -20
  30. data/docs/font-awesome-pro.md +1 -1
  31. data/docs/getting-started.md +3 -3
  32. data/docs/i18n.md +3 -3
  33. data/docs/indirection.md +6 -4
  34. data/docs/namespacing.md +1 -1
  35. data/docs/onboarding.md +8 -8
  36. data/docs/overriding.md +1 -1
  37. data/docs/permissions.md +1 -1
  38. data/docs/seeds.md +1 -1
  39. data/docs/testing.md +2 -1
  40. data/docs/themes.md +18 -11
  41. data/docs/tunneling.md +2 -2
  42. data/docs/upgrades.md +2 -1
  43. data/lib/bullet_train/version.rb +1 -1
  44. data/lib/bullet_train.rb +2 -1
  45. data/lib/colorizer.rb +1 -1
  46. data/lib/tasks/bullet_train_tasks.rake +29 -12
  47. metadata +20 -8
  48. data/app/views/account/invitations/_invitation.json.jbuilder +0 -7
  49. data/app/views/account/invitations/index.json.jbuilder +0 -1
  50. data/app/views/account/invitations/show.json.jbuilder +0 -1
  51. data/app/views/account/teams/_team.json.jbuilder +0 -9
  52. data/app/views/account/teams/index.json.jbuilder +0 -1
  53. data/app/views/account/teams/show.json.jbuilder +0 -1
data/docs/tunneling.md CHANGED
@@ -4,14 +4,14 @@ Before your application can take advantage of features that depend on incoming w
4
4
 
5
5
  ## Use a Paid Plan
6
6
 
7
- You should specifically sign up for a paid account. Although ngrok offers a free plan, their $25/month paid plan will allow you to reserve a custom subdomain for reuse each time you spin up your tunnel. This is a critical productivity improvement, because in practice you'll end up configuring your tunnel URL in a bunch of different places like `config/application.yml` but also in external systems like when you [configure payment providers to deliver webhooks to you](docs/billing/stripe.md).
7
+ You should specifically sign up for a paid account. Although ngrok offers a free plan, their $25/month paid plan will allow you to reserve a custom subdomain for reuse each time you spin up your tunnel. This is a critical productivity improvement, because in practice you'll end up configuring your tunnel URL in a bunch of different places like `config/application.yml` but also in external systems like when you [configure payment providers to deliver webhooks to you](/docs/billing/stripe.md).
8
8
 
9
9
  ## Usage
10
10
 
11
11
  Once you have ngrok installed, you can start your tunnel like so, replacing `YOUR-SUBDOMAIN` with whatever subdomain you reserved in your ngrok account:
12
12
 
13
13
  ```
14
- ngrok http 3000 -subdomain=YOUR-SUBDOMAIN
14
+ ngrok http 3000 --subdomain=YOUR-SUBDOMAIN
15
15
  ```
16
16
 
17
17
  ## Updating Your Configuration
data/docs/upgrades.md CHANGED
@@ -43,7 +43,7 @@ git checkout -b updating-starter-repo
43
43
  git merge starter-repo/main
44
44
  ```
45
45
 
46
- It's quite possible you'll get some merge conflicts at this point. No big deal! Just go through and resolve them like you would if you were integrating code from another developer on your team. We tend to comment our code heavily, but if you have any questions about the code you're trying to understand, let us know on Slack!
46
+ It's quite possible you'll get some merge conflicts at this point. No big deal! Just go through and resolve them like you would if you were integrating code from another developer on your team. We tend to comment our code heavily, but if you have any questions about the code you're trying to understand, let us know on Discord!
47
47
 
48
48
  ```
49
49
  git diff
@@ -55,6 +55,7 @@ git commit -m "Upgrading Bullet Train."
55
55
 
56
56
  ```
57
57
  rails test
58
+ rails test:system
58
59
  ```
59
60
 
60
61
  ### 6. Merge into `main` and delete the branch.
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.2.10"
2
+ VERSION = "1.2.11"
3
3
  end
data/lib/bullet_train.rb CHANGED
@@ -13,6 +13,7 @@ require "colorizer"
13
13
  require "bullet_train/core_ext/string_emoji_helper"
14
14
 
15
15
  require "devise"
16
+ require "xxhash"
16
17
  # require "devise-two-factor"
17
18
  # require "rqrcode"
18
19
  require "cancancan"
@@ -115,7 +116,7 @@ def cloudinary_enabled?
115
116
  end
116
117
 
117
118
  def two_factor_authentication_enabled?
118
- ENV["TWO_FACTOR_ENCRYPTION_KEY"].present?
119
+ Rails.application.credentials.active_record_encryption&.primary_key.present?
119
120
  end
120
121
 
121
122
  # Don't redefine this if an application redefines it locally.
data/lib/colorizer.rb CHANGED
@@ -11,7 +11,7 @@ module Colorizer
11
11
  end
12
12
 
13
13
  def colorize_similarly(object, saturation, lightness)
14
- rnd = ((object.hash * 7) % 100) * 0.01
14
+ rnd = ((XXhash.xxh64(object) * 7) % 100) * 0.01
15
15
  hsl_to_rgb(rnd, saturation, lightness)
16
16
  end
17
17
 
@@ -218,15 +218,18 @@ namespace :bullet_train do
218
218
  def set_core_gems(flag, framework_packages)
219
219
  packages = framework_packages.keys
220
220
  gemfile_lines = File.readlines("./Gemfile")
221
- new_lines = gemfile_lines.map do |line|
222
- packages.each do |package|
221
+
222
+ packages.each do |package|
223
+ original_path = "gem \"#{package}\""
224
+ local_path = "gem \"#{package}\", path: \"local/bullet_train-core/#{package}\""
225
+ match_found = false
226
+
227
+ new_lines = gemfile_lines.map do |line|
223
228
  if line.match?(/"#{package}"/)
224
- original_path = "gem \"#{package}\""
225
- local_path = "gem \"#{package}\", path: \"local/bullet_train-core/#{package}\""
229
+ match_found = true
226
230
 
227
- case flag
228
- when "--link"
229
- if `cat Gemfile | grep "gem \\\"#{package}\\\", path: \\\"local/#{package}\\\""`.chomp.present?
231
+ if flag == "--link"
232
+ if `cat Gemfile | grep "gem \\\"#{package}\\\", path: \\\"local/bullet_train-core/#{package}\\\""`.chomp.present?
230
233
  puts "#{package} is already linked to a checked out copy in `local` in the `Gemfile`.".green
231
234
  elsif `cat Gemfile | grep "gem \\\"#{package}\\\","`.chomp.present?
232
235
  puts "#{package} already has some sort of alternative source configured in the `Gemfile`.".yellow
@@ -235,18 +238,32 @@ namespace :bullet_train do
235
238
  puts "#{package} is directly present in the `Gemfile`, so we'll update that line.".green
236
239
  line.gsub!(original_path, local_path)
237
240
  end
238
- break
239
- when "--reset"
241
+ elsif flag == "--reset"
240
242
  line.gsub!(local_path, original_path)
241
243
  puts "Resetting '#{package}' package in the Gemfile...".blue
242
- break
243
244
  end
244
245
  end
246
+ line
245
247
  end
246
- line
248
+
249
+ # Add/Remove any packages that aren't primarily in the Gemfile.
250
+ if flag == "--link"
251
+ unless match_found
252
+ puts "Could not find #{package}. Adding to the end of the Gemfile.".blue
253
+ new_lines << "#{local_path}\n"
254
+ end
255
+ elsif flag == "--reset"
256
+ gem_regexp = /bullet_train-[a-z|A-Z_-]+/
257
+ while new_lines.last.match?(gem_regexp)
258
+ puts "Removing #{new_lines.last.scan(gem_regexp).first} from the Gemfile.".yellow
259
+ new_lines.pop
260
+ end
261
+ end
262
+
263
+ gemfile_lines = new_lines
247
264
  end
248
265
 
249
- File.write("./Gemfile", new_lines.join)
266
+ File.write("./Gemfile", gemfile_lines.join)
250
267
  end
251
268
 
252
269
  def set_npm_package(flag, package)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-31 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: xxhash
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: cancancan
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -486,6 +500,8 @@ files:
486
500
  - app/javascript/controllers/bulk_action_form_controller.js
487
501
  - app/javascript/controllers/bulk_actions_controller.js
488
502
  - app/javascript/controllers/clipboard_controller.js
503
+ - app/javascript/controllers/connection_workflow_controller.js
504
+ - app/javascript/controllers/desktop_menu_controller.js
489
505
  - app/javascript/controllers/form_controller.js
490
506
  - app/javascript/controllers/index.js
491
507
  - app/javascript/controllers/mobile_menu_controller.js
@@ -493,6 +509,7 @@ files:
493
509
  - app/javascript/controllers/text_toggle_controller.js
494
510
  - app/javascript/electron/index.js
495
511
  - app/javascript/index.js
512
+ - app/javascript/support/turn.js
496
513
  - app/mailers/concerns/mailers/base.rb
497
514
  - app/mailers/devise_mailer.rb
498
515
  - app/mailers/user_mailer.rb
@@ -513,11 +530,8 @@ files:
513
530
  - app/models/users.rb
514
531
  - app/views/account/invitations/_breadcrumbs.html.erb
515
532
  - app/views/account/invitations/_form.html.erb
516
- - app/views/account/invitations/_invitation.json.jbuilder
517
- - app/views/account/invitations/index.json.jbuilder
518
533
  - app/views/account/invitations/new.html.erb
519
534
  - app/views/account/invitations/show.html.erb
520
- - app/views/account/invitations/show.json.jbuilder
521
535
  - app/views/account/memberships/_breadcrumbs.html.erb
522
536
  - app/views/account/memberships/_fields.html.erb
523
537
  - app/views/account/memberships/_form.html.erb
@@ -536,15 +550,13 @@ files:
536
550
  - app/views/account/teams/_index.html.erb
537
551
  - app/views/account/teams/_menu_item.html.erb
538
552
  - app/views/account/teams/_team.html.erb
539
- - app/views/account/teams/_team.json.jbuilder
540
553
  - app/views/account/teams/edit.html.erb
541
554
  - app/views/account/teams/index.html.erb
542
- - app/views/account/teams/index.json.jbuilder
543
555
  - app/views/account/teams/new.html.erb
544
556
  - app/views/account/teams/show.html.erb
545
- - app/views/account/teams/show.json.jbuilder
546
557
  - app/views/account/two_factors/create.js.erb
547
558
  - app/views/account/two_factors/destroy.js.erb
559
+ - app/views/account/two_factors/verify.js.erb
548
560
  - app/views/account/users/_breadcrumbs.html.erb
549
561
  - app/views/account/users/_fields.html.erb
550
562
  - app/views/account/users/_form.html.erb
@@ -1,7 +0,0 @@
1
- json.extract! invitation,
2
- :id,
3
- :email,
4
- # 🚅 super scaffolding will insert new fields above this line.
5
- :created_at,
6
- :updated_at
7
- json.url account_invitation_url(invitation, format: :json)
@@ -1 +0,0 @@
1
- json.array! @invitations, partial: "invitations/invitation", as: :invitation
@@ -1 +0,0 @@
1
- json.partial! "invitations/invitation", invitation: @invitation
@@ -1,9 +0,0 @@
1
- json.extract! team,
2
- :id,
3
- :name,
4
- :time_zone,
5
- :locale,
6
- # 🚅 super scaffolding will insert new fields above this line.
7
- :created_at,
8
- :updated_at
9
- json.url account_team_url(team, format: :json)
@@ -1 +0,0 @@
1
- json.array! @teams, partial: "teams/team", as: :team
@@ -1 +0,0 @@
1
- json.partial! "teams/team", team: @team