faceb 0.1.0
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.
- data/.document +5 -0
- data/.gitignore +24 -0
- data/Gemfile +13 -0
- data/LICENSE +20 -0
- data/README.md +70 -0
- data/Rakefile +76 -0
- data/VERSION +1 -0
- data/bin/console +3 -0
- data/faceb.gemspec +164 -0
- data/features/faceb-session.feature +7 -0
- data/features/step_definitions/facebook-session_steps.rb +14 -0
- data/features/support/env.rb +4 -0
- data/lib/faceb.rb +7 -0
- data/lib/faceb/api.rb +69 -0
- data/lib/faceb/base.rb +51 -0
- data/lib/faceb/rails.rb +12 -0
- data/lib/faceb/rails/api.rb +21 -0
- data/lib/faceb/rails/base.rb +30 -0
- data/lib/faceb/rails/configuration.rb +31 -0
- data/lib/faceb/rails/controller.rb +49 -0
- data/lib/faceb/rails/generators.rb +3 -0
- data/lib/faceb/rails/generators/config/USAGE +8 -0
- data/lib/faceb/rails/generators/config/config_generator.rb +16 -0
- data/lib/faceb/rails/generators/config/templates/faceb.yml +6 -0
- data/lib/faceb/rails/generators/fb_connect/USAGE +7 -0
- data/lib/faceb/rails/generators/fb_connect/fb_connect_generator.rb +16 -0
- data/lib/faceb/rails/generators/fb_connect/templates/xd_receiver.html +10 -0
- data/lib/faceb/rails/generators/fb_connect/templates/xd_receiver_ssl.html +10 -0
- data/lib/faceb/rails/rails_23_init.rb +21 -0
- data/lib/faceb/rails/railtie.rb +39 -0
- data/lib/faceb/rails/tasks.rb +2 -0
- data/lib/faceb/rails/tasks/faceb.tasks +6 -0
- data/lib/faceb/rails/tasks/tunnel.tasks +46 -0
- data/lib/faceb/session.rb +38 -0
- data/spec/faceb_api_spec.rb +107 -0
- data/spec/faceb_base_spec.rb +48 -0
- data/spec/faceb_session_spec.rb +64 -0
- data/spec/rails/config_generator_spec.rb +39 -0
- data/spec/rails/configuration_sepc.rb +11 -0
- data/spec/rails/controller_spec.rb +39 -0
- data/spec/rails/fb_connect_generator_spec.rb +28 -0
- data/spec/rails/railtie_spec.rb +23 -0
- data/spec/rails_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_app/app/controllers/posts_controller.rb +7 -0
- data/spec/rails_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +46 -0
- data/spec/rails_app/config/boot.rb +9 -0
- data/spec/rails_app/config/database.yml +22 -0
- data/spec/rails_app/config/environment.rb +5 -0
- data/spec/rails_app/config/environments/development.rb +19 -0
- data/spec/rails_app/config/environments/production.rb +33 -0
- data/spec/rails_app/config/environments/test.rb +32 -0
- data/spec/rails_app/config/faceb.yml +3 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/cookie_verification_secret.rb +7 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/session_store.rb +10 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/routes.rb +58 -0
- data/spec/rails_app/log/development.log +0 -0
- data/spec/rails_app/log/production.log +0 -0
- data/spec/rails_app/log/server.log +0 -0
- data/spec/rails_app/log/test.log +0 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +26 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/javascripts/application.js +2 -0
- data/spec/rails_app/public/javascripts/controls.js +965 -0
- data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
- data/spec/rails_app/public/javascripts/effects.js +1123 -0
- data/spec/rails_app/public/javascripts/prototype.js +4874 -0
- data/spec/rails_app/public/javascripts/rails.js +110 -0
- data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
- data/spec/rails_app/script/rails +9 -0
- data/spec/rails_spec_helper.rb +6 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +27 -0
- metadata +247 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
document.observe("dom:loaded", function() {
|
2
|
+
var authToken = $$('meta[name=csrf-token]').first().readAttribute('content'),
|
3
|
+
authParam = $$('meta[name=csrf-param]').first().readAttribute('content'),
|
4
|
+
formTemplate = '<form method="#{method}" action="#{action}">\
|
5
|
+
#{realmethod}<input name="#{param}" value="#{token}" type="hidden">\
|
6
|
+
</form>',
|
7
|
+
realmethodTemplate = '<input name="_method" value="#{method}" type="hidden">';
|
8
|
+
|
9
|
+
function handleRemote(element) {
|
10
|
+
var method, url, params;
|
11
|
+
|
12
|
+
if (element.tagName.toLowerCase() == 'form') {
|
13
|
+
method = element.readAttribute('method') || 'post';
|
14
|
+
url = element.readAttribute('action');
|
15
|
+
params = element.serialize(true);
|
16
|
+
} else {
|
17
|
+
method = element.readAttribute('data-method') || 'get';
|
18
|
+
// TODO: data-url support is going away, just use href
|
19
|
+
url = element.readAttribute('data-url') || element.readAttribute('href');
|
20
|
+
params = {};
|
21
|
+
}
|
22
|
+
|
23
|
+
var event = element.fire("ajax:before");
|
24
|
+
if (event.stopped) return false;
|
25
|
+
|
26
|
+
new Ajax.Request(url, {
|
27
|
+
method: method,
|
28
|
+
parameters: params,
|
29
|
+
asynchronous: true,
|
30
|
+
evalScripts: true,
|
31
|
+
|
32
|
+
onLoading: function(request) { element.fire("ajax:loading", {request: request}); },
|
33
|
+
onLoaded: function(request) { element.fire("ajax:loaded", {request: request}); },
|
34
|
+
onInteractive: function(request) { element.fire("ajax:interactive", {request: request}); },
|
35
|
+
onComplete: function(request) { element.fire("ajax:complete", {request: request}); },
|
36
|
+
onSuccess: function(request) { element.fire("ajax:success", {request: request}); },
|
37
|
+
onFailure: function(request) { element.fire("ajax:failure", {request: request}); }
|
38
|
+
});
|
39
|
+
|
40
|
+
element.fire("ajax:after");
|
41
|
+
}
|
42
|
+
|
43
|
+
$(document.body).observe("click", function(event) {
|
44
|
+
var message = event.element().readAttribute('data-confirm');
|
45
|
+
if (message && !confirm(message)) {
|
46
|
+
event.stop();
|
47
|
+
return false;
|
48
|
+
}
|
49
|
+
|
50
|
+
var element = event.findElement("a[data-remote=true]");
|
51
|
+
if (element) {
|
52
|
+
handleRemote(element);
|
53
|
+
event.stop();
|
54
|
+
}
|
55
|
+
|
56
|
+
var element = event.findElement("a[data-method]");
|
57
|
+
if (element && element.readAttribute('data-remote') != 'true') {
|
58
|
+
var method = element.readAttribute('data-method'),
|
59
|
+
piggyback = method.toLowerCase() != 'post',
|
60
|
+
formHTML = formTemplate.interpolate({
|
61
|
+
method: 'POST',
|
62
|
+
realmethod: piggyback ? realmethodTemplate.interpolate({ method: method }) : '',
|
63
|
+
action: element.readAttribute('href'),
|
64
|
+
token: authToken,
|
65
|
+
param: authParam
|
66
|
+
});
|
67
|
+
|
68
|
+
var form = new Element('div').update(formHTML).down().hide();
|
69
|
+
this.insert({ bottom: form });
|
70
|
+
|
71
|
+
form.submit();
|
72
|
+
event.stop();
|
73
|
+
}
|
74
|
+
});
|
75
|
+
|
76
|
+
// TODO: I don't think submit bubbles in IE
|
77
|
+
$(document.body).observe("submit", function(event) {
|
78
|
+
var message = event.element().readAttribute('data-confirm');
|
79
|
+
if (message && !confirm(message)) {
|
80
|
+
event.stop();
|
81
|
+
return false;
|
82
|
+
}
|
83
|
+
|
84
|
+
var inputs = event.element().select("input[type=submit][data-disable-with]");
|
85
|
+
inputs.each(function(input) {
|
86
|
+
input.disabled = true;
|
87
|
+
input.writeAttribute('data-original-value', input.value);
|
88
|
+
input.value = input.readAttribute('data-disable-with');
|
89
|
+
});
|
90
|
+
|
91
|
+
var element = event.findElement("form[data-remote=true]");
|
92
|
+
if (element) {
|
93
|
+
handleRemote(element);
|
94
|
+
event.stop();
|
95
|
+
}
|
96
|
+
});
|
97
|
+
|
98
|
+
$(document.body).observe("ajax:complete", function(event) {
|
99
|
+
var element = event.element();
|
100
|
+
|
101
|
+
if (element.tagName.toLowerCase() == 'form') {
|
102
|
+
var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
|
103
|
+
inputs.each(function(input) {
|
104
|
+
input.value = input.readAttribute('data-original-value');
|
105
|
+
input.writeAttribute('data-original-value', null);
|
106
|
+
input.disabled = false;
|
107
|
+
});
|
108
|
+
}
|
109
|
+
});
|
110
|
+
});
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
|
5
|
+
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
|
6
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
+
|
8
|
+
require BOOT_PATH
|
9
|
+
require 'rails/commands'
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'faceb'
|
5
|
+
require 'spec'
|
6
|
+
require 'spec/autorun'
|
7
|
+
|
8
|
+
require 'rails_spec_helper' if ENV["FACEB_TEST"] == 'rails'
|
9
|
+
|
10
|
+
|
11
|
+
# Stop all requests
|
12
|
+
require 'fakeweb'
|
13
|
+
FakeWeb.allow_net_connect = false
|
14
|
+
|
15
|
+
# Use RR for mock
|
16
|
+
require 'rr'
|
17
|
+
|
18
|
+
Spec::Runner.configure do |config|
|
19
|
+
config.mock_with :rr
|
20
|
+
|
21
|
+
# Reset the session after each example
|
22
|
+
config.prepend_before(:each) do
|
23
|
+
FaceB::Session.reset!
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
TMP_DIR = File.join(File.dirname(__FILE__), 'tmp')
|
metadata
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faceb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Mathieu Fosse
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-05 00:00:00 +02:00
|
18
|
+
default_executable: console
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: httparty
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 5
|
30
|
+
- 2
|
31
|
+
version: 0.5.2
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rack-facebook
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
- 0
|
44
|
+
- 3
|
45
|
+
version: 0.0.3
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 1
|
57
|
+
- 2
|
58
|
+
- 9
|
59
|
+
version: 1.2.9
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: cucumber
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
type: :development
|
73
|
+
version_requirements: *id004
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: fakeweb
|
76
|
+
prerelease: false
|
77
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 1
|
83
|
+
- 2
|
84
|
+
- 8
|
85
|
+
version: 1.2.8
|
86
|
+
type: :development
|
87
|
+
version_requirements: *id005
|
88
|
+
- !ruby/object:Gem::Dependency
|
89
|
+
name: rr
|
90
|
+
prerelease: false
|
91
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
- 10
|
98
|
+
- 10
|
99
|
+
version: 0.10.10
|
100
|
+
type: :development
|
101
|
+
version_requirements: *id006
|
102
|
+
description: Facebook library
|
103
|
+
email: mathieu@tigerlilyapps.com
|
104
|
+
executables:
|
105
|
+
- console
|
106
|
+
extensions: []
|
107
|
+
|
108
|
+
extra_rdoc_files:
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
files:
|
112
|
+
- .document
|
113
|
+
- .gitignore
|
114
|
+
- Gemfile
|
115
|
+
- LICENSE
|
116
|
+
- README.md
|
117
|
+
- Rakefile
|
118
|
+
- VERSION
|
119
|
+
- bin/console
|
120
|
+
- faceb.gemspec
|
121
|
+
- features/faceb-session.feature
|
122
|
+
- features/step_definitions/facebook-session_steps.rb
|
123
|
+
- features/support/env.rb
|
124
|
+
- lib/faceb.rb
|
125
|
+
- lib/faceb/api.rb
|
126
|
+
- lib/faceb/base.rb
|
127
|
+
- lib/faceb/rails.rb
|
128
|
+
- lib/faceb/rails/api.rb
|
129
|
+
- lib/faceb/rails/base.rb
|
130
|
+
- lib/faceb/rails/configuration.rb
|
131
|
+
- lib/faceb/rails/controller.rb
|
132
|
+
- lib/faceb/rails/generators.rb
|
133
|
+
- lib/faceb/rails/generators/config/USAGE
|
134
|
+
- lib/faceb/rails/generators/config/config_generator.rb
|
135
|
+
- lib/faceb/rails/generators/config/templates/faceb.yml
|
136
|
+
- lib/faceb/rails/generators/fb_connect/USAGE
|
137
|
+
- lib/faceb/rails/generators/fb_connect/fb_connect_generator.rb
|
138
|
+
- lib/faceb/rails/generators/fb_connect/templates/xd_receiver.html
|
139
|
+
- lib/faceb/rails/generators/fb_connect/templates/xd_receiver_ssl.html
|
140
|
+
- lib/faceb/rails/rails_23_init.rb
|
141
|
+
- lib/faceb/rails/railtie.rb
|
142
|
+
- lib/faceb/rails/tasks.rb
|
143
|
+
- lib/faceb/rails/tasks/faceb.tasks
|
144
|
+
- lib/faceb/rails/tasks/tunnel.tasks
|
145
|
+
- lib/faceb/session.rb
|
146
|
+
- spec/faceb_api_spec.rb
|
147
|
+
- spec/faceb_base_spec.rb
|
148
|
+
- spec/faceb_session_spec.rb
|
149
|
+
- spec/rails/config_generator_spec.rb
|
150
|
+
- spec/rails/configuration_sepc.rb
|
151
|
+
- spec/rails/controller_spec.rb
|
152
|
+
- spec/rails/fb_connect_generator_spec.rb
|
153
|
+
- spec/rails/railtie_spec.rb
|
154
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
155
|
+
- spec/rails_app/app/controllers/posts_controller.rb
|
156
|
+
- spec/rails_app/app/helpers/application_helper.rb
|
157
|
+
- spec/rails_app/config.ru
|
158
|
+
- spec/rails_app/config/application.rb
|
159
|
+
- spec/rails_app/config/boot.rb
|
160
|
+
- spec/rails_app/config/database.yml
|
161
|
+
- spec/rails_app/config/environment.rb
|
162
|
+
- spec/rails_app/config/environments/development.rb
|
163
|
+
- spec/rails_app/config/environments/production.rb
|
164
|
+
- spec/rails_app/config/environments/test.rb
|
165
|
+
- spec/rails_app/config/faceb.yml
|
166
|
+
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
167
|
+
- spec/rails_app/config/initializers/cookie_verification_secret.rb
|
168
|
+
- spec/rails_app/config/initializers/inflections.rb
|
169
|
+
- spec/rails_app/config/initializers/mime_types.rb
|
170
|
+
- spec/rails_app/config/initializers/session_store.rb
|
171
|
+
- spec/rails_app/config/locales/en.yml
|
172
|
+
- spec/rails_app/config/routes.rb
|
173
|
+
- spec/rails_app/log/development.log
|
174
|
+
- spec/rails_app/log/production.log
|
175
|
+
- spec/rails_app/log/server.log
|
176
|
+
- spec/rails_app/log/test.log
|
177
|
+
- spec/rails_app/public/404.html
|
178
|
+
- spec/rails_app/public/422.html
|
179
|
+
- spec/rails_app/public/500.html
|
180
|
+
- spec/rails_app/public/favicon.ico
|
181
|
+
- spec/rails_app/public/javascripts/application.js
|
182
|
+
- spec/rails_app/public/javascripts/controls.js
|
183
|
+
- spec/rails_app/public/javascripts/dragdrop.js
|
184
|
+
- spec/rails_app/public/javascripts/effects.js
|
185
|
+
- spec/rails_app/public/javascripts/prototype.js
|
186
|
+
- spec/rails_app/public/javascripts/rails.js
|
187
|
+
- spec/rails_app/public/stylesheets/.gitkeep
|
188
|
+
- spec/rails_app/script/rails
|
189
|
+
- spec/rails_spec_helper.rb
|
190
|
+
- spec/spec.opts
|
191
|
+
- spec/spec_helper.rb
|
192
|
+
has_rdoc: true
|
193
|
+
homepage: http://github.com/tigerlily/faceb
|
194
|
+
licenses: []
|
195
|
+
|
196
|
+
post_install_message:
|
197
|
+
rdoc_options:
|
198
|
+
- --charset=UTF-8
|
199
|
+
require_paths:
|
200
|
+
- lib
|
201
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
segments:
|
206
|
+
- 0
|
207
|
+
version: "0"
|
208
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
segments:
|
213
|
+
- 0
|
214
|
+
version: "0"
|
215
|
+
requirements: []
|
216
|
+
|
217
|
+
rubyforge_project:
|
218
|
+
rubygems_version: 1.3.6
|
219
|
+
signing_key:
|
220
|
+
specification_version: 3
|
221
|
+
summary: Facebook library
|
222
|
+
test_files:
|
223
|
+
- spec/faceb_api_spec.rb
|
224
|
+
- spec/faceb_base_spec.rb
|
225
|
+
- spec/faceb_session_spec.rb
|
226
|
+
- spec/rails/config_generator_spec.rb
|
227
|
+
- spec/rails/configuration_sepc.rb
|
228
|
+
- spec/rails/controller_spec.rb
|
229
|
+
- spec/rails/fb_connect_generator_spec.rb
|
230
|
+
- spec/rails/railtie_spec.rb
|
231
|
+
- spec/rails_app/app/controllers/application_controller.rb
|
232
|
+
- spec/rails_app/app/controllers/posts_controller.rb
|
233
|
+
- spec/rails_app/app/helpers/application_helper.rb
|
234
|
+
- spec/rails_app/config/application.rb
|
235
|
+
- spec/rails_app/config/boot.rb
|
236
|
+
- spec/rails_app/config/environment.rb
|
237
|
+
- spec/rails_app/config/environments/development.rb
|
238
|
+
- spec/rails_app/config/environments/production.rb
|
239
|
+
- spec/rails_app/config/environments/test.rb
|
240
|
+
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
241
|
+
- spec/rails_app/config/initializers/cookie_verification_secret.rb
|
242
|
+
- spec/rails_app/config/initializers/inflections.rb
|
243
|
+
- spec/rails_app/config/initializers/mime_types.rb
|
244
|
+
- spec/rails_app/config/initializers/session_store.rb
|
245
|
+
- spec/rails_app/config/routes.rb
|
246
|
+
- spec/rails_spec_helper.rb
|
247
|
+
- spec/spec_helper.rb
|