by 1.0.0 → 1.1.0
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/CHANGELOG +12 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +2 -4
- data/bin/by-session +1 -1
- data/lib/by/server.rb +1 -1
- data/lib/by/worker.rb +39 -2
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d622dede047f1dcb4f5b49be636d08ce0099b1338a70c46f17d6f3153a00f26f
|
4
|
+
data.tar.gz: 95390f53bd32c5269b2d6082d984f2864daca6bb08e0c2c0d07d060f8d706aa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76b61b4369e401138a16f71dc4e769eec6845d3aab3ddec019335f53684d6fad7d9a0260300015385845a4869ad820a49c4fed8886306f476cf275dcd9a4c8f6
|
7
|
+
data.tar.gz: 2a4b6efe40f06cb1912957eedfa1d15a83cfb82e9a801faae06b14cb235f0408bda93443e4e72321897353d22ed543d55acc119baa11d3ccf3ede561fd9c4806
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 1.1.0 (2024-11-06)
|
2
|
+
|
3
|
+
* Support rspec as first argument to by, to run rspec with by (jeremyevans)
|
4
|
+
|
5
|
+
=== 1.0.1 (2023-02-09)
|
6
|
+
|
7
|
+
* Make by-server stop more reliable by using SIGKILL if server does not stop with SIGQUIT (jeremyevans)
|
8
|
+
|
9
|
+
* Remove debugging code when running a single file with minitest autorun (jeremyevans)
|
10
|
+
|
11
|
+
* Use RbConfig.ruby to get the ruby binary name (eregon) (#1)
|
12
|
+
|
1
13
|
=== 1.0.0 (2023-02-07)
|
2
14
|
|
3
15
|
* Initial Public Release
|
data/MIT-LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -65,8 +65,7 @@ needs the +socket+ standard library. The only issue with that is that
|
|
65
65
|
|
66
66
|
require 'rbconfig'
|
67
67
|
by = Gem.activate_bin_path("by", "by")
|
68
|
-
|
69
|
-
puts "alias by='#{ruby} --disable-gems #{by}'"
|
68
|
+
puts "alias by='#{RbConfig.ruby} --disable-gems #{by}'"
|
70
69
|
|
71
70
|
Note that one issue with using a shell alias is that it only
|
72
71
|
works when loaded and used by the shell, it won't work if
|
@@ -88,8 +87,7 @@ needs the +socket+ standard library. The only issue with that is that
|
|
88
87
|
|
89
88
|
require 'rbconfig'
|
90
89
|
by = Gem.activate_bin_path("by", "by")
|
91
|
-
|
92
|
-
File.binwrite("by", "#!/bin/sh\nexec #{ruby} --disable-gems #{by} \"$@\"\n")
|
90
|
+
File.binwrite("by", "#!/bin/sh\nexec #{RbConfig.ruby} --disable-gems #{by} \"$@\"\n")
|
93
91
|
File.chmod(0755, "by")
|
94
92
|
|
95
93
|
With each of these approaches, you can get much faster program
|
data/bin/by-session
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'rbconfig'
|
5
5
|
ENV['BY_SOCKET'] ||= File.join(Dir.pwd, '.by_socket')
|
6
6
|
by_server = File.join(__dir__, 'by-server')
|
7
|
-
ruby =
|
7
|
+
ruby = RbConfig.ruby
|
8
8
|
|
9
9
|
begin
|
10
10
|
system(ruby, by_server, *ARGV, exception: true)
|
data/lib/by/server.rb
CHANGED
@@ -89,7 +89,7 @@ module By
|
|
89
89
|
end
|
90
90
|
|
91
91
|
# Handle an existing server socket. This attempts to connect to the socket and
|
92
|
-
# then shutdown the server. If successful, it removes the socket. If
|
92
|
+
# then shutdown the server. If successful, it removes the socket. If unsuccessful,
|
93
93
|
# it will print an error.
|
94
94
|
def handle_existing_server
|
95
95
|
if File.socket?(@socket_path)
|
data/lib/by/worker.rb
CHANGED
@@ -48,7 +48,28 @@ module By
|
|
48
48
|
|
49
49
|
# Stop the server process by sending it the SIGQUIT signal, then exit.
|
50
50
|
def stop_server
|
51
|
-
|
51
|
+
i = 0
|
52
|
+
while Process.ppid != 1 && Process.kill(0, Process.ppid)
|
53
|
+
if i < 4
|
54
|
+
Process.kill(:QUIT, Process.ppid)
|
55
|
+
end
|
56
|
+
sleep 0.1
|
57
|
+
|
58
|
+
if i == 5
|
59
|
+
# This is only reached if the QUIT signal does not
|
60
|
+
# cause the process to exit.
|
61
|
+
Process.kill(:KILL, Process.ppid)
|
62
|
+
end
|
63
|
+
if i > 8
|
64
|
+
# This is only reached if the process has still not
|
65
|
+
# stopped even after the KILL signal was sent.
|
66
|
+
$stderr.puts "ERROR: cannot stop by-server"
|
67
|
+
@normal_exit = false
|
68
|
+
break
|
69
|
+
end
|
70
|
+
|
71
|
+
i += 1
|
72
|
+
end
|
52
73
|
cleanup_proc.call
|
53
74
|
exit
|
54
75
|
end
|
@@ -115,6 +136,22 @@ module By
|
|
115
136
|
super(exit_code)
|
116
137
|
end
|
117
138
|
M.run(args)
|
139
|
+
when 'rspec'
|
140
|
+
args.shift
|
141
|
+
ARGV.replace(args)
|
142
|
+
require 'rspec/core'
|
143
|
+
RSpec.configure do |c|
|
144
|
+
# Fix start_time to be accurate if rspec was required by by-server
|
145
|
+
c.instance_variable_set(:@start_time, Time.now)
|
146
|
+
end
|
147
|
+
# invoke exits non-zero if there are failures
|
148
|
+
RSpec::Core::Runner.define_singleton_method(:exit) do |exit_code|
|
149
|
+
worker.normal_exit = exit_code == 0
|
150
|
+
cleanup.call
|
151
|
+
super(exit_code)
|
152
|
+
end
|
153
|
+
RSpec::Core::Runner.invoke
|
154
|
+
at_exit(&cleanup)
|
118
155
|
when 'irb'
|
119
156
|
at_exit(&cleanup)
|
120
157
|
args.shift
|
@@ -146,7 +183,7 @@ module By
|
|
146
183
|
if defined?(Minitest) && Minitest.class_variable_get(:@@installed_at_exit)
|
147
184
|
Minitest.singleton_class.prepend(Module.new do
|
148
185
|
define_method(:run) do |argv|
|
149
|
-
super(argv).tap{|exit_code|
|
186
|
+
super(argv).tap{|exit_code| worker.normal_exit = exit_code == true}
|
150
187
|
end
|
151
188
|
end)
|
152
189
|
Minitest.after_run(&cleanup)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: by
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest-global_expectations
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-core
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-expectations
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: |
|
42
70
|
by is a library preloader for ruby designed to speed up process startup.
|
43
71
|
It uses a client/server approach, where the server loads the libraries and
|
@@ -97,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
125
|
- !ruby/object:Gem::Version
|
98
126
|
version: '0'
|
99
127
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.5.22
|
101
129
|
signing_key:
|
102
130
|
specification_version: 4
|
103
131
|
summary: Ruby library preloader
|