Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REQUEST: Pull my changes to make this more "heroku friendly" #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
This is forked from a Sinatra app which shows how to do Facebook Login/Logout, as well as Like & Share buttons.

To use this application, you first need to go to Facebook and get application credentials.

http://www.facebook.com/developers/createapp.php

You need your:
Facebook application ID: <APP_ID>
Facebook application secret: <APP_SECRET>

Also, pick a "Application Name" for your app in the Facebook config page.

You need to set up Ruby (I used 1.9.2) and the heroku gem
> gem install heroku

To run this on Windows, you must first set the environment variables to the values you got from Facebook (above).

C:\> set FB_APPLICATION_ID=<APP_ID>
C:\> set FB_APPLICATION_SECRET=<APP_SECRET>

To run this on Linux/bash you must first set the environment variables to the values you got from Facebook (above).
$ export FB_APPLICATION_ID=<APP_ID>
$ export FB_APPLICATION_SECRET=<APP_SECRET>


To deploy this application at heroku.com, you need to do the following:

1. git clone https://[email protected]/jgodse/jgodseFaceboku.git
2. cd jgodseFaceboku
3. heroku create --stack bamboo-ree-1.8.7
(save the URL give by Heroku for later)

4. git push heroku master
5. heroku config:add FB_APPLICATION_ID=<APP_ID> FB_APPLICATION_SECRET=<APP_SECRET>
6. heroku open
7. Go to the application configuration page at Facebook and make sure that the "Site URL" and
"Canvas URL" is the same as the URL for this app. If you need to rename this app, use a
"heroku rename" on the app before reconfiguring Facebook.
8. At this point, reload the URL of your Facebook App and you should be able to login, logout, and hit the "like" and "share" buttons.


* Note that this application does not work on the heroku stack bamboo-mri-1.9.2
* Run "heroku stack" to ensure that it is bamboo-ree-1.8.7

* Also note that I could not get this working as a FB canvas application either in my version or the
* original version from which I forked.
5 changes: 3 additions & 2 deletions faceboku.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

enable :sessions

APP_ID = "153304591365687"
APP_SECRET = "7a7663099ccb62f180d985ba1252a3e2"
APP_ID = ENV['FB_APPLICATION_ID']
APP_SECRET = ENV['FB_APPLICATION_SECRET']

use OmniAuth::Builder do
provider :facebook, APP_ID, APP_SECRET, { :scope => 'email, status_update, publish_stream' }
Expand All @@ -15,6 +15,7 @@
@articles << {:title => 'Introduction to Heroku', :url => 'http://docs.heroku.com/heroku'}
@articles << {:title => 'Deploying Rack-based apps in Heroku', :url => 'http://docs.heroku.com/rack'}
@articles << {:title => 'Learn Ruby in twenty minutes', :url => 'http://www.ruby-lang.org/en/documentation/quickstart/'}
@articles << {:title => 'Cloud Apps Experts Blog', :url => 'http://blog.cloud-apps-experts.com'}

erb :index
end
Expand Down
2 changes: 1 addition & 1 deletion views/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
<% if session['fb_auth'] %>
<hr />
<p><span class='like_site'>Do you like this site?</span></p>
<p><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffaceboku.heroku.com%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe></p>
<p><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fradiant-sky-944.heroku.com%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe></p>
<% end %>
12 changes: 6 additions & 6 deletions views/layout.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<meta property="og:title" content="List of Articles"/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="http://faceboku.heroku.com/images/heroku_logo.png"/>
<meta property="og:url" content="http://faceboku.heroku.com/"/>
<meta property="og:site_name" content="Heroku:Interesting Articles"/>
<meta property="fb:admins" content="643897273"/>
<meta property="og:title" content="List of Articles"></meta>
<meta property="og:type" content="website"></meta>
<meta property="og:image" content="http://radiant-sky-944.heroku.com/images/heroku_logo.png"></meta>
<meta property="og:url" content="http://radiant-sky-944.heroku.com/"></meta>
<meta property="og:site_name" content="Jay Godse:Heroku:Interesting Articles"></meta>
<meta property="fb:admins" content="580332546"></meta>

<title>Faceboku</title>
<style>
Expand Down