Sha256: 2821c88f4495903036abd6612e838e28d8561ed3c34043c4cb55b61aaa7c4072

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 Bytes

Contents

require 'sinatra/base'
require 'zendesk_apps_support/package'

module ZendeskAppsTools
  class Server < Sinatra::Base
    set :protection, :except => :frame_options
    set :public_folder, proc { "#{settings.root}/assets" }
    last_mtime = Time.new(0)

    get '/app.js' do
      content_type 'text/javascript'

      if File.exists? settings.config
        curr_mtime = File.stat(settings.config).mtime
        if curr_mtime > last_mtime
          settings_helper = ZendeskAppsTools::Settings.new
          settings.parameters = settings_helper.get_settings_from_file(settings.config, settings.manifest)
          last_mtime = curr_mtime
        end
      end

      ZendeskAppsSupport::Package.new(settings.root).readified_js(nil, settings.app_id, "http://localhost:#{settings.port}/", settings.parameters, params['locale'])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zendesk_apps_tools-1.25.0 lib/zendesk_apps_tools/server.rb
zendesk_apps_tools-1.24.3 lib/zendesk_apps_tools/server.rb