bullet_train 1.0.35 → 1.0.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/layouts/docs.html.erb +46 -18
- data/app/views/public/home/docs.html.erb +18 -1
- data/config/routes.rb +1 -1
- data/docs/api.md +3 -0
- data/docs/authentication.md +13 -0
- data/docs/billing/stripe.md +90 -0
- data/docs/desktop.md +13 -0
- data/docs/field-partials/buttons.md +42 -0
- data/docs/field-partials/super-select.md +58 -0
- data/docs/field-partials.md +132 -0
- data/docs/font-awesome-pro.md +50 -0
- data/docs/getting-started.md +55 -0
- data/docs/heroku.md +91 -0
- data/docs/i18n.md +3 -0
- data/docs/index.md +52 -0
- data/docs/indirection.md +53 -0
- data/docs/modeling.md +93 -0
- data/docs/namespacing.md +11 -0
- data/docs/oauth.md +27 -0
- data/docs/onboarding.md +41 -0
- data/docs/permissions.md +18 -0
- data/docs/seeds.md +48 -0
- data/docs/super-scaffolding/delegated-types.md +328 -0
- data/docs/super-scaffolding.md +246 -0
- data/docs/teams.md +8 -0
- data/docs/testing.md +34 -0
- data/docs/themes.md +101 -0
- data/docs/tunneling.md +29 -0
- data/docs/upgrades.md +69 -0
- data/docs/webhooks/incoming.md +3 -0
- data/docs/webhooks/outgoing.md +3 -0
- data/lib/bullet_train/version.rb +1 -1
- metadata +29 -1
data/docs/themes.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Themes
|
2
|
+
|
3
|
+
Bullet Train has a theme subsystem designed to allow you the flexibility to either extend or completely replace the stock “Light” and “Clean” UI templates.
|
4
|
+
|
5
|
+
## Inheritance Structure
|
6
|
+
|
7
|
+
To reduce duplication of code across themes, Bullet Train implements an inheritance structure. For example, the official Bullet Train themes are structured hierarchically like so:
|
8
|
+
|
9
|
+
- “Base”
|
10
|
+
- “Bootstrap” (in the future)
|
11
|
+
- “Clean” (in the future)
|
12
|
+
- “Tailwind CSS”
|
13
|
+
- “Light”
|
14
|
+
|
15
|
+
Any component partials that can be shared are pushed up the inheritance structure. For example, [Bullet Train's library of field partials](/docs/field-partials.md) provide a good example of this, illustrating the power of the approach we’ve taken here:
|
16
|
+
|
17
|
+
- The most general field styling varies substantially between Tailwind CSS and Bootstrap, so a `_field.html.erb` component partial exists in both the foundational “Tailwind CSS” and “Bootstrap” themes, but also a further customized version exists in themes like “Light”.
|
18
|
+
- However, many concrete field types like `_text_field.html.erb` and `_phone_field.html.erb` leverage `_field.html.erb`, and they themselves are completely framework agnostic as a result. These partials can live in the shared “Base” theme.
|
19
|
+
|
20
|
+
At run-time, this means:
|
21
|
+
|
22
|
+
- When rendering `_text_field.html.erb`, it renders from “Base”.
|
23
|
+
- However, when `_text_field.html.erb` references `_field.html.erb`, that renders from “Light”.
|
24
|
+
- If you extend “Light” and override `_field.html.erb`, rendering `_text_field.html.erb` will now use your theme’s `_field.html.erb`.
|
25
|
+
|
26
|
+
## Theme Component Usage
|
27
|
+
|
28
|
+
To use a theme component, simply include it from "within" `shared` like so:
|
29
|
+
|
30
|
+
```
|
31
|
+
<%= render 'shared/fields/text_field', method: :text_field_value %>
|
32
|
+
```
|
33
|
+
|
34
|
+
We say "within" because while a `shared` view partial directory does exist, the referenced `shared/fields/_text_field.html.erb` doesn't actually exist within it. Instead, the theme engine picks up on `shared` and also works its way through the theme directories to find the appropriate match.
|
35
|
+
|
36
|
+
### Dealing with Indirection
|
37
|
+
|
38
|
+
This small piece of indirection buys us an incredible amount of power in building and extending themes, but as with any indirection, it could potentially come at the cost of developer experience. That's why Bullet Train includes additional tools for smoothing over this experience. Be sure to read the section on [dealing with indirection].
|
39
|
+
|
40
|
+
|
41
|
+
## Theme Configuration
|
42
|
+
|
43
|
+
You can specify the theme you’d like to use and its inheritance structure in `app/helpers/theme_helper.rb`. The code there is well commented to help you.
|
44
|
+
|
45
|
+
## Theme Structure
|
46
|
+
|
47
|
+
Themes are represented in a few places. Taking “Light” as an example, we have:
|
48
|
+
|
49
|
+
- A directory of theme-specific component partials in `app/views/themes/light`, including a layout ERB template.
|
50
|
+
- A theme-specific stylesheet in `app/javascript/stylesheets/light/application.scss`.
|
51
|
+
- A theme-specific pack in `app/javascript/packs/light.js`. You’ll see there that the actual JavaScript dependencies and code are shared across all themes. The whole purpose of this theme-specific pack is to serve up the theme-specific stylesheet.
|
52
|
+
- Theme-specific logos and images in `app/javascript/images/light`.
|
53
|
+
|
54
|
+
## Adding a New Theme
|
55
|
+
|
56
|
+
To extend the “Light” theme in a new theme called “Tokyo”, we would:
|
57
|
+
|
58
|
+
1. Copy `app/javascript/packs/light.js` to `app/javascript/packs/tokyo.js` and update references to `light` therein to `tokyo`.
|
59
|
+
2. Copy `app/views/themes/light/layouts` to `app/views/themes/tokyo/layouts` and update references to `light` in the contained files to `tokyo`. It's possible this is too much duplication, but in practice most people want to customize these two layouts in their custom themes.
|
60
|
+
3. Create a new file at `app/javascript/stylesheets/tokyo/application.scss`. To start just add `@import "../light/application";` at the top, which represents the fact that “Tokyo” extends “Light”. Any custom styles can be added below that.
|
61
|
+
4. Add `"tokyo"` as the first item in the `THEME_DIRECTORY_ORDER` array in `app/helpers/theme_helper.rb`.
|
62
|
+
|
63
|
+
You should be good to go! We'll try to add a generator for this in the future.
|
64
|
+
|
65
|
+
## Additional Guidance and Principles
|
66
|
+
|
67
|
+
### Should you extend or replace?
|
68
|
+
|
69
|
+
For most development projects, the likely best path for customizing the UI is to extend “Light” or another complete Bullet Train theme. It’s difficult to convey how many hours have gone into making the Bullet Train themes complete and coherent from end to end. Every type of field partial, all the third-party libraries, all the responsiveness scenarios, etc. It’s taken many hours and many invoices.
|
70
|
+
|
71
|
+
Extending an existing theme is like retaining an option on shipping. By extending a theme that is already complete, you allow yourself to say “enough is enough” at a certain point and just living with some inherited defaults in exchange for shipping your product sooner. You can always do more UI work later, but it doesn’t look unpolished now!
|
72
|
+
|
73
|
+
On the other hand, if you decide to try to build a theme from the ground up, you risk getting to that same point, but not being able to stop because there are bits around the edges that don’t feel polished and cohesive.
|
74
|
+
|
75
|
+
### Don’t reference theme component partials directly, even within the same theme!
|
76
|
+
|
77
|
+
#### ❌ Don’t do this, even in theme partials:
|
78
|
+
|
79
|
+
```
|
80
|
+
<%= render "themes/light/box" do |p| %>
|
81
|
+
...
|
82
|
+
<% end %>
|
83
|
+
```
|
84
|
+
|
85
|
+
#### ✅ Instead, always do this:
|
86
|
+
|
87
|
+
```
|
88
|
+
<%= render "shared/box" do |p| %>
|
89
|
+
...
|
90
|
+
<% end %>
|
91
|
+
```
|
92
|
+
|
93
|
+
This allows the theme engine to resolve which theme in the inheritance chain to include the `box` partial from. For example:
|
94
|
+
|
95
|
+
- It might come from the “Light” theme today, but if you switch to the “Bold” theme later, it’ll can start pulling it from there.
|
96
|
+
- If you start extending “Light”, you can override its `box` implementation and your application will pick up the new customized version from your theme automatically.
|
97
|
+
- If (hypothetically) `box` became generalized and move into the parent “Tailwind CSS” theme, your application would pick it up from the appropriate place.
|
98
|
+
|
99
|
+
### Let your designer name their theme.
|
100
|
+
|
101
|
+
You're going to have to call your theme something and there are practical reasons to not call it something generic. If you're pursuing a heavily customized design, consider allowing the designer or designers who are creating the look-and-feel of your application to name their own masterpiece. Giving it a distinct name will really help differentiate things when you're ready to start introducing additional facets to your application or a totally new look-and-feel down the road.
|
data/docs/tunneling.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# HTTP Tunneling with ngrok
|
2
|
+
|
3
|
+
Before your application can take advantage of features that depend on incoming webhooks, you'll need to setup an HTTP tunnel using a service like [ngrok](https://ngrok.com).
|
4
|
+
|
5
|
+
## Use a Paid Plan
|
6
|
+
|
7
|
+
You should specifically sign up for a paid account. Although ngrok offers a free plan, their $5/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
|
+
|
9
|
+
## Usage
|
10
|
+
|
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
|
+
|
13
|
+
```
|
14
|
+
ngrok http 3000 -subdomain=your-subdomain
|
15
|
+
```
|
16
|
+
|
17
|
+
## Updating Your Configuration
|
18
|
+
|
19
|
+
Before your Rails application will accept connections on your tunnel hostname, you need to update `config/application.yml` with:
|
20
|
+
|
21
|
+
```
|
22
|
+
BASE_URL: https://your-subdomain.ngrok.io
|
23
|
+
```
|
24
|
+
|
25
|
+
You'll also need to restart your Rails server:
|
26
|
+
|
27
|
+
```
|
28
|
+
rails restart
|
29
|
+
```
|
data/docs/upgrades.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Upgrading Your Bullet Train Application
|
2
|
+
|
3
|
+
## Upgrading the Framework
|
4
|
+
|
5
|
+
The vast majority of Bullet Train's functionality is distributed via Ruby gems, so you can pull the latest updates by running `bundle update`.
|
6
|
+
|
7
|
+
## Pulling Updates from the Starter Repository
|
8
|
+
|
9
|
+
There are times when you'll want to pull updates from the starter repository into your local application. Thankfully, `git merge` provides us with the perfect tool for just that. You can simply merge the upstream Bullet Train repository into your local repository. If you haven’t tinkered with the starter repository defaults at all, then this should happen with no meaningful conflicts at all. Simply run your automated tests (including the comprehensive integration tests Bullet Train ships with) to make sure everything is still working as it was before.
|
10
|
+
|
11
|
+
If you _have_ modified some starter repository defaults _and_ we also happened to update that same logic upstream, then pulling the most recent version of the starter repository should cause a merge conflict in Git. This is actually great, because Git will then give you the opportunity to compare our upstream changes with your local customizations and allow you to resolve them in a way that makes sense for your application.
|
12
|
+
|
13
|
+
### 1. Make sure you're working with a clean local copy.
|
14
|
+
|
15
|
+
```
|
16
|
+
git status
|
17
|
+
```
|
18
|
+
|
19
|
+
If you've got uncommitted or untracked files, you can clean them up with the following.
|
20
|
+
|
21
|
+
```
|
22
|
+
# ⚠️ This will destroy any uncommitted or untracked changes and files you have locally.
|
23
|
+
git checkout .
|
24
|
+
git clean -d -f
|
25
|
+
```
|
26
|
+
|
27
|
+
### 2. Fetch the latest and greatest from the Bullet Train repository.
|
28
|
+
|
29
|
+
```
|
30
|
+
git fetch starter-repo
|
31
|
+
````
|
32
|
+
|
33
|
+
### 3. Create a new "upgrade" branch off of your main branch.
|
34
|
+
|
35
|
+
```
|
36
|
+
git checkout main
|
37
|
+
git checkout -b updating-starter-repo
|
38
|
+
```
|
39
|
+
|
40
|
+
### 4. Merge in the newest stuff from Bullet Train and resolve any merge conflicts.
|
41
|
+
|
42
|
+
```
|
43
|
+
git merge starter-repo/main
|
44
|
+
```
|
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!
|
47
|
+
|
48
|
+
```
|
49
|
+
git diff
|
50
|
+
git add -A
|
51
|
+
git commit -m "Upgrading Bullet Train."
|
52
|
+
```
|
53
|
+
|
54
|
+
### 5. Run Tests.
|
55
|
+
|
56
|
+
```
|
57
|
+
rails test
|
58
|
+
```
|
59
|
+
|
60
|
+
### 6. Merge into `main` and delete the branch.
|
61
|
+
|
62
|
+
```
|
63
|
+
git checkout main
|
64
|
+
git merge updating-starter-repo
|
65
|
+
git push origin main
|
66
|
+
git branch -d updating-starter-repo
|
67
|
+
```
|
68
|
+
|
69
|
+
Alternatively, if you're using GitHub, you can push the `updating-starter-repo` branch up and create a PR from it and let your CI integration do it's thing and then merge in the PR and delete the branch there. (That's what we typically do.)
|
data/lib/bullet_train/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
@@ -535,6 +535,34 @@ files:
|
|
535
535
|
- db/migrate/20210816072508_add_locale_to_teams.rb
|
536
536
|
- db/migrate/20211020200855_add_doorkeeper_application_to_memberships.rb
|
537
537
|
- db/migrate/20211027002944_add_doorkeeper_application_to_users.rb
|
538
|
+
- docs/api.md
|
539
|
+
- docs/authentication.md
|
540
|
+
- docs/billing/stripe.md
|
541
|
+
- docs/desktop.md
|
542
|
+
- docs/field-partials.md
|
543
|
+
- docs/field-partials/buttons.md
|
544
|
+
- docs/field-partials/super-select.md
|
545
|
+
- docs/font-awesome-pro.md
|
546
|
+
- docs/getting-started.md
|
547
|
+
- docs/heroku.md
|
548
|
+
- docs/i18n.md
|
549
|
+
- docs/index.md
|
550
|
+
- docs/indirection.md
|
551
|
+
- docs/modeling.md
|
552
|
+
- docs/namespacing.md
|
553
|
+
- docs/oauth.md
|
554
|
+
- docs/onboarding.md
|
555
|
+
- docs/permissions.md
|
556
|
+
- docs/seeds.md
|
557
|
+
- docs/super-scaffolding.md
|
558
|
+
- docs/super-scaffolding/delegated-types.md
|
559
|
+
- docs/teams.md
|
560
|
+
- docs/testing.md
|
561
|
+
- docs/themes.md
|
562
|
+
- docs/tunneling.md
|
563
|
+
- docs/upgrades.md
|
564
|
+
- docs/webhooks/incoming.md
|
565
|
+
- docs/webhooks/outgoing.md
|
538
566
|
- lib/bullet_train.rb
|
539
567
|
- lib/bullet_train/engine.rb
|
540
568
|
- lib/bullet_train/resolver.rb
|