rails_build 1.0.0 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -0
- data/README.md +70 -124
- data/Rakefile +437 -22
- data/bin/rails_build +848 -659
- data/config/rails_build.rb +33 -0
- data/lib/rails_build/_lib.rb +87 -0
- data/lib/rails_build.rb +189 -16
- data/rails_build.gemspec +42 -0
- metadata +34 -75
- data/MIT-LICENSE +0 -20
- data/app/assets/config/rails_build_manifest.js +0 -2
- data/app/assets/javascripts/rails_build/application.js +0 -13
- data/app/assets/stylesheets/rails_build/application.css +0 -32
- data/app/controllers/rails_build/application_controller.rb +0 -12
- data/app/helpers/rails_build/application_helper.rb +0 -4
- data/app/jobs/rails_build/application_job.rb +0 -4
- data/app/mailers/rails_build/application_mailer.rb +0 -6
- data/app/models/rails_build/application_record.rb +0 -5
- data/app/views/layouts/rails_build/application.html.erb +0 -14
- data/app/views/rails_build/application/index.html.erb +0 -20
- data/bin/rails +0 -13
- data/config/routes.rb +0 -10
- data/lib/rails_build/engine.rb +0 -50
- data/lib/rails_build/version.rb +0 -3
- data/lib/tasks/rails_build_tasks.rake +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2fdeb8b08b19d89fe8b117fa6113056fa1c7cc7df38b66780f043fc970cde7ab
|
4
|
+
data.tar.gz: dc3342b95ad179fd2da82f57c0c41cf296796b0b7ebc92ef5f8011415ccd08ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c50a5d183280afadf89c695190d72fcfda5ed7cb4cfabd29c05acf4931749229d814c366e92f654935d3b4a4975f05c97e881717b3ca4713c91d30fa632dae6
|
7
|
+
data.tar.gz: ca443255a67532b1aa5a67edae2b5f745825b0a7f0f94bacdb8cd0c5e553764a33568a36647ee823cb2a60542c224860bc7be236ec834d457dc32e16a6f7aedd
|
data/LICENSE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Ruby
|
data/README.md
CHANGED
@@ -1,179 +1,125 @@
|
|
1
|
-
#
|
1
|
+
# TL;DR;
|
2
2
|
|
3
|
-
|
4
|
-
built as a Rails 5 engine.
|
3
|
+
- install
|
5
4
|
|
5
|
+
```sh
|
6
6
|
|
7
|
+
echo 'gem "raild_build"' >> Gemfile
|
7
8
|
|
8
|
-
|
9
|
+
bundle
|
9
10
|
|
10
|
-
|
11
|
-
a static site suitable for deployment to Netlify, Amazon S3, or your favorite
|
12
|
-
static website hosting solution. It does this by:
|
11
|
+
```
|
13
12
|
|
14
|
-
-
|
15
|
-
- Precompiling all assets
|
16
|
-
- Including every static resource in ./public/
|
17
|
-
- GET'ing every configured url via super fast parallel downloading
|
13
|
+
- setup
|
18
14
|
|
19
|
-
|
20
|
-
sites and requires learning practically no new techniques to make super fast
|
21
|
-
building static websites.
|
15
|
+
```sh
|
22
16
|
|
17
|
+
rails_build --init
|
23
18
|
|
19
|
+
```
|
24
20
|
|
25
|
-
|
21
|
+
- build
|
26
22
|
|
27
|
-
|
28
|
-
static site generators. You need to drop a *./config/rails_build.rb* looking
|
29
|
-
something like this into your app:
|
23
|
+
```sh
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
RailsBuild.configure do |rails_build|
|
34
|
-
|
35
|
-
urls = rails_build.urls
|
36
|
-
|
37
|
-
urls << "/"
|
38
|
-
|
39
|
-
urls << "/about/"
|
40
|
-
|
41
|
-
urls << "/contact/"
|
42
|
-
|
43
|
-
|
44
|
-
Post.each do |post|
|
45
|
-
urls << blog_path(post)
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
```
|
52
|
-
|
53
|
-
That's it: simply enumerate the urls - anything additional to your assets and
|
54
|
-
./public/ directory - that you want to include in your build.
|
55
|
-
|
56
|
-
## On Trailing Slashes
|
57
|
-
|
58
|
-
Most static hosting solutions support Apache style directory indexing will be
|
59
|
-
better behaved with urls that look like
|
60
|
-
|
61
|
-
```markdown
|
62
|
-
|
63
|
-
http://my.site.com/blog/
|
64
|
-
|
65
|
-
```
|
66
|
-
|
67
|
-
vs.
|
68
|
-
|
69
|
-
```markdown
|
70
|
-
|
71
|
-
http://my.site.com/blog
|
72
|
-
|
73
|
-
```
|
74
|
-
|
75
|
-
RailsBuild tries to help you do this with a little bit of Rails' config that
|
76
|
-
is turned on by default but which can be turned off via
|
25
|
+
rails_build
|
77
26
|
|
78
|
-
```
|
79
|
-
|
80
|
-
RailsBuild.configure do |rails_build|
|
81
|
-
|
82
|
-
rails_build.trailing_slash false # the default is 'true'
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
```
|
27
|
+
```
|
87
28
|
|
88
|
-
|
89
|
-
like './about' vs. '../about'
|
29
|
+
- deploy?
|
90
30
|
|
31
|
+
the contents of ./build/ are good to deploy to *any* static web host
|
32
|
+
including netlify, vercel, an s3 bucket, or simply your app's own ./public
|
33
|
+
directory in order to 'pre-cache' a ton of pages
|
91
34
|
|
35
|
+
ps. if you want to preview your local static ./build i *highly* recommend
|
92
36
|
|
93
|
-
|
37
|
+
https://github.com/copiousfreetime/launchy
|
94
38
|
|
95
39
|
|
96
|
-
|
97
|
-
|
98
|
-
When trying to squeeze out performance just remember that RailsBuild runs in
|
99
|
-
production mode and, therefore, making a build go fast follows the *exact same
|
100
|
-
rules* as making anything other Rails' application fast. The first place to
|
101
|
-
reach is typically fragment caching of partials used in your app.
|
102
|
-
|
103
|
-
Finally, don't forget about *./config/initializers/assets.rb* - RailsBuild
|
104
|
-
doesn't do anything special to the asset pipeline and only those assets
|
105
|
-
normally built when
|
106
|
-
|
107
|
-
```bash
|
108
|
-
|
109
|
-
~> rake assets:precompile
|
110
|
-
|
111
|
-
```
|
112
|
-
|
113
|
-
is run will be included in the build.
|
40
|
+
# ABOUT
|
114
41
|
|
42
|
+
rails_build is a very small, fast enough, static site generator built on top
|
43
|
+
of the rails you already know and love.
|
115
44
|
|
45
|
+
it's been in production usage for close to a decade but i've been too busy
|
46
|
+
to relase it until now. also, #wtf is up with javascript land?!
|
116
47
|
|
117
|
-
|
118
|
-
|
119
|
-
|
48
|
+
it has a small set of dependencies, namely the `parallel` gem, and requires
|
49
|
+
absolutely minimal configuration. it should be pretty darn self
|
50
|
+
explanatory:
|
120
51
|
|
121
52
|
```ruby
|
122
53
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
```
|
54
|
+
# file : ./config/rails_build.rb
|
127
55
|
|
128
|
-
|
56
|
+
<<~________
|
129
57
|
|
130
|
-
|
58
|
+
this file should to enumerate all the urls you'd like to build
|
131
59
|
|
132
|
-
|
60
|
+
the contents of your ./public directory, and any assets, are automaticaly
|
61
|
+
included
|
133
62
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
```
|
63
|
+
therefore you need only declare which dynamic urls, that is to say, 'routes'
|
138
64
|
|
65
|
+
you would like included in your build
|
139
66
|
|
67
|
+
it is not loaded except during build time, and will not affect your normal
|
68
|
+
rails app in any way
|
140
69
|
|
141
|
-
|
70
|
+
________
|
142
71
|
|
143
72
|
|
144
|
-
|
73
|
+
RailsBuild.configure do |config|
|
145
74
|
|
146
|
-
|
75
|
+
# most of the time you are going to want your route included, which will
|
76
|
+
# translate into an ./index.html being output in the build
|
77
|
+
#
|
147
78
|
|
148
|
-
|
79
|
+
config.urls << '/'
|
149
80
|
|
81
|
+
# include any/all additional routes youd' like built thusly
|
82
|
+
#
|
150
83
|
|
151
|
-
|
84
|
+
Post.each do |post|
|
85
|
+
config.urls << "/posts/#{ post.id }"
|
86
|
+
end
|
152
87
|
|
153
|
-
|
88
|
+
# thats it! - now just run `rails_build` and you are GTG
|
154
89
|
|
90
|
+
end
|
155
91
|
|
156
92
|
```
|
157
93
|
|
94
|
+
# MOTIVATION
|
158
95
|
|
96
|
+
why another static site builder? why not hugo or, the
|
97
|
+
other-soon-to-be-released-blazing-fast-one-i-am-building-on Roda?
|
159
98
|
|
160
|
-
|
99
|
+
because:
|
161
100
|
|
162
|
-
|
163
|
-
|
101
|
+
- there are a lot of Rails apps
|
102
|
+
- nothing is as fast as static
|
103
|
+
- Rails has no facility to 'pre-render' routes on deployment
|
164
104
|
|
165
|
-
|
105
|
+
so, you can use this tool to leverage the code and the app you already have,
|
106
|
+
and/or to utilize the entire Rails ecosystem, it's docs and gems, to build
|
107
|
+
sophisticated sites without needing to learn yet another framework.
|
166
108
|
|
167
|
-
|
109
|
+
# HOW IT WORKS
|
168
110
|
|
169
|
-
|
111
|
+
as always, docs are worthless and Ruby is beautiful, so #RTFC ->
|
170
112
|
|
171
|
-
|
113
|
+
https://github.com/ahoward/rails_build/blob/main/bin/rails_build
|
172
114
|
|
173
|
-
to be configured as the build command and directory respectively.
|
174
115
|
|
116
|
+
# LICENSE
|
175
117
|
|
118
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
176
119
|
|
177
|
-
|
120
|
+
# AI _boo_
|
178
121
|
|
179
|
-
|
122
|
+
Any and all usage, in any way, shape, or form, in prohibited by any AI
|
123
|
+
application, or LLM. This includes indexing, knowing about, training on, or
|
124
|
+
existing inside a commercial LLM or training data set. Iff (and *only* if)
|
125
|
+
your LLM is OSS, please contact me directly before including this source.
|