socialite 0.0.1.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. data/.autotest +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +10 -0
  5. data/.yardopts +8 -0
  6. data/Gemfile +8 -0
  7. data/Gemfile.lock +208 -0
  8. data/LICENSE +176 -0
  9. data/README.md +63 -0
  10. data/Rakefile +34 -0
  11. data/app/assets/images/socialite/.gitkeep +0 -0
  12. data/app/assets/javascripts/socialite/.gitkeep +0 -0
  13. data/app/assets/stylesheets/socialite/socialite.css +40 -0
  14. data/app/assets/stylesheets/socialite.css +7 -0
  15. data/app/controllers/socialite/identities_controller.rb +53 -0
  16. data/app/controllers/socialite/session_controller.rb +28 -0
  17. data/app/controllers/socialite/user_controller.rb +39 -0
  18. data/app/helpers/socialite/authentication_helper.rb +15 -0
  19. data/app/models/socialite/facebook_identity.rb +7 -0
  20. data/app/models/socialite/identity.rb +6 -0
  21. data/app/models/socialite/user.rb +42 -0
  22. data/app/views/socialite/identities/_identities.html.haml +14 -0
  23. data/app/views/socialite/session/new.html.haml +14 -0
  24. data/app/views/socialite/user/_form.html.haml +13 -0
  25. data/app/views/socialite/user/edit.html.haml +1 -0
  26. data/app/views/socialite/user/show.html.haml +16 -0
  27. data/config/initializers/simple_form.rb +90 -0
  28. data/config/locales/simple_form.en.yml +23 -0
  29. data/config/routes.rb +10 -0
  30. data/db/migrate/20110914215410_create_users.rb +14 -0
  31. data/db/migrate/20110925224222_create_identities.rb +26 -0
  32. data/db/migrate/20110926005551_create_facebook_identities.rb +12 -0
  33. data/features/authentication/facebook_signin.feature +5 -0
  34. data/features/authentication/twitter_signin.feature +5 -0
  35. data/features/identities/facebook_management.feature +14 -0
  36. data/features/identities/twitter_management.feature +7 -0
  37. data/features/registration/facebook_signup.feature +10 -0
  38. data/features/registration/twitter_signup.feature +0 -0
  39. data/features/step_definitions/authentication_steps.rb +31 -0
  40. data/features/step_definitions/common_steps.rb +13 -0
  41. data/features/step_definitions/identity_steps.rb +5 -0
  42. data/features/step_definitions/web_steps.rb +254 -0
  43. data/features/support/env.rb +58 -0
  44. data/features/support/hooks.rb +3 -0
  45. data/features/support/omniauth.rb +31 -0
  46. data/features/support/paths.rb +34 -0
  47. data/features/support/selectors.rb +39 -0
  48. data/lib/socialite/api_wrappers/facebook.rb +67 -0
  49. data/lib/socialite/api_wrappers/twitter.rb +19 -0
  50. data/lib/socialite/base_identity.rb +96 -0
  51. data/lib/socialite/controller_support.rb +136 -0
  52. data/lib/socialite/engine.rb +32 -0
  53. data/lib/socialite/service_config.rb +14 -0
  54. data/lib/socialite/version.rb +3 -0
  55. data/lib/socialite.rb +37 -0
  56. data/lib/tasks/.gitkeep +0 -0
  57. data/lib/tasks/cucumber.rake +65 -0
  58. data/lib/tasks/socialite_tasks.rake +4 -0
  59. data/script/cucumber +10 -0
  60. data/script/rails +6 -0
  61. data/socialite.gemspec +39 -0
  62. data/spec/dummy/Rakefile +7 -0
  63. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  64. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  65. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  66. data/spec/dummy/app/controllers/home_controller.rb +11 -0
  67. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  68. data/spec/dummy/app/views/home/index.html.haml +12 -0
  69. data/spec/dummy/app/views/home/show.html.haml +6 -0
  70. data/spec/dummy/app/views/layouts/application.html.erb +18 -0
  71. data/spec/dummy/config/application.rb +48 -0
  72. data/spec/dummy/config/boot.rb +20 -0
  73. data/spec/dummy/config/database.yml +9 -0
  74. data/spec/dummy/config/environment.rb +5 -0
  75. data/spec/dummy/config/environments/development.rb +30 -0
  76. data/spec/dummy/config/environments/production.rb +60 -0
  77. data/spec/dummy/config/environments/test.rb +42 -0
  78. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  79. data/spec/dummy/config/initializers/inflections.rb +10 -0
  80. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  81. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  82. data/spec/dummy/config/initializers/session_store.rb +8 -0
  83. data/spec/dummy/config/initializers/socialite.rb +6 -0
  84. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  85. data/spec/dummy/config/locales/en.yml +5 -0
  86. data/spec/dummy/config/routes.rb +11 -0
  87. data/spec/dummy/config.ru +4 -0
  88. data/spec/dummy/db/schema.rb +43 -0
  89. data/spec/dummy/public/404.html +26 -0
  90. data/spec/dummy/public/422.html +26 -0
  91. data/spec/dummy/public/500.html +26 -0
  92. data/spec/dummy/public/favicon.ico +0 -0
  93. data/spec/dummy/script/rails +6 -0
  94. data/spec/factories/facebook.rb +5 -0
  95. data/spec/factories/identity.rb +9 -0
  96. data/spec/factories/twitter.rb +6 -0
  97. data/spec/factories/user.rb +16 -0
  98. data/spec/models/facebook_spec.rb +28 -0
  99. data/spec/models/identity_spec.rb +9 -0
  100. data/spec/models/user_spec.rb +27 -0
  101. data/spec/spec_helper.rb +29 -0
  102. data/spec/support/.gitkeep +0 -0
  103. data/spec/support/database_loader.rb +13 -0
  104. data/spec/support/databases.yml +14 -0
  105. data/spec/support/identity_shared_example.rb +67 -0
  106. metadata +409 -0
