devise-2fa 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +46 -0
  3. data/.gitignore +8 -0
  4. data/Gemfile +3 -22
  5. data/README.md +13 -14
  6. data/Rakefile +6 -28
  7. data/bin/rspec +10 -0
  8. data/bin/setup +12 -0
  9. data/{devise-2fa.gemspec → devise_2fa.gemspec} +15 -8
  10. data/lib/devise-2fa/version.rb +1 -1
  11. data/lib/devise_two_factorable/models/two_factorable.rb +5 -1
  12. data/{test → spec}/dummy/Rakefile +2 -3
  13. data/{test/dummy/app/mailers/.gitkeep → spec/dummy/app/assets/images/.keep} +0 -0
  14. data/spec/dummy/app/assets/javascripts/application.js +3 -0
  15. data/{test/dummy/lib/assets/.gitkeep → spec/dummy/app/assets/javascripts/channels/.keep} +0 -0
  16. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  17. data/{test → spec}/dummy/app/controllers/application_controller.rb +4 -1
  18. data/{test/dummy/public/favicon.ico → spec/dummy/app/controllers/concerns/.keep} +0 -0
  19. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  20. data/spec/dummy/app/models/application_record.rb +3 -0
  21. data/spec/dummy/app/models/concerns/.keep +0 -0
  22. data/spec/dummy/app/models/user.rb +6 -0
  23. data/spec/dummy/app/views/layouts/application.html.erb +19 -0
  24. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  25. data/spec/dummy/bin/bundle +3 -0
  26. data/spec/dummy/bin/rails +4 -0
  27. data/spec/dummy/bin/rake +4 -0
  28. data/spec/dummy/bin/setup +25 -0
  29. data/spec/dummy/bin/update +25 -0
  30. data/spec/dummy/bin/yarn +11 -0
  31. data/spec/dummy/config.ru +5 -0
  32. data/spec/dummy/config/application.rb +14 -0
  33. data/spec/dummy/config/boot.rb +5 -0
  34. data/{test → spec}/dummy/config/database.yml +10 -10
  35. data/spec/dummy/config/environment.rb +5 -0
  36. data/spec/dummy/config/environments/development.rb +61 -0
  37. data/{test → spec}/dummy/config/environments/test.rb +15 -5
  38. data/spec/dummy/config/initializers/assets.rb +4 -0
  39. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  40. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  41. data/{test → spec}/dummy/config/initializers/devise.rb +134 -56
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  43. data/{test → spec}/dummy/config/initializers/inflections.rb +6 -5
  44. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -1
  45. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +5 -5
  46. data/spec/dummy/config/locales/devise.en.yml +68 -0
  47. data/spec/dummy/config/locales/devise.two_factor.en.yml +57 -0
  48. data/spec/dummy/config/locales/en.yml +2 -0
  49. data/spec/dummy/config/puma.rb +9 -0
  50. data/spec/dummy/config/routes.rb +4 -0
  51. data/spec/dummy/config/spring.rb +6 -0
  52. data/spec/dummy/config/storage.yml +8 -0
  53. data/spec/dummy/db/migrate/20190311184605_devise_create_users.rb +44 -0
  54. data/{test/dummy/db/migrate/20130131160351_devise_otp_add_to_users.rb → spec/dummy/db/migrate/20190312222952_devise_two_factor_add_to_users.rb} +4 -5
  55. data/spec/dummy/db/schema.rb +39 -0
  56. data/spec/dummy/lib/assets/.keep +0 -0
  57. data/spec/dummy/package.json +5 -0
  58. data/spec/dummy/public/404.html +1 -0
  59. data/spec/dummy/public/422.html +1 -0
  60. data/spec/dummy/public/500.html +19 -0
  61. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  62. data/spec/dummy/public/apple-touch-icon.png +0 -0
  63. data/spec/dummy/public/favicon.ico +0 -0
  64. data/spec/dummy/storage/.keep +0 -0
  65. data/spec/models/user_spec.rb +33 -0
  66. data/spec/spec_helper.rb +69 -0
  67. data/spec/system/persistence_spec.rb +59 -0
  68. data/spec/system/refresh_spec.rb +100 -0
  69. data/spec/system/token_spec.rb +41 -0
  70. data/spec/system/users_spec.rb +98 -0
  71. metadata +213 -123
  72. data/.travis.yml +0 -28
  73. data/lib/devise_two_factorable/two_factorable.rb +0 -131
  74. data/test/dummy/README.rdoc +0 -261
  75. data/test/dummy/app/assets/javascripts/application.js +0 -13
  76. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  77. data/test/dummy/app/controllers/posts_controller.rb +0 -83
  78. data/test/dummy/app/helpers/posts_helper.rb +0 -2
  79. data/test/dummy/app/models/post.rb +0 -2
  80. data/test/dummy/app/models/user.rb +0 -20
  81. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  82. data/test/dummy/app/views/posts/_form.html.erb +0 -25
  83. data/test/dummy/app/views/posts/edit.html.erb +0 -6
  84. data/test/dummy/app/views/posts/index.html.erb +0 -25
  85. data/test/dummy/app/views/posts/new.html.erb +0 -5
  86. data/test/dummy/app/views/posts/show.html.erb +0 -15
  87. data/test/dummy/config.ru +0 -4
  88. data/test/dummy/config/application.rb +0 -67
  89. data/test/dummy/config/boot.rb +0 -10
  90. data/test/dummy/config/environment.rb +0 -5
  91. data/test/dummy/config/environments/development.rb +0 -37
  92. data/test/dummy/config/environments/production.rb +0 -73
  93. data/test/dummy/config/initializers/secret_token.rb +0 -8
  94. data/test/dummy/config/initializers/session_store.rb +0 -8
  95. data/test/dummy/config/locales/en.yml +0 -5
  96. data/test/dummy/config/routes.rb +0 -6
  97. data/test/dummy/db/migrate/20130125101430_create_users.rb +0 -9
  98. data/test/dummy/db/migrate/20130131092406_add_devise_to_users.rb +0 -52
  99. data/test/dummy/db/migrate/20130131142320_create_posts.rb +0 -10
  100. data/test/dummy/public/404.html +0 -26
  101. data/test/dummy/public/422.html +0 -26
  102. data/test/dummy/public/500.html +0 -25
  103. data/test/dummy/script/rails +0 -6
  104. data/test/integration/persistence_test.rb +0 -63
  105. data/test/integration/refresh_test.rb +0 -103
  106. data/test/integration/sign_in_test.rb +0 -85
  107. data/test/integration/token_test.rb +0 -30
  108. data/test/integration_tests_helper.rb +0 -64
  109. data/test/model_tests_helper.rb +0 -20
  110. data/test/models/two_factorable_test.rb +0 -120
  111. data/test/orm/active_record.rb +0 -4
  112. data/test/orm/mongoid.rb +0 -13
  113. data/test/support/mongoid.yml +0 -6
  114. data/test/support/symmetric_encryption.yml +0 -70
  115. data/test/test_helper.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 818ff39f300655bfc5e4595926641b1d8b7e9bfe
