devise-verifiable 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +14 -0
- data/Rakefile +37 -0
- data/app/controllers/devise/verification_controller.rb +37 -0
- data/app/views/devise/verification/new.erb +17 -0
- data/config/locales/en.yml +4 -0
- data/lib/devise-verifiable.rb +20 -0
- data/lib/devise/controller/helpers.rb +22 -0
- data/lib/devise/models/verifiable.rb +59 -0
- data/lib/devise/verifiable/engine.rb +12 -0
- data/lib/devise/verifiable/routes.rb +18 -0
- data/lib/devise/verifiable/version.rb +5 -0
- data/lib/tasks/devise_verifiable_tasks.rake +4 -0
- data/test/devise_verifiable_test.rb +7 -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/controllers/home_controller.rb +6 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/user.rb +6 -0
- data/test/dummy/app/views/home/index.html.erb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +17 -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 +13 -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 +42 -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/devise.rb +267 -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/devise.en.yml +62 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20160326191549_create_users.rb +13 -0
- data/test/dummy/db/migrate/20160326200137_add_devise_to_users.rb +49 -0
- data/test/dummy/db/schema.rb +39 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +723 -0
- data/test/dummy/log/test.log +14134 -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/dummy/tmp/cache/assets/sprockets/v3.0/0P64YMvGLyegqKbcLGgQEMgpMem2a76XNfbXIz9-Ey0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/1dJiU-fQPONR0DpPbDVF8uV-KnmaNjmvmOwPj96fQjM.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/534R9hua9PcmJx52xsGKCkjQOOpAz82i1NVXrew7wRI.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/BJSW3SvCsdyDxfrPXPEX-SdPn6WpFejINpQC-ohzq1M.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ch2bQFHkYziI9Erdkuj8uoPJyw0W2aA5prtYAqlccww.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/FsGm4YIKEUTAAoLtBvqu9W2QJph2IK0QwuDkhZTX9Po.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/IvDM1j8-H1H6kEjVCsyIW8N2zla-aIp9q_OE9PVZtVw.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/J7VgE3aDZL9AndrYm8x10MZyJhmtGgOqKVF7sDlAn6g.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/JMWwR7l28LmBEVBcM5dlvxSMN8WXl5AYuCL_61oGl0o.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/K9ZheMi0hi4DNLzmDMRnv9A_lOVz33kNImc16Now42o.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/LHgjtAV8kdldaJ_dX0RCznzjmWYRuLdhU29fZCJ0VmU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/NnUCa7jNYx9HCmEB7E7WPWT00DwaM4IYICy1Ju1jjcs.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/OlBX9JIv9SAOmK2t35x1SYDx1sxCXF0yvqpna3WMyH0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/YrZ0OIHu42cExs1kqngMA6ShVDKhfGmhyW-E9haNo5Y.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/dGmwK2w4ea6Db33cXkyKS6ufPhxdaAcKsHWKqy4q7u8.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fLS-tnaEaPlVn0Fq4Ug11zN5DgVroLYMXYN2OdjFjsk.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/gpiWtnqpufka8lRtMznM6Ko0aWJrcH_j8cfZwdYmzNI.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/jd9LtCHlkjxlA-wzs0l6_1jn61CDnMmqYnjRMYnEHlE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/kzdSvu57G4i6eTuarsZCAfbhbICnkRa0Xhi0b9ua6qk.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/n9y1tI8pEiZFScheiDHWNB37EK6_rfbXTYMY5nC6bd0.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rCO5-bHVJ6Y_GsPBmOPUL23pfjvc2Gw2zt_ODmZsygw.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/s6AtMNZlL_Kj-d3p2Resd_EU2Dy2v2Nn3rQnZvlmML4.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/sFqi-B8R6HSSCM6DhcvfXJk3vZeoIUDAR02K9P3JRBs.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/x3o-vQBj2yHdj2-2aquYbWr5KEAIYG1rFAAx70fHJDc.cache +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/fixtures/users.yml +11 -0
- data/test/integration/navigation_test.rb +24 -0
- data/test/integration/verification_test.rb +39 -0
- data/test/models/verifiable_test.rb +31 -0
- data/test/routes_test.rb +26 -0
- data/test/support/integration_case.rb +23 -0
- data/test/support/matchers.rb +13 -0
- data/test/test_helper.rb +30 -0
- metadata +284 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1afe17f16eea98c37bec3bf04a9fdb3f7ba241c1
|
4
|
+
data.tar.gz: 52fdf1381acaf1ca9cbebca7421c2daec78036d2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc6ba081419298df480151781b739b4ba9956063e919d3d807302ef2b51b3970844103f9ad9973c132d6c4a916272a3452ad6c29289310a0e3180531108947b8
|
7
|
+
data.tar.gz: 7bcc5b657813087bc483098692fc132caf12a7b3cbdd3a832218f8be9078d0ad12b11132038fd1ad680dcd3a54923ac1df3b0e5ecd1c883bb52fed63a693d650
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Rodrigo Ra
|
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
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'DeviseVerifiable'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Bundler::GemHelper.install_tasks
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Devise
|
2
|
+
class VerificationController < DeviseController
|
3
|
+
prepend_before_action :authenticate_scope!
|
4
|
+
|
5
|
+
def new
|
6
|
+
end
|
7
|
+
|
8
|
+
def create
|
9
|
+
resource.assign_attributes(account_verification_params)
|
10
|
+
|
11
|
+
if resource.valid_for_verification? && resource.save
|
12
|
+
set_flash_message :notice, :verified
|
13
|
+
redirect_to after_verification_path(resource)
|
14
|
+
else
|
15
|
+
render 'new'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def after_verification_path(resource)
|
22
|
+
'/'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Authenticates the current scope and gets the current resource from the
|
26
|
+
# session
|
27
|
+
def authenticate_scope!
|
28
|
+
send(:"authenticate_#{resource_name}!", force: true)
|
29
|
+
self.resource = send(:"current_#{resource_name}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def account_verification_params
|
33
|
+
params.require(resource_name)
|
34
|
+
.permit(resource_class.fields_for_verification)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h2>Account Verification</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: user_verification_path, method: :post) do |f| %>
|
4
|
+
|
5
|
+
<%= devise_error_messages! %>
|
6
|
+
|
7
|
+
<%- resource_class.fields_for_verification.each do |field| %>
|
8
|
+
<div class="field">
|
9
|
+
<%= f.label field %><br />
|
10
|
+
<%= f.email_field field, autofocus: true %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="actions">
|
15
|
+
<%= f.submit "Verify" %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'devise'
|
2
|
+
require "devise/verifiable/routes"
|
3
|
+
require "devise/verifiable/engine"
|
4
|
+
|
5
|
+
module Devise
|
6
|
+
module Verifiable
|
7
|
+
module Controller
|
8
|
+
autoload :Helpers, 'devise/controller/helpers'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
mattr_accessor :fields_for_verification
|
13
|
+
@@fields_for_verification = []
|
14
|
+
|
15
|
+
@@helpers << Devise::Verifiable::Controller::Helpers
|
16
|
+
end
|
17
|
+
|
18
|
+
Devise.add_module :verifiable, model: 'devise/models/verifiable',
|
19
|
+
controller: :verifications,
|
20
|
+
route: { verification: [:new, :create] }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Devise
|
2
|
+
module Verifiable
|
3
|
+
module Controller
|
4
|
+
module Helpers
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
def self.define_helpers(mapping)
|
8
|
+
mapping = mapping.name
|
9
|
+
|
10
|
+
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
11
|
+
|
12
|
+
def authenticate_verified_#{mapping}!(opts={})
|
13
|
+
authenticate_#{mapping}!
|
14
|
+
redirect_to new_user_verification_path unless current_#{mapping}.verified?
|
15
|
+
end
|
16
|
+
|
17
|
+
METHODS
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Devise
|
2
|
+
module Models
|
3
|
+
# Verifiable is responsible to add a second step to user sign up process.
|
4
|
+
# This module is used when extra information is needed at sign up, e.g.
|
5
|
+
# full name, address, documents, etc. Since this adds a second step, the
|
6
|
+
# user will be able to finish the registration afterwards.
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# == Options
|
10
|
+
#
|
11
|
+
# Verifiable adds the following options to +devise+:
|
12
|
+
#
|
13
|
+
# * +fields_for_verification+: A list of fields which have to be filled
|
14
|
+
# in the second step of the registration process by the user. These
|
15
|
+
# fields will be used to build the form in the second screen.
|
16
|
+
#
|
17
|
+
# == Examples
|
18
|
+
#
|
19
|
+
# User.find(1).verified? # true/false
|
20
|
+
#
|
21
|
+
module Verifiable
|
22
|
+
extend ActiveSupport::Concern
|
23
|
+
|
24
|
+
def self.required_fields(klass)
|
25
|
+
klass.fields_for_verification
|
26
|
+
end
|
27
|
+
|
28
|
+
# Determine if the user filled the fields required in the second sign up
|
29
|
+
# step
|
30
|
+
def verified?
|
31
|
+
self.class.fields_for_verification.all? { |field| send("#{field}?") }
|
32
|
+
end
|
33
|
+
|
34
|
+
def valid_for_verification?
|
35
|
+
self.class.fields_for_verification.each do |field|
|
36
|
+
validate_for_verification(field)
|
37
|
+
end
|
38
|
+
errors.empty?
|
39
|
+
end
|
40
|
+
|
41
|
+
protected
|
42
|
+
|
43
|
+
def validate_for_verification(field)
|
44
|
+
errors.add(field, I18n.t('errors.messages.blank')) if send(field).blank?
|
45
|
+
end
|
46
|
+
|
47
|
+
module ClassMethods
|
48
|
+
Devise::Models.config(self, :fields_for_verification)
|
49
|
+
|
50
|
+
|
51
|
+
def verify_fields(*fields)
|
52
|
+
self.fields_for_verification = fields
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
3
|
+
|
4
|
+
protected
|
5
|
+
|
6
|
+
def devise_verification(mapping, controllers)
|
7
|
+
path_names = {
|
8
|
+
new: mapping.path_names[:new],
|
9
|
+
create: mapping.path_names[:create]
|
10
|
+
}
|
11
|
+
|
12
|
+
resource :verification, only: [:new, :create],
|
13
|
+
path: mapping.path_names[:verification],
|
14
|
+
path_names: path_names,
|
15
|
+
controller: controllers[:verification]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
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 any plugin's vendor/assets/javascripts directory 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
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
# Include default devise modules. Others available are:
|
3
|
+
# :confirmable, :lockable, :timeoutable and :omniauthable
|
4
|
+
devise :database_authenticatable, :registerable,
|
5
|
+
:recoverable, :rememberable, :trackable, :validatable, :verifiable
|
6
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<p class="notice"><%= notice %></p>
|
12
|
+
<p class="alert"><%= alert %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|