gnarus_exercise 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +10 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/gnarus_exercise/application.js +15 -0
  5. data/app/assets/stylesheets/gnarus_exercise/application.css +13 -0
  6. data/app/controllers/gnarus_exercise/application_controller.rb +4 -0
  7. data/app/controllers/gnarus_exercise/attempts_controller.rb +21 -0
  8. data/app/controllers/gnarus_exercise/exercises_controller.rb +74 -0
  9. data/app/helpers/gnarus_exercise/application_helper.rb +4 -0
  10. data/app/models/gnarus_exercise/attempt.rb +13 -0
  11. data/app/models/gnarus_exercise/exercise.rb +7 -0
  12. data/app/models/gnarus_exercise/user.rb +5 -0
  13. data/app/views/gnarus_exercise/exercises/_form.html.erb +21 -0
  14. data/app/views/gnarus_exercise/exercises/edit.html.erb +6 -0
  15. data/app/views/gnarus_exercise/exercises/index.html.erb +23 -0
  16. data/app/views/gnarus_exercise/exercises/new.html.erb +5 -0
  17. data/app/views/gnarus_exercise/exercises/show.html.erb +10 -0
  18. data/app/views/layouts/gnarus_exercise/application.html.erb +15 -0
  19. data/config/initializers/devise.rb +223 -0
  20. data/config/locales/devise.en.yml +57 -0
  21. data/config/routes.rb +9 -0
  22. data/db/migrate/20120405185453_create_gnarus_exercise_exercises.rb +10 -0
  23. data/db/migrate/20120405185533_create_gnarus_exercise_attempts.rb +12 -0
  24. data/lib/gnarus_exercise.rb +4 -0
  25. data/lib/gnarus_exercise/engine.rb +5 -0
  26. data/lib/gnarus_exercise/version.rb +3 -0
  27. data/lib/tasks/gnarus_exercise_tasks.rake +4 -0
  28. data/test/dummy/README.rdoc +261 -0
  29. data/test/dummy/Rakefile +7 -0
  30. data/test/dummy/app/assets/javascripts/application.js +15 -0
  31. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  32. data/test/dummy/app/controllers/application_controller.rb +3 -0
  33. data/test/dummy/app/helpers/application_helper.rb +2 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/config.ru +4 -0
  36. data/test/dummy/config/application.rb +56 -0
  37. data/test/dummy/config/boot.rb +10 -0
  38. data/test/dummy/config/database.yml +25 -0
  39. data/test/dummy/config/environment.rb +5 -0
  40. data/test/dummy/config/environments/development.rb +37 -0
  41. data/test/dummy/config/environments/production.rb +67 -0
  42. data/test/dummy/config/environments/test.rb +37 -0
  43. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  44. data/test/dummy/config/initializers/inflections.rb +15 -0
  45. data/test/dummy/config/initializers/mime_types.rb +5 -0
  46. data/test/dummy/config/initializers/secret_token.rb +7 -0
  47. data/test/dummy/config/initializers/session_store.rb +8 -0
  48. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/test/dummy/config/locales/en.yml +5 -0
  50. data/test/dummy/config/routes.rb +4 -0
  51. data/test/dummy/public/404.html +26 -0
  52. data/test/dummy/public/422.html +26 -0
  53. data/test/dummy/public/500.html +25 -0
  54. data/test/dummy/public/favicon.ico +0 -0
  55. data/test/dummy/script/rails +6 -0
  56. data/test/fixtures/gnarus_exercise/attempts.yml +11 -0
  57. data/test/fixtures/gnarus_exercise/exercises.yml +9 -0
  58. data/test/fixtures/gnarus_exercise/users.yml +11 -0
  59. data/test/gnarus_exercise_test.rb +7 -0
  60. data/test/integration/navigation_test.rb +10 -0
  61. data/test/test_helper.rb +10 -0
  62. data/test/unit/gnarus_exercise/attempt_test.rb +9 -0
  63. data/test/unit/gnarus_exercise/exercise_test.rb +9 -0
  64. data/test/unit/gnarus_exercise/user_test.rb +9 -0
  65. metadata +178 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 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.rdoc ADDED
