Sha256: 395122373e408c72e7ab3c9090e4b087a65661dded46950d36e3acedc34cbe48
Contents?: true
Size: 811 Bytes
Versions: 9
Compression:
Stored size: 811 Bytes
Contents
require 'erb' require 'yaml' require 'find' require 'fileutils' $base = File.expand_path(File.dirname(__FILE__)) require 'rubygems' require 'sinatra' require 'json' class DemoTestSite < Sinatra::Base configure do set(:server, ["mongrel", "webrick"]) set(:chdir, $base) set(:public_folder, ($base + "/public")) set(:bind, "localhost") #enable(:sessions) end get("/") do cook = false erb(:index) end post("/create_tmp_file") do res = {:results => false} file = "/tmp/#{params['file_name']}" begin FileUtils.rm_f file if File.exists? file FileUtils.touch file rescue => e end res[:results] = File.exists? file res.to_json end end Dir.chdir($base) retry_ct = 0 DemoTestSite.run!(:host => "localhost", :port => 9090, :chdir => $base)
Version data entries
9 entries across 9 versions & 1 rubygems