trainmaster 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +286 -0
- data/Rakefile +38 -0
- data/app/controllers/trainmaster/application_controller.rb +9 -0
- data/app/controllers/trainmaster/sessions_controller.rb +141 -0
- data/app/controllers/trainmaster/users_controller.rb +199 -0
- data/app/helpers/trainmaster/application_helper.rb +313 -0
- data/app/helpers/trainmaster/sessions_helper.rb +4 -0
- data/app/helpers/trainmaster/users_helper.rb +4 -0
- data/app/jobs/trainmaster/sessions_cleanup_job.rb +13 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/mailers/trainmaster/user_mailer.rb +14 -0
- data/app/models/trainmaster/session.rb +56 -0
- data/app/models/trainmaster/user.rb +77 -0
- data/app/views/layouts/mailer.html.erb +5 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/app/views/layouts/trainmaster/application.html.erb +14 -0
- data/app/views/trainmaster/user_mailer/email_verification.html.erb +12 -0
- data/app/views/trainmaster/user_mailer/email_verification.text.erb +13 -0
- data/app/views/trainmaster/user_mailer/password_reset.html.erb +14 -0
- data/app/views/trainmaster/user_mailer/password_reset.text.erb +15 -0
- data/config/routes.rb +10 -0
- data/db/migrate/20161120020344_create_trainmaster_users.rb +23 -0
- data/db/migrate/20161120020722_create_trainmaster_sessions.rb +11 -0
- data/lib/tasks/trainmaster_tasks.rake +4 -0
- data/lib/trainmaster.rb +10 -0
- data/lib/trainmaster/cache.rb +28 -0
- data/lib/trainmaster/engine.rb +9 -0
- data/lib/trainmaster/roles.rb +12 -0
- data/lib/trainmaster/version.rb +3 -0
- data/test/controllers/trainmaster/application_controller_test.rb +106 -0
- data/test/controllers/trainmaster/sessions_controller_test.rb +275 -0
- data/test/controllers/trainmaster/users_controller_test.rb +335 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -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/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +34 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -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 +4 -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/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/trainmaster/sessions.yml +36 -0
- data/test/fixtures/trainmaster/users.yml +27 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/jobs/trainmaster/sessions_cleanup_job_test.rb +9 -0
- data/test/mailers/previews/trainmaster/user_mailer_preview.rb +6 -0
- data/test/mailers/trainmaster/user_mailer_test.rb +9 -0
- data/test/models/trainmaster/session_test.rb +26 -0
- data/test/models/trainmaster/user_test.rb +52 -0
- data/test/test_helper.rb +33 -0
- data/test/trainmaster.rb +12 -0
- metadata +327 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
require 'coveralls'
|
6
|
+
|
7
|
+
# Coveralls.wear!('rails')
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
9
|
+
SimpleCov::Formatter::HTMLFormatter,
|
10
|
+
Coveralls::SimpleCov::Formatter
|
11
|
+
])
|
12
|
+
SimpleCov.start do
|
13
|
+
add_group "Models", "app/models"
|
14
|
+
add_group "Controllers", "app/controllers"
|
15
|
+
end
|
16
|
+
|
17
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
18
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
19
|
+
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
|
20
|
+
require "rails/test_help"
|
21
|
+
|
22
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
23
|
+
# to be shown.
|
24
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
25
|
+
|
26
|
+
# Load support files
|
27
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
28
|
+
|
29
|
+
# Load fixtures from the engine
|
30
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
31
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
32
|
+
ActiveSupport::TestCase.fixtures :all
|
33
|
+
end
|
data/test/trainmaster.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TrainmasterTest < ActiveSupport::TestCase
|
4
|
+
test "truth" do
|
5
|
+
assert_kind_of Module, Trainmaster
|
6
|
+
end
|
7
|
+
|
8
|
+
test "basic cache operations" do
|
9
|
+
Trainmaster::Cache.set("foo", 42)
|
10
|
+
assert_equal 42, Trainmaster::Cache.get("foo")
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,327 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trainmaster
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David An
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-20 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: 5.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bcrypt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: uuidtools
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.1.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.1.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jwt
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.5.4
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: paranoia
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: repia
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.3.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.3.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: omniauth
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.3.1
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.3.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: hashie
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 3.4.4
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.4.4
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: sqlite3
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: |
|
168
|
+
trainmaster is a Rails engine that provides JWT-based session management
|
169
|
+
platform for API development. This plugin is suitable for developing RESTful
|
170
|
+
APIs that do not require an enterprise identity service. There are no
|
171
|
+
cookies or non-unique IDs involved in this project.
|
172
|
+
email:
|
173
|
+
- davidan1981@gmail.com
|
174
|
+
executables: []
|
175
|
+
extensions: []
|
176
|
+
extra_rdoc_files: []
|
177
|
+
files:
|
178
|
+
- LICENSE
|
179
|
+
- README.md
|
180
|
+
- Rakefile
|
181
|
+
- app/controllers/trainmaster/application_controller.rb
|
182
|
+
- app/controllers/trainmaster/sessions_controller.rb
|
183
|
+
- app/controllers/trainmaster/users_controller.rb
|
184
|
+
- app/helpers/trainmaster/application_helper.rb
|
185
|
+
- app/helpers/trainmaster/sessions_helper.rb
|
186
|
+
- app/helpers/trainmaster/users_helper.rb
|
187
|
+
- app/jobs/trainmaster/sessions_cleanup_job.rb
|
188
|
+
- app/mailers/application_mailer.rb
|
189
|
+
- app/mailers/trainmaster/user_mailer.rb
|
190
|
+
- app/models/trainmaster/session.rb
|
191
|
+
- app/models/trainmaster/user.rb
|
192
|
+
- app/views/layouts/mailer.html.erb
|
193
|
+
- app/views/layouts/mailer.text.erb
|
194
|
+
- app/views/layouts/trainmaster/application.html.erb
|
195
|
+
- app/views/trainmaster/user_mailer/email_verification.html.erb
|
196
|
+
- app/views/trainmaster/user_mailer/email_verification.text.erb
|
197
|
+
- app/views/trainmaster/user_mailer/password_reset.html.erb
|
198
|
+
- app/views/trainmaster/user_mailer/password_reset.text.erb
|
199
|
+
- config/routes.rb
|
200
|
+
- db/migrate/20161120020344_create_trainmaster_users.rb
|
201
|
+
- db/migrate/20161120020722_create_trainmaster_sessions.rb
|
202
|
+
- lib/tasks/trainmaster_tasks.rake
|
203
|
+
- lib/trainmaster.rb
|
204
|
+
- lib/trainmaster/cache.rb
|
205
|
+
- lib/trainmaster/engine.rb
|
206
|
+
- lib/trainmaster/roles.rb
|
207
|
+
- lib/trainmaster/version.rb
|
208
|
+
- test/controllers/trainmaster/application_controller_test.rb
|
209
|
+
- test/controllers/trainmaster/sessions_controller_test.rb
|
210
|
+
- test/controllers/trainmaster/users_controller_test.rb
|
211
|
+
- test/dummy/README.rdoc
|
212
|
+
- test/dummy/Rakefile
|
213
|
+
- test/dummy/app/assets/javascripts/application.js
|
214
|
+
- test/dummy/app/assets/stylesheets/application.css
|
215
|
+
- test/dummy/app/controllers/application_controller.rb
|
216
|
+
- test/dummy/app/helpers/application_helper.rb
|
217
|
+
- test/dummy/app/views/layouts/application.html.erb
|
218
|
+
- test/dummy/bin/bundle
|
219
|
+
- test/dummy/bin/rails
|
220
|
+
- test/dummy/bin/rake
|
221
|
+
- test/dummy/bin/setup
|
222
|
+
- test/dummy/config.ru
|
223
|
+
- test/dummy/config/application.rb
|
224
|
+
- test/dummy/config/boot.rb
|
225
|
+
- test/dummy/config/database.yml
|
226
|
+
- test/dummy/config/environment.rb
|
227
|
+
- test/dummy/config/environments/development.rb
|
228
|
+
- test/dummy/config/environments/production.rb
|
229
|
+
- test/dummy/config/environments/test.rb
|
230
|
+
- test/dummy/config/initializers/assets.rb
|
231
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
232
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
233
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
234
|
+
- test/dummy/config/initializers/inflections.rb
|
235
|
+
- test/dummy/config/initializers/mime_types.rb
|
236
|
+
- test/dummy/config/initializers/session_store.rb
|
237
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
238
|
+
- test/dummy/config/locales/en.yml
|
239
|
+
- test/dummy/config/routes.rb
|
240
|
+
- test/dummy/config/secrets.yml
|
241
|
+
- test/dummy/public/404.html
|
242
|
+
- test/dummy/public/422.html
|
243
|
+
- test/dummy/public/500.html
|
244
|
+
- test/dummy/public/favicon.ico
|
245
|
+
- test/fixtures/trainmaster/sessions.yml
|
246
|
+
- test/fixtures/trainmaster/users.yml
|
247
|
+
- test/integration/navigation_test.rb
|
248
|
+
- test/jobs/trainmaster/sessions_cleanup_job_test.rb
|
249
|
+
- test/mailers/previews/trainmaster/user_mailer_preview.rb
|
250
|
+
- test/mailers/trainmaster/user_mailer_test.rb
|
251
|
+
- test/models/trainmaster/session_test.rb
|
252
|
+
- test/models/trainmaster/user_test.rb
|
253
|
+
- test/test_helper.rb
|
254
|
+
- test/trainmaster.rb
|
255
|
+
homepage: https://github.com/davidan1981/trainmaster
|
256
|
+
licenses:
|
257
|
+
- MIT
|
258
|
+
metadata: {}
|
259
|
+
post_install_message:
|
260
|
+
rdoc_options: []
|
261
|
+
require_paths:
|
262
|
+
- lib
|
263
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
264
|
+
requirements:
|
265
|
+
- - ">="
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '0'
|
268
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
|
+
requirements:
|
270
|
+
- - ">="
|
271
|
+
- !ruby/object:Gem::Version
|
272
|
+
version: '0'
|
273
|
+
requirements: []
|
274
|
+
rubyforge_project:
|
275
|
+
rubygems_version: 2.5.1
|
276
|
+
signing_key:
|
277
|
+
specification_version: 4
|
278
|
+
summary: trainmaster is a Rails engine that provides a simple JWT-based session management
|
279
|
+
platform for API development.
|
280
|
+
test_files:
|
281
|
+
- test/test_helper.rb
|
282
|
+
- test/fixtures/trainmaster/sessions.yml
|
283
|
+
- test/fixtures/trainmaster/users.yml
|
284
|
+
- test/trainmaster.rb
|
285
|
+
- test/jobs/trainmaster/sessions_cleanup_job_test.rb
|
286
|
+
- test/mailers/previews/trainmaster/user_mailer_preview.rb
|
287
|
+
- test/mailers/trainmaster/user_mailer_test.rb
|
288
|
+
- test/dummy/README.rdoc
|
289
|
+
- test/dummy/app/views/layouts/application.html.erb
|
290
|
+
- test/dummy/app/assets/stylesheets/application.css
|
291
|
+
- test/dummy/app/assets/javascripts/application.js
|
292
|
+
- test/dummy/app/helpers/application_helper.rb
|
293
|
+
- test/dummy/app/controllers/application_controller.rb
|
294
|
+
- test/dummy/Rakefile
|
295
|
+
- test/dummy/public/500.html
|
296
|
+
- test/dummy/public/404.html
|
297
|
+
- test/dummy/public/favicon.ico
|
298
|
+
- test/dummy/public/422.html
|
299
|
+
- test/dummy/config/locales/en.yml
|
300
|
+
- test/dummy/config/database.yml
|
301
|
+
- test/dummy/config/environments/production.rb
|
302
|
+
- test/dummy/config/environments/test.rb
|
303
|
+
- test/dummy/config/environments/development.rb
|
304
|
+
- test/dummy/config/environment.rb
|
305
|
+
- test/dummy/config/routes.rb
|
306
|
+
- test/dummy/config/initializers/assets.rb
|
307
|
+
- test/dummy/config/initializers/inflections.rb
|
308
|
+
- test/dummy/config/initializers/mime_types.rb
|
309
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
310
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
311
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
312
|
+
- test/dummy/config/initializers/session_store.rb
|
313
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
314
|
+
- test/dummy/config/secrets.yml
|
315
|
+
- test/dummy/config/application.rb
|
316
|
+
- test/dummy/config/boot.rb
|
317
|
+
- test/dummy/config.ru
|
318
|
+
- test/dummy/bin/bundle
|
319
|
+
- test/dummy/bin/rails
|
320
|
+
- test/dummy/bin/setup
|
321
|
+
- test/dummy/bin/rake
|
322
|
+
- test/models/trainmaster/session_test.rb
|
323
|
+
- test/models/trainmaster/user_test.rb
|
324
|
+
- test/integration/navigation_test.rb
|
325
|
+
- test/controllers/trainmaster/users_controller_test.rb
|
326
|
+
- test/controllers/trainmaster/application_controller_test.rb
|
327
|
+
- test/controllers/trainmaster/sessions_controller_test.rb
|