fb-channel-file 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fb-channel-file.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 peterlind
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # fb-channel-file
2
+
3
+ Adds a /channel.html route to a Rails app. This fixes a IE7 problem with the Facebook JS SDK.
4
+
5
+ See http://developers.facebook.com/docs/reference/javascript/ and http://stackoverflow.com/questions/2955012/facebook-javascript-sdk-fb-xd-fragment for more info.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'fb-channel-file'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install fb-channel-file
20
+
21
+ ## Usage
22
+
23
+ Include the gem in your Gemfile. A route will automatically be added to your app.
24
+ With no extra config the locale will be inferred from what `I18n.locale` returns. If `I18n.locale` doesn't contain a language part, the locale will default to `en_US`
25
+ To configure something else, put this in an initializer in config/initializers:
26
+
27
+ ```
28
+ FbChannelFileApp.config[:infer_locale] = false
29
+ FbChannelFileApp.config[:locale] = 'your locale'
30
+ ```
31
+
32
+ For a list of Facebook supported locales look here: https://www.facebook.com/translations/FacebookLocales.xml
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
41
+
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/fb-channel-file/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Peter Lind"]
6
+ gem.email = ["peter@lind.be"]
7
+ gem.description = %q{Adds a /channel.html route to a Rails app. This fixes a IE7 problem with the Facebook JS SDK.
8
+ See http://developers.facebook.com/docs/reference/javascript/ and http://stackoverflow.com/questions/2955012/facebook-javascript-sdk-fb-xd-fragment}
9
+ gem.summary = %q{Adds a /channel.html route to a Rails app.}
10
+ gem.homepage = "https://github.com/peterlind/fb-channel-file"
11
+ gem.files = `git ls-files`.split($\)
12
+ #gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "fb-channel-file"
15
+ gem.require_paths = ["lib"]
16
+ gem.add_runtime_dependency 'rails' , '>= 3.0'
17
+ gem.add_development_dependency 'rake'
18
+ gem.version = FbChannelFileEngine::VERSION
19
+ end
@@ -0,0 +1,2 @@
1
+ require "fb-channel-file/version"
2
+ require "fb-channel-file/engine"
@@ -0,0 +1,44 @@
1
+ class FbChannelFileApp
2
+ class << self
3
+ def config
4
+ @@config ||= default_config.dup
5
+ end
6
+
7
+ def default_config
8
+ { :locale => "en_US",
9
+ :infer_locale => true }
10
+ end
11
+
12
+ def call(env)
13
+ puts I18n.locale
14
+ [
15
+ 200,
16
+ { "Pragma" => "public", "Cache-Control" => "max-age=#{60*60*24*365}", "Expires" => CGI.rfc1123_date(1.year.from_now), "Content-Type" => "text/html" },
17
+ ["<script src='//connect.facebook.net/#{locale}/all.js'></script>"]
18
+ ]
19
+ end
20
+
21
+ def locale
22
+ config[:infer_locale] ? infer_locale : config[:locale]
23
+ end
24
+
25
+ def infer_locale
26
+ # a list of supported locales are here https://www.facebook.com/translations/FacebookLocales.xml
27
+ # default to en_US if locale not set with language
28
+ locale = I18n.locale.to_s.sub(/-/, "_")
29
+ locale.index(/_/) ? locale : default_config[:locale]
30
+ end
31
+ end
32
+ end
33
+
34
+ module FbChannelFileEngine
35
+ class Engine < Rails::Engine
36
+ initializer "fb-channel-file.configure_router", :before => :add_routing_paths do |app|
37
+ app.routes.prepend do
38
+ match "/channel.html" => FbChannelFileApp
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+
@@ -0,0 +1,3 @@
1
+ module FbChannelFileEngine
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fb-channel-file
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Peter Lind
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: ! 'Adds a /channel.html route to a Rails app. This fixes a IE7 problem
47
+ with the Facebook JS SDK.
48
+
49
+ See http://developers.facebook.com/docs/reference/javascript/ and http://stackoverflow.com/questions/2955012/facebook-javascript-sdk-fb-xd-fragment'
50
+ email:
51
+ - peter@lind.be
52
+ executables: []
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - .gitignore
57
+ - Gemfile
58
+ - LICENSE
59
+ - README.md
60
+ - Rakefile
61
+ - fb-channel-file.gemspec
62
+ - lib/fb-channel-file.rb
63
+ - lib/fb-channel-file/engine.rb
64
+ - lib/fb-channel-file/version.rb
65
+ homepage: https://github.com/peterlind/fb-channel-file
66
+ licenses: []
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 1.8.24
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Adds a /channel.html route to a Rails app.
89
+ test_files: []