@@ -0,0 +1,10 @@
1
+ = GnarusExercise
2
+
3
+ This project rocks and uses MIT-LICENSE.
4
+
5
+ echo "gem gnarus_exercise" > Gemfile
6
+ echo "gem devise" > Gemfile
7
+ bundle install
8
+ rails g devise:install
9
+ rails g devise User
10
+ rake gnarus_exercise:install:migrations
data/Rakefile ADDED
@@ -0,0 +1,40 @@
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
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'GnarusExercise'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module GnarusExercise
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,21 @@
1
+ module GnarusExercise
2
+ class AttemptsController < ApplicationController
3
+
4
+ skip_before_filter :verify_authenticity_token
5
+
6
+ def update
7
+ @attempt = Attempt.find(params[:id])
8
+ if(@attempt.not_finished)
9
+ @attempt.update_attributes(:solution => params[:path])
10
+ end
11
+ redirect_to @attempt.full_return_uri
12
+ end
13
+
14
+ def index
15
+ exercise = Exercise.find(params[:exercise_id])
16
+ @attempt = exercise.attempts.create(params[:attempt])
17
+ @attempt.save
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,74 @@
1
+ module GnarusExercise
2
+ class ExercisesController < ApplicationController
3
+
4
+ before_filter :authenticate_user! if defined?(Devise)
5
+
6
+ def index
7
+ @exercises = Exercise.all.select{|e| e.author.id == current_user.id}
8
+ end
9
+
10
+ # GET /exercises/1
11
+ # GET /exercises/1.json
12
+ def show
13
+ @exercise = Exercise.find(params[:id])
14
+
15
+ respond_to do |format|
16
+ format.html # show.html.erb
17
+ format.json { render json: @exercise }
18
+ end
19
+ end
20
+
21
+ # GET /exercises/new
22
+ # GET /exercises/new.json
23
+ def new
24
+ @exercise = Exercise.new
25
+
26
+ respond_to do |format|
27
+ format.html # new.html.erb
28
+ format.json { render json: @exercise }
29
+ end
30
+ end
31
+
32
+ # GET /exercises/1/edit
33
+ def edit
34
+ @exercise = Exercise.find(params[:id])
35
+ end
36
+
37
+ # POST /exercises
38
+ # POST /exercises.json
39
+ def create
40
+ @exercise = Exercise.new(params[:exercise])
41
+ @exercise.author = current_user if defined?(Devise)
42
+
43
+ respond_to do |format|
44
+ if @exercise.save
45
+ format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }
46
+ format.json { render json: @exercise, status: :created, location: @exercise }
47
+ else
48
+ format.html { render action: "new" }
49
+ format.json { render json: @exercise.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ def update
55
+ @exercise = Exercise.find(params[:id])
56
+ if defined?(Devise) && @exercise.author == current_user
57
+ @exercise.update_attributes(params[:exercise])
58
+ end
59
+
60
+ redirect_to @exercise, notice: 'Exercise was successfully updated.'
61
+ end
62
+
63
+ # DELETE /exercises/1
64
+ # DELETE /exercises/1.json
65
+ def destroy
66
+ @exercise = Exercise.find(params[:id])
67
+ if defined?(Devise) && @exercise.author == current_user
68
+ @exercise.destroy
69
+ end
70
+
71
+ redirect_to exercises_url
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,4 @@
1
+ module GnarusExercise
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,13 @@
1
+ module GnarusExercise
2
+ class Attempt < ActiveRecord::Base
3
+ belongs_to :exercise
4
+ attr_accessible :return_uri, :solution
5
+
6
+ def not_finished
7
+ solution.nil?
8
+ end
9
+ def full_return_uri
10
+ (return_uri || "") + "?answer=" + (solution || "")
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module GnarusExercise
2
+ class Exercise < ActiveRecord::Base
3
+ attr_accessible :author_id, :content
4
+ has_many :attempts
5
+ belongs_to :author, :class_name => User
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module GnarusExercise
2
+ class User < ActiveRecord::Base
3
+ # attr_accessible :title, :body
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ <%= form_for(@exercise) do |f| %>
2
+ <% if @exercise.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@exercise.errors.count, "error") %> prohibited this exercise from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @exercise.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :content %><br />
16
+ <%= f.text_area :content %>
17
+ </div>
18
+ <div class="actions">
19
+ <%= f.submit %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing exercise</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @exercise %> |
6
+ <%= link_to 'Back', exercises_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Listing exercises</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Content</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <% @exercises.each do |exercise| %>
12
+ <tr>
13
+ <td><%= exercise.content %></td>
14
+ <td><%= link_to 'Show', exercise %></td>
15
+ <td><%= link_to 'Edit', edit_exercise_path(exercise) %></td>
16
+ <td><%= link_to 'Destroy', exercise, confirm: 'Are you sure?', method: :delete %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New Exercise', new_exercise_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New exercise</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', exercises_path %>
@@ -0,0 +1,10 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Content:</b>
5
+ <%= @exercise.content %>
6
+ </p>
7
+
8
+ <a href="/exercises/<%= @exercise.id%>/attempts">Preview</a> |
9
+ <%= link_to 'Edit', edit_exercise_path(@exercise) %> |
10
+ <%= link_to 'Back', exercises_path %>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>GnarusExercise</title>
5
+ <%= stylesheet_link_tag "gnarus_exercise/application", :media => "all" %>
6
+ <%= javascript_include_tag "gnarus_exercise/application" %>
7
+ <%= javascript_include_tag "application" %>
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,223 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in Devise::Mailer,
6
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
8
+
9
+ # Configure the class responsible to send e-mails.
10
+ # config.mailer = "Devise::Mailer"
11
+
12
+ # Automatically apply schema changes in tableless databases
13
+ config.apply_schema = false
14
+
15
+ # ==> ORM configuration
16
+ # Load and configure the ORM. Supports :active_record (default) and
17
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
18
+ # available as additional gems.
19
+ require 'devise/orm/active_record'
20
+
21
+ # ==> Configuration for any authentication mechanism
22
+ # Configure which keys are used when authenticating a user. The default is
23
+ # just :email. You can configure it to use [:username, :subdomain], so for
24
+ # authenticating a user, both parameters are required. Remember that those
25
+ # parameters are used only when authenticating and not when retrieving from
26
+ # session. If you need permissions, you should implement that in a before filter.
27
+ # You can also supply a hash where the value is a boolean determining whether
28
+ # or not authentication should be aborted when the value is not present.
29
+ # config.authentication_keys = [ :email ]
30
+
31
+ # Configure parameters from the request object used for authentication. Each entry
32
+ # given should be a request method and it will automatically be passed to the
33
+ # find_for_authentication method and considered in your model lookup. For instance,
34
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
35
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
36
+ # config.request_keys = []
37
+
38
+ # Configure which authentication keys should be case-insensitive.
39
+ # These keys will be downcased upon creating or modifying a user and when used
40
+ # to authenticate or find a user. Default is :email.
41
+ config.case_insensitive_keys = [ :email ]
42
+
43
+ # Configure which authentication keys should have whitespace stripped.
44
+ # These keys will have whitespace before and after removed upon creating or
45
+ # modifying a user and when used to authenticate or find a user. Default is :email.
46
+ config.strip_whitespace_keys = [ :email ]
47
+
48
+ # Tell if authentication through request.params is enabled. True by default.
49
+ # It can be set to an array that will enable params authentication only for the
50
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
51
+ # enable it only for database (email + password) authentication.
52
+ # config.params_authenticatable = true
53
+
54
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
55
+ # It can be set to an array that will enable http authentication only for the
56
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
57
+ # enable it only for token authentication.
58
+ # config.http_authenticatable = false
59
+
60
+ # If http headers should be returned for AJAX requests. True by default.
61
+ # config.http_authenticatable_on_xhr = true
62
+
63
+ # The realm used in Http Basic Authentication. "Application" by default.
64
+ # config.http_authentication_realm = "Application"
65
+
66
+ # It will change confirmation, password recovery and other workflows
67
+ # to behave the same regardless if the e-mail provided was right or wrong.
68
+ # Does not affect registerable.
69
+ # config.paranoid = true
70
+
71
+ # By default Devise will store the user in session. You can skip storage for
72
+ # :http_auth and :token_auth by adding those symbols to the array below.
73
+ # Notice that if you are skipping storage for all authentication paths, you
74
+ # may want to disable generating routes to Devise's sessions controller by
75
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
76
+ config.skip_session_storage = [:http_auth]
77
+
78
+ # ==> Configuration for :database_authenticatable
79
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
80
+ # using other encryptors, it sets how many times you want the password re-encrypted.
81
+ #
82
+ # Limiting the stretches to just one in testing will increase the performance of
83
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
84
+ # a value less than 10 in other environments.
85
+ config.stretches = Rails.env.test? ? 1 : 10
86
+
87
+ # Setup a pepper to generate the encrypted password.
88
+ # config.pepper = "c15dde3b38b00250c612bae710383894fc4670bf4013bb36fedacacb906ddbfe819179662ae9368cafb82d82741e4b16a72ce55747a0ca518e8bbd953cae10c7"
89
+
90
+ # ==> Configuration for :confirmable
91
+ # A period that the user is allowed to access the website even without
92
+ # confirming his account. For instance, if set to 2.days, the user will be
93
+ # able to access the website for two days without confirming his account,
94
+ # access will be blocked just in the third day. Default is 0.days, meaning
95
+ # the user cannot access the website without confirming his account.
96
+ # config.allow_unconfirmed_access_for = 2.days
97
+
98
+ # If true, requires any email changes to be confirmed (exctly the same way as
99
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
100
+ # db field (see migrations). Until confirmed new email is stored in
101
+ # unconfirmed email column, and copied to email column on successful confirmation.
102
+ config.reconfirmable = true
103
+
104
+ # Defines which key will be used when confirming an account
105
+ # config.confirmation_keys = [ :email ]
106
+
107
+ # ==> Configuration for :rememberable
108
+ # The time the user will be remembered without asking for credentials again.
109
+ # config.remember_for = 2.weeks
110
+
111
+ # If true, extends the user's remember period when remembered via cookie.
112
+ # config.extend_remember_period = false
113
+
114
+ # If true, uses the password salt as remember token. This should be turned
115
+ # to false if you are not using database authenticatable.
116
+ config.use_salt_as_remember_token = true
117
+
118
+ # Options to be passed to the created cookie. For instance, you can set
119
+ # :secure => true in order to force SSL only cookies.
120
+ # config.cookie_options = {}
121
+
122
+ # ==> Configuration for :validatable
123
+ # Range for password length. Default is 6..128.
124
+ # config.password_length = 6..128
125
+
126
+ # Email regex used to validate email formats. It simply asserts that
127
+ # an one (and only one) @ exists in the given string. This is mainly
128
+ # to give user feedback and not to assert the e-mail validity.
129
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
130
+
131
+ # ==> Configuration for :timeoutable
132
+ # The time you want to timeout the user session without activity. After this
133
+ # time the user will be asked for credentials again. Default is 30 minutes.
134
+ # config.timeout_in = 30.minutes
135
+
136
+ # ==> Configuration for :lockable
137
+ # Defines which strategy will be used to lock an account.
138
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
139
+ # :none = No lock strategy. You should handle locking by yourself.
140
+ # config.lock_strategy = :failed_attempts
141
+
142
+ # Defines which key will be used when locking and unlocking an account
143
+ # config.unlock_keys = [ :email ]
144
+
145
+ # Defines which strategy will be used to unlock an account.
146
+ # :email = Sends an unlock link to the user email
147
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
148
+ # :both = Enables both strategies
149
+ # :none = No unlock strategy. You should handle unlocking by yourself.
150
+ # config.unlock_strategy = :both
151
+
152
+ # Number of authentication tries before locking an account if lock_strategy
153
+ # is failed attempts.
154
+ # config.maximum_attempts = 20
155
+
156
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
157
+ # config.unlock_in = 1.hour
158
+
159
+ # ==> Configuration for :recoverable
160
+ #
161
+ # Defines which key will be used when recovering the password for an account
162
+ # config.reset_password_keys = [ :email ]
163
+
164
+ # Time interval you can reset your password with a reset password key.
165
+ # Don't put a too small interval or your users won't have the time to
166
+ # change their passwords.
167
+ config.reset_password_within = 6.hours
168
+
169
+ # ==> Configuration for :encryptable
170
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
171
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
172
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
173
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
174
+ # REST_AUTH_SITE_KEY to pepper)
175
+ # config.encryptor = :sha512
176
+
177
+ # ==> Configuration for :token_authenticatable
178
+ # Defines name of the authentication token params key
179
+ # config.token_authentication_key = :auth_token
180
+
181
+ # ==> Scopes configuration
182
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
183
+ # "users/sessions/new". It's turned off by default because it's slower if you
184
+ # are using only default views.
185
+ # config.scoped_views = false
186
+
187
+ # Configure the default scope given to Warden. By default it's the first
188
+ # devise role declared in your routes (usually :user).
189
+ # config.default_scope = :user
190
+
191
+ # Configure sign_out behavior.
192
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
193
+ # The default is true, which means any logout action will sign out all active scopes.
194
+ # config.sign_out_all_scopes = true
195
+
196
+ # ==> Navigation configuration
197
+ # Lists the formats that should be treated as navigational. Formats like
198
+ # :html, should redirect to the sign in page when the user does not have
199
+ # access, but formats like :xml or :json, should return 401.
200
+ #
201
+ # If you have any extra navigational formats, like :iphone or :mobile, you
202
+ # should add them to the navigational formats lists.
203
+ #
204
+ # The "*/*" below is required to match Internet Explorer requests.
205
+ # config.navigational_formats = ["*/*", :html]
206
+
207
+ # The default HTTP method used to sign out a resource. Default is :delete.
208
+ config.sign_out_via = :delete
209
+
210
+ # ==> OmniAuth
211
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
212
+ # up on your models and hooks.
213
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
214
+
215
+ # ==> Warden configuration
216
+ # If you want to use other strategies, that are not supported by Devise, or
217
+ # change the failure app, you can configure them inside the config.warden block.
218
+ #
219
+ # config.warden do |manager|
220
+ # manager.intercept_401 = false
221
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
222
+ # end
223
+ end