rubocoin 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/rubocoind +38 -35
- data/lib/rubocoin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8aa4172dacf8effb4c4050bb7a4ef0778bb236f9
|
|
4
|
+
data.tar.gz: ddce33a158d62bf7a3d4598847dfcb550cf8acc1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b442f9a3f79d80061055fe2587ef7c4225f78b17b62e73524a5834a48eb4cc44da901b5a6c226a52bea835ee31f4d793e97a6e54856a6742cfe84dc9cef13077
|
|
7
|
+
data.tar.gz: d1d400b8c6f643855b793cd44d571cd4fa392654a904670b34a784362d09856d016e76452c83e43bdb07083107a8a5fdd3875538ed1f0a39b7b4e75cc2a9791f
|
data/Gemfile.lock
CHANGED
data/bin/rubocoind
CHANGED
|
@@ -5,6 +5,44 @@ unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
require 'rubocoin'
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
+
daemonize = false
|
|
9
|
+
|
|
10
|
+
parser = OptionParser.new do |opts|
|
|
11
|
+
|
|
12
|
+
opts.banner = "Usage #{File.basename($PROGRAM_NAME)} [options]"
|
|
13
|
+
|
|
14
|
+
opts.on('-d', '--daemon', 'Run the node in the background') do
|
|
15
|
+
daemonize = true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
opts.on('-k', '--kill-daemon', 'Kill the rubocoind service if it\'s running') do
|
|
19
|
+
unless File.file?('/tmp/rubocoind.pid')
|
|
20
|
+
puts 'The rubocoin daemon doesn\'t seem to be running'
|
|
21
|
+
exit 0
|
|
22
|
+
end
|
|
23
|
+
pid = File.read('/tmp/rubocoind.pid')
|
|
24
|
+
# Check validity of pid file (no code injection for you)
|
|
25
|
+
if pid.to_s =~ /^[A-Z+$]/i
|
|
26
|
+
puts 'PID file is not in the correct format'
|
|
27
|
+
exit 0
|
|
28
|
+
end
|
|
29
|
+
system("kill #{pid}")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
opts.on('--version', 'Show the current version and exit') do
|
|
33
|
+
puts Rubocoin::VERSION
|
|
34
|
+
exit 0
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
opts.on_tail('-h', '--help', 'Show this help message and exit') do
|
|
38
|
+
puts opts
|
|
39
|
+
exit 0
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
parser.parse!
|
|
44
|
+
|
|
45
|
+
|
|
8
46
|
def return_invalid_json
|
|
9
47
|
{ :message => 'ERROR: Please supply valid JSON' }.to_json
|
|
10
48
|
end
|
|
@@ -133,41 +171,6 @@ class Rubocoind < Sinatra::Base
|
|
|
133
171
|
end
|
|
134
172
|
|
|
135
173
|
|
|
136
|
-
daemonize = false
|
|
137
|
-
|
|
138
|
-
OptionParser.new do |opts|
|
|
139
|
-
|
|
140
|
-
opts.banner = "Usage #{File.basename($PROGRAM_NAME) [options]}"
|
|
141
|
-
|
|
142
|
-
opts.on('-d', '--daemon', 'Run the node in the background') do
|
|
143
|
-
daemonize = true
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
opts.on('-k', '--kill-daemon', 'Kill the rubocoind service if it\'s running') do
|
|
147
|
-
unless File.file?('/tmp/rubocoind.pid')
|
|
148
|
-
puts 'The rubocoin daemon doesn\'t seem to be running'
|
|
149
|
-
exit 0
|
|
150
|
-
end
|
|
151
|
-
pid = File.read('/tmp/rubocoind.pid')
|
|
152
|
-
# Check validity of pid file (no code injection for you)
|
|
153
|
-
if pid ~= /^[A-Z+$]/i
|
|
154
|
-
puts 'PID file is not in the correct format'
|
|
155
|
-
exit 0
|
|
156
|
-
end
|
|
157
|
-
system("kill #{pid}")
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
opts.on('--version', 'Show the current version and exit') do
|
|
161
|
-
puts Rubocoin::Version
|
|
162
|
-
exit 0
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
opts.on_tail('-h', '--help', 'SHow this help message and exit') do
|
|
166
|
-
puts opts
|
|
167
|
-
exit 0
|
|
168
|
-
end
|
|
169
|
-
end.parse!
|
|
170
|
-
|
|
171
174
|
if daemonize
|
|
172
175
|
fork do
|
|
173
176
|
Rubocoind.run!
|
data/lib/rubocoin/version.rb
CHANGED