facebook_js 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +40 -0
- data/Rakefile +22 -0
- data/app/helpers/facebook_js_helper.rb +20 -0
- data/app/views/facebook_js_helper/_facebook.html.erb +23 -0
- data/lib/facebook_js.rb +4 -0
- data/lib/facebook_js/engine.rb +45 -0
- data/lib/facebook_js/version.rb +3 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +9 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/log/test.log +1498 -0
- data/test/dummy/public/404.html +27 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/facebook_js_test.rb +7 -0
- data/test/helpers/facebook_js_helper_test.rb +49 -0
- data/test/integration/navigation_test.rb +22 -0
- data/test/test_helper.rb +7 -0
- metadata +139 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
<p>If you are the application owner check the logs for more information.</p>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
<p>If you are the application owner check the logs for more information.</p>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FacebookJsHelperTest < ActionView::TestCase
|
4
|
+
def setup
|
5
|
+
FacebookJs.app_id = '12345'
|
6
|
+
FacebookJs.domain = 'localhost:3000'
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
FacebookJs.status = true
|
11
|
+
FacebookJs.cookie = true
|
12
|
+
FacebookJs.xfbml = true
|
13
|
+
FacebookJs.locale = 'en_US'
|
14
|
+
FacebookJs.debug = false
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'facebook_js should render the proper default content' do
|
18
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:true,cookie:true,xfbml:true});};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/en_US/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,false));</script>", facebook_js.split(/\n/).join("").delete(" ")
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'facebook_js should render the proper content with proper status' do
|
22
|
+
FacebookJs.status = false
|
23
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:false,cookie:true,xfbml:true});};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/en_US/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,false));</script>", facebook_js.split(/\n/).join("").delete(" ")
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'facebook_js should render the proper content with proper cookie' do
|
27
|
+
FacebookJs.cookie = false
|
28
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:true,cookie:false,xfbml:true});};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/en_US/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,false));</script>", facebook_js.split(/\n/).join("").delete(" ")
|
29
|
+
end
|
30
|
+
|
31
|
+
test 'facebook_js should render the proper content with proper xfbml' do
|
32
|
+
FacebookJs.xfbml = false
|
33
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:true,cookie:true,xfbml:false});};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/en_US/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,false));</script>", facebook_js.split(/\n/).join("").delete(" ")
|
34
|
+
end
|
35
|
+
|
36
|
+
test 'facebook_js should render the proper content with proper debug' do
|
37
|
+
FacebookJs.debug = true
|
38
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:true,cookie:true,xfbml:true});};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/en_US/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,true));</script>", facebook_js.split(/\n/).join("").delete(" ")
|
39
|
+
end
|
40
|
+
|
41
|
+
test 'facebook_js should render the proper content with proper locale' do
|
42
|
+
FacebookJs.locale = 'zh_CN'
|
43
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:true,cookie:true,xfbml:true});};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/zh_CN/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,false));</script>", facebook_js.split(/\n/).join("").delete(" ")
|
44
|
+
end
|
45
|
+
|
46
|
+
test 'facebook_js should render the proper content with block' do
|
47
|
+
assert_equal "<divid=\"fb-root\"></div><script>window.fbAsyncInit=function(){FB.init({appId:'12345',channelUrl:'//localhost:3000/channel.html',status:true,cookie:true,xfbml:true});function(){}};(function(d,debug){varjs,id='facebook-jssdk',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}js=d.createElement('script');js.id=id;js.async=true;js.src=\"//connect.facebook.net/en_US/all\"+(debug?\"/debug\":\"\")+\".js\";ref.parentNode.insertBefore(js,ref);}(document,false));</script>", (facebook_js { 'function(){}' } ).split(/\n/).join("").delete(" ")
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NavigationTest < ActionDispatch::IntegrationTest
|
4
|
+
test '/channel.html should have the proper content' do
|
5
|
+
get '/channel.html'
|
6
|
+
assert_equal "<script src='//connect.facebook.net/en_US/all.js'></script>", body
|
7
|
+
end
|
8
|
+
|
9
|
+
test '/channel.html should show proper locale' do
|
10
|
+
FacebookJs.locale = 'zh_CN'
|
11
|
+
get '/channel.html'
|
12
|
+
assert_equal "<script src='//connect.facebook.net/zh_CN/all.js'></script>", body
|
13
|
+
end
|
14
|
+
|
15
|
+
test '/channel.html should have the proper headers' do
|
16
|
+
get '/channel.html'
|
17
|
+
assert_equal "public", headers[:"Pragma"]
|
18
|
+
assert_equal "max-age=31536000", headers[:"Cache-Control"]
|
19
|
+
assert_equal "public", headers[:"Pragma"]
|
20
|
+
assert headers[:"Expires"]
|
21
|
+
end
|
22
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: facebook_js
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Teng Siong Ong
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0.beta1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0.beta1
|
27
|
+
description: facebook_js helps to keep all the unnecessary editing from using Facebook
|
28
|
+
JS SDK.
|
29
|
+
email:
|
30
|
+
- siong1987@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- app/helpers/facebook_js_helper.rb
|
36
|
+
- app/views/facebook_js_helper/_facebook.html.erb
|
37
|
+
- lib/facebook_js/engine.rb
|
38
|
+
- lib/facebook_js/version.rb
|
39
|
+
- lib/facebook_js.rb
|
40
|
+
- MIT-LICENSE
|
41
|
+
- Rakefile
|
42
|
+
- README.md
|
43
|
+
- test/dummy/app/assets/javascripts/application.js
|
44
|
+
- test/dummy/app/assets/stylesheets/application.css
|
45
|
+
- test/dummy/app/controllers/application_controller.rb
|
46
|
+
- test/dummy/app/helpers/application_helper.rb
|
47
|
+
- test/dummy/app/views/layouts/application.html.erb
|
48
|
+
- test/dummy/bin/bundle
|
49
|
+
- test/dummy/bin/rails
|
50
|
+
- test/dummy/bin/rake
|
51
|
+
- test/dummy/config/application.rb
|
52
|
+
- test/dummy/config/boot.rb
|
53
|
+
- test/dummy/config/database.yml
|
54
|
+
- test/dummy/config/environment.rb
|
55
|
+
- test/dummy/config/environments/development.rb
|
56
|
+
- test/dummy/config/environments/production.rb
|
57
|
+
- test/dummy/config/environments/test.rb
|
58
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
59
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
60
|
+
- test/dummy/config/initializers/inflections.rb
|
61
|
+
- test/dummy/config/initializers/mime_types.rb
|
62
|
+
- test/dummy/config/initializers/secret_token.rb
|
63
|
+
- test/dummy/config/initializers/session_store.rb
|
64
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
65
|
+
- test/dummy/config/locales/en.yml
|
66
|
+
- test/dummy/config/routes.rb
|
67
|
+
- test/dummy/config.ru
|
68
|
+
- test/dummy/log/test.log
|
69
|
+
- test/dummy/public/404.html
|
70
|
+
- test/dummy/public/422.html
|
71
|
+
- test/dummy/public/500.html
|
72
|
+
- test/dummy/public/favicon.ico
|
73
|
+
- test/dummy/Rakefile
|
74
|
+
- test/dummy/README.rdoc
|
75
|
+
- test/facebook_js_test.rb
|
76
|
+
- test/helpers/facebook_js_helper_test.rb
|
77
|
+
- test/integration/navigation_test.rb
|
78
|
+
- test/test_helper.rb
|
79
|
+
homepage: http://www.github.com/siong1987/facebook_js
|
80
|
+
licenses: []
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.0.3
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: facebook_js helps to keep all the unnecessary editing from using Facebook
|
102
|
+
JS SDK.
|
103
|
+
test_files:
|
104
|
+
- test/dummy/app/assets/javascripts/application.js
|
105
|
+
- test/dummy/app/assets/stylesheets/application.css
|
106
|
+
- test/dummy/app/controllers/application_controller.rb
|
107
|
+
- test/dummy/app/helpers/application_helper.rb
|
108
|
+
- test/dummy/app/views/layouts/application.html.erb
|
109
|
+
- test/dummy/bin/bundle
|
110
|
+
- test/dummy/bin/rails
|
111
|
+
- test/dummy/bin/rake
|
112
|
+
- test/dummy/config/application.rb
|
113
|
+
- test/dummy/config/boot.rb
|
114
|
+
- test/dummy/config/database.yml
|
115
|
+
- test/dummy/config/environment.rb
|
116
|
+
- test/dummy/config/environments/development.rb
|
117
|
+
- test/dummy/config/environments/production.rb
|
118
|
+
- test/dummy/config/environments/test.rb
|
119
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
120
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
121
|
+
- test/dummy/config/initializers/inflections.rb
|
122
|
+
- test/dummy/config/initializers/mime_types.rb
|
123
|
+
- test/dummy/config/initializers/secret_token.rb
|
124
|
+
- test/dummy/config/initializers/session_store.rb
|
125
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
126
|
+
- test/dummy/config/locales/en.yml
|
127
|
+
- test/dummy/config/routes.rb
|
128
|
+
- test/dummy/config.ru
|
129
|
+
- test/dummy/log/test.log
|
130
|
+
- test/dummy/public/404.html
|
131
|
+
- test/dummy/public/422.html
|
132
|
+
- test/dummy/public/500.html
|
133
|
+
- test/dummy/public/favicon.ico
|
134
|
+
- test/dummy/Rakefile
|
135
|
+
- test/dummy/README.rdoc
|
136
|
+
- test/facebook_js_test.rb
|
137
|
+
- test/helpers/facebook_js_helper_test.rb
|
138
|
+
- test/integration/navigation_test.rb
|
139
|
+
- test/test_helper.rb
|