bullet_train 1.0.45 ā†’ 1.0.48

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 041e2b16ba7fe195c4622eca9f52ba3f2ece36e2ca4990e81091dcd7dce77f67
4
- data.tar.gz: 4343cfb1d33be84c52dd412e335d15928ad13afb9d8a95eddbc41b751452c335
3
+ metadata.gz: f97118eaaa7253406852b09625acb890ba8d2653e0266628795bde576044eec5
4
+ data.tar.gz: 47688fa0493151a13a4b5060efd32703c9bc9bfa5a4f13052519c6afb6a864a6
5
5
  SHA512:
6
- metadata.gz: fa1d5423f1a3b3ab31ac94b2c75b6d298b9c0fb670f70178a2aec8e8638e9adaf07d3e8c77a2bb0e99edcc79961407058cbf0807a7972fbc50c08e008312de45
7
- data.tar.gz: 7875607106a2cb2932a30a537717ac947e62121709a0389c2144be1f4c39366dbd799d5286d2548f8d2b513136992e1b526f5a66782eea4aebea0137ce2c3c9f
6
+ metadata.gz: 5c750045603680f1d1ffcff0bbc7ffb1e3d334ca6e280f2d4332c2d5270ae94228d0f230876f63223d5aeeca146b5678a8b6fb9ed6b0656b3fecb7b5a751f54e
7
+ data.tar.gz: 15a90ab25fa884ae6004423c6469d2dd974f08da0c88eae230cbd4e60bfb3c64af1011ff02c2bf6bfe1a732518324c8c55cb0898a10f88ca25e0c9e2059a21a8
data/README.md CHANGED
@@ -13,12 +13,12 @@ gem "bullet_train"
13
13
 
14
14
  And then execute:
15
15
  ```bash
16
- $ bundle
16
+ bundle
17
17
  ```
18
18
 
19
19
  Or install it yourself as:
20
20
  ```bash
21
- $ gem install bullet_train
21
+ gem install bullet_train
22
22
  ```
23
23
 
24
24
  ## Contributing
@@ -46,7 +46,7 @@ module Account::LocaleHelper
46
46
  begin
47
47
  super(key + "šŸ’£", options.except(:default))
48
48
  rescue I18n::MissingTranslationData => exception
49
- full_key = exception.message.rpartition(" ").last.gsub("šŸ’£", "")
49
+ full_key = exception.message.rpartition(" ").last.delete("šŸ’£")
50
50
  end
51
51
  end
52
52
  end
@@ -75,7 +75,7 @@ module Account::LocaleHelper
75
75
  end
76
76
  end
77
77
 
78
- return result
78
+ result
79
79
  end
80
80
 
81
81
  # like 't', but if the key isn't found, it returns nil.
@@ -2,7 +2,7 @@ module CurrentAttributes::Base
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- attribute :user, :team, :membership, :ability
5
+ attribute :user, :team, :membership, :ability, :context
6
6
 
7
7
  resets do
8
8
  Time.zone = nil
@@ -1,5 +1,5 @@
1
1
  class Invitation < ApplicationRecord
2
- include Invitations::Core
2
+ include Invitations::Base
3
3
  # šŸš… add concerns above.
4
4
 
5
5
  # šŸš… add belongs_to associations above.
@@ -1,5 +1,5 @@
1
1
  class Membership < ApplicationRecord
2
- include Memberships::Core
2
+ include Memberships::Base
3
3
  # šŸš… add concerns above.
4
4
 
5
5
  # šŸš… add belongs_to associations above.
data/app/models/team.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class Team < ApplicationRecord
2
- include Teams::Core
3
- include Webhooks::Outgoing::TeamSupport
2
+ include Teams::Base
3
+ # include Webhooks::Outgoing::TeamSupport
4
4
  # šŸš… add concerns above.
5
5
 
6
6
  # šŸš… add belongs_to associations above.
