ember_auth_rails 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.
- checksums.yaml +15 -0
- data/Gemfile +47 -0
- data/Gemfile.lock +219 -0
- data/Guardfile +33 -0
- data/MIT-LICENSE +20 -0
- data/README.md +65 -0
- data/Rakefile +67 -0
- data/VERSION +1 -0
- data/app/assets/images/ember_auth_rails/.gitkeep +0 -0
- data/app/assets/javascripts/ember_auth_rails/.gitkeep +0 -0
- data/app/assets/stylesheets/ember_auth_rails/.gitkeep +0 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/controllers/ember_users_controller.rb +32 -0
- data/app/controllers/registrations_controller.rb +3 -0
- data/app/controllers/sessions_controller.rb +43 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/helpers/ember_auth_helper.rb +2 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/ember_auth_rails/user_mod.rb +17 -0
- data/app/models/user.rb +3 -0
- data/app/serializers/user_serializer.rb +3 -0
- data/app/views/.gitkeep +0 -0
- data/config/initializers/devise.rb +241 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20130601155410_devise_create_users.rb +46 -0
- data/db/migrate/20130601155411_user_auth_token.rb +9 -0
- data/ember_auth_rails.gemspec +176 -0
- data/lib/ember_auth_rails.rb +7 -0
- data/lib/ember_auth_rails/engine.rb +16 -0
- data/lib/ember_auth_rails/version.rb +3 -0
- data/lib/tasks/ember_auth_rails_tasks.rake +4 -0
- data/script/rails +8 -0
- data/spec/controllers/ember_users_controller_spec.rb +28 -0
- data/spec/controllers/sessions_controller_spec.rb +45 -0
- data/spec/controllers/widgets_controller_spec.rb +27 -0
- data/spec/dummy/.env +2 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/widgets.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/widgets.css +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/widgets_controller.rb +8 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/widgets_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/widget.rb +4 -0
- data/spec/dummy/app/serializers/widget_serializer.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/widgets/index.html.haml +1 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +59 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +61 -0
- data/spec/dummy/db/migrate/20130703135528_create_users.multiauth_engine.rb +47 -0
- data/spec/dummy/db/migrate/20130703135529_create_identities.multiauth_engine.rb +14 -0
- data/spec/dummy/db/migrate/20130703136445_user_auth_token.ember_auth_rails_engine.rb +10 -0
- data/spec/dummy/db/migrate/20130703142306_create_widgets.rb +10 -0
- data/spec/dummy/db/schema.rb +54 -0
- data/spec/dummy/db/seeds.rb +10 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/devise.rb +3 -0
- data/spec/support/make_user.rb +21 -0
- data/test/ember_auth_rails_test.rb +7 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- metadata +383 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
N2I4MTRiYTIzOWZhMzdjM2FiYjAxOTFiOTM4MmM4NGVhNDZlYjk0ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Njg0MDMyNTQ4MTQ1M2U0NzM3MDhhZTY1ZDNiMTU5M2EzNzE2YTAxOA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTI1MGE5YzRjMjQ2ZjQzN2QwOWY2NDFhNjkxOTM2ODk5MDAxZmE5NTU5Y2Nl
|
10
|
+
YmRhYzExNGUwODY2OThhOWRmNWUxY2JhZWM0MDUzYjUyM2NiZGIxYjdjYmE4
|
11
|
+
ODFjZmU4OTM2MDBlYTcyMDJiN2IzNGRiYjk0MmY1YThkOGU3ZWY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZDdiOGMyN2IyZTJiYTgxMDdhOTZiYjE0ZDM2MTI3MzNiNmRlODMyNmIxNDZi
|
14
|
+
MmNkNjVkNGFkZjBmYTA4MDdhMzRhYzMwNjNkMTA4OTFlZGIxYTRmYjQ5ZGJi
|
15
|
+
OTM3NGM5MzA2YjU1M2ExNWNkNTM2YzFhMTA1MzQ4YjIxMjBiMGI=
|
data/Gemfile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in ember_auth_rails.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
group :development do
|
7
|
+
gem "rspec", ">= 2.13.0"
|
8
|
+
gem "rdoc", "~> 3.12"
|
9
|
+
gem "bundler", "~> 1.1"
|
10
|
+
gem "jeweler", "~> 1.8.7"
|
11
|
+
gem 'sqlite3'
|
12
|
+
end
|
13
|
+
|
14
|
+
# jquery-rails is used by the dummy application
|
15
|
+
gem "jquery-rails"
|
16
|
+
gem 'rails','3.2.13'
|
17
|
+
|
18
|
+
#gem 'multiauth',:github => "mharris717/multiauth", :branch => :master
|
19
|
+
|
20
|
+
# Declare any dependencies that are still in development here instead of in
|
21
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
22
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
23
|
+
# your gem to rubygems.org.
|
24
|
+
|
25
|
+
# To use debugger
|
26
|
+
# gem 'debugger'
|
27
|
+
|
28
|
+
group :development, :test do
|
29
|
+
gem 'rspec-rails', '~> 2.0'
|
30
|
+
|
31
|
+
gem 'guard'
|
32
|
+
gem 'guard-rspec'
|
33
|
+
gem 'guard-spork'
|
34
|
+
|
35
|
+
gem 'rb-fsevent', '~> 0.9'
|
36
|
+
|
37
|
+
gem 'rr', ">= 1.1",:require => false
|
38
|
+
|
39
|
+
gem 'factory_girl_rails'
|
40
|
+
|
41
|
+
gem 'lre'
|
42
|
+
|
43
|
+
gem 'rspec-mocks','~> 2.13.0'
|
44
|
+
end
|
45
|
+
|
46
|
+
gem 'active_model_serializers'
|
47
|
+
gem 'devise',"< 3.0.0"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.13)
|
5
|
+
actionpack (= 3.2.13)
|
6
|
+
mail (~> 2.5.3)
|
7
|
+
actionpack (3.2.13)
|
8
|
+
activemodel (= 3.2.13)
|
9
|
+
activesupport (= 3.2.13)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.5)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.2.1)
|
17
|
+
active_model_serializers (0.8.1)
|
18
|
+
activemodel (>= 3.0)
|
19
|
+
activemodel (3.2.13)
|
20
|
+
activesupport (= 3.2.13)
|
21
|
+
builder (~> 3.0.0)
|
22
|
+
activerecord (3.2.13)
|
23
|
+
activemodel (= 3.2.13)
|
24
|
+
activesupport (= 3.2.13)
|
25
|
+
arel (~> 3.0.2)
|
26
|
+
tzinfo (~> 0.3.29)
|
27
|
+
activeresource (3.2.13)
|
28
|
+
activemodel (= 3.2.13)
|
29
|
+
activesupport (= 3.2.13)
|
30
|
+
activesupport (3.2.13)
|
31
|
+
i18n (= 0.6.1)
|
32
|
+
multi_json (~> 1.0)
|
33
|
+
addressable (2.3.5)
|
34
|
+
arel (3.0.2)
|
35
|
+
bcrypt-ruby (3.0.1)
|
36
|
+
builder (3.0.4)
|
37
|
+
childprocess (0.3.9)
|
38
|
+
ffi (~> 1.0, >= 1.0.11)
|
39
|
+
coderay (1.0.9)
|
40
|
+
devise (2.2.4)
|
41
|
+
bcrypt-ruby (~> 3.0)
|
42
|
+
orm_adapter (~> 0.1)
|
43
|
+
railties (~> 3.1)
|
44
|
+
warden (~> 1.2.1)
|
45
|
+
diff-lcs (1.2.4)
|
46
|
+
erubis (2.7.0)
|
47
|
+
facets (2.9.3)
|
48
|
+
factory_girl (4.2.0)
|
49
|
+
activesupport (>= 3.0.0)
|
50
|
+
factory_girl_rails (4.2.1)
|
51
|
+
factory_girl (~> 4.2.0)
|
52
|
+
railties (>= 3.0.0)
|
53
|
+
faraday (0.8.8)
|
54
|
+
multipart-post (~> 1.2.0)
|
55
|
+
fattr (2.2.1)
|
56
|
+
ffi (1.9.0)
|
57
|
+
formatador (0.2.4)
|
58
|
+
git (1.2.6)
|
59
|
+
github_api (0.10.1)
|
60
|
+
addressable
|
61
|
+
faraday (~> 0.8.1)
|
62
|
+
hashie (>= 1.2)
|
63
|
+
multi_json (~> 1.4)
|
64
|
+
nokogiri (~> 1.5.2)
|
65
|
+
oauth2
|
66
|
+
guard (1.8.1)
|
67
|
+
formatador (>= 0.2.4)
|
68
|
+
listen (>= 1.0.0)
|
69
|
+
lumberjack (>= 1.0.2)
|
70
|
+
pry (>= 0.9.10)
|
71
|
+
thor (>= 0.14.6)
|
72
|
+
guard-rspec (3.0.2)
|
73
|
+
guard (>= 1.8)
|
74
|
+
rspec (~> 2.13)
|
75
|
+
guard-spork (1.5.0)
|
76
|
+
childprocess (>= 0.2.3)
|
77
|
+
guard (>= 1.1)
|
78
|
+
spork (>= 0.8.4)
|
79
|
+
hashie (2.0.5)
|
80
|
+
highline (1.6.19)
|
81
|
+
hike (1.2.2)
|
82
|
+
httpauth (0.2.0)
|
83
|
+
i18n (0.6.1)
|
84
|
+
jeweler (1.8.7)
|
85
|
+
builder
|
86
|
+
bundler (~> 1.0)
|
87
|
+
git (>= 1.2.5)
|
88
|
+
github_api (= 0.10.1)
|
89
|
+
highline (>= 1.6.15)
|
90
|
+
nokogiri (= 1.5.10)
|
91
|
+
rake
|
92
|
+
rdoc
|
93
|
+
journey (1.0.4)
|
94
|
+
jquery-rails (3.0.0)
|
95
|
+
railties (>= 3.0, < 5.0)
|
96
|
+
thor (>= 0.14, < 2.0)
|
97
|
+
json (1.8.0)
|
98
|
+
jwt (0.1.8)
|
99
|
+
multi_json (>= 1.5)
|
100
|
+
listen (1.2.2)
|
101
|
+
rb-fsevent (>= 0.9.3)
|
102
|
+
rb-inotify (>= 0.9)
|
103
|
+
rb-kqueue (>= 0.2)
|
104
|
+
lre (0.3.0)
|
105
|
+
fattr
|
106
|
+
mharris_ext
|
107
|
+
watchr
|
108
|
+
lumberjack (1.0.3)
|
109
|
+
mail (2.5.4)
|
110
|
+
mime-types (~> 1.16)
|
111
|
+
treetop (~> 1.4.8)
|
112
|
+
method_source (0.8.1)
|
113
|
+
mharris_ext (1.7.0)
|
114
|
+
facets
|
115
|
+
fattr
|
116
|
+
mime-types (1.23)
|
117
|
+
multi_json (1.7.4)
|
118
|
+
multi_xml (0.5.5)
|
119
|
+
multipart-post (1.2.0)
|
120
|
+
nokogiri (1.5.10)
|
121
|
+
oauth2 (0.9.2)
|
122
|
+
faraday (~> 0.8)
|
123
|
+
httpauth (~> 0.2)
|
124
|
+
jwt (~> 0.1.4)
|
125
|
+
multi_json (~> 1.0)
|
126
|
+
multi_xml (~> 0.5)
|
127
|
+
rack (~> 1.2)
|
128
|
+
orm_adapter (0.4.0)
|
129
|
+
polyglot (0.3.3)
|
130
|
+
pry (0.9.12.2)
|
131
|
+
coderay (~> 1.0.5)
|
132
|
+
method_source (~> 0.8)
|
133
|
+
slop (~> 3.4)
|
134
|
+
rack (1.4.5)
|
135
|
+
rack-cache (1.2)
|
136
|
+
rack (>= 0.4)
|
137
|
+
rack-ssl (1.3.3)
|
138
|
+
rack
|
139
|
+
rack-test (0.6.2)
|
140
|
+
rack (>= 1.0)
|
141
|
+
rails (3.2.13)
|
142
|
+
actionmailer (= 3.2.13)
|
143
|
+
actionpack (= 3.2.13)
|
144
|
+
activerecord (= 3.2.13)
|
145
|
+
activeresource (= 3.2.13)
|
146
|
+
activesupport (= 3.2.13)
|
147
|
+
bundler (~> 1.0)
|
148
|
+
railties (= 3.2.13)
|
149
|
+
railties (3.2.13)
|
150
|
+
actionpack (= 3.2.13)
|
151
|
+
activesupport (= 3.2.13)
|
152
|
+
rack-ssl (~> 1.3.2)
|
153
|
+
rake (>= 0.8.7)
|
154
|
+
rdoc (~> 3.4)
|
155
|
+
thor (>= 0.14.6, < 2.0)
|
156
|
+
rake (10.0.4)
|
157
|
+
rb-fsevent (0.9.3)
|
158
|
+
rb-inotify (0.9.0)
|
159
|
+
ffi (>= 0.5.0)
|
160
|
+
rb-kqueue (0.2.0)
|
161
|
+
ffi (>= 0.5.0)
|
162
|
+
rdoc (3.12.2)
|
163
|
+
json (~> 1.4)
|
164
|
+
rr (1.1.1)
|
165
|
+
rspec (2.13.0)
|
166
|
+
rspec-core (~> 2.13.0)
|
167
|
+
rspec-expectations (~> 2.13.0)
|
168
|
+
rspec-mocks (~> 2.13.0)
|
169
|
+
rspec-core (2.13.1)
|
170
|
+
rspec-expectations (2.13.0)
|
171
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
172
|
+
rspec-mocks (2.13.1)
|
173
|
+
rspec-rails (2.13.2)
|
174
|
+
actionpack (>= 3.0)
|
175
|
+
activesupport (>= 3.0)
|
176
|
+
railties (>= 3.0)
|
177
|
+
rspec-core (~> 2.13.0)
|
178
|
+
rspec-expectations (~> 2.13.0)
|
179
|
+
rspec-mocks (~> 2.13.0)
|
180
|
+
slop (3.4.5)
|
181
|
+
spork (0.9.2)
|
182
|
+
sprockets (2.2.2)
|
183
|
+
hike (~> 1.2)
|
184
|
+
multi_json (~> 1.0)
|
185
|
+
rack (~> 1.0)
|
186
|
+
tilt (~> 1.1, != 1.3.0)
|
187
|
+
sqlite3 (1.3.7)
|
188
|
+
thor (0.18.1)
|
189
|
+
tilt (1.4.1)
|
190
|
+
treetop (1.4.14)
|
191
|
+
polyglot
|
192
|
+
polyglot (>= 0.3.1)
|
193
|
+
tzinfo (0.3.37)
|
194
|
+
warden (1.2.1)
|
195
|
+
rack (>= 1.0)
|
196
|
+
watchr (0.7)
|
197
|
+
|
198
|
+
PLATFORMS
|
199
|
+
ruby
|
200
|
+
|
201
|
+
DEPENDENCIES
|
202
|
+
active_model_serializers
|
203
|
+
bundler (~> 1.1)
|
204
|
+
devise (< 3.0.0)
|
205
|
+
factory_girl_rails
|
206
|
+
guard
|
207
|
+
guard-rspec
|
208
|
+
guard-spork
|
209
|
+
jeweler (~> 1.8.7)
|
210
|
+
jquery-rails
|
211
|
+
lre
|
212
|
+
rails (= 3.2.13)
|
213
|
+
rb-fsevent (~> 0.9)
|
214
|
+
rdoc (~> 3.12)
|
215
|
+
rr (>= 1.1)
|
216
|
+
rspec (>= 2.13.0)
|
217
|
+
rspec-mocks (~> 2.13.0)
|
218
|
+
rspec-rails (~> 2.0)
|
219
|
+
sqlite3
|
data/Guardfile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'spork', :rspec_port => 5614 do
|
5
|
+
watch('config/application.rb')
|
6
|
+
watch('config/environment.rb')
|
7
|
+
watch('config/environments/test.rb')
|
8
|
+
watch(%r{^config/initializers/.+\.rb$})
|
9
|
+
watch('Gemfile')
|
10
|
+
watch('Gemfile.lock')
|
11
|
+
watch('spec/spec_helper.rb') { :rspec }
|
12
|
+
watch('test/test_helper.rb') { :test_unit }
|
13
|
+
watch(%r{features/support/}) { :cucumber }
|
14
|
+
watch(%r{^spec/support/.+\.rb$})
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
guard 'rspec', :cli => "--drb --drb-port 5614" do
|
21
|
+
watch(%r{^spec/.+_spec\.rb$}) { "spec" }
|
22
|
+
watch(%r{^lib/(.+)\.rb$}) { "spec" } # { |m| "spec/lib/#{m[1]}_spec.rb" }
|
23
|
+
watch(%r{^lib/(.+)\.treetop$}) { "spec" }
|
24
|
+
watch(%r{^lib/(.+)\.csv$}) { "spec" }
|
25
|
+
#watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
26
|
+
watch('spec/spec_helper.rb') { "spec" }
|
27
|
+
watch(%r{^app/(.+)\.rb$}) { "spec" }
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# EmberAuthRails (EAR)
|
2
|
+
|
3
|
+
This library is intended to be used with Ember.js and the
|
4
|
+
[ember-auth-easy](http://github.com/mharris717/ember-auth-easy) javascript library.
|
5
|
+
|
6
|
+
It adds token authentication to your Rails app (thanks Devise!).
|
7
|
+
|
8
|
+
## Adding EAR to your Rails app.
|
9
|
+
|
10
|
+
* Add ember_auth_rails to your gemfile
|
11
|
+
|
12
|
+
```
|
13
|
+
gem 'ember_auth_rails'
|
14
|
+
```
|
15
|
+
|
16
|
+
* Copy the EAR migrations over
|
17
|
+
|
18
|
+
```
|
19
|
+
rake ember_auth_rails_engine:install:migrations
|
20
|
+
```
|
21
|
+
|
22
|
+
* Run the migrations
|
23
|
+
|
24
|
+
```
|
25
|
+
rake db:migrate
|
26
|
+
```
|
27
|
+
|
28
|
+
* Add the authenticate_user! filter to your controllers
|
29
|
+
|
30
|
+
```
|
31
|
+
class PostsController < ApplicationController
|
32
|
+
before_filter :authenticate_user!
|
33
|
+
|
34
|
+
....
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
* Create your users
|
39
|
+
|
40
|
+
```
|
41
|
+
User.create! :email => "user@fake.com", :password => "password123"
|
42
|
+
```
|
43
|
+
|
44
|
+
## Rack::CORS
|
45
|
+
|
46
|
+
If your Ember app will not be running on the same url/port, add Rack::Cors to your app
|
47
|
+
|
48
|
+
* Add to your Gemfile:
|
49
|
+
|
50
|
+
```
|
51
|
+
gem 'rack-cors',:require=>"rack/cors"
|
52
|
+
```
|
53
|
+
|
54
|
+
* Add an initializer (config/initializers/cors.rb)
|
55
|
+
|
56
|
+
```
|
57
|
+
YOURAPPNAME::Application.config.middleware.use Rack::Cors do
|
58
|
+
allow do
|
59
|
+
# This will allow requests from all URLs.
|
60
|
+
# Change to whitelist specific URLs in production
|
61
|
+
origins '*'
|
62
|
+
resource '*', :headers => :any, :methods => [:get, :post, :options, :put]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,67 @@
|
|
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
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'EmberAuthRails'
|
19
|
+
rdoc.options << '--line-numbers'
|
20
|
+
rdoc.rdoc_files.include('README.rdoc')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
23
|
+
|
24
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
25
|
+
load 'rails/tasks/engine.rake'
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
require 'jeweler'
|
30
|
+
Jeweler::Tasks.new do |gem|
|
31
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
32
|
+
gem.name = "ember_auth_rails"
|
33
|
+
gem.homepage = "http://github.com/mharris717/ember_auth_rails"
|
34
|
+
gem.license = "MIT"
|
35
|
+
gem.summary = %Q{ember_auth_rails}
|
36
|
+
gem.description = %Q{ember_auth_rails}
|
37
|
+
gem.email = "mharris717@gmail.com"
|
38
|
+
gem.authors = ["Mike Harris"]
|
39
|
+
# dependencies defined in Gemfile
|
40
|
+
end
|
41
|
+
Jeweler::RubygemsDotOrgTasks.new
|
42
|
+
|
43
|
+
require 'rspec/core'
|
44
|
+
require 'rspec/core/rake_task'
|
45
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
46
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
require 'rake/testtask'
|
51
|
+
|
52
|
+
Rake::TestTask.new(:test) do |t|
|
53
|
+
t.libs << 'lib'
|
54
|
+
t.libs << 'test'
|
55
|
+
t.pattern = 'test/**/*_test.rb'
|
56
|
+
t.verbose = false
|
57
|
+
end
|
58
|
+
|
59
|
+
task :migrate_dummy do
|
60
|
+
root = File.expand_path(File.dirname(__FILE__))
|
61
|
+
puts `cd #{root}/spec/dummy && rake db:migrate RAILS_ENV=test && cd ../..`
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
task :default => [:migrate_dummy,:spec]
|
66
|
+
|
67
|
+
|