data/.autotest ADDED
@@ -0,0 +1,7 @@
1
+ begin
2
+ require 'rubygems'
3
+ require 'autotest/growl'
4
+ require 'autotest/fsevent'
5
+ rescue LoadError
6
+
7
+ end
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ .bundle/
3
+ log/*.log
4
+ pkg/
5
+ spec/dummy/db/*.sqlite3
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
8
+ .yardoc
9
+ doc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format nested
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ before_script:
2
+ - "psql -c 'create database socialite_test;' -U postgres >/dev/null"
3
+ - "mysql -e 'create database socialite_test;' >/dev/null"
4
+ rvm:
5
+ - 1.9.2
6
+ - 1.9.3
7
+ env:
8
+ - DB=sqlite
9
+ - DB=mysql
10
+ - DB=postgres
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ 'lib/**/*.rb'
2
+ 'app/**/*.rb'
3
+ 'config/**/*.rb'
4
+ 'db/**/*.rb'
5
+ - README.md
6
+ - LICENSE
7
+ --protected
8
+ --no-private
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :travis_ci do
6
+ gem 'pg', '~> 0.11'
7
+ gem 'mysql2'
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,208 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ socialite (0.0.1.beta)
5
+ grackle (~> 0.1.10)
6
+ haml (~> 3.1.2)
7
+ koala (~> 1.2.0beta4)
8
+ oa-core (~> 0.3.0.rc3)
9
+ oa-oauth (~> 0.3.0.rc3)
10
+ rails (~> 3.1.0)
11
+ sass-rails (~> 3.1.0)
12
+ simple_form (~> 1.5.2)
13
+
14
+ GEM
15
+ remote: http://rubygems.org/
16
+ specs:
17
+ actionmailer (3.1.0)
18
+ actionpack (= 3.1.0)
19
+ mail (~> 2.3.0)
20
+ actionpack (3.1.0)
21
+ activemodel (= 3.1.0)
22
+ activesupport (= 3.1.0)
23
+ builder (~> 3.0.0)
24
+ erubis (~> 2.7.0)
25
+ i18n (~> 0.6)
26
+ rack (~> 1.3.2)
27
+ rack-cache (~> 1.0.3)
28
+ rack-mount (~> 0.8.2)
29
+ rack-test (~> 0.6.1)
30
+ sprockets (~> 2.0.0)
31
+ activemodel (3.1.0)
32
+ activesupport (= 3.1.0)
33
+ bcrypt-ruby (~> 3.0.0)
34
+ builder (~> 3.0.0)
35
+ i18n (~> 0.6)
36
+ activerecord (3.1.0)
37
+ activemodel (= 3.1.0)
38
+ activesupport (= 3.1.0)
39
+ arel (~> 2.2.1)
40
+ tzinfo (~> 0.3.29)
41
+ activeresource (3.1.0)
42
+ activemodel (= 3.1.0)
43
+ activesupport (= 3.1.0)
44
+ activesupport (3.1.0)
45
+ multi_json (~> 1.0)
46
+ addressable (2.2.6)
47
+ arel (2.2.1)
48
+ bcrypt-ruby (3.0.1)
49
+ builder (3.0.0)
50
+ capybara (1.1.1)
51
+ mime-types (>= 1.16)
52
+ nokogiri (>= 1.3.3)
53
+ rack (>= 1.0.0)
54
+ rack-test (>= 0.5.4)
55
+ selenium-webdriver (~> 2.0)
56
+ xpath (~> 0.1.4)
57
+ childprocess (0.2.2)
58
+ ffi (~> 1.0.6)
59
+ cucumber (1.1.0)
60
+ builder (>= 2.1.2)
61
+ diff-lcs (>= 1.1.2)
62
+ gherkin (~> 2.5.0)
63
+ json (>= 1.4.6)
64
+ term-ansicolor (>= 1.0.6)
65
+ cucumber-rails (1.0.6)
66
+ capybara (>= 1.1.1)
67
+ cucumber (>= 1.0.6)
68
+ nokogiri (>= 1.5.0)
69
+ database_cleaner (0.6.7)
70
+ diff-lcs (1.1.3)
71
+ erubis (2.7.0)
72
+ factory_girl (2.1.2)
73
+ activesupport
74
+ faraday (0.7.4)
75
+ addressable (~> 2.2.6)
76
+ multipart-post (~> 1.1.0)
77
+ rack (< 2, >= 1.1.0)
78
+ ffi (1.0.9)
79
+ gherkin (2.5.1)
80
+ json (>= 1.4.6)
81
+ grackle (0.1.10)
82
+ json
83
+ mime-types
84
+ oauth
85
+ haml (3.1.3)
86
+ hike (1.2.1)
87
+ i18n (0.6.0)
88
+ json (1.6.1)
89
+ json_pure (1.6.1)
90
+ koala (1.2.0beta4)
91
+ faraday (~> 0.7.0)
92
+ multi_json (~> 1.0)
93
+ launchy (2.0.5)
94
+ addressable (~> 2.2.6)
95
+ mail (2.3.0)
96
+ i18n (>= 0.4.0)
97
+ mime-types (~> 1.16)
98
+ treetop (~> 1.4.8)
99
+ mime-types (1.16)
100
+ multi_json (1.0.3)
101
+ multi_xml (0.4.1)
102
+ multipart-post (1.1.3)
103
+ mysql2 (0.3.7)
104
+ nokogiri (1.5.0)
105
+ oa-core (0.3.0)
106
+ oa-oauth (0.3.0)
107
+ faraday (~> 0.7.3)
108
+ multi_json (~> 1.0.0)
109
+ multi_xml (~> 0.4.0)
110
+ oa-core (= 0.3.0)
111
+ oauth (~> 0.4.0)
112
+ oauth2 (~> 0.5.0)
113
+ oauth (0.4.5)
114
+ oauth2 (0.5.1)
115
+ faraday (~> 0.7.4)
116
+ multi_json (~> 1.0.3)
117
+ pg (0.11.0)
118
+ polyglot (0.3.2)
119
+ rack (1.3.3)
120
+ rack-cache (1.0.3)
121
+ rack (>= 0.4)
122
+ rack-mount (0.8.3)
123
+ rack (>= 1.0.0)
124
+ rack-ssl (1.3.2)
125
+ rack
126
+ rack-test (0.6.1)
127
+ rack (>= 1.0)
128
+ rails (3.1.0)
129
+ actionmailer (= 3.1.0)
130
+ actionpack (= 3.1.0)
131
+ activerecord (= 3.1.0)
132
+ activeresource (= 3.1.0)
133
+ activesupport (= 3.1.0)
134
+ bundler (~> 1.0)
135
+ railties (= 3.1.0)
136
+ railties (3.1.0)
137
+ actionpack (= 3.1.0)
138
+ activesupport (= 3.1.0)
139
+ rack-ssl (~> 1.3.2)
140
+ rake (>= 0.8.7)
141
+ rdoc (~> 3.4)
142
+ thor (~> 0.14.6)
143
+ rake (0.9.2)
144
+ rdiscount (1.6.8)
145
+ rdoc (3.9.4)
146
+ rspec (2.6.0)
147
+ rspec-core (~> 2.6.0)
148
+ rspec-expectations (~> 2.6.0)
149
+ rspec-mocks (~> 2.6.0)
150
+ rspec-core (2.6.4)
151
+ rspec-expectations (2.6.0)
152
+ diff-lcs (~> 1.1.2)
153
+ rspec-mocks (2.6.0)
154
+ rspec-rails (2.6.1)
155
+ actionpack (~> 3.0)
156
+ activesupport (~> 3.0)
157
+ railties (~> 3.0)
158
+ rspec (~> 2.6.0)
159
+ rubyzip (0.9.4)
160
+ sass (3.1.7)
161
+ sass-rails (3.1.2)
162
+ actionpack (~> 3.1.0)
163
+ railties (~> 3.1.0)
164
+ sass (>= 3.1.4)
165
+ sprockets (~> 2.0.0)
166
+ tilt (~> 1.3.2)
167
+ selenium-webdriver (2.7.0)
168
+ childprocess (>= 0.2.1)
169
+ ffi (>= 1.0.7)
170
+ json_pure
171
+ rubyzip
172
+ shoulda-matchers (1.0.0.beta3)
173
+ simple_form (1.5.2)
174
+ actionpack (~> 3.0)
175
+ activemodel (~> 3.0)
176
+ sprockets (2.0.0)
177
+ hike (~> 1.2)
178
+ rack (~> 1.0)
179
+ tilt (!= 1.3.0, ~> 1.1)
180
+ sqlite3 (1.3.4)
181
+ term-ansicolor (1.0.6)
182
+ thor (0.14.6)
183
+ tilt (1.3.3)
184
+ treetop (1.4.10)
185
+ polyglot
186
+ polyglot (>= 0.3.1)
187
+ tzinfo (0.3.29)
188
+ xpath (0.1.4)
189
+ nokogiri (~> 1.3)
190
+ yard (0.7.2)
191
+
192
+ PLATFORMS
193
+ ruby
194
+
195
+ DEPENDENCIES
196
+ cucumber-rails (~> 1.0.6)
197
+ database_cleaner (>= 0.6.7)
198
+ factory_girl (~> 2.1.0)
199
+ launchy (~> 2.0.5)
200
+ mysql2
201
+ pg (~> 0.11)
202
+ rdiscount
203
+ rspec-rails (~> 2.6.1)
204
+ selenium-webdriver (>= 2.4.0)
205
+ shoulda-matchers
206
+ socialite!
207
+ sqlite3
208
+ yard
data/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # Socialite
2
+
3
+ A Rails 3.1 engine that provides a User model with support for linking
4
+ multiple authorization accounts per user (linking). Current support for
5
+ Twitter, Facebook, Github and LinkedIn.
6
+
7
+ Additional authorizations can be added if they are supported by
8
+ the [OmniAuth](http://github.com/intridea/omniauth) project.
9
+
10
+ ## Development
11
+
12
+ We are currently working on an initial release of Socialite. Once we
13
+ have a solid suite of tests in place, we will release an official 0.1.0
14
+ version to the public.
15
+
16
+ ## Resources
17
+
18
+ * [Documentation](http://rdoc.info/github/jsmestad/socialite/master/frames)
19
+ * [Travis CI Project](http://travis-ci.org/#!/jsmestad/socialite)
20
+ * [Issue Tracker](https://github.com/jsmestad/socialite/issues)
21
+ * [Gem Releases](https://rubygems.org/gems/socialite)
22
+ * [Staging Testbed](http://socialite-gem.herokuapp.com)
23
+ * [Facebook Testbed](https://www.facebook.com/apps/application.php?id=281326728563029)
24
+
25
+ ## Installation
26
+
27
+ To use Socialite in a Rails 3.1 application:
28
+
29
+ * Require it in the Gemfile: `gem 'socialite'`
30
+ * Install it by running `bundle`.
31
+ * Import migrations into the parent project with `rake
32
+ socialite:install:migrations`
33
+ * Use the provided CSS by adding `//= require socialite` from your
34
+ application's CSS manifest file
35
+
36
+ ## History
37
+
38
+ This project began as a fork of [Tim Riley](http://openmonkey.com)'s
39
+ great Omnisocial plugin. The motivation for this fork is that I required
40
+ multiple authorizations for each account (linking support) and wanted a
41
+ proper Rails 3.1 Engine.
42
+
43
+ ## Socialite Contributers
44
+
45
+ * [Justin Smestad](http://github.com/jsmestad)
46
+ * [Bobby Wilson](http://github.com/bobbyw)
47
+
48
+ ### Omnisocial Contributers
49
+
50
+ * [Klaus Hartl](http://github.com/carhartl)
51
+ * [Stephen Aument](http://github.com/stephenaument)
52
+ * [Lucas Allan](http://github.com/lucasallan)
53
+ * [James Dumay](http://github.com/i386)
54
+ * [Pablo Dejuan](http://github.com/pdjota)
55
+ * [Chris Oliver](http://github.com/excid3)
56
+
57
+ ## Copyright & License
58
+
59
+ Socialite is Copyright (c) 2011 Justin Smestad. All Rights are Reserved. Code is
60
+ distributed under the Apache 2.0 License. See LICENSE file for more information.
61
+
62
+ The original OmniSocial code is Copyright (c) 2010-2011 [Tim Riley](http://openmonkey.com/)
63
+ and [Icelab](http://icelab.com.au/), and is released under MIT License.
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ begin
9
+ require 'rdoc/task'
10
+ rescue LoadError
11
+ require 'rdoc/rdoc'
12
+ require 'rake/rdoctask'
13
+ RDoc::Task = Rake::RDocTask
14
+ end
15
+
16
+ require 'rspec/core'
17
+ require 'rspec/core/rake_task'
18
+
19
+ RSpec::Core::RakeTask.new(:spec)
20
+
21
+ task :default => :spec
22
+
23
+ Rake::RDocTask.new(:rdoc) do |rdoc|
24
+ rdoc.rdoc_dir = 'rdoc'
25
+ rdoc.title = 'Socialite'
26
+ rdoc.options << '--line-numbers' << '--inline-source'
27
+ rdoc.rdoc_files.include('README.rdoc')
28
+ rdoc.rdoc_files.include('lib/**/*.rb')
29
+ end
30
+
31
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
32
+ load 'rails/tasks/engine.rake'
33
+
34
+ Bundler::GemHelper.install_tasks
File without changes
File without changes
@@ -0,0 +1,40 @@
1
+ a.socialite_button {
2
+ float: left;
3
+ text-decoration: none;
4
+ margin-left: 20px;
5
+ margin-right: 20px;
6
+ }
7
+
8
+ a.socialite_button.twitter {
9
+ margin-left: 0;
10
+ }
11
+
12
+ a.socialite_button span {
13
+ display: inline-block;
14
+ margin-top: 1px;
15
+ padding: 8px 10px 9px;
16
+ border: 1px solid #bbe2f8;
17
+ -webkit-border-radius: 3px;
18
+ -moz-border-radius: 3px;
19
+ border-radius: 3px;
20
+ background: #3583cf;
21
+ background: -webkit-gradient(linear, left top, left bottom, from(#629ed9), to(#3583cf));
22
+ font-weight: bold;
23
+ font-family: Helvetica, Arial, Verdana, sans-serif;
24
+ font-size: 18px;
25
+ line-height: 1;
26
+ color: white;
27
+ text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0px;
28
+ cursor: pointer;
29
+ }
30
+
31
+ a:hover.socialite_button span {
32
+ text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0px;
33
+ background: #6ca520;
34
+ background: -webkit-gradient(linear, left top, left bottom, from(#90bb58), to(#6ca520));
35
+ border-color: #dcf1bf;
36
+ -o-box-shadow: rgba(0, 0, 0, 0.5) 0 0 5px 0;
37
+ -webkit-box-shadow: rgba(0, 0, 0, 0.5) 0 0 5px 0;
38
+ -moz-box-shadow: rgba(0, 0, 0, 0.5) 0 0 5px 0;
39
+ box-shadow: rgba(0, 0, 0, 0.5) 0 0 5px 0;
40
+ }
@@ -0,0 +1,7 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree ./socialite
7
+ */
@@ -0,0 +1,53 @@
1
+ module Socialite
2
+ class IdentitiesController < ApplicationController
3
+ unloadable
4
+
5
+ before_filter :ensure_user, :only => [:destroy]
6
+ respond_to :html, :json
7
+
8
+ def create
9
+ auth_hash = request.env['omniauth.auth']
10
+ identity = Identity.find_or_initialize_by_oauth(auth_hash)
11
+ identity.build_user if identity.user.blank?
12
+
13
+ if identity.save
14
+ self.current_user ||= identity.user
15
+ flash_message :notice, 'You have logged in successfully.'
16
+ else
17
+ flash_message :error, 'An error occurred. Please try again.'
18
+ end
19
+ respond_with(identity) do |format|
20
+ format.html { redirect_back_or_default }
21
+ end
22
+ end
23
+
24
+ def failure
25
+ flash_message :error, 'We had trouble signing you in. Did you make sure to grant access? Please select a service below and try again.'
26
+ respond_with do |format|
27
+ format.html { redirect_back_or_default }
28
+ end
29
+ end
30
+
31
+ def destroy
32
+ if identity.destroy
33
+ logout! if identities.count == 0
34
+ flash_message :notice, 'Identity has been unlinked.'
35
+ else
36
+ flash_message :error, 'We had trouble unlinking this service.'
37
+ end
38
+ respond_with(identity) do |format|
39
+ format.html { redirect_back_or_default }
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def identities
46
+ @identities = current_user.identities
47
+ end
48
+
49
+ def identity
50
+ @identity ||= current_user.identities.find(params[:id])
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,28 @@
1
+ module Socialite
2
+ class SessionController < ApplicationController
3
+ unloadable
4
+
5
+ before_filter :ensure_user, :only => [:destroy]
6
+ before_filter :ensure_no_user, :except => [:destroy]
7
+
8
+ respond_to :html, :json
9
+
10
+ # Render the login page.
11
+ def new
12
+ respond_with(@user = User.new)
13
+ end
14
+
15
+ # Destroy the session, logging out the current user.
16
+ def destroy
17
+ @user = current_user
18
+ if logout!
19
+ flash_message :notice, 'You have been logged out.'
20
+ else
21
+ flash_message :error, 'We had trouble signing you out.'
22
+ end
23
+ respond_with(@user) do |format|
24
+ format.html { redirect_to default_route }
25
+ end
26
+ end
27
+ end
28
+ end