data/app/models/user.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class User < ApplicationRecord
2
- include Users::Core
2
+ include Users::Base
3
3
  # šŸš… add concerns above.
4
4
 
5
5
  # šŸš… add belongs_to associations above.
@@ -5,8 +5,8 @@ Bullet Train uses [Devise](https://github.com/heartcombo/devise) for authenticat
5
5
  Bullet Train registers its own slightly customized registration and session controllers for Devise. If you want to customize them further, you can simply eject those controllers from the framework and override them locally, like so:
6
6
 
7
7
  ```
8
- $ bin/resolve RegistrationsController --eject --open
9
- $ bin/resolve SessionsController --eject --open
8
+ bin/resolve RegistrationsController --eject --open
9
+ bin/resolve SessionsController --eject --open
10
10
  ```
11
11
 
12
12
  ## Customizing Views
@@ -11,45 +11,45 @@ If you're using Bullet Train for the first time, begin by learning these five im
11
11
  1. Use `rails g model` to create and `bin/super-scaffold` to scaffold a new model:
12
12
 
13
13
  ```
14
- $ rails g model Project team:references name:string
15
- $ bin/super-scaffold crud Project Team name:text_field
14
+ rails g model Project team:references name:string
15
+ bin/super-scaffold crud Project Team name:text_field
16
16
  ```
17
17
 
18
- In this example, `Team` refers to the immediate parent of the `Project` resource. For more details, just run `bin/super-scaffold` or [read the documentation](https://github.com/bullet-train-co/bullet_train-base/blob/main/docs/super-scaffolding.md).
18
+ In this example, `Team` refers to the immediate parent of the `Project` resource. For more details, just run `bin/super-scaffold` or [read the documentation](/docs/super-scaffolding.md).
19
19
 
20
20
  2. Use `rails g migration` and `bin/super-scaffold` to add a new field to a model you've already scaffolded:
21
21
 
22
22
  ```
23
- $ rails g migration add_description_to_projects description:text
24
- $ bin/super-scaffold crud-field Project description:trix_editor
23
+ rails g migration add_description_to_projects description:text
24
+ bin/super-scaffold crud-field Project description:trix_editor
25
25
  ```
26
26
 
27
- These first two points about Super Scaffolding are just the tip of the iceberg, so be sure to circle around and [read the full documentation](https://github.com/bullet-train-co/bullet_train-base/blob/main/docs/super-scaffolding.md).
27
+ These first two points about Super Scaffolding are just the tip of the iceberg, so be sure to circle around and [read the full documentation](/docs/super-scaffolding.md).
28
28
 
29
29
  3. Figure out which ERB views are powering something you see in the UI by:
30
30
 
31
31
  - Right clicking the element.
32
32
  - Selecting "Inspect Element".
33
- - Looking for the `<!--XRAY START ...-->` comment above the element you've selected.
33
+ - Looking for the `<!-- BEGIN ... -->` comment above the element you've selected.
34
34
 
35
35
  4. Figure out the full I18N translation key of any string on the page by adding `?show_locales=true` to the URL.
36
36
 
37
37
  5. Use `bin/resolve` to figure out where framework or theme things are coming from and eject them if you need to customize something locally:
38
38
 
39
39
  ```
40
- $ bin/resolve Users::Base
41
- $ bin/resolve en.account.teams.show.header --open
42
- $ bin/resolve shared/box --open --eject
40
+ bin/resolve Users::Base
41
+ bin/resolve en.account.teams.show.header --open
42
+ bin/resolve shared/box --open --eject
43
43
  ```
44
44
 
45
45
  Also, for inputs that can't be provided on the shell, there's an interactive mode where you can paste them:
46
46
 
47
47
  ```
48
- $ bin/resolve --interactive --eject --open
48
+ bin/resolve --interactive --eject --open
49
49
  ```
50
50
 
51
51
  And then paste any input, e.g.:
52
52
 
53
53
  ```
54
- <!--XRAY START 73 /Users/andrewculver/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bullet_train-themes-light-1.0.10/app/views/themes/light/commentary/_box.html.erb-->
54
+ <!-- BEGIN /Users/andrewculver/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bullet_train-themes-light-1.0.10/app/views/themes/light/commentary/_box.html.erb -->
55
55
  ```
data/docs/indirection.md CHANGED
@@ -27,20 +27,18 @@ Even in vanilla Rails development, when you're looking at a view file, the path
27
27
  `bin/resolve` makes it easy to figure out where where a partial is being served from:
28
28
 
29
29
  ```
30
- $ bin/resolve shared/box
30
+ bin/resolve shared/box
31
31
  ```
32
32
 
33
- ### Exposing Rendered Views with Xray
33
+ ### Exposing Rendered Views with Annotated Views
34
34
 
35
- > TODO Is this still true in Rails 7? Does it not do something like this by default now?
36
-
37
- If you're looking at a rendered view in the browser, it can be hard to know which file to open in order to make a change. To help, Bullet Train includes [Xray](https://github.com/brentd/xray-rails) by default, so you can right click on any element you see, select "Inspect Element", and you'll see comments in the HTML source telling you which file is powering a particular portion of the view, like this:
35
+ If you're looking at a rendered view in the browser, it can be hard to know which file to open in order to make a change. To help, Bullet Train enables `config.action_view.annotate_rendered_view_with_filenames` by default, so you can right click on any element you see, select "Inspect Element", and you'll see comments in the HTML source telling you which file is powering a particular portion of the view, like this:
38
36
 
39
37
  ```
40
- <!--XRAY START 90 /Users/andrewculver/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bullet_train-themes-light-1.0.10/app/views/themes/light/workflow/_box.html.erb-->
38
+ <!-- BEGIN /Users/andrewculver/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/bullet_train-themes-light-1.0.10/app/views/themes/light/workflow/_box.html.erb -->
41
39
  ```
42
40
 
43
- Note that in the example above, the view in question isn't actually coming from the application repository. Instead, it's being included from the `bullet_train-themes-light` package. For instructions on how to customize it, see [Overriding the Framework](/docs/override).
41
+ Note that in the example above, the view in question isn't actually coming from the application repository. Instead, it's being included from the `bullet_train-themes-light` package. For instructions on how to customize it, see [Overriding Framework Defaults](/docs/overriding.md).
44
42
 
45
43
  ### Drilling Down on Translation Keys
46
44
 
@@ -59,5 +57,5 @@ You can also log all the translation key for anything being rendered to the cons
59
57
  Once you have the full I18N translation key, you can use `bin/resolve` to figure out which package and file it's coming from. At that point, if you need to customize it, you can also use the `--eject` option to copy the the framework for customization in your local application:
60
58
 
61
59
  ```
62
- $ bin/resolve en.account.onboarding.user_details.edit.header --eject --open
60
+ bin/resolve en.account.onboarding.user_details.edit.header --eject --open
63
61
  ```
data/docs/namespacing.md CHANGED
@@ -7,5 +7,5 @@ Bullet Train comes preconfigured with an `Account` and controller and view names
7
7
  In Bullet Train applications with [multiple team types](/docs/teams.md), you may find it helpful to introduce additional controller and view namespaces to represent and organize user interfaces and experiences for certain team types that vary substantially from the `Account` namespace default. In Super Scaffolding, you can specify a namespace other than `Account` with the `--namespace` option, for example:
8
8
 
9
9
  ```
10
- $ bin/super-scaffold crud Event Team name:text_field --namespace=customers
10
+ bin/super-scaffold crud Event Team name:text_field --namespace=customers
11
11
  ```
data/docs/overriding.md CHANGED
@@ -12,7 +12,7 @@ For this reason, common points of extension like framework-provided models and c
12
12
 
13
13
  ```
14
14
  class User < ApplicationRecord
15
- include Users::Core
15
+ include Users::Base
16
16
 
17
17
  # ...
18
18
  end
@@ -1,4 +1,4 @@
1
- require 'io/wait'
1
+ require "io/wait"
2
2
 
3
3
  module BulletTrain
4
4
  class Resolver
@@ -13,28 +13,26 @@ module BulletTrain
13
13
  source_file = calculate_source_file_details
14
14
 
15
15
  if source_file[:absolute_path]
16
+ puts ""
16
17
  if source_file[:package_name].present?
17
- puts ""
18
18
  puts "Absolute path:".green
19
19
  puts " #{source_file[:absolute_path]}".green
20
20
  puts ""
21
21
  puts "Package name:".green
22
22
  puts " #{source_file[:package_name]}".green
23
- puts ""
24
23
  else
25
- puts ""
26
24
  puts "Project path:".green
27
25
  puts " #{source_file[:project_path]}".green
28
26
  puts ""
29
27
  puts "Note: If this file was previously ejected from a package, we can no longer see which package it came from. However, it should say at the top of the file where it was ejected from.".yellow
30
- puts ""
31
28
  end
29
+ puts ""
32
30
 
33
31
  if interactive && !eject
34
32
  puts "\nWould you like to eject the file into the local project? (y/n)\n"
35
33
  input = $stdin.gets
36
34
  $stdin.getc while $stdin.ready?
37
- if input.first.downcase == 'y'
35
+ if input.first.downcase == "y"
38
36
  eject = true
39
37
  end
40
38
  end
@@ -46,7 +44,7 @@ module BulletTrain
46
44
  else
47
45
  `mkdir -p #{source_file[:project_path].split("/")[0...-1].join("/")}`
48
46
  puts "Ejecting `#{source_file[:absolute_path]}` to `#{source_file[:project_path]}`".green
49
- File.open("#{source_file[:project_path]}", "w+") do |file|
47
+ File.open((source_file[:project_path]).to_s, "w+") do |file|
50
48
  case source_file[:project_path].split(".").last
51
49
  when "rb", "yml"
52
50
  file.puts "# Ejected from `#{source_file[:package_name]}`.\n\n"
@@ -69,13 +67,13 @@ module BulletTrain
69
67
  puts "\nWould you like to open `#{source_file[:absolute_path]}`? (y/n)\n"
70
68
  input = $stdin.gets
71
69
  $stdin.getc while $stdin.ready?
72
- if input.first.downcase == 'y'
70
+ if input.first.downcase == "y"
73
71
  open = true
74
72
  end
75
73
  end
76
74
 
77
75
  if open
78
- path = source_file[:package_name] ? source_file[:absolute_path] : "#{source_file[:project_path]}"
76
+ path = source_file[:package_name] ? source_file[:absolute_path] : (source_file[:project_path]).to_s
79
77
  puts "Opening `#{path}`.\n".green
80
78
  exec "open #{path}"
81
79
  end
@@ -121,25 +119,21 @@ module BulletTrain
121
119
  end
122
120
 
123
121
  def class_path
124
- begin
125
- @needle.constantize
126
- return Object.const_source_location(@needle).first
127
- rescue NameError => _
128
- return false
129
- end
122
+ @needle.constantize
123
+ Object.const_source_location(@needle).first
124
+ rescue NameError => _
125
+ false
130
126
  end
131
127
 
132
128
  def partial_path
133
- begin
134
- xray_path = ApplicationController.render(template: "bullet_train/partial_resolver", layout: nil, assigns: {needle: @needle}).lines[1].chomp
135
- if xray_path.match(/<!--XRAY START \d+ (.*)-->/)
136
- return $1
137
- else
138
- raise "It looks like Xray-rails isn't properly enabled?"
139
- end
140
- rescue ActionView::Template::Error => _
141
- return nil
129
+ annotated_path = ApplicationController.render(template: "bullet_train/partial_resolver", layout: nil, assigns: {needle: @needle}).lines[1].chomp
130
+ if annotated_path =~ /<!-- BEGIN (.*) -->/
131
+ $1
132
+ else
133
+ raise "It looks like `config.action_view.annotate_rendered_view_with_filenames` isn't enabled?"
142
134
  end
135
+ rescue ActionView::Template::Error => _
136
+ nil
143
137
  end
144
138
 
145
139
  def file_path
@@ -149,7 +143,7 @@ module BulletTrain
149
143
 
150
144
  def locale_path
151
145
  # This is a complete list of translation files provided by this app or any linked Bullet Train packages.
152
- (["#{Rails.root.to_s}/config/locales"] + `find ./tmp/gems/*`.lines.map(&:strip).map { |link| File.readlink(link) + "/config/locales" }).each do |locale_source|
146
+ (["#{Rails.root}/config/locales"] + `find ./tmp/gems/*`.lines.map(&:strip).map { |link| File.readlink(link) + "/config/locales" }).each do |locale_source|
153
147
  if File.exist?(locale_source)
154
148
  `find -L #{locale_source} | grep ".yml"`.lines.map(&:strip).each do |file_path|
155
149
  yaml = YAML.load_file(file_path, aliases: true)
@@ -161,7 +155,7 @@ module BulletTrain
161
155
  end
162
156
  end
163
157
 
164
- return nil
158
+ nil
165
159
  end
166
160
  end
167
161
  end
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.0.45"
2
+ VERSION = "1.0.48"
3
3
  end
@@ -1,13 +1,13 @@
1
- require 'io/wait'
1
+ require "io/wait"
2
2
 
3
3
  namespace :bt do
4
4
  desc "Symlink registered gems in `./tmp/gems` so their views, etc. can be inspected by Tailwind CSS."
5
- task :link => :environment do
6
- if Dir.exists?("tmp/gems")
5
+ task link: :environment do
6
+ if Dir.exist?("tmp/gems")
7
7
  puts "Removing previously linked gems."
8
8
  `rm -f tmp/gems/*`
9
9
  else
10
- if File.exists?("tmp/gems")
10
+ if File.exist?("tmp/gems")
11
11
  raise "A file named `tmp/gems` already exists? It has to be removed before we can create the required directory."
12
12
  end
13
13
 
@@ -42,8 +42,8 @@ namespace :bullet_train do
42
42
  input = $stdin.gets.strip
43
43
  $stdin.getc while $stdin.ready?
44
44
 
45
- # Extract absolute paths from XRAY comments.
46
- if input.match(/<!--XRAY START \d+ (.*)-->/)
45
+ # Extract absolute paths from annotated views.
46
+ if input =~ /<!-- BEGIN (.*) -->/
47
47
  input = $1
48
48
  end
49
49
 
@@ -53,7 +53,7 @@ namespace :bullet_train do
53
53
  if ARGV.first.present?
54
54
  BulletTrain::Resolver.new(ARGV.first).run(eject: ARGV.include?("--eject"), open: ARGV.include?("--open"), force: ARGV.include?("--force"), interactive: ARGV.include?("--interactive"))
55
55
  else
56
- $stderr.puts "\nšŸš… Usage: `bin/resolve [path, partial, or URL] (--eject) (--open)`\n".blue
56
+ warn "\nšŸš… Usage: `bin/resolve [path, partial, or URL] (--eject) (--open)`\n".blue
57
57
  end
58
58
  end
59
59
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.45
4
+ version: 1.0.48
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-03-26 00:00:00.000000000 Z
11
+ date: 2022-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: standard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rails
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -240,14 +254,14 @@ dependencies:
240
254
  requirements:
241
255
  - - '='
242
256
  - !ruby/object:Gem::Version
243
- version: 5.0.0.pre8
257
+ version: 5.0.0.pre9
244
258
  type: :runtime
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - '='
249
263
  - !ruby/object:Gem::Version
250
- version: 5.0.0.pre8
264
+ version: 5.0.0.pre9
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: hiredis
253
267
  requirement: !ruby/object:Gem::Requirement