utils 0.0.86 → 0.0.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/probe +4 -52
- data/lib/utils/probe_server.rb +64 -0
- data/lib/utils/version.rb +1 -1
- data/lib/utils.rb +1 -0
- data/utils.gemspec +4 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 004b410eccaece7453569464e3b75461cfb7170e
|
4
|
+
data.tar.gz: e1b554b0e44210fdf1939bab0db842d997bc0f5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13d8d08a0bef2b3c9baafd0f7ed76f6c8d95ee2005b155d805be017b6600c91606c2c92662127d14757945cd0f42505f03c36d3e2135530827d344034061a086
|
7
|
+
data.tar.gz: a86533457a1f063d8e64e87608e7fdc68948c64e0bd28a895a436aee7cf037dc88e26469db8c829693e225722431106b554cc5e93122bcafa84076c8046d055c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.87
|
data/bin/probe
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
4
|
require 'tins/xt'
|
5
|
-
require 'term/ansicolor'
|
6
|
-
class String
|
7
|
-
include Term::ANSIColor
|
8
|
-
end
|
9
5
|
require 'tins/lines_file'
|
10
6
|
include Tins::GO
|
11
7
|
require 'utils'
|
@@ -54,54 +50,10 @@ uri = "druby://localhost:#{$opt['p'] || 6623}"
|
|
54
50
|
if $opt['l']
|
55
51
|
Thread.abort_on_exception = $DEBUG
|
56
52
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
def enqueue(job)
|
64
|
-
output_message "Job #{job.inspect} enqueued.".black.on_green
|
65
|
-
@jobs.push job
|
66
|
-
end
|
67
|
-
alias run enqueue
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def output_message(msg)
|
72
|
-
STDOUT.puts msg
|
73
|
-
STDOUT.flush
|
74
|
-
end
|
75
|
-
|
76
|
-
def run_job(job)
|
77
|
-
message = "Job #{job.inspect} about to run now:".black
|
78
|
-
message = message.ask_and_send(:on_color, 166) || message.on_yellow
|
79
|
-
output_message message
|
80
|
-
fork do
|
81
|
-
exec(*cmd(job))
|
82
|
-
end
|
83
|
-
Process.wait
|
84
|
-
message = "Job #{job.inspect} was just run"
|
85
|
-
if $?.success?
|
86
|
-
message << " successfully."
|
87
|
-
message = message.black.on_green
|
88
|
-
else
|
89
|
-
message << " and failed with exit status #{$?.exitstatus}!"
|
90
|
-
message = message.white.on_red.blink
|
91
|
-
end
|
92
|
-
output_message message
|
93
|
-
end
|
94
|
-
|
95
|
-
def work_loop
|
96
|
-
loop do
|
97
|
-
job = @jobs.shift
|
98
|
-
run_job job
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def cmd(job)
|
103
|
-
[ $0, *job ]
|
104
|
-
end
|
53
|
+
begin
|
54
|
+
DRb.start_service
|
55
|
+
DRbObject.new_with_uri(uri).shutdown
|
56
|
+
rescue DRb::DRbConnError
|
105
57
|
end
|
106
58
|
|
107
59
|
puts "Starting probe server listening to #{uri.inspect}."
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'tins/xt'
|
4
|
+
require 'term/ansicolor'
|
5
|
+
class String
|
6
|
+
include Term::ANSIColor
|
7
|
+
end
|
8
|
+
|
9
|
+
module Utils
|
10
|
+
class ProbeServer
|
11
|
+
def initialize
|
12
|
+
@jobs = Queue.new
|
13
|
+
Thread.new { work_loop }
|
14
|
+
end
|
15
|
+
|
16
|
+
def enqueue(job)
|
17
|
+
output_message "Job #{job.inspect} enqueued.".black.on_yellow
|
18
|
+
@jobs.push job
|
19
|
+
end
|
20
|
+
alias run enqueue
|
21
|
+
|
22
|
+
def shutdown
|
23
|
+
output_message "Server was shutdown down – HARD!".white.on_red.blink
|
24
|
+
exit! 23
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def output_message(msg)
|
30
|
+
STDOUT.puts msg
|
31
|
+
STDOUT.flush
|
32
|
+
end
|
33
|
+
|
34
|
+
def run_job(job)
|
35
|
+
message = "Job #{job.inspect} about to run now:".black
|
36
|
+
message = message.ask_and_send(:on_color, 166) || message.on_yellow
|
37
|
+
output_message message
|
38
|
+
fork do
|
39
|
+
exec(*cmd(job))
|
40
|
+
end
|
41
|
+
Process.wait
|
42
|
+
message = "Job #{job.inspect} was just run"
|
43
|
+
if $?.success?
|
44
|
+
message << " successfully."
|
45
|
+
message = message.black.on_green
|
46
|
+
else
|
47
|
+
message << " and failed with exit status #{$?.exitstatus}!"
|
48
|
+
message = message.white.on_red.blink
|
49
|
+
end
|
50
|
+
output_message message
|
51
|
+
end
|
52
|
+
|
53
|
+
def work_loop
|
54
|
+
loop do
|
55
|
+
job = @jobs.shift
|
56
|
+
run_job job
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def cmd(job)
|
61
|
+
[ $0, *job ]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/utils/version.rb
CHANGED
data/lib/utils.rb
CHANGED
data/utils.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "utils"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.87"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "2013-06-
|
9
|
+
s.date = "2013-06-21"
|
10
10
|
s.description = "This ruby gem provides some useful command line utilities"
|
11
11
|
s.email = "flori@ping.de"
|
12
12
|
s.executables = ["chroot-exec", "chroot-libs", "classify", "create_tags", "discover", "edit", "edit_wait", "enum", "errf", "git-empty", "irb_connect", "myex", "number_files", "on_change", "path", "probe", "remote_copy", "same_files", "search", "sedit", "ssh-tunnel", "strip_spaces", "unquarantine_apps", "untest", "utils-install-config", "utils-utilsrc", "vacuum_firefox_sqlite", "xmp"]
|
13
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/version.rb"]
|
14
|
-
s.files = [".gitignore", "COPYING", "Gemfile", "README.rdoc", "Rakefile", "TODO", "VERSION", "bin/chroot-exec", "bin/chroot-libs", "bin/classify", "bin/create_tags", "bin/discover", "bin/edit", "bin/edit_wait", "bin/enum", "bin/errf", "bin/git-empty", "bin/irb_connect", "bin/myex", "bin/number_files", "bin/on_change", "bin/path", "bin/probe", "bin/remote_copy", "bin/same_files", "bin/search", "bin/sedit", "bin/ssh-tunnel", "bin/strip_spaces", "bin/unquarantine_apps", "bin/untest", "bin/utils-install-config", "bin/utils-utilsrc", "bin/vacuum_firefox_sqlite", "bin/xmp", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/config/gdb/asm", "lib/utils/config/gdb/ruby", "lib/utils/config/gdbinit", "lib/utils/config/irbrc", "lib/utils/config/rdebugrc", "lib/utils/config/rvmrc", "lib/utils/config/screenrc", "lib/utils/config/utilsrc", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/version.rb", "utils.gemspec"]
|
13
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/probe_server.rb", "lib/utils/version.rb"]
|
14
|
+
s.files = [".gitignore", "COPYING", "Gemfile", "README.rdoc", "Rakefile", "TODO", "VERSION", "bin/chroot-exec", "bin/chroot-libs", "bin/classify", "bin/create_tags", "bin/discover", "bin/edit", "bin/edit_wait", "bin/enum", "bin/errf", "bin/git-empty", "bin/irb_connect", "bin/myex", "bin/number_files", "bin/on_change", "bin/path", "bin/probe", "bin/remote_copy", "bin/same_files", "bin/search", "bin/sedit", "bin/ssh-tunnel", "bin/strip_spaces", "bin/unquarantine_apps", "bin/untest", "bin/utils-install-config", "bin/utils-utilsrc", "bin/vacuum_firefox_sqlite", "bin/xmp", "lib/utils.rb", "lib/utils/config.rb", "lib/utils/config/config_file.rb", "lib/utils/config/gdb/asm", "lib/utils/config/gdb/ruby", "lib/utils/config/gdbinit", "lib/utils/config/irbrc", "lib/utils/config/rdebugrc", "lib/utils/config/rvmrc", "lib/utils/config/screenrc", "lib/utils/config/utilsrc", "lib/utils/editor.rb", "lib/utils/file_xt.rb", "lib/utils/finder.rb", "lib/utils/grepper.rb", "lib/utils/irb.rb", "lib/utils/md5.rb", "lib/utils/patterns.rb", "lib/utils/probe_server.rb", "lib/utils/version.rb", "utils.gemspec"]
|
15
15
|
s.homepage = "http://github.com/flori/utils"
|
16
16
|
s.rdoc_options = ["--title", "Utils - Some useful command line utilities", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.87
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -138,6 +138,7 @@ extra_rdoc_files:
|
|
138
138
|
- lib/utils/irb.rb
|
139
139
|
- lib/utils/md5.rb
|
140
140
|
- lib/utils/patterns.rb
|
141
|
+
- lib/utils/probe_server.rb
|
141
142
|
- lib/utils/version.rb
|
142
143
|
files:
|
143
144
|
- .gitignore
|
@@ -193,6 +194,7 @@ files:
|
|
193
194
|
- lib/utils/irb.rb
|
194
195
|
- lib/utils/md5.rb
|
195
196
|
- lib/utils/patterns.rb
|
197
|
+
- lib/utils/probe_server.rb
|
196
198
|
- lib/utils/version.rb
|
197
199
|
- utils.gemspec
|
198
200
|
homepage: http://github.com/flori/utils
|