rsense-server 0.5.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.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/Gemfile +14 -0
  4. data/Guardfile +5 -0
  5. data/LICENSE.txt +1 -0
  6. data/README.md +51 -0
  7. data/Rakefile +9 -0
  8. data/bin/_rsense.rb +115 -0
  9. data/config/puma.rb +2 -0
  10. data/lib/rsense/server/code.rb +38 -0
  11. data/lib/rsense/server/command/completion_result.rb +11 -0
  12. data/lib/rsense/server/command/special_meth.rb +18 -0
  13. data/lib/rsense/server/command/type_inference_method.rb +24 -0
  14. data/lib/rsense/server/command.rb +239 -0
  15. data/lib/rsense/server/config.rb +70 -0
  16. data/lib/rsense/server/gem_path.rb +18 -0
  17. data/lib/rsense/server/listeners/find_definition_event_listener.rb +91 -0
  18. data/lib/rsense/server/listeners/where_event_listener.rb +39 -0
  19. data/lib/rsense/server/load_path.rb +62 -0
  20. data/lib/rsense/server/options.rb +85 -0
  21. data/lib/rsense/server/parser.rb +17 -0
  22. data/lib/rsense/server/path_info.rb +17 -0
  23. data/lib/rsense/server/project.rb +24 -0
  24. data/lib/rsense/server/version.rb +5 -0
  25. data/lib/rsense/server.rb +18 -0
  26. data/rsense-server.gemspec +35 -0
  27. data/spec/fixtures/config_fixture/.rsense +4 -0
  28. data/spec/fixtures/deeply/nested/thing.rb +0 -0
  29. data/spec/fixtures/find_def_sample.json +10 -0
  30. data/spec/fixtures/sample.json +10 -0
  31. data/spec/fixtures/test_gem/.gitignore +22 -0
  32. data/spec/fixtures/test_gem/Gemfile +4 -0
  33. data/spec/fixtures/test_gem/LICENSE.txt +22 -0
  34. data/spec/fixtures/test_gem/README.md +29 -0
  35. data/spec/fixtures/test_gem/Rakefile +2 -0
  36. data/spec/fixtures/test_gem/lib/sample/version.rb +3 -0
  37. data/spec/fixtures/test_gem/lib/sample.rb +16 -0
  38. data/spec/fixtures/test_gem/sample.gemspec +23 -0
  39. data/spec/fixtures/test_gem/test.json +10 -0
  40. data/spec/rsense/server/code_spec.rb +44 -0
  41. data/spec/rsense/server/command/special_meth_spec.rb +23 -0
  42. data/spec/rsense/server/command_spec.rb +108 -0
  43. data/spec/rsense/server/config_spec.rb +27 -0
  44. data/spec/rsense/server/gem_path_spec.rb +16 -0
  45. data/spec/rsense/server/load_path_spec.rb +63 -0
  46. data/spec/rsense/server/options_spec.rb +33 -0
  47. data/spec/rsense/server/path_info_spec.rb +11 -0
  48. data/spec/rsense/server/project_spec.rb +18 -0
  49. data/spec/rsense/server_spec.rb +7 -0
  50. data/spec/spec_helper.rb +16 -0
  51. data/vendor/gems/puma-2.8.2-java/COPYING +55 -0
  52. data/vendor/gems/puma-2.8.2-java/DEPLOYMENT.md +92 -0
  53. data/vendor/gems/puma-2.8.2-java/Gemfile +17 -0
  54. data/vendor/gems/puma-2.8.2-java/History.txt +532 -0
  55. data/vendor/gems/puma-2.8.2-java/LICENSE +26 -0
  56. data/vendor/gems/puma-2.8.2-java/Manifest.txt +68 -0
  57. data/vendor/gems/puma-2.8.2-java/README.md +251 -0
  58. data/vendor/gems/puma-2.8.2-java/Rakefile +158 -0
  59. data/vendor/gems/puma-2.8.2-java/bin/puma +10 -0
  60. data/vendor/gems/puma-2.8.2-java/bin/puma-wild +17 -0
  61. data/vendor/gems/puma-2.8.2-java/bin/pumactl +12 -0
  62. data/vendor/gems/puma-2.8.2-java/docs/config.md +0 -0
  63. data/vendor/gems/puma-2.8.2-java/docs/nginx.md +80 -0
  64. data/vendor/gems/puma-2.8.2-java/docs/signals.md +42 -0
  65. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/PumaHttp11Service.java +17 -0
  66. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/ext_help.h +15 -0
  67. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/extconf.rb +8 -0
  68. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/http11_parser.c +1225 -0
  69. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/http11_parser.h +64 -0
  70. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/http11_parser.java.rl +161 -0
  71. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/http11_parser.rl +146 -0
  72. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/http11_parser_common.rl +54 -0
  73. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/io_buffer.c +155 -0
  74. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/mini_ssl.c +195 -0
  75. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/org/jruby/puma/Http11.java +225 -0
  76. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/org/jruby/puma/Http11Parser.java +488 -0
  77. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/org/jruby/puma/MiniSSL.java +289 -0
  78. data/vendor/gems/puma-2.8.2-java/ext/puma_http11/puma_http11.c +491 -0
  79. data/vendor/gems/puma-2.8.2-java/lib/puma/accept_nonblock.rb +23 -0
  80. data/vendor/gems/puma-2.8.2-java/lib/puma/app/status.rb +59 -0
  81. data/vendor/gems/puma-2.8.2-java/lib/puma/binder.rb +298 -0
  82. data/vendor/gems/puma-2.8.2-java/lib/puma/capistrano.rb +86 -0
  83. data/vendor/gems/puma-2.8.2-java/lib/puma/cli.rb +587 -0
  84. data/vendor/gems/puma-2.8.2-java/lib/puma/client.rb +289 -0
  85. data/vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb +389 -0
  86. data/vendor/gems/puma-2.8.2-java/lib/puma/compat.rb +18 -0
  87. data/vendor/gems/puma-2.8.2-java/lib/puma/configuration.rb +377 -0
  88. data/vendor/gems/puma-2.8.2-java/lib/puma/const.rb +165 -0
  89. data/vendor/gems/puma-2.8.2-java/lib/puma/control_cli.rb +251 -0
  90. data/vendor/gems/puma-2.8.2-java/lib/puma/daemon_ext.rb +25 -0
  91. data/vendor/gems/puma-2.8.2-java/lib/puma/delegation.rb +11 -0
  92. data/vendor/gems/puma-2.8.2-java/lib/puma/detect.rb +4 -0
  93. data/vendor/gems/puma-2.8.2-java/lib/puma/events.rb +130 -0
  94. data/vendor/gems/puma-2.8.2-java/lib/puma/io_buffer.rb +7 -0
  95. data/vendor/gems/puma-2.8.2-java/lib/puma/java_io_buffer.rb +45 -0
  96. data/vendor/gems/puma-2.8.2-java/lib/puma/jruby_restart.rb +83 -0
  97. data/vendor/gems/puma-2.8.2-java/lib/puma/minissl.rb +148 -0
  98. data/vendor/gems/puma-2.8.2-java/lib/puma/null_io.rb +34 -0
  99. data/vendor/gems/puma-2.8.2-java/lib/puma/puma_http11.jar +0 -0
  100. data/vendor/gems/puma-2.8.2-java/lib/puma/rack_default.rb +7 -0
  101. data/vendor/gems/puma-2.8.2-java/lib/puma/rack_patch.rb +45 -0
  102. data/vendor/gems/puma-2.8.2-java/lib/puma/reactor.rb +183 -0
  103. data/vendor/gems/puma-2.8.2-java/lib/puma/runner.rb +146 -0
  104. data/vendor/gems/puma-2.8.2-java/lib/puma/server.rb +801 -0
  105. data/vendor/gems/puma-2.8.2-java/lib/puma/single.rb +102 -0
  106. data/vendor/gems/puma-2.8.2-java/lib/puma/tcp_logger.rb +32 -0
  107. data/vendor/gems/puma-2.8.2-java/lib/puma/thread_pool.rb +185 -0
  108. data/vendor/gems/puma-2.8.2-java/lib/puma/util.rb +9 -0
  109. data/vendor/gems/puma-2.8.2-java/lib/puma.rb +14 -0
  110. data/vendor/gems/puma-2.8.2-java/lib/rack/handler/puma.rb +66 -0
  111. data/vendor/gems/puma-2.8.2-java/puma.gemspec +55 -0
  112. data/vendor/gems/puma-2.8.2-java/test/test_app_status.rb +92 -0
  113. data/vendor/gems/puma-2.8.2-java/test/test_cli.rb +173 -0
  114. data/vendor/gems/puma-2.8.2-java/test/test_config.rb +26 -0
  115. data/vendor/gems/puma-2.8.2-java/test/test_http10.rb +27 -0
  116. data/vendor/gems/puma-2.8.2-java/test/test_http11.rb +144 -0
  117. data/vendor/gems/puma-2.8.2-java/test/test_integration.rb +165 -0
  118. data/vendor/gems/puma-2.8.2-java/test/test_iobuffer.rb +38 -0
  119. data/vendor/gems/puma-2.8.2-java/test/test_minissl.rb +25 -0
  120. data/vendor/gems/puma-2.8.2-java/test/test_null_io.rb +31 -0
  121. data/vendor/gems/puma-2.8.2-java/test/test_persistent.rb +238 -0
  122. data/vendor/gems/puma-2.8.2-java/test/test_puma_server.rb +323 -0
  123. data/vendor/gems/puma-2.8.2-java/test/test_rack_handler.rb +10 -0
  124. data/vendor/gems/puma-2.8.2-java/test/test_rack_server.rb +141 -0
  125. data/vendor/gems/puma-2.8.2-java/test/test_tcp_rack.rb +42 -0
  126. data/vendor/gems/puma-2.8.2-java/test/test_thread_pool.rb +156 -0
  127. data/vendor/gems/puma-2.8.2-java/test/test_unix_socket.rb +39 -0
  128. data/vendor/gems/puma-2.8.2-java/test/test_ws.rb +89 -0
  129. data/vendor/gems/puma-2.8.2-java/tools/jungle/README.md +9 -0
  130. data/vendor/gems/puma-2.8.2-java/tools/jungle/init.d/README.md +54 -0
  131. data/vendor/gems/puma-2.8.2-java/tools/jungle/init.d/puma +332 -0
  132. data/vendor/gems/puma-2.8.2-java/tools/jungle/init.d/run-puma +3 -0
  133. data/vendor/gems/puma-2.8.2-java/tools/jungle/upstart/README.md +61 -0
  134. data/vendor/gems/puma-2.8.2-java/tools/jungle/upstart/puma-manager.conf +31 -0
  135. data/vendor/gems/puma-2.8.2-java/tools/jungle/upstart/puma.conf +63 -0
  136. data/vendor/gems/puma-2.8.2-java/tools/trickletest.rb +45 -0
  137. metadata +389 -0