4
- data.tar.gz: c5efa8ee1d94153371f2a5f484d01c63391432da
2
+ SHA256:
3
+ metadata.gz: 83df80ebf1e6b543d6ac9e53d8577e70d727323312ea8748d5709fc8cd6fb491
4
+ data.tar.gz: ee76f7c9922b69ba53fe2fd13b6409a241c4da93d6ec89b47f6b2384409a1ee7
5
5
  SHA512:
6
- metadata.gz: f8ea4680d7be412d4c2a5cbe3b031950e8370ba125d2b7b612114e12d1629297c894c8a343b33709e49208ef35d13874f7c1502acf7aecae7e59980443b53e19
7
- data.tar.gz: 484dc83eb67d9071190988e53a7bc84cf68dc1f078d50fb994fb0e62e297fa4cebae0b9372465141cd3255bd5c03147aa121677d75a66444c8a48f2ae9fdeb68
6
+ metadata.gz: 0e799896dc4f81b392382af681bb1aa346bb1271a61c85c243231b2045a58674ac552ecce6dbefbaef9198f5bc5d967426fec3acc9ac64ced888c244c5895275
7
+ data.tar.gz: 88e4f90b42ea6447f90f6d3e0a96814ee161fd859266dcdca7a89418855eaf637d5420e1c2fb7982b95684f73d188bd49ff97c7b7d058eff1213d47b800ac948
@@ -0,0 +1,46 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ - image: circleci/ruby:2.4.1-node-browsers
6
+
7
+ working_directory: ~/repo
8
+
9
+ steps:
10
+ - checkout
11
+
12
+ - restore_cache:
13
+ keys:
14
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
15
+ - v1-dependencies-
16
+
17
+ - run:
18
+ name: install dependencies
19
+ command: |
20
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
21
+
22
+ - save_cache:
23
+ paths:
24
+ - ./vendor/bundle
25
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
26
+
27
+ - run: cd spec/dummy && bin/setup
28
+
29
+ - run:
30
+ name: run tests
31
+ command: |
32
+ mkdir /tmp/test-results
33
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
34
+ circleci tests split --split-by=timings)"
35
+
36
+ bundle exec rspec \
37
+ --format progress \
38
+ --out /tmp/test-results/rspec.xml \
39
+ --format progress \
40
+ $TEST_FILES
41
+
42
+ - store_test_results:
43
+ path: /tmp/test-results
44
+ - store_artifacts:
45
+ path: /tmp/test-results
46
+ destination: test-results
data/.gitignore CHANGED
@@ -34,3 +34,11 @@ build/
34
34
 
