Module: HTTY::Rack
- Defined in:
- lib/htty/rack.rb,
lib/htty/rack/cli.rb,
lib/htty/rack/requests_util.rb
Defined Under Namespace
Classes: CLI, Request, RequestsUtil, Session
Constant Summary
collapse
- VERSION =
File.read("#{File.dirname __FILE__}/../../VERSION").chomp
Class Method Summary
collapse
Class Method Details
.build_app(filename = nil) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/htty/rack.rb', line 14
def self.build_app(filename = nil)
config_file_name = File.basename(filename || find_config_file)
config_file = File.read(config_file_name)
app = ::Rack::Builder.new { instance_eval(config_file) }.to_app
[config_file_name, app]
end
|
.find_config_file ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/htty/rack.rb', line 21
def self.find_config_file
if Dir.glob("config.ru").length > 0
File.join(Dir.pwd,"config.ru")
elsif Dir.pwd != "/"
Dir.chdir("..") { find_config_file }
else
raise "Cannot find config.ru"
end
end
|