bullet_train 1.2.10 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/account/two_factors_controller.rb +21 -5
  3. data/app/helpers/account/forms_helper.rb +3 -1
  4. data/app/javascript/controllers/clipboard_controller.js +1 -1
  5. data/app/javascript/controllers/connection_workflow_controller.js +7 -0
  6. data/app/javascript/controllers/desktop_menu_controller.js +26 -0
  7. data/app/javascript/controllers/index.js +4 -0
  8. data/app/javascript/index.js +2 -1
  9. data/app/javascript/support/turn.js +183 -0
  10. data/app/models/concerns/users/base.rb +1 -1
  11. data/app/views/account/invitations/_form.html.erb +2 -2
  12. data/app/views/account/memberships/_form.html.erb +2 -2
  13. data/app/views/account/memberships/_membership.html.erb +1 -1
  14. data/app/views/account/teams/_breadcrumbs.html.erb +12 -5
  15. data/app/views/account/teams/_team.html.erb +3 -23
  16. data/app/views/account/two_factors/verify.js.erb +1 -0
  17. data/app/views/devise/registrations/_two_factor.html.erb +29 -8
  18. data/app/views/devise/sessions/new.html.erb +4 -2
  19. data/app/views/layouts/docs.html.erb +7 -7
  20. data/app/views/showcase/engine/_stylesheets.html.erb +1 -0
  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 +5 -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 +21 -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/engine.rb +6 -0
  44. data/lib/bullet_train/version.rb +1 -1
  45. data/lib/bullet_train.rb +2 -1
  46. data/lib/colorizer.rb +1 -1
  47. data/lib/tasks/bullet_train_tasks.rake +29 -12
  48. metadata +35 -9
  49. data/app/controllers/turbo_devise_controller.rb +0 -19
  50. data/app/views/account/invitations/_invitation.json.jbuilder +0 -7
  51. data/app/views/account/invitations/index.json.jbuilder +0 -1
  52. data/app/views/account/invitations/show.json.jbuilder +0 -1
  53. data/app/views/account/teams/_team.json.jbuilder +0 -9
  54. data/app/views/account/teams/index.json.jbuilder +0 -1
  55. 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.
@@ -13,6 +13,12 @@ rescue LoadError
13
13
  # Devise isn't in the Gemfile, and we don't have any other load order dependencies.
14
14
  end
15
15
 
16
+ begin
17
+ # Similarly we need to hoist showcase-rails, so our view paths can override Showcase.
18
+ require "showcase-rails"
19
+ rescue LoadError
20
+ end
21
+
16
22
  module BulletTrain
17
23
  class Engine < ::Rails::Engine
18
24
  end
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.2.10"
2
+ VERSION = "1.2.12"
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.12
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-03-01 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
@@ -290,6 +304,20 @@ dependencies:
290
304
  - - "~>"
291
305
  - !ruby/object:Gem::Version
292
306
  version: '0.1'
307
+ - !ruby/object:Gem::Dependency
308
+ name: showcase-rails
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - ">="
312
+ - !ruby/object:Gem::Version
313
+ version: '0'
314
+ type: :runtime
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - ">="
319
+ - !ruby/object:Gem::Version
320
+ version: '0'
293
321
  - !ruby/object:Gem::Dependency
294
322
  name: premailer-rails
295
323
  requirement: !ruby/object:Gem::Requirement
@@ -465,7 +493,6 @@ files:
465
493
  - app/controllers/concerns/sessions/controller_base.rb
466
494
  - app/controllers/registrations_controller.rb
467
495
  - app/controllers/sessions_controller.rb
468
- - app/controllers/turbo_devise_controller.rb
469
496
  - app/helpers/account/buttons_helper.rb
470
497
  - app/helpers/account/dates_helper.rb
471
498
  - app/helpers/account/forms_helper.rb
@@ -486,6 +513,8 @@ files:
486
513
  - app/javascript/controllers/bulk_action_form_controller.js
487
514
  - app/javascript/controllers/bulk_actions_controller.js
488
515
  - app/javascript/controllers/clipboard_controller.js
516
+ - app/javascript/controllers/connection_workflow_controller.js
517
+ - app/javascript/controllers/desktop_menu_controller.js
489
518
  - app/javascript/controllers/form_controller.js
490
519
  - app/javascript/controllers/index.js
491
520
  - app/javascript/controllers/mobile_menu_controller.js
@@ -493,6 +522,7 @@ files:
493
522
  - app/javascript/controllers/text_toggle_controller.js
494
523
  - app/javascript/electron/index.js
495
524
  - app/javascript/index.js
525
+ - app/javascript/support/turn.js
496
526
  - app/mailers/concerns/mailers/base.rb
497
527
  - app/mailers/devise_mailer.rb
498
528
  - app/mailers/user_mailer.rb
@@ -513,11 +543,8 @@ files:
513
543
  - app/models/users.rb
514
544
  - app/views/account/invitations/_breadcrumbs.html.erb
515
545
  - app/views/account/invitations/_form.html.erb
516
- - app/views/account/invitations/_invitation.json.jbuilder
517
- - app/views/account/invitations/index.json.jbuilder
518
546
  - app/views/account/invitations/new.html.erb
519
547
  - app/views/account/invitations/show.html.erb
520
- - app/views/account/invitations/show.json.jbuilder
521
548
  - app/views/account/memberships/_breadcrumbs.html.erb
522
549
  - app/views/account/memberships/_fields.html.erb
523
550
  - app/views/account/memberships/_form.html.erb
@@ -536,15 +563,13 @@ files:
536
563
  - app/views/account/teams/_index.html.erb
537
564
  - app/views/account/teams/_menu_item.html.erb
538
565
  - app/views/account/teams/_team.html.erb
539
- - app/views/account/teams/_team.json.jbuilder
540
566
  - app/views/account/teams/edit.html.erb
541
567
  - app/views/account/teams/index.html.erb
542
- - app/views/account/teams/index.json.jbuilder
543
568
  - app/views/account/teams/new.html.erb
544
569
  - app/views/account/teams/show.html.erb
545
- - app/views/account/teams/show.json.jbuilder
546
570
  - app/views/account/two_factors/create.js.erb
547
571
  - app/views/account/two_factors/destroy.js.erb
572
+ - app/views/account/two_factors/verify.js.erb
548
573
  - app/views/account/users/_breadcrumbs.html.erb
549
574
  - app/views/account/users/_fields.html.erb
550
575
  - app/views/account/users/_form.html.erb
@@ -572,6 +597,7 @@ files:
572
597
  - app/views/layouts/docs.html.erb
573
598
  - app/views/layouts/mailer.html.erb
574
599
  - app/views/public/home/docs.html.erb
600
+ - app/views/showcase/engine/_stylesheets.html.erb
575
601
  - app/views/user_mailer/invited.html.erb
576
602
  - app/views/user_mailer/welcome.html.erb
577
603
  - config/initializers/concerns/inflections_base.rb
@@ -1,19 +0,0 @@
1
- # NOTE: This is a workaround to get Devise working with Turbo
2
- class TurboDeviseController < ApplicationController
3
- class Responder < ActionController::Responder
4
- def to_turbo_stream
5
- controller.render(options.merge(formats: :html))
6
- rescue ActionView::MissingTemplate => error
7
- if get?
8
- raise error
9
- elsif has_errors? && default_action
10
- render rendering_options.merge(formats: :html, status: :unprocessable_entity)
11
- else
12
- redirect_to navigation_location
13
- end
14
- end
15
- end
16
-
17
- self.responder = Responder
18
- respond_to :html, :turbo_stream
19
- end
@@ -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