-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.rb
executable file
·54 lines (47 loc) · 1.86 KB
/
index.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)
require 'yaml'
configure do
set :protection, :except => :frame_options
end
routes_info = YAML.load(File.read('meta_tag_content.yaml'))
def find_hashed_js # TODO: Now name of appcomponents file is taken from ENV. Delete this code if everything will be stable and on production.
js_filename = `find /home/deployer/smg_frontend/js -name "appcomponents*.js" | sed 's#.*/##'`
js_filename = `find /home/ubuntu/html/js -name "appcomponents*.js" | sed 's#.*/##'` if js_filename.strip == ''
puts "JS_FILENAME: #{js_filename}"
js_filename = 'appcomponents.js' if js_filename.strip == ''
js_filename
end
routes_info.each do |route, info|
get "/#{route}" do
info = routes_info[[route, params[:direct_link]].join('/')] if params[:direct_link]
@title = info['Title']
@description = info['Description']
@js_filename = ENV['APP_FILE_NAME']
erb :'index'
end
end
get "/support" do
@js_filename = ENV['APP_FILE_NAME']
case params[:direct_link]
when "general"
@title = routes_info["support/general"]["Title"]
@description = routes_info["support/general"]["Description"]
erb :'index'
when "publishers"
@title = routes_info["support/publishers"]["Title"]
@description = routes_info["support/publishers"]["Description"]
erb :'index'
when "influencers"
@title = routes_info["support/influencers"]["Title"]
@description = routes_info["support/influencers"]["Description"]
erb :'index'
end
end
get '/*' do
@title = 'SWAYY | Targeted Influencer Marketing for Hotels & Restaurants'
@description = "Swayy is the world's first hotel and restaurant booking site for digital Influencers. Swayy helps Leisure Businesses increase sales and brand awareness through effective Influencer Marketing."
@js_filename = ENV['APP_FILE_NAME']
erb :'index'
end