35
35
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
36
  .rvmrc
37
+
38
+ # Rails
39
+ spec/dummy/db/development.sqlite3
40
+ spec/dummy/log/*
41
+ spec/dummy/db/test.sqlite3
42
+ *.cache
43
+ spec/dummy/tmp/development_secret.txt
44
+ spec/dummy/tmp/restart.txt
data/Gemfile CHANGED
@@ -1,25 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
2
5
 
3
6
  gemspec
4
-
5
- gem 'rdoc'
6
-
7
- group :test do
8
- platforms :jruby do
9
- gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0.beta1'
10
- end
11
-
12
- platforms :ruby do
13
- gem 'sqlite3', '~> 1.3.4'
14
- end
15
-
16
- gem 'devise', '~> 4.0'
17
- gem 'activerecord', '~> 4.2.6'
18
- gem 'mongo'
19
-
20
- gem 'capybara'
21
- gem 'shoulda'
22
- gem 'selenium-webdriver'
23
-
24
- gem 'minitest-reporters', '>= 0.5.0'
25
- end
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Devise::TwoFactor
2
- [![Build Status](https://travis-ci.org/williamatodd/devise-2fa.png?branch=master)](https://travis-ci.org/williamatodd/devise-2fa)
2
+
3
+ [![CircleCI](https://circleci.com/gh/williamatodd/devise-2fa.svg?style=svg)](https://circleci.com/gh/williamatodd/devise-2fa)
3
4
 
4
5
  Devise TwoFactor implements two-factor authentication for Devise, using an rfc6238 compatible Time-Based One-Time Password Algorithm.
5
- * Uses [rotp library](https://github.com/mdp/rotp) for the generation and verification of codes.
6
+ * Uses [rotp](https://github.com/mdp/rotp) for the generation and verification of codes.
6
7
  * Uses [RQRCode](https://github.com/whomwah/rqrcode) to generate QR Code PNGs.
7
- * Uses [SymmetricEncryption](https://github.com/rocketjob/symmetric-encryption) to generate QR Code PNGs.
8
+ * Uses [SymmetricEncryption](https://github.com/rocketjob/symmetric-encryption) to encrypt secrets and recovery codes.
8
9
 
9
10
  It currently has the following features:
10
11
 
@@ -19,17 +20,6 @@ Compatible token devices are:
19
20
  * [Google Authenticator](https://code.google.com/p/google-authenticator/)
20
21
  * [FreeOTP](https://fedorahosted.org/freeotp/)
21
22
 
22
- ## Quick overview of Two Factors Authentication, using OTPs.
23
-
24
- * A shared secret is generated on the server, and stored both on the token device (eg: the phone) and the server itself.
25
- * The secret is used to generate short numerical tokens that are either time or sequence based.
26
- * Tokens can be generated on a phone without internet connectivity.
27
- * The token provides an additional layer of security against password theft.
28
- * OTP's should always be used as a second factor of authentication(if your phone is lost, you account is still secured with a password)
29
-
30
- Although there's an adjustable drift window, it is important that both the server and the token device (phone) have their clocks set (eg: using NTP).
31
-
32
-
33
23
  ## Installation
34
24
 
35
25
  Setup the symmetric-encryption gem by following the steps on the (configuration page)[http://rocketjob.github.io/symmetric-encryption/configuration.html]
@@ -98,6 +88,7 @@ With this extension enabled, the following is expected behavior:
98
88
  * Users may go to _/MODEL/token_ and enable their OTP state, they might be asked to provide their password again (and OTP token, if it's enabled)
99
89
  * Once enabled they're shown an alphanumeric code (for manual provisioning) and a QR code, for automatic provisioning of their authentication device (for instance, Google Authenticator)
100
90
  * If config.otp_mandatory or model_instance.otp_mandatory, users will be required to enable, and provision, next time they successfully sign-in.
91
+ * Although there's an adjustable drift window, it is important that both the server and the token device (phone) have their clocks set (eg: using NTP).
101
92
 
102
93
 
103
94
  ### Configuration Options
@@ -112,6 +103,12 @@ The install generator adds some options to the end of your Devise config file (c
112
103
  * `config.otp_trust_persistence` - The user is allowed to set his browser as "trusted", no more OTP challenges will be asked for that browser, for a limited time. (default: `1.month`, set to false to disable setting the browser as trusted)
113
104
  * `config.otp_issuer` - The name of the token issuer, to be added to the provisioning url. Display will vary based on token application. (defaults to the Rails application class)
114
105
 
106
+ ### Development
107
+
108
+ Set up the gem for development with `bin/setup`.
109
+
110
+ Run the test suite with `bin/rspec`.
111
+
115
112
  ## Contributing
116
113
 
117
114
  1. Fork it
@@ -128,3 +125,5 @@ This extension is a hodgepodge of
128
125
  ## License
129
126
 
130
127
  MIT Licensed
128
+
129
+ Copyright © 2015-2019 William A. Todd and contributors.
data/Rakefile CHANGED
@@ -1,41 +1,19 @@
1
- #!/usr/bin/env rake
2
1
  begin
3
2
  require 'bundler/setup'
4
3
  rescue LoadError
5
4
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
5
  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
6
+
7
+ require 'rdoc/task'
14
8
 
15
9
  RDoc::Task.new(:rdoc) do |rdoc|
16
10
  rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'Foobar'
11
+ rdoc.title = 'Devise::TwoFactor'
18
12
  rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
20
14
  rdoc.rdoc_files.include('lib/**/*.rb')
