Module: Apitest
- Defined in:
- lib/apitest.rb,
lib/apitest/engine.rb,
lib/apitest/version.rb,
app/jobs/apitest/application_job.rb,
app/helpers/apitest/apitest_helper.rb,
app/models/apitest/application_record.rb,
app/helpers/apitest/application_helper.rb,
app/mailers/apitest/application_mailer.rb,
app/controllers/apitest/apitest_controller.rb,
app/controllers/apitest/application_controller.rb
Defined Under Namespace
Modules: ApitestHelper, ApplicationHelper
Classes: ApitestController, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Engine, Reader
Constant Summary
collapse
- VERSION =
'0.1.8'
Class Method Summary
collapse
Class Method Details
.api_dir(dir = nil) ⇒ Object
18
19
20
21
|
# File 'lib/apitest.rb', line 18
def api_dir(dir = nil)
@api_dir = dir if dir
@api_dir
end
|
.default_types(default_types = []) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/apitest.rb', line 28
def default_types(default_types = [])
return @default_types if default_types.blank?
@default_types = {}
default_types.each do |type|
@default_types[type] = []
end
@default_types
end
|
.general_need(general_need = []) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/apitest.rb', line 37
def general_need(general_need = [])
return @general_need if general_need.blank?
@general_need = {}
general_need.each do |need|
@general_need[need] = { text: need.to_s , required: true }
end
@general_need
end
|
.start_server_log_listen ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/apitest.rb', line 46
def start_server_log_listen
Process.detach(
fork do
p 'Kill Apitest WebSocket Process ...'
`lsof -i :9527 |awk '$1 == "ruby" {print $2}' |xargs kill -9`
begin
filename = "#{Rails.root}/log/#{Rails.env}.log"
EventMachine.run do
WebSocket::EventMachine::Server.start(:host => "0.0.0.0", :port => 9527) do |ws|
proc = Proc.new { |line|
ws.send Ansi::To::Html.new(line.strip).to_html.strip
}
EventMachine::file_tail(filename, Reader, &proc)
end
p 'Start Apitest WebSocket Process !'
end
rescue Exception => e
retry
end
end
)
end
|
.theme(theme = nil) ⇒ Object
23
24
25
26
|
# File 'lib/apitest.rb', line 23
def theme(theme = nil)
@theme = theme if theme
@theme
end
|