riddl 0.99.196 → 0.99.197
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/lib/ruby/riddl/server.rb +19 -16
- data/lib/ruby/riddl/utils/fileserve.rb +18 -11
- data/riddl.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f63ab5e073d3f4ad52ca2a8da2610744e41c5bd3
|
4
|
+
data.tar.gz: 6d2230ea52f58d53079cea749da984748705edbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d81f4ada7e6f5439766326bea935a36d4e111b58fe32a069b9f5710c9963f4de8e29bdeb4492b1cf58b3912174d8e88af0af3e9efead16e0d22939c7064b3103
|
7
|
+
data.tar.gz: c76110264a2abffa77c0e6136eda9f4a571b08d3b7c056604157da273582b5c86566e38faeda7be72c564b07ade64a97976a221a051c2ab75d8e85d32e9ef488
|
data/lib/ruby/riddl/server.rb
CHANGED
@@ -43,13 +43,14 @@ module Riddl
|
|
43
43
|
end #}}}
|
44
44
|
|
45
45
|
OPTS = {
|
46
|
-
:host
|
47
|
-
:port
|
48
|
-
:secure
|
49
|
-
:mode
|
50
|
-
:basepath
|
51
|
-
:pidfile
|
52
|
-
:conffile
|
46
|
+
:host => 'localhost',
|
47
|
+
:port => 9292,
|
48
|
+
:secure => false,
|
49
|
+
:mode => :debug,
|
50
|
+
:basepath => File.expand_path(File.dirname($0)),
|
51
|
+
:pidfile => File.basename($0,'.rb') + '.pid',
|
52
|
+
:conffile => File.basename($0,'.rb') + '.conf',
|
53
|
+
:runtime_options => []
|
53
54
|
}
|
54
55
|
|
55
56
|
def loop! #{{{
|
@@ -61,16 +62,18 @@ module Riddl
|
|
61
62
|
operation = "start"
|
62
63
|
ARGV.options { |opt|
|
63
64
|
opt.summary_indent = ' ' * 4
|
64
|
-
opt.banner = "Usage:\n#{opt.summary_indent}ruby server.rb [options] start|
|
65
|
+
opt.banner = "Usage:\n#{opt.summary_indent}ruby server.rb [options] start|stop|restart|info|...\n"
|
65
66
|
opt.on("Options:")
|
66
67
|
opt.on("--http-only", "-s", "Only http, no other protocols.") { http_only = true }
|
67
68
|
opt.on("--verbose", "-v", "Do not daemonize. Write ouput to console.") { verbose = true }
|
68
69
|
opt.on("--help", "-h", "This text.") { puts opt; exit }
|
69
70
|
opt.separator(opt.summary_indent + "start|stop|restart|info".ljust(opt.summary_width+1) + "Do operation start, stop, restart or get information.")
|
70
|
-
|
71
|
+
@riddl_opts[:runtime_options].each do |ro|
|
72
|
+
opt.separator(opt.summary_indent + ro[0].ljust(opt.summary_width+1) + ro[1])
|
73
|
+
end
|
71
74
|
opt.parse!
|
72
75
|
}
|
73
|
-
unless %w{start
|
76
|
+
unless (%w{start stop restart info} + @riddl_opts[:runtime_options].map{|ro| ro[0] }).include?(ARGV[0])
|
74
77
|
puts ARGV.options
|
75
78
|
exit
|
76
79
|
end
|
@@ -104,10 +107,12 @@ module Riddl
|
|
104
107
|
end
|
105
108
|
exit
|
106
109
|
end
|
107
|
-
if %w{start
|
110
|
+
if %w{start}.include?(operation) && status.call == true
|
108
111
|
puts "Server (#{@riddl_opts[:url]}) already started"
|
109
112
|
exit
|
110
113
|
end
|
114
|
+
|
115
|
+
|
111
116
|
|
112
117
|
########################################################################################################################
|
113
118
|
# stop/restart server
|
@@ -127,12 +132,10 @@ module Riddl
|
|
127
132
|
end
|
128
133
|
|
129
134
|
########################################################################################################################
|
130
|
-
#
|
135
|
+
# go through user defined startup thingis
|
131
136
|
########################################################################################################################
|
132
|
-
|
133
|
-
|
134
|
-
FileUtils.rm_r(d) if File.basename(d) =~ /^\d+$/
|
135
|
-
end
|
137
|
+
@riddl_opts[:runtime_options].each do |ro|
|
138
|
+
ro[2].call(status.call) if operation == ro[0]
|
136
139
|
end
|
137
140
|
|
138
141
|
app = Rack::Builder.new self
|
@@ -21,18 +21,25 @@ module Riddl
|
|
21
21
|
@headers << Riddl::Header.new("Connection","close")
|
22
22
|
@status = 304 # Not modified
|
23
23
|
return []
|
24
|
-
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
else
|
25
|
+
fmt = @a[1] || begin
|
26
|
+
mt = MIME::Types.type_for(path).first
|
27
|
+
if mt.nil?
|
28
|
+
'text/plain;charset=utf-8'
|
29
|
+
else
|
30
|
+
apx = ''
|
31
|
+
if mt.ascii?
|
32
|
+
tstr = File.read(path,CharlockHolmes::EncodingDetector::DEFAULT_BINARY_SCAN_LEN)
|
33
|
+
apx = ';charset=' + CharlockHolmes::EncodingDetector.detect(tstr)[:encoding]
|
34
|
+
end
|
35
|
+
mt.to_s + apx
|
36
|
+
end
|
30
37
|
end
|
31
|
-
return Riddl::Parameter::Complex.new('file',
|
32
|
-
end
|
38
|
+
return Riddl::Parameter::Complex.new('file',fmt,File.open(path,'r'))
|
39
|
+
end
|
33
40
|
end
|
34
41
|
@status = 404
|
35
|
-
end
|
42
|
+
end
|
36
43
|
end
|
37
|
-
end
|
38
|
-
end
|
44
|
+
end
|
45
|
+
end
|
data/riddl.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.197
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: tools
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xml-smart
|