constable 0.2.1 → 0.2.2
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.
- data/bin/constable-compare +47 -0
- data/bin/constable-composite +47 -0
- data/bin/constabled +30 -0
- data/lib/constable/version.rb +1 -1
- metadata +7 -3
@@ -0,0 +1,47 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
require 'stomp'
|
5
|
+
require 'json'
|
6
|
+
require "getoptlong"
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
argv = GetoptLong.new(
|
10
|
+
[ "--broker", "-b", GetoptLong::OPTIONAL_ARGUMENT ]
|
11
|
+
)
|
12
|
+
argv.each do |option, value|
|
13
|
+
options['broker'] = value if option == '--broker'
|
14
|
+
end
|
15
|
+
options['broker'] ||= 'stomp://127.0.0.1:61613'
|
16
|
+
|
17
|
+
parameters = ARGV.join ' '
|
18
|
+
command = {
|
19
|
+
command: File.basename($0).gsub(/^constable-/, ''),
|
20
|
+
parameters: parameters,
|
21
|
+
files: {}
|
22
|
+
}
|
23
|
+
ARGV.each do |file_name|
|
24
|
+
if File.exists? file_name
|
25
|
+
file = File.read file_name
|
26
|
+
data = Base64.encode64 file
|
27
|
+
command[:files][file_name] = data
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
command_json = JSON.generate command
|
32
|
+
|
33
|
+
results = '/queue/constable.results-' + Process.pid.to_s + '-' + Time.now.to_i.to_s
|
34
|
+
client = Stomp::Client.new options['broker']
|
35
|
+
client.publish '/queue/constable', command_json, 'reply-to' => results
|
36
|
+
|
37
|
+
client.subscribe results, 'auto-delete' => true do |message|
|
38
|
+
results = JSON.parse message.body
|
39
|
+
if results['exit_code'] == 0
|
40
|
+
print results['stdout']
|
41
|
+
else
|
42
|
+
print results['stderr']
|
43
|
+
end
|
44
|
+
client.close
|
45
|
+
end
|
46
|
+
|
47
|
+
client.join
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
require 'stomp'
|
5
|
+
require 'json'
|
6
|
+
require "getoptlong"
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
argv = GetoptLong.new(
|
10
|
+
[ "--broker", "-b", GetoptLong::OPTIONAL_ARGUMENT ]
|
11
|
+
)
|
12
|
+
argv.each do |option, value|
|
13
|
+
options['broker'] = value if option == '--broker'
|
14
|
+
end
|
15
|
+
options['broker'] ||= 'stomp://127.0.0.1:61613'
|
16
|
+
|
17
|
+
parameters = ARGV.join ' '
|
18
|
+
command = {
|
19
|
+
command: File.basename($0).gsub(/^constable-/, ''),
|
20
|
+
parameters: parameters,
|
21
|
+
files: {}
|
22
|
+
}
|
23
|
+
ARGV.each do |file_name|
|
24
|
+
if File.exists? file_name
|
25
|
+
file = File.read file_name
|
26
|
+
data = Base64.encode64 file
|
27
|
+
command[:files][file_name] = data
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
command_json = JSON.generate command
|
32
|
+
|
33
|
+
results = '/queue/constable.results-' + Process.pid.to_s + '-' + Time.now.to_i.to_s
|
34
|
+
client = Stomp::Client.new options['broker']
|
35
|
+
client.publish '/queue/constable', command_json, 'reply-to' => results
|
36
|
+
|
37
|
+
client.subscribe results, 'auto-delete' => true do |message|
|
38
|
+
results = JSON.parse message.body
|
39
|
+
if results['exit_code'] == 0
|
40
|
+
print results['stdout']
|
41
|
+
else
|
42
|
+
print results['stderr']
|
43
|
+
end
|
44
|
+
client.close
|
45
|
+
end
|
46
|
+
|
47
|
+
client.join
|
data/bin/constabled
CHANGED
@@ -120,6 +120,36 @@ class Job
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
class CompareCommand
|
124
|
+
include WorkingEnvironment
|
125
|
+
|
126
|
+
attr_accessor :options
|
127
|
+
private :options, :options=
|
128
|
+
|
129
|
+
def initialize options
|
130
|
+
self.options = options
|
131
|
+
end
|
132
|
+
|
133
|
+
def execute
|
134
|
+
run_command :compare
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
class CompositeCommand
|
139
|
+
include WorkingEnvironment
|
140
|
+
|
141
|
+
attr_accessor :options
|
142
|
+
private :options, :options=
|
143
|
+
|
144
|
+
def initialize options
|
145
|
+
self.options = options
|
146
|
+
end
|
147
|
+
|
148
|
+
def execute
|
149
|
+
run_command :composite
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
123
153
|
class ConvertCommand
|
124
154
|
include WorkingEnvironment
|
125
155
|
|
data/lib/constable/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-03 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: stomp
|
16
|
-
requirement: &
|
16
|
+
requirement: &70151215102360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,12 +21,14 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70151215102360
|
25
25
|
description: Installing ImageMagick and RMagick everywhere sucks, right? So install
|
26
26
|
it in one place and have everything else use that one install.
|
27
27
|
email:
|
28
28
|
- craig@barkingiguana.com
|
29
29
|
executables:
|
30
|
+
- constable-compare
|
31
|
+
- constable-composite
|
30
32
|
- constable-convert
|
31
33
|
- constable-identify
|
32
34
|
- constable-install
|
@@ -36,6 +38,8 @@ extra_rdoc_files: []
|
|
36
38
|
files:
|
37
39
|
- lib/constable/version.rb
|
38
40
|
- lib/constable.rb
|
41
|
+
- bin/constable-compare
|
42
|
+
- bin/constable-composite
|
39
43
|
- bin/constable-convert
|
40
44
|
- bin/constable-identify
|
41
45
|
- bin/constable-install
|