21
15
  end
22
16
 
23
- Bundler::GemHelper.install_tasks
24
-
25
- require 'rake/testtask'
26
- Rake::TestTask.new(:test) do |test|
27
- test.libs << 'lib' << 'test'
28
- test.pattern = 'test/**/*_test.rb'
29
- test.verbose = true
30
- end
31
-
32
- desc 'Run Devise tests for all ORMs.'
33
- task :tests do
34
- Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
35
- orm = File.basename(file).split('.').first
36
- system "rake test DEVISE_ORM=#{orm}"
37
- end
38
- end
17
+ require 'bundler/gem_tasks'
39
18
 
40
- desc 'Default: run tests for all ORMs.'
41
- task default: :tests
19
+ task default: :rdoc
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ begin
5
+ load File.expand_path('../spring', __FILE__)
6
+ rescue LoadError => e
7
+ raise unless e.message.include?('spring')
8
+ end
9
+ require 'bundler/setup'
10
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ # Fail out, bail out
4
+ set -e
5
+
6
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7
+
8
+ echo "Installing dependencies"
9
+ gem install bundler --conservative
10
+ bundle check || bundle install
11
+
12
+ $DIR/../spec/dummy/bin/setup
@@ -1,27 +1,34 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'devise-2fa/version'
1
+ $:.push File.expand_path("lib", __dir__)
5
2
 
3
+ # Maintain your gem's version:
4
+ require "devise-2fa/version"
5
+
6
+ # Describe your gem and declare its dependencies:
6
7
  Gem::Specification.new do |gem|
7
8
  gem.name = 'devise-2fa'
8
9
  gem.version = Devise::TwoFactor::VERSION
9
10
  gem.authors = ['William A. Todd']
10
- gem.email = ['info@investinwaffles.com']
11
+ gem.email = ['info@rockcreek.io']
11
12
  gem.description = 'Time Based OTP/rfc6238 authentication for Devise'
