custom landing page logic for mobile. yay

This commit is contained in:
danielgrippi 2012-05-11 17:05:09 -07:00
parent 132bdd3bc5
commit 81661c883f
4 changed files with 10 additions and 7 deletions

View file

@ -13,7 +13,11 @@ class HomeController < ApplicationController
redirect_to stream_path
end
elsif is_mobile_device?
unless(File.exist?("#{Rails.root}/app/views/home/_show.mobile.erb"))
redirect_to user_session_path
else
render :show, :layout => 'post'
end
else
@landing_page = true
render :show, :layout => 'post'

View file

@ -2,7 +2,7 @@ desc "revert custom landing page commit after heroku san deploys"
task :after_deploy => :environment do
# Perform this task only if custom landing page is not present in app/views/home/_show.html.haml
if File.exist?(File.join(Rails.root, "app", "views", "home", "_show.html.erb")) && system("git log | head -5 | grep 'custom\ landing\ page'")
if (File.exist?(File.join(Rails.root, "app", "views", "home", "_show.html.erb")) || File.exist?(File.join(Rails.root, "app", "views", "home", "_show.mobile.erb"))) && system("git log | head -5 | grep 'custom\ landing\ page(s)'")
puts "-----> resetting HEAD before custom landing page commit"
system("git reset HEAD^") ? true : fail

View file

@ -2,16 +2,15 @@ desc "include custom landing page before heroku san deploys"
task :before_deploy => :environment do
each_heroku_app do |stage|
home_file = stage.config['HOME_FILE']
home_file = stage.config['HOME_FILE_DESKTOP']
# Perform this task only if custom landing page is not present in app/views/home/_show.html.haml
if home_file.present?
puts "-----> custom landing page detected..."
puts "-----> including custom landing page in a temp commit"
puts "-----> custom landing page(s) detected..."
puts "-----> including custom landing page(s) in a temp commit"
@did_not_stash = system("git stash| grep 'No local changes to save'")
system("git add #{home_file} -f") ? true : fail
system("git commit -m 'adding custom landing page for heroku'") ? true : fail
system("git commit -m 'adding custom landing page(s) for heroku'") ? true : fail
puts "-----> done"
end