rails_build 2.4.4 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/TODO.md +11 -0
- data/bin/rails_build +27 -60
- data/lib/rails_build/_lib.rb +1 -1
- data/rails_build.gemspec +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11ce797010e3a72acc5ec8128e8ebaf87e11eedabda3f8a3d26b0ded5a50ca1
|
4
|
+
data.tar.gz: 88aef1d5d7f3c9b977cff618669ee54f2804057cbe5a179fbe70ab46da639f62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e30d7e8f5895d7ddb019ef1ac7d3e47edd9204850ee84fb42cecef442bfbc2bd3ca4be3b4ff17bf79dc3a9358094468cdf8597b43b3c8048bed0d14eb4d442a6
|
7
|
+
data.tar.gz: 4bfbdcaf7a3b32cce567648026477b6262150129abb3ed0e6657fa022b9edcbad1b819967a801d9577690f21ed7943a283796f99d5bb521fef98c120e54f1526
|
data/README.md
CHANGED
@@ -163,6 +163,26 @@
|
|
163
163
|
and/or to utilize the entire Rails ecosystem, it's docs and gems, to build
|
164
164
|
sophisticated sites without needing to learn yet another framework.
|
165
165
|
|
166
|
+
# SPEED
|
167
|
+
|
168
|
+
`rails_build` is as fast as your rails app. optimizing the build means
|
169
|
+
optimizing your app so, the internet abounds with advice here, and all the
|
170
|
+
production stuff one might normally do, caching, etc, is applicable for
|
171
|
+
cranking things up. that being said, on a 'normal' laptop one should expect
|
172
|
+
to crank through 1000 urls in 10s of seconds. this is what is meant by,
|
173
|
+
_"good enough"_.
|
174
|
+
|
175
|
+
# ENV
|
176
|
+
|
177
|
+
at build time, the following environment variables will be available to your
|
178
|
+
app, such that i can _"know"_ that it is being built. they should be self
|
179
|
+
explanatory:
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
ENV['RAILS_BUILD'] # a uuid fo the build
|
183
|
+
ENV['RAILS_BUILD_TIME'] # a timestamp when the build was run
|
184
|
+
|
185
|
+
```
|
166
186
|
|
167
187
|
# RTFM
|
168
188
|
|
data/TODO.md
ADDED
data/bin/rails_build
CHANGED
@@ -209,8 +209,6 @@ module RailsBuild
|
|
209
209
|
def mkdir!
|
210
210
|
FileUtils.rm_rf(@directory)
|
211
211
|
FileUtils.mkdir_p(@directory)
|
212
|
-
|
213
|
-
log(:info, "build: #{ @directory }")
|
214
212
|
end
|
215
213
|
|
216
214
|
#
|
@@ -357,75 +355,43 @@ module RailsBuild
|
|
357
355
|
|
358
356
|
if @asset_tmp
|
359
357
|
FileUtils.rm_rf(@asset_dir)
|
360
|
-
FileUtils.mv(@asset_tmp, @asset_dir)
|
358
|
+
FileUtils.mv(@asset_tmp, @asset_dir)
|
361
359
|
end
|
362
360
|
end
|
363
361
|
|
364
362
|
#
|
365
363
|
def parallel_build!
|
366
|
-
|
364
|
+
slices =
|
365
|
+
@urls.each_slice(@parallel).map.to_a
|
367
366
|
|
368
|
-
|
369
|
-
:
|
370
|
-
|
371
|
-
|
372
|
-
}
|
367
|
+
Parallel.each(slices, in_processes: @parallel) do |slice|
|
368
|
+
Parallel.each(slice, in_threads: 4) do |url|
|
369
|
+
uri = uri_for(url)
|
370
|
+
path = path_for(uri)
|
373
371
|
|
374
|
-
|
372
|
+
rpath = relative_path(path, :from => @directory)
|
375
373
|
|
376
|
-
|
377
|
-
|
378
|
-
path = path_for(uri)
|
374
|
+
code = nil
|
375
|
+
body = nil
|
379
376
|
|
380
|
-
|
377
|
+
time =
|
378
|
+
timing do
|
379
|
+
code, body = http_get(uri)
|
380
|
+
write_path(path, body) if code == 200
|
381
|
+
end
|
381
382
|
|
382
|
-
|
383
|
-
body = nil
|
383
|
+
msg = "#{ url } -> /#{ rpath } (time:#{ time }, code:#{ code })"
|
384
384
|
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
385
|
+
case code
|
386
|
+
when 200
|
387
|
+
log(:info, msg)
|
388
|
+
else
|
389
|
+
log(:error, msg)
|
390
|
+
abort
|
389
391
|
end
|
390
|
-
|
391
|
-
times.push(time)
|
392
|
-
ts = times.dup
|
393
|
-
rps = (ts.size / ts.sum).round(4)
|
394
|
-
msg = "#{ url } -> /#{ rpath } (time:#{ time }, rps:#{ rps }, code:#{ code })"
|
395
|
-
|
396
|
-
case code
|
397
|
-
when 200
|
398
|
-
log(:info, msg)
|
399
|
-
stats[:success].push(url)
|
400
|
-
when 404
|
401
|
-
log(:error, msg)
|
402
|
-
stats[:missing].push(url)
|
403
|
-
else
|
404
|
-
log(:error, msg)
|
405
|
-
stats[:failure].push(url)
|
406
392
|
end
|
407
393
|
end
|
408
394
|
|
409
|
-
borked = 0
|
410
|
-
|
411
|
-
if stats[:missing].size > 0
|
412
|
-
borked += stats[:missing].size
|
413
|
-
log(:error, "missing on #{ stats[:missing].size } url(s)")
|
414
|
-
end
|
415
|
-
|
416
|
-
if stats[:failure].size > 0
|
417
|
-
borked += stats[:failure].size
|
418
|
-
log(:error, "failure on #{ stats[:failure].size } url(s)")
|
419
|
-
end
|
420
|
-
|
421
|
-
if borked > 0
|
422
|
-
exit(borked)
|
423
|
-
end
|
424
|
-
|
425
|
-
rps = (times.size / times.sum).round(4)
|
426
|
-
|
427
|
-
log(:info, "downloaded #{ @urls.size } urls at ~#{ rps } rps")
|
428
|
-
|
429
395
|
@urls
|
430
396
|
end
|
431
397
|
|
@@ -446,8 +412,6 @@ module RailsBuild
|
|
446
412
|
|
447
413
|
FileUtils.rm_rf(build)
|
448
414
|
FileUtils.send(cp, @directory, build)
|
449
|
-
|
450
|
-
#log(:info, "to preview run: ruby -run -ehttpd ./build/ -p4242")
|
451
415
|
end
|
452
416
|
|
453
417
|
def timing(&block)
|
@@ -707,6 +671,9 @@ module RailsBuild
|
|
707
671
|
system("#{ version_command } >/dev/null 2>&1") ||
|
708
672
|
abort("app fails to load via: #{ version_command }")
|
709
673
|
|
674
|
+
@cli.log(:info, "rails_build version: #{ RailsBuild.version }")
|
675
|
+
@cli.log(:info, "build: #{ @directory }")
|
676
|
+
|
710
677
|
q = Queue.new
|
711
678
|
|
712
679
|
cmd = start_command_for(port)
|
@@ -750,15 +717,15 @@ module RailsBuild
|
|
750
717
|
RAILS_BUILD=#{ @uuid }
|
751
718
|
|
752
719
|
RAILS_SERVE_STATIC_FILES=true
|
753
|
-
RAILS_LOG_TO_STDOUT=
|
720
|
+
RAILS_LOG_TO_STDOUT=false
|
754
721
|
WEB_CONCURRENCY=#{ @parallel.to_s }
|
722
|
+
RAILS_MAX_THREADS=8
|
755
723
|
|
756
724
|
rails server
|
757
725
|
|
758
726
|
--environment=#{ @env }
|
759
727
|
--port=#{ port }
|
760
728
|
--binding=0.0.0.0
|
761
|
-
--log-to-stdout
|
762
729
|
]
|
763
730
|
)
|
764
731
|
end
|
data/lib/rails_build/_lib.rb
CHANGED
data/rails_build.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
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.5"
|
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"
|
@@ -14,6 +14,7 @@ Gem::Specification::new do |spec|
|
|
14
14
|
["LICENSE",
|
15
15
|
"README.md",
|
16
16
|
"Rakefile",
|
17
|
+
"TODO.md",
|
17
18
|
"bin",
|
18
19
|
"bin/rails_build",
|
19
20
|
"lib",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- LICENSE
|
58
58
|
- README.md
|
59
59
|
- Rakefile
|
60
|
+
- TODO.md
|
60
61
|
- bin/rails_build
|
61
62
|
- lib/rails_build.rb
|
62
63
|
- lib/rails_build/_lib.rb
|