12
13
  gem.summary = 'Includes ActiveRecord and Mongoid ORM support'
13
14
  gem.homepage = 'http://www.github.com/williamatodd/devise-2fa'
14
15
  gem.license = 'MIT'
15
16
 
16
17
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ['lib']
20
20
 
21
+ gem.add_dependency "rails", "~> 5.0"
22
+
21
23
  gem.add_runtime_dependency 'devise', '~> 4.0'
22
24
  gem.add_runtime_dependency 'rotp', '~> 3.0'
23
25
  gem.add_runtime_dependency 'rqrcode', '~> 0.10.1'
24
- gem.add_runtime_dependency 'symmetric-encryption', '~> 3.8'
26
+ gem.add_runtime_dependency 'symmetric-encryption', '~> 4.2.0'
25
27
 
26
- gem.add_development_dependency 'sqlite3', '~> 0'
28
+ gem.add_development_dependency 'sqlite3', '~> 1.3.6'
29
+ gem.add_development_dependency 'selenium-webdriver'
30
+ gem.add_development_dependency 'rspec-rails'
31
+ gem.add_development_dependency 'capybara'
32
+ gem.add_development_dependency 'rspec'
33
+ gem.add_development_dependency 'pry'
27
34
  end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module TwoFactor
3
- VERSION = '0.1.1'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
@@ -7,7 +7,11 @@ module Devise::Models
7
7
  included do
8
8
  before_validation :generate_otp_auth_secret, on: :create
9
9
  before_validation :generate_otp_persistence_seed, on: :create
10
- scope :with_valid_otp_challenge, ->{ where(:otp_challenge_expires.gt => Time.current) }
10
+ if defined?(ActiveRecord) && self < ActiveRecord::Base
11
+ scope :with_valid_otp_challenge, ->{ where(User.arel_table[:otp_challenge_expires].gt(Time.current)) }
12
+ else # Mongoid
13
+ scope :with_valid_otp_challenge, ->{ where(:otp_challenge_expires.gt => Time.current) }
14
+ end
11
15
  end
12
16
 
13
17
  module ClassMethods
@@ -1,7 +1,6 @@
1
- #!/usr/bin/env rake
2
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
3
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
3
 
5
- require File.expand_path('../config/application', __FILE__)
4
+ require_relative 'config/application'
6
5
 
7
- Dummy::Application.load_tasks
6
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= require rails-ujs
2
+ //= require activestorage
3
+ //= 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 other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -1,4 +1,7 @@
1
1
  class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
2
  before_action :authenticate_user!
3
+
4
+ def show
5
+ render html: "", layout: "application"
6
+ end
4
7
  end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ class User < ApplicationRecord
2
+ # Include default devise modules. Others available are:
3
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
4
+ devise :two_factorable, :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :validatable
6
+ end
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <p class="notice"><%= notice %></p>
5
+ <p class="alert"><%= alert %></p>
6
+
7
+ <title>Dummy</title>
8
+ <%= csrf_meta_tags %>
9
+ <%= csp_meta_tag %>
10
+
11
+ <%= stylesheet_link_tag 'application', media: 'all' %>
12
+ <%= javascript_include_tag 'application' %>
13
+ </head>
14
+
15
+ <body>
16
+ <%= link_to('Logout', destroy_user_session_path, method: :delete) %>
17
+ <%= yield %>
18
+ </body>
19
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ puts '== Installing dependencies =='
14
+ system! 'gem install bundler --conservative'
15
+ system('bundle check') || system!('bundle install')
16
+
17
+ puts "\n== Preparing database =="
18
+ system! 'bin/rails db:setup'
19
+
20
+ puts "\n== Removing old logs and tempfiles =="
21
+ system! 'bin/rails log:clear tmp:clear'
22
+
23
+ puts "\n== Restarting application server =="
24
+ system! 'bin/rails restart'
25
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ puts '== Installing dependencies =='
14
+ system! 'gem install bundler --conservative'
15
+ system('bundle check') || system!('bundle install')
16
+
17
+ puts "\n== Updating database =="
18
+ system! 'bin/rails db:migrate'
19
+
20
+ puts "\n== Removing old logs and tempfiles =="
21
+ system! 'bin/rails log:clear tmp:clear'
22
+
23
+ puts "\n== Restarting application server =="
24
+ system! 'bin/rails restart'
25
+ end