bullet_train 1.0.41 → 1.0.42

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: 87bfe6b6ae9a8c873f110f0360c436e333cb68f0d6f0bb14fd4a458f4747aa29
4
- data.tar.gz: 3b76e560de7117ae70b7af138937a3cdb96396fab8d660313335ca374f6fb35a
3
+ metadata.gz: 438ec7c1fcc8aa67605106070f6aef746efa3b2cbdf007821f6f8067cf42484a
4
+ data.tar.gz: e81d6d7fe358d9faa19e546c61cf40ad51328e8bc817ad5701aac8fa1c59a79d
5
5
  SHA512:
6
- metadata.gz: 41a7e50329932973e67dab25af3c0182bc6365ca57b4e8f859a4f691a9e202b0d248383960154a7aa84a0476d013204a1a802bd36b76a9936a3118897b00c1ae
7
- data.tar.gz: 62cf5ad94c650779f7639f5a3eaf71d9a5b5f0885822c3ea5d9c5769532a7ebc358e86fbf866ccdd99a855feb512dc52c55d4931a1f87106c96e4f93dcf53244
6
+ metadata.gz: 25a0b0dbedef4259ca1b8f1d4429b441f6c2a2fd47e71128110b2580e04800950b65c68647e63caa7a0d570191bef3e8f04a97e32337dac12cac293ee7a26f7b
7
+ data.tar.gz: ac36a9a1179fec2ff1e1084279f2453aab59d64faf5cb6a21113f5a2dacc9c73945e3719167cd5ea8aa4534bdff804dd6f4c81bec8ae679e31a2dd752fabd870
data/docs/indirection.md CHANGED
@@ -1,3 +1,53 @@
1
- # Overriding Framework Defaults
1
+ # Dealing with Indirection
2
2
 
3
- > TODO This section needs to be written.
3
+ ## The Problem with Indirection
4
+
5
+ In software development, indirection is everywhere and takes many forms.
6
+
7
+ For example, in vanilla Rails development, you introduce a type of indirection when you extract a button label out of a view file and use the `t` helper to render the string from a translation YAML file. In the future, when another developer goes to update the button label, they will first open the view, they'll see `t(".submit")` and then have to reason a little bit about which translation file they need to open up in order to update that label.
8
+
9
+ Our goal in Bullet Train is to improve developer experience, not reduce it, so it was important that along with any instances of indirection we were introducing, we also included new tooling to ensure it was never a burden to developers. Thankfully, in practice we found that some of this new tooling improves even layers of indirection that have always been with us in Rails development.
10
+
11
+ ## Solving Indirection in Views
12
+
13
+ ### Resolving Partial Paths with `bin/resolve`
14
+
15
+ Even in vanilla Rails development, when you're looking at a view file, the path you see passed to a `render` call isn't the actual file name of the partial that will be rendered. This is even more true in Bullet Train where certain partial paths are [magically served from theme gems](/docs/themes.md).
16
+
17
+ `bin/resolve` makes it easy to figure out where where a partial is being served from:
18
+
19
+ ```
20
+ $ bin/resolve shared/box
21
+ ```
22
+
23
+ ### Exposing Rendered Views with Xray
24
+
25
+ > TODO Is this still true in Rails 7? Does it not do something like this by default now?
26
+
27
+ 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:
28
+
29
+ ```
30
+ <!--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-->
31
+ ```
32
+
33
+ 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).
34
+
35
+ ### Drilling Down on Translation Keys
36
+
37
+ Even in vanilla Rails applications, extracting strings from view files into I18N translation YAML files introduces a layer of indirection. Bullet Train tries to improve the resulting DX with a couple tools that make it easier to figure out where a translation you see in your browser is coming from.
38
+
39
+ #### Show Translation Keys in the Browser with `?show_locales=true`
40
+
41
+ You can see the full translation key of any string on the page by adding `?show_locales=true` to the URL.
42
+
43
+ #### Log Translation Keys to the Console with `?log_locales=true`
44
+
45
+ You can also log all the translation key for anything being rendered to the console by adding `?log_locales=true` to the request URL. This can make it easier to copy and paste translation keys for strings that are rendered in non-selectable UI elements.
46
+
47
+ #### Resolving Translation Keys with `bin/resolve`
48
+
49
+ 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:
50
+
51
+ ```
52
+ $ bin/resolve en.account.onboarding.user_details.edit.header --eject --open
53
+ ```
data/docs/overriding.md CHANGED
@@ -1,53 +1,3 @@
1
- # Dealing with Indirection
1
+ # Overriding Framework Defaults
2
2
 
3
- ## The Problem with Indirection
4
-
5
- In software development, indirection is everywhere and takes many forms.
6
-
7
- For example, in vanilla Rails development, you introduce a type of indirection when you extract a button label out of a view file and use the `t` helper to render the string from a translation YAML file. In the future, when another developer goes to update the button label, they will first open the view, they'll see `t(".submit")` and then have to reason a little bit about which translation file they need to open up in order to update that label.
8
-
9
- Our goal in Bullet Train is to improve developer experience, not reduce it, so it was important that along with any instances of indirection we were introducing, we also included new tooling to ensure it was never a burden to developers. Thankfully, in practice we found that some of this new tooling improves even layers of indirection that have always been with us in Rails development.
10
-
11
- ## Solving Indirection in Views
12
-
13
- ### Resolving Partial Paths with `bin/resolve`
14
-
15
- Even in vanilla Rails development, when you're looking at a view file, the path you see passed to a `render` call isn't the actual file name of the partial that will be rendered. This is even more true in Bullet Train where certain partial paths are [magically served from theme gems](/docs/themes.md).
16
-
17
- `bin/resolve` makes it easy to figure out where where a partial is being served from:
18
-
19
- ```
20
- $ bin/resolve shared/box
21
- ```
22
-
23
- ### Exposing Rendered Views with Xray
24
-
25
- > TODO Is this still true in Rails 7? Does it not do something like this by default now?
26
-
27
- 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:
28
-
29
- ```
30
- <!--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-->
31
- ```
32
-
33
- 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).
34
-
35
- ### Drilling Down on Translation Keys
36
-
37
- Even in vanilla Rails applications, extracting strings from view files into I18N translation YAML files introduces a layer of indirection. Bullet Train tries to improve the resulting DX with a couple tools that make it easier to figure out where a translation you see in your browser is coming from.
38
-
39
- #### Show Translation Keys in the Browser with `?show_locales=true`
40
-
41
- You can see the full translation key of any string on the page by adding `?show_locales=true` to the URL.
42
-
43
- #### Log Translation Keys to the Console with `?log_locales=true`
44
-
45
- You can also log all the translation key for anything being rendered to the console by adding `?log_locales=true` to the request URL. This can make it easier to copy and paste translation keys for strings that are rendered in non-selectable UI elements.
46
-
47
- #### Resolving Translation Keys with `bin/resolve`
48
-
49
- 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:
50
-
51
- ```
52
- $ bin/resolve en.account.onboarding.user_details.edit.header --eject --open
53
- ```
3
+ > TODO This section needs to be written.
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.0.41"
2
+ VERSION = "1.0.42"
3
3
  end
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.0.41
4
+ version: 1.0.42
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-25 00:00:00.000000000 Z
11
+ date: 2022-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails