rails_build 2.4.2 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +107 -47
- data/bin/rails_build +24 -103
- data/lib/rails_build/_lib.rb +1 -1
- data/lib/rails_build.rb +1 -1
- data/rails_build.gemspec +2 -4
- metadata +2 -3
- data/config/rails_build.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85f445833fa2d2a73f3fdcc41602c12a29b0710c3efe1f22fb3ca2255f28d0b3
|
4
|
+
data.tar.gz: c763470f51741a1082165bc9d4d67fe6528904bc5ac4598fad840a1b3025f702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1776c7af9d7b84230b00d573503897a90109f01c77ff4e039dce651dd7f4bb01333b30efe773f3dca9bf7b5b6a014e8211683e0b13a52b4b79cc61f13fbee6
|
7
|
+
data.tar.gz: c546c9901cfc78d879e6089e1a4ff59061e5b62f67706f9c712b035aff35e17e350d536323e8be2314b84333a21bc69b30667bf07edb4e43fe011504015c3315
|
data/LICENSE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Nonstandard
|
data/README.md
CHANGED
@@ -3,27 +3,20 @@
|
|
3
3
|
- install
|
4
4
|
|
5
5
|
```sh
|
6
|
-
|
7
6
|
echo 'gem "raild_build"' >> Gemfile
|
8
|
-
|
9
7
|
bundle
|
10
|
-
|
11
8
|
```
|
12
9
|
|
13
10
|
- setup
|
14
11
|
|
15
12
|
```sh
|
16
|
-
|
17
13
|
rails_build --init
|
18
|
-
|
19
14
|
```
|
20
15
|
|
21
16
|
- build
|
22
17
|
|
23
18
|
```sh
|
24
|
-
|
25
19
|
rails_build
|
26
|
-
|
27
20
|
```
|
28
21
|
|
29
22
|
- deploy?
|
@@ -49,77 +42,144 @@
|
|
49
42
|
absolutely minimal configuration. it should be pretty darn self
|
50
43
|
explanatory:
|
51
44
|
|
52
|
-
```ruby
|
45
|
+
```ruby
|
46
|
+
|
47
|
+
# file : ./config/rails_build.rb
|
53
48
|
|
54
|
-
|
49
|
+
<<~________
|
55
50
|
|
56
|
-
|
51
|
+
this file should to enumerate all the urls you'd like to build
|
57
52
|
|
58
|
-
|
53
|
+
the contents of your ./public directory, and any assets, are automaticaly
|
54
|
+
included
|
59
55
|
|
60
|
-
|
61
|
-
included
|
56
|
+
therefore you need only declare which dynamic urls, that is to say, 'routes'
|
62
57
|
|
63
|
-
|
58
|
+
you would like included in your build
|
64
59
|
|
65
|
-
|
60
|
+
it is not loaded except during build time, and will not affect your normal
|
61
|
+
rails app in any way
|
66
62
|
|
67
|
-
|
68
|
-
rails app in any way
|
63
|
+
________
|
69
64
|
|
70
|
-
________
|
71
65
|
|
66
|
+
RailsBuild.configure do |config|
|
72
67
|
|
73
|
-
|
68
|
+
# most of the time you are going to want your root route included, which
|
69
|
+
# will translate into an ./index.html being output in the build, as you
|
70
|
+
# would expect.
|
71
|
+
#
|
74
72
|
|
75
|
-
|
76
|
-
# translate into an ./index.html being output in the build
|
77
|
-
#
|
73
|
+
config.urls << '/'
|
78
74
|
|
79
|
-
|
75
|
+
# include any/all additional routes youd' like built thusly
|
76
|
+
#
|
80
77
|
|
81
|
-
|
82
|
-
|
78
|
+
Post.each do |post|
|
79
|
+
config.urls << "/posts/#{ post.id }"
|
80
|
+
end
|
81
|
+
|
82
|
+
# thats it! - now just run `rails_build` and you are gtg
|
83
83
|
|
84
|
-
Post.each do |post|
|
85
|
-
config.urls << "/posts/#{ post.id }"
|
86
84
|
end
|
87
85
|
|
88
|
-
|
86
|
+
```
|
87
|
+
|
88
|
+
# CONFIGURATION
|
89
|
+
|
90
|
+
although `rails_build` aims to be as zero-config as possible, it does expose
|
91
|
+
a few configuration settings, which you may configure in
|
92
|
+
`config/rails_build.rb`:
|
93
|
+
|
94
|
+
- *config.urls*
|
95
|
+
|
96
|
+
as shown above, the config has a list of urls that the build process
|
97
|
+
will GET. this is a simple array and contains only '/' by default, the
|
98
|
+
root route, such that the default unconfigured build would map '/' ->
|
99
|
+
'index.html' and not be empty. if your app does not have a root route,
|
100
|
+
or you do not wish to include that route in your build, simply call
|
101
|
+
`config.urls.clear`
|
102
|
+
|
89
103
|
|
90
|
-
|
104
|
+
- *config.force_ssl*
|
91
105
|
|
92
|
-
|
106
|
+
this one can be important. when `rails_build` starts your rails app, it
|
107
|
+
does so with *RAILS_ENV=production*, such that the build is of production
|
108
|
+
quality and speed. (you can change this by running `rails_build
|
109
|
+
--env=development`, etc.). this can cause issues since the build runs on
|
110
|
+
localhost, and rails (without `thruster`), has no facility for ssl
|
111
|
+
termination. as such, you may want the the following
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
# file : ./config/environments/production.rb
|
115
|
+
|
116
|
+
config.force_ssl = ENV['RAILS_BUILD'] ? false : true
|
117
|
+
```
|
118
|
+
|
119
|
+
- *config.index_html*
|
120
|
+
|
121
|
+
controls the mapping of urls to build files, eg.
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
RailsBuild.configure do
|
125
|
+
config.index_html = true # the default
|
126
|
+
config.urls << "/post/42" #=> ./build/posts/42/index.html
|
127
|
+
end
|
128
|
+
|
129
|
+
# vs.
|
130
|
+
|
131
|
+
RailsBuild.configure do
|
132
|
+
config.index_html = false
|
133
|
+
config.urls << "/post/42" #=> ./build/posts/42.html
|
134
|
+
end
|
135
|
+
```
|
136
|
+
|
137
|
+
- *config.path*
|
138
|
+
|
139
|
+
this is the path to the build config file itself, the default is
|
140
|
+
`./config/rails_build.rb`, as you would expect
|
141
|
+
|
142
|
+
- *config.trailing_slash*
|
143
|
+
|
144
|
+
this is current un-used, but maybe be used in the future. it's default is the
|
145
|
+
value of
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
Rails.application.default_url_options[:trailing_slash]
|
149
|
+
```
|
93
150
|
|
94
151
|
# MOTIVATION
|
95
152
|
|
96
|
-
why
|
97
|
-
other-soon-to-be-released-blazing-fast-one-i-am-building-on Roda?
|
153
|
+
why yet _another_ static site builder? why not hugo or, the
|
154
|
+
other-soon-to-be-released-blazing-fast-one-i-am-building-on Roda?
|
155
|
+
|
156
|
+
because:
|
98
157
|
|
99
|
-
|
158
|
+
- there are a lot of Rails apps
|
159
|
+
- nothing is as fast as static
|
160
|
+
- Rails has no facility to 'pre-render' routes on deployment
|
100
161
|
|
101
|
-
|
102
|
-
|
103
|
-
|
162
|
+
so, you can use this tool to leverage the code and the app you already have,
|
163
|
+
and/or to utilize the entire Rails ecosystem, it's docs and gems, to build
|
164
|
+
sophisticated sites without needing to learn yet another framework.
|
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.
|
108
166
|
|
109
|
-
#
|
167
|
+
# RTFM
|
110
168
|
|
111
|
-
as always, docs are worthless and
|
169
|
+
as always, docs are worthless and ruby is beautiful, so #RTFC ->
|
112
170
|
|
113
|
-
|
171
|
+
https://github.com/ahoward/rails_build/blob/main/bin/rails_build
|
114
172
|
|
115
173
|
|
116
174
|
# LICENSE
|
117
175
|
|
118
|
-
|
176
|
+
the gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
119
177
|
|
120
178
|
# AI _boo_
|
121
179
|
|
122
|
-
|
123
|
-
application, or
|
124
|
-
existing inside a commercial
|
125
|
-
your
|
180
|
+
any and all usage, in any way, shape, or form, in prohibited by any ai
|
181
|
+
application, or llm. this includes indexing, knowing about, training on, or
|
182
|
+
existing inside a commercial llm or training data set. iff (that is not a
|
183
|
+
typo) your llm is oss, please contact me directly before including this source.
|
184
|
+
|
185
|
+
any usage by openai, or google, is forbidden regardless.
|
data/bin/rails_build
CHANGED
@@ -194,7 +194,7 @@ module RailsBuild
|
|
194
194
|
|
195
195
|
#
|
196
196
|
def init!
|
197
|
-
config =
|
197
|
+
config = SAMPLE_CONFIG
|
198
198
|
|
199
199
|
path = './config/rails_build.rb'
|
200
200
|
|
@@ -288,7 +288,7 @@ module RailsBuild
|
|
288
288
|
|
289
289
|
def extract_urls!
|
290
290
|
path = @config.path
|
291
|
-
urls = @config.urls
|
291
|
+
urls = @config.urls.uniq
|
292
292
|
|
293
293
|
if urls.size == 0
|
294
294
|
abort("failed to find any rails_build urls in:\n#{ @config.to_json }")
|
@@ -361,88 +361,6 @@ module RailsBuild
|
|
361
361
|
end
|
362
362
|
end
|
363
363
|
|
364
|
-
#
|
365
|
-
=begin
|
366
|
-
def parallel_build!
|
367
|
-
size = @parallel
|
368
|
-
|
369
|
-
stats = {
|
370
|
-
:success => [],
|
371
|
-
:missing => [],
|
372
|
-
:failure => [],
|
373
|
-
}
|
374
|
-
|
375
|
-
times = []
|
376
|
-
|
377
|
-
elapsed = timing do
|
378
|
-
ThreadPool.new(size:) do |tp|
|
379
|
-
tp.run do
|
380
|
-
@urls.each{|url| tp.process!(url:)}
|
381
|
-
end
|
382
|
-
|
383
|
-
tp.process do |url:|
|
384
|
-
uri = uri_for(url)
|
385
|
-
path = path_for(uri)
|
386
|
-
|
387
|
-
upath = uri.path
|
388
|
-
rpath = relative_path(path, :from => @directory)
|
389
|
-
|
390
|
-
code = nil
|
391
|
-
body = nil
|
392
|
-
|
393
|
-
time =
|
394
|
-
timing do
|
395
|
-
code, body = http_get(uri)
|
396
|
-
write_path(path, body) if code == 200
|
397
|
-
end
|
398
|
-
|
399
|
-
tp.success!(url:, rpath:, time:, code:)
|
400
|
-
end
|
401
|
-
|
402
|
-
tp.success do |url:, rpath:, time:, code:|
|
403
|
-
times.push(time)
|
404
|
-
rps = (times.size / times.sum).round(4)
|
405
|
-
msg = "#{ url } -> /#{ rpath } (time:#{ time }, rps:#{ rps }, code:#{ code })"
|
406
|
-
|
407
|
-
case code
|
408
|
-
when 200
|
409
|
-
log(:info, msg)
|
410
|
-
stats[:success].push(url)
|
411
|
-
when 404
|
412
|
-
log(:error, msg)
|
413
|
-
stats[:missing].push(url)
|
414
|
-
else
|
415
|
-
log(:error, msg)
|
416
|
-
stats[:failure].push(url)
|
417
|
-
end
|
418
|
-
end
|
419
|
-
end
|
420
|
-
end
|
421
|
-
|
422
|
-
borked = 0
|
423
|
-
|
424
|
-
if stats[:missing].size > 0
|
425
|
-
borked += stats[:missing].size
|
426
|
-
log(:error, "missing on #{ stats[:missing].size } url(s)")
|
427
|
-
end
|
428
|
-
|
429
|
-
if stats[:failure].size > 0
|
430
|
-
borked += stats[:failure].size
|
431
|
-
log(:error, "failure on #{ stats[:failure].size } url(s)")
|
432
|
-
end
|
433
|
-
|
434
|
-
if borked > 0
|
435
|
-
exit(borked)
|
436
|
-
end
|
437
|
-
|
438
|
-
rps = (times.size / times.sum).round(4)
|
439
|
-
|
440
|
-
log(:info, "downloaded #{ @urls.size } urls at ~#{ rps } rps")
|
441
|
-
|
442
|
-
@urls
|
443
|
-
end
|
444
|
-
=end
|
445
|
-
|
446
364
|
#
|
447
365
|
def parallel_build!
|
448
366
|
size = @parallel
|
@@ -883,37 +801,40 @@ END {
|
|
883
801
|
RailsBuild::CLI.run!
|
884
802
|
}
|
885
803
|
|
886
|
-
|
887
|
-
<<~
|
804
|
+
module RailsBuild
|
805
|
+
SAMPLE_CONFIG = <<~'__'
|
806
|
+
<<~________
|
888
807
|
|
889
|
-
|
808
|
+
this file should to enumerate all the urls you'd like to build
|
890
809
|
|
891
|
-
|
810
|
+
the contents of your ./public directory, and any assets, are automaticaly included
|
892
811
|
|
893
|
-
|
812
|
+
therefore you need only declare which dynamic urls, that is to say, 'routes'
|
894
813
|
|
895
|
-
|
814
|
+
you would like included in your build
|
896
815
|
|
897
|
-
|
816
|
+
it is not loaded except during build time, and will not affect your normal rails app in any way
|
898
817
|
|
899
|
-
________
|
818
|
+
________
|
900
819
|
|
901
820
|
|
902
|
-
RailsBuild.configure do |config|
|
821
|
+
RailsBuild.configure do |config|
|
903
822
|
|
904
|
-
|
905
|
-
|
906
|
-
|
823
|
+
# most of the time you are going to want your route included, which will
|
824
|
+
# translate into an ./index.html being output in the build
|
825
|
+
#
|
907
826
|
|
908
|
-
|
827
|
+
config.urls << '/'
|
909
828
|
|
910
|
-
|
911
|
-
|
829
|
+
# include any/all additional routes youd' like built thusly
|
830
|
+
#
|
912
831
|
|
913
|
-
|
914
|
-
|
915
|
-
|
832
|
+
Post.each do |post|
|
833
|
+
config.urls << "/posts/#{ post.id }"
|
834
|
+
end
|
916
835
|
|
917
|
-
|
836
|
+
# thats it! - now just run `rails_build` and you are GTG
|
918
837
|
|
838
|
+
end
|
839
|
+
__
|
919
840
|
end
|
data/lib/rails_build/_lib.rb
CHANGED
data/lib/rails_build.rb
CHANGED
@@ -72,7 +72,7 @@ module RailsBuild
|
|
72
72
|
defaults = {
|
73
73
|
path: RailsBuild.config_path,
|
74
74
|
trailing_slash: (defined?(Rails) ? !!Rails.application.default_url_options[:trailing_slash] : false),
|
75
|
-
force_ssl: (defined?(Rails) ? !!Rails.configuration.force_ssl :
|
75
|
+
force_ssl: (defined?(Rails) ? !!Rails.configuration.force_ssl : false),
|
76
76
|
urls: %w[ / ],
|
77
77
|
index_html: true,
|
78
78
|
}
|
data/rails_build.gemspec
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "rails_build"
|
6
|
-
spec.version = "2.4.
|
6
|
+
spec.version = "2.4.4"
|
7
7
|
spec.required_ruby_version = '>= 3.0'
|
8
8
|
spec.platform = Gem::Platform::RUBY
|
9
9
|
spec.summary = "a small, simple, bullet proof, and fast enough static site generator built on top of the rails you already know and love"
|
10
10
|
spec.description = "rails_build is a very small, fast enough, static site generator built\non top of the rails you already know and love.\n\nit's been in production usage for close to a decade but i've been too\nbusy to relase it until now. also, #wtf is up with javascript land?!\n\nit has a small set of dependencies, namely the `parallel` gem, and\nrequires absolutely minimal configuration. it should be pretty darn\nself explanatory:"
|
11
|
-
spec.license = "
|
11
|
+
spec.license = "Nonstandard"
|
12
12
|
|
13
13
|
spec.files =
|
14
14
|
["LICENSE",
|
@@ -16,8 +16,6 @@ Gem::Specification::new do |spec|
|
|
16
16
|
"Rakefile",
|
17
17
|
"bin",
|
18
18
|
"bin/rails_build",
|
19
|
-
"config",
|
20
|
-
"config/rails_build.rb",
|
21
19
|
"lib",
|
22
20
|
"lib/rails_build",
|
23
21
|
"lib/rails_build.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
@@ -58,13 +58,12 @@ files:
|
|
58
58
|
- README.md
|
59
59
|
- Rakefile
|
60
60
|
- bin/rails_build
|
61
|
-
- config/rails_build.rb
|
62
61
|
- lib/rails_build.rb
|
63
62
|
- lib/rails_build/_lib.rb
|
64
63
|
- rails_build.gemspec
|
65
64
|
homepage: https://github.com/ahoward/rails_build
|
66
65
|
licenses:
|
67
|
-
-
|
66
|
+
- Nonstandard
|
68
67
|
metadata: {}
|
69
68
|
post_install_message:
|
70
69
|
rdoc_options: []
|
data/config/rails_build.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
<<~________
|
2
|
-
|
3
|
-
this file should to enumerate all the urls you'd like to build
|
4
|
-
|
5
|
-
the contents of your ./public directory, and any assets, are automaticaly included
|
6
|
-
|
7
|
-
therefore you need only declare which dynamic urls, that is to say, 'routes'
|
8
|
-
|
9
|
-
you would like included in your build
|
10
|
-
|
11
|
-
it is not loaded except during build time, and will not affect your normal rails app in any way
|
12
|
-
|
13
|
-
________
|
14
|
-
|
15
|
-
|
16
|
-
RailsBuild.configure do |config|
|
17
|
-
|
18
|
-
# most of the time you are going to want your route included, which will
|
19
|
-
# translate into an ./index.html being output in the build
|
20
|
-
#
|
21
|
-
|
22
|
-
config.urls << '/'
|
23
|
-
|
24
|
-
# include any/all additional routes youd' like built thusly
|
25
|
-
#
|
26
|
-
|
27
|
-
Post.each do |post|
|
28
|
-
config.urls << "/posts/#{ post.id }"
|
29
|
-
end
|
30
|
-
|
31
|
-
# thats it! - now just run `rails_build` and you are GTG
|
32
|
-
|
33
|
-
end
|