Sha256: 19adbb97fef63a966efec2900112b6a01ad375201be81455e9785f3f3af11355
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'sinatra/base' require 'erb' module WebTranslateIt class Server < Sinatra::Base attr_reader :config dir = File.dirname(File.expand_path(__FILE__)) set :views, "#{dir}/views" set :public, "#{dir}/public" set :static, true set :lock, true helpers do def wti_root root = request.path root = "" if root == "/" root end def highlight(value, expected) return if value.nil? print_value = value == true ? "Yes" : "No" value == expected ? "<em>#{print_value}</em>" : "<em class=\"information\">#{print_value}</em>" end end get '/' do erb :index, :locals => { :config => config } end post '/pull' do `#{config.before_pull}` if config.before_pull `wti pull` `#{config.after_pull}` if config.after_pull redirect "/" end def initialize(*args) super @config = WebTranslateIt::Configuration.new('.') end def self.start(host, port) WebTranslateIt::Server.run! :host => host, :port => port end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
web_translate_it-1.7.0.4 | lib/web_translate_it/server.rb |
web_translate_it-1.7.0.3 | lib/web_translate_it/server.rb |