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 +4 -4
- data/README.md +2 -2
- data/app/helpers/account/locale_helper.rb +2 -2
- data/app/models/concerns/current_attributes/base.rb +1 -1
- data/app/models/invitation.rb +1 -1
- data/app/models/membership.rb +1 -1
- data/app/models/team.rb +2 -2
- data/app/models/user.rb +1 -1
- data/docs/authentication.md +2 -2
- data/docs/getting-started.md +12 -12
- data/docs/indirection.md +6 -8
- data/docs/namespacing.md +1 -1
- data/docs/overriding.md +1 -1
- data/lib/bullet_train/resolver.rb +20 -26
- data/lib/bullet_train/version.rb +1 -1
- data/lib/tasks/bullet_train_tasks.rake +7 -7
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f97118eaaa7253406852b09625acb890ba8d2653e0266628795bde576044eec5
|
4
|
+
data.tar.gz: 47688fa0493151a13a4b5060efd32703c9bc9bfa5a4f13052519c6afb6a864a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c750045603680f1d1ffcff0bbc7ffb1e3d334ca6e280f2d4332c2d5270ae94228d0f230876f63223d5aeeca146b5678a8b6fb9ed6b0656b3fecb7b5a751f54e
|
7
|
+
data.tar.gz: 15a90ab25fa884ae6004423c6469d2dd974f08da0c88eae230cbd4e60bfb3c64af1011ff02c2bf6bfe1a732518324c8c55cb0898a10f88ca25e0c9e2059a21a8
|
data/README.md
CHANGED
@@ -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.
|
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
|
-
|
78
|
+
result
|
79
79
|
end
|
80
80
|
|
81
81
|
# like 't', but if the key isn't found, it returns nil.
|
data/app/models/invitation.rb
CHANGED
data/app/models/membership.rb
CHANGED
data/app/models/team.rb
CHANGED
data/app/models/user.rb
CHANGED
data/docs/authentication.md
CHANGED
@@ -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
|
-
|
9
|
-
|
8
|
+
bin/resolve RegistrationsController --eject --open
|
9
|
+
bin/resolve SessionsController --eject --open
|
10
10
|
```
|
11
11
|
|
12
12
|
## Customizing Views
|
data/docs/getting-started.md
CHANGED
@@ -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
|
-
|
15
|
-
|
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](
|
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
|
-
|
24
|
-
|
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](
|
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 `<!--
|
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
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
48
|
+
bin/resolve --interactive --eject --open
|
49
49
|
```
|
50
50
|
|
51
51
|
And then paste any input, e.g.:
|
52
52
|
|
53
53
|
```
|
54
|
-
<!--
|
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
|
-
|
30
|
+
bin/resolve shared/box
|
31
31
|
```
|
32
32
|
|
33
|
-
### Exposing Rendered Views with
|
33
|
+
### Exposing Rendered Views with Annotated Views
|
34
34
|
|
35
|
-
|
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
|
-
<!--
|
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
|
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
|
-
|
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
|
-
|
10
|
+
bin/super-scaffold crud Event Team name:text_field --namespace=customers
|
11
11
|
```
|
data/docs/overriding.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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 ==
|
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(
|
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 ==
|
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] :
|
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
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
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
|
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
|
-
|
158
|
+
nil
|
165
159
|
end
|
166
160
|
end
|
167
161
|
end
|
data/lib/bullet_train/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
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 :
|
6
|
-
if Dir.
|
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.
|
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
|
46
|
-
if input
|
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
|
-
|
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.
|
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-
|
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.
|
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.
|
264
|
+
version: 5.0.0.pre9
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
266
|
name: hiredis
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|