rego 3.2.0 → 4.2.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/bin/rego +62 -8
- data/lib/rego/_lib.rb +2 -2
- data/rego.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e704eca7b7db48e6d200a33befa0da637e5942cb1d1d3765130e1ec5f57be8d5
|
4
|
+
data.tar.gz: 720ab9f7447d22e03099694269c6ae807e25132ee332b7ef6771cb2c8fa7ba80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db96fac13956e14aadffc198c760d7767b6eae548c15eea15be554589709a4ea8f6a8b9953f778695319cb96b94a960becd2503d3d45be65552cc6a2eef7e0b
|
7
|
+
data.tar.gz: 507f3755d8235fc4107380461a106bc44bb5d9be7d7062137486298fb4db74b9ffade5719bf44359e5945a72935766cf4572d04133312182249195e603606775
|
data/bin/rego
CHANGED
@@ -29,13 +29,24 @@ Main do
|
|
29
29
|
# run a specific test whenever it, or your app, has changed
|
30
30
|
#
|
31
31
|
~> rego ./test -- ruby -Itest @
|
32
|
+
|
33
|
+
# run a server, killing it gracefully whenever files change
|
34
|
+
#
|
35
|
+
~> rego --killer -- ./dev/server
|
32
36
|
__
|
33
37
|
|
34
38
|
option('--path=path', '-p')
|
35
39
|
option('--paths=paths')
|
36
40
|
option('--command=command', '-c')
|
41
|
+
option('--version', '-v')
|
42
|
+
option('--killer', '-k')
|
37
43
|
|
38
44
|
def run
|
45
|
+
if params[:version].given?
|
46
|
+
puts version
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
39
50
|
parse_the_command_line!
|
40
51
|
print_a_summary_of_watched_files!
|
41
52
|
loop_watching_files_and_running_commands!
|
@@ -80,35 +91,78 @@ Main do
|
|
80
91
|
end
|
81
92
|
|
82
93
|
def loop_watching_files_and_running_commands!
|
83
|
-
cmdno = '0'
|
94
|
+
@cmdno = '0'
|
95
|
+
@killer = params[:killer].given?
|
96
|
+
@pid = nil
|
84
97
|
|
85
98
|
rego =
|
86
99
|
proc do
|
87
100
|
puts
|
88
|
-
Rego.say("#=> rego.#{cmdno} @ #{Time.now.strftime('%H:%M:%S')} -> #{@pretty[:command]}", color: :yellow)
|
101
|
+
Rego.say("#=> rego.#{@cmdno} @ #{Time.now.strftime('%H:%M:%S')} -> #{@pretty[:command]}", color: :yellow)
|
89
102
|
|
90
|
-
|
91
|
-
|
103
|
+
@pid = Process.spawn(*@command)
|
104
|
+
Rego.say("#=> rego.#{@cmdno} @ #{Time.now.strftime('%H:%M:%S')} -> pid=#{@pid}", color: :cyan)
|
105
|
+
status = Process.wait(@pid)
|
106
|
+
@pid = nil
|
107
|
+
|
108
|
+
success = (@killer || (status==0))
|
92
109
|
|
93
|
-
Rego.say("#=> rego.#{cmdno} @ #{Time.now.strftime('%H:%M:%S')} -> #{$?.exitstatus}",
|
94
|
-
color: (success ? :green : :red))
|
95
110
|
puts
|
111
|
+
Rego.say("#=> rego.#{@cmdno} @ #{Time.now.strftime('%H:%M:%S')} -> #{status}", color: (success ? :green : :red))
|
96
112
|
|
97
|
-
cmdno.succ!
|
113
|
+
@cmdno.succ!
|
114
|
+
puts
|
98
115
|
end
|
99
116
|
|
100
117
|
listener = Listen.to(*@paths) do |_modified, _added, _removed|
|
118
|
+
if @killer && @pid
|
119
|
+
kill!(@pid)
|
120
|
+
end
|
121
|
+
|
101
122
|
rego.call
|
102
123
|
end
|
103
124
|
|
104
125
|
begin
|
105
|
-
rego.call
|
106
126
|
listener.start
|
127
|
+
rego.call
|
107
128
|
sleep
|
108
129
|
rescue SignalException
|
109
130
|
exit(0)
|
110
131
|
end
|
111
132
|
end
|
133
|
+
|
134
|
+
def kill!(pid)
|
135
|
+
Rego.say("#=> rego.#{@cmdno} @ #{Time.now.strftime('%H:%M:%S')} -> kill=#{@pid}", color: :magenta)
|
136
|
+
|
137
|
+
3.times do
|
138
|
+
%w[
|
139
|
+
SIGTERM SIGINT SIGQUIT SIGKILL
|
140
|
+
].each do |signal|
|
141
|
+
begin
|
142
|
+
Process.kill("-#{signal}", pid)
|
143
|
+
rescue Object
|
144
|
+
nil
|
145
|
+
end
|
146
|
+
|
147
|
+
sleep(0.1)
|
148
|
+
|
149
|
+
return pid if alive?(pid)
|
150
|
+
|
151
|
+
sleep(rand)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
abort("failed to kill pid=#{ pid }!") if alive?(pid)
|
156
|
+
end
|
157
|
+
|
158
|
+
def alive?(pid)
|
159
|
+
begin
|
160
|
+
Process.kill(0, pid)
|
161
|
+
true
|
162
|
+
rescue Errno::ESRCH
|
163
|
+
false
|
164
|
+
end
|
165
|
+
end
|
112
166
|
end
|
113
167
|
|
114
168
|
BEGIN {
|
data/lib/rego/_lib.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Rego
|
2
|
-
Version = '
|
2
|
+
Version = '4.2.0' unless defined?(Version)
|
3
3
|
|
4
4
|
def self.version
|
5
5
|
Rego::Version
|
@@ -9,7 +9,7 @@ module Rego
|
|
9
9
|
{
|
10
10
|
'main' => ['main', ' ~> 6.3.0'],
|
11
11
|
'map' => ['map', ' ~> 6.6.0'],
|
12
|
-
'listen' => ['listen', ' ~> 3.
|
12
|
+
'listen' => ['listen', ' ~> 3.9.0']
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
data/rego.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "rego"
|
6
|
-
spec.version = "
|
6
|
+
spec.version = "4.2.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "rego"
|
9
9
|
spec.description = "description: rego kicks the ass"
|
@@ -22,7 +22,7 @@ Gem::Specification::new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_dependency(*["map", " ~> 6.6.0"])
|
24
24
|
|
25
|
-
spec.add_dependency(*["listen", " ~> 3.
|
25
|
+
spec.add_dependency(*["listen", " ~> 3.9.0"])
|
26
26
|
|
27
27
|
|
28
28
|
spec.extensions.push(*[])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rego
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.2.0
|
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:
|
11
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: main
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.9.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.9.0
|
55
55
|
description: 'description: rego kicks the ass'
|
56
56
|
email: ara.t.howard@gmail.com
|
57
57
|
executables:
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
88
|
+
rubygems_version: 3.5.16
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: rego
|