@@ -0,0 +1,298 @@
1
+ require 'puma/const'
2
+
3
+ module Puma
4
+ class Binder
5
+ include Puma::Const
6
+
7
+ def initialize(events)
8
+ @events = events
9
+ @listeners = []
10
+ @inherited_fds = {}
11
+ @unix_paths = []
12
+
13
+ @proto_env = {
14
+ "rack.version".freeze => Rack::VERSION,
15
+ "rack.errors".freeze => events.stderr,
16
+ "rack.multithread".freeze => true,
17
+ "rack.multiprocess".freeze => false,
18
+ "rack.run_once".freeze => false,
19
+ "SCRIPT_NAME".freeze => ENV['SCRIPT_NAME'] || "",
20
+
21
+ # Rack blows up if this is an empty string, and Rack::Lint
22
+ # blows up if it's nil. So 'text/plain' seems like the most
23
+ # sensible default value.
24
+ "CONTENT_TYPE".freeze => "text/plain",
25
+
26
+ "QUERY_STRING".freeze => "",
27
+ SERVER_PROTOCOL => HTTP_11,
28
+ SERVER_SOFTWARE => PUMA_VERSION,
29
+ GATEWAY_INTERFACE => CGI_VER
30
+ }
31
+
32
+ @envs = {}
33
+ @ios = []
34
+ end
35
+
36
+ attr_reader :listeners, :ios
37
+
38
+ def env(sock)
39
+ @envs.fetch(sock, @proto_env)
40
+ end
41
+
42
+ def close
43
+ @ios.each { |i| i.close }
44
+ @unix_paths.each { |i| File.unlink i }
45
+ end
46
+
47
+ def import_from_env
48
+ remove = []
49
+
50
+ ENV.each do |k,v|
51
+ if k =~ /PUMA_INHERIT_\d+/
52
+ fd, url = v.split(":", 2)
53
+ @inherited_fds[url] = fd.to_i
54
+ remove << k
55
+ end
56
+ if k =~ /LISTEN_FDS/ && ENV['LISTEN_PID'].to_i == $$
57
+ v.to_i.times do |num|
58
+ fd = num + 3
59
+ sock = TCPServer.for_fd(fd)
60
+ begin
61
+ url = "unix://" + Socket.unpack_sockaddr_un(sock.getsockname)
62
+ rescue ArgumentError
63
+ port, addr = Socket.unpack_sockaddr_in(sock.getsockname)
64
+ if addr =~ /\:/
65
+ addr = "[#{addr}]"
66
+ end
67
+ url = "tcp://#{addr}:#{port}"
68
+ end
69
+ @inherited_fds[url] = sock
70
+ end
71
+ ENV.delete k
72
+ ENV.delete 'LISTEN_PID'
73
+ end
74
+ end
75
+
76
+ remove.each do |k|
77
+ ENV.delete k
78
+ end
79
+ end
80
+
81
+ def parse(binds, logger)
82
+ binds.each do |str|
83
+ uri = URI.parse str
84
+ case uri.scheme
85
+ when "tcp"
86
+ if fd = @inherited_fds.delete(str)
87
+ logger.log "* Inherited #{str}"
88
+ io = inherit_tcp_listener uri.host, uri.port, fd
89
+ else
90
+ params = Rack::Utils.parse_query uri.query
91
+
92
+ opt = params.key?('low_latency')
93
+ bak = params.fetch('backlog', 1024).to_i
94
+
95
+ logger.log "* Listening on #{str}"
96
+ io = add_tcp_listener uri.host, uri.port, opt, bak
97
+ end
98
+
99
+ @listeners << [str, io]
100
+ when "unix"
101
+ path = "#{uri.host}#{uri.path}"
102
+
103
+ if fd = @inherited_fds.delete(str)
104
+ logger.log "* Inherited #{str}"
105
+ io = inherit_unix_listener path, fd
106
+ else
107
+ logger.log "* Listening on #{str}"
108
+
109
+ umask = nil
110
+
111
+ if uri.query
112
+ params = Rack::Utils.parse_query uri.query
113
+ if u = params['umask']
114
+ # Use Integer() to respect the 0 prefix as octal
115
+ umask = Integer(u)
116
+ end
117
+ end
118
+
119
+ io = add_unix_listener path, umask
120
+ end
121
+
122
+ @listeners << [str, io]
123
+ when "ssl"
124
+ if IS_JRUBY
125
+ @events.error "SSL not supported on JRuby"
126
+ raise UnsupportedOption
127
+ end
128
+
129
+ params = Rack::Utils.parse_query uri.query
130
+ require 'puma/minissl'
131
+
132
+ ctx = MiniSSL::Context.new
133
+ unless params['key']
134
+ @events.error "Please specify the SSL key via 'key='"
135
+ end
136
+
137
+ ctx.key = params['key']
138
+
139
+ unless params['cert']
140
+ @events.error "Please specify the SSL cert via 'cert='"
141
+ end
142
+
143
+ ctx.cert = params['cert']
144
+
145
+ ctx.verify_mode = MiniSSL::VERIFY_NONE
146
+
147
+ if fd = @inherited_fds.delete(str)
148
+ logger.log "* Inherited #{str}"
149
+ io = inherited_ssl_listener fd, ctx
150
+ else
151
+ logger.log "* Listening on #{str}"
152
+ io = add_ssl_listener uri.host, uri.port, ctx
153
+ end
154
+
155
+ @listeners << [str, io]
156
+ else
157
+ logger.error "Invalid URI: #{str}"
158
+ end
159
+ end
160
+
161
+ # If we inherited fds but didn't use them (because of a
162
+ # configuration change), then be sure to close them.
163
+ @inherited_fds.each do |str, fd|
164
+ logger.log "* Closing unused inherited connection: #{str}"
165
+
166
+ begin
167
+ if fd.kind_of? TCPServer
168
+ fd.close
169
+ else
170
+ IO.for_fd(fd).close
171
+ end
172
+
173
+ rescue SystemCallError
174
+ end
175
+
176
+ # We have to unlink a unix socket path that's not being used
177
+ uri = URI.parse str
178
+ if uri.scheme == "unix"
179
+ path = "#{uri.host}#{uri.path}"
180
+ File.unlink path
181
+ end
182
+ end
183
+
184
+ end
185
+
186
+ # Tell the server to listen on host +host+, port +port+.
187
+ # If +optimize_for_latency+ is true (the default) then clients connecting
188
+ # will be optimized for latency over throughput.
189
+ #
190
+ # +backlog+ indicates how many unaccepted connections the kernel should
191
+ # allow to accumulate before returning connection refused.
192
+ #
193
+ def add_tcp_listener(host, port, optimize_for_latency=true, backlog=1024)
194
+ host = host[1..-2] if host[0..0] == '['
195
+ s = TCPServer.new(host, port)
196
+ if optimize_for_latency
197
+ s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
198
+ end
199
+ s.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
200
+ s.listen backlog
201
+ @ios << s
202
+ s
203
+ end
204
+
205
+ def inherit_tcp_listener(host, port, fd)
206
+ if fd.kind_of? TCPServer
207
+ s = fd
208
+ else
209
+ s = TCPServer.for_fd(fd)
210
+ end
211
+
212
+ @ios << s
213
+ s
214
+ end
215
+
216
+ def add_ssl_listener(host, port, ctx,
217
+ optimize_for_latency=true, backlog=1024)
218
+ if IS_JRUBY
219
+ @events.error "SSL not supported on JRuby"
220
+ raise UnsupportedOption
221
+ end
222
+
223
+ require 'puma/minissl'
224
+
225
+ s = TCPServer.new(host, port)
226
+ if optimize_for_latency
227
+ s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
228
+ end
229
+ s.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
230
+ s.listen backlog
231
+
232
+ ssl = MiniSSL::Server.new s, ctx
233
+ env = @proto_env.dup
234
+ env[HTTPS_KEY] = HTTPS
235
+ @envs[ssl] = env
236
+
237
+ @ios << ssl
238
+ s
239
+ end
240
+
241
+ def inherited_ssl_listener(fd, ctx)
242
+ if IS_JRUBY
243
+ @events.error "SSL not supported on JRuby"
244
+ raise UnsupportedOption
245
+ end
246
+
247
+ require 'puma/minissl'
248
+ s = TCPServer.for_fd(fd)
249
+ @ios << MiniSSL::Server.new(s, ctx)
250
+ s
251
+ end
252
+
253
+ # Tell the server to listen on +path+ as a UNIX domain socket.
254
+ #
255
+ def add_unix_listener(path, umask=nil)
256
+ @unix_paths << path
257
+
258
+ # Let anyone connect by default
259
+ umask ||= 0
260
+
261
+ begin
262
+ old_mask = File.umask(umask)
263
+
264
+ if File.exist? path
265
+ begin
266
+ old = UNIXSocket.new path
267
+ rescue SystemCallError, IOError
268
+ File.unlink path
269
+ else
270
+ old.close
271
+ raise "There is already a server bound to: #{path}"
272
+ end
273
+ end
274
+
275
+ s = UNIXServer.new(path)
276
+ @ios << s
277
+ ensure
278
+ File.umask old_mask
279
+ end
280
+
281
+ s
282
+ end
283
+
284
+ def inherit_unix_listener(path, fd)
285
+ @unix_paths << path
286
+
287
+ if fd.kind_of? TCPServer
288
+ s = fd
289
+ else
290
+ s = UNIXServer.for_fd fd
291
+ end
292
+ @ios << s
293
+
294
+ s
295
+ end
296
+
297
+ end
298
+ end
@@ -0,0 +1,86 @@
1
+ Capistrano::Configuration.instance.load do
2
+
3
+ # Ensure the tmp/sockets directory is created by the deploy:setup task and
4
+ # symlinked in by the deploy:update task. This is not handled by Capistrano
5
+ # v2 but is fixed in v3.
6
+ shared_children.push('tmp/sockets')
7
+
8
+ _cset(:puma_default_hooks) { true }
9
+ _cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
10
+ _cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
11
+ _cset(:puma_env) { fetch(:rack_env, fetch(:rails_env, 'production')) }
12
+ _cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
13
+ _cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" }
14
+ _cset(:puma_role) { :app }
15
+
16
+ if fetch(:puma_default_hooks)
17
+ after 'deploy:stop', 'puma:stop'
18
+ after 'deploy:start', 'puma:start'
19
+ after 'deploy:restart', 'puma:restart'
20
+ end
21
+
22
+ namespace :puma do
23
+ desc 'Start puma'
24
+ task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
25
+ run "cd #{current_path} && #{puma_cmd} #{start_options}", :pty => false
26
+ end
27
+
28
+ desc 'Stop puma'
29
+ task :stop, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
30
+ run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} stop"
31
+ end
32
+
33
+ desc 'Restart puma'
34
+ task :restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
35
+ begin
36
+ run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} restart"
37
+ rescue Capistrano::CommandError => ex
38
+ puts "Failed to restart puma: #{ex}\nAssuming not started."
39
+ start
40
+ end
41
+ end
42
+
43
+ desc 'Restart puma (phased restart)'
44
+ task :phased_restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
45
+ begin
46
+ run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} phased-restart"
47
+ rescue Capistrano::CommandError => ex
48
+ puts "Failed to restart puma: #{ex}\nAssuming not started."
49
+ start
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ def start_options
56
+ if config_file
57
+ "-q -d -e #{puma_env} -C #{config_file}"
58
+ else
59
+ "-q -d -e #{puma_env} -b '#{puma_socket}' -S #{state_path} --control 'unix://#{shared_path}/sockets/pumactl.sock'"
60
+ end
61
+ end
62
+
63
+ def config_file
64
+ @_config_file ||= begin
65
+ file = fetch(:puma_config_file, nil)
66
+ file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
67
+ file
68
+ end
69
+ end
70
+
71
+ def puma_env
72
+ fetch(:rack_env, fetch(:rails_env, 'production'))
73
+ end
74
+
75
+ def state_path
76
+ (config_file ? configuration.options[:state] : nil) || puma_state
77
+ end
78
+
79
+ def configuration
80
+ require 'puma/configuration'
81
+
82
+ config = Puma::Configuration.new(:config_file => config_file)
83
+ config.load
84
+ config
85
+ end
86
+ end