-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
75 lines (62 loc) · 1.57 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# frozen_string_literal: true
# rubocop:disable Style/HashSyntax
require 'rake/testtask'
require './require_app'
task :print_env do
puts "Environment: #{ENV.fetch('RACK_ENV', 'development')}"
end
desc 'Run application console (pry)'
task :console => :print_env do
sh 'pry -r ./spec/test_load_all'
end
desc 'Test all the specs'
Rake::TestTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
t.warning = false
end
desc 'Rerun tests on live code changes'
task :respec do
sh 'rerun -c rake spec'
end
desc 'Run rubocop to check style'
task :style => :spec do
sh 'rubocop .'
end
desc 'Update vulnerabilities lit and audit gems'
task :audit do
sh 'bundle audit check --update'
end
desc 'Checks for release'
task :release => [:spec, :style, :audit] do
puts "\nReady for release!"
end
namespace :run do
# Run in development mode
desc 'Run Web App in development mode'
task :dev => :print_env do
sh 'puma -p 9292'
end
end
task :load_lib do
require_app('lib')
end
namespace :generate do
desc 'Create rbnacl key'
task :msg_key => :load_lib do
puts "New MSG_KEY (base64): #{SecureMessage.generate_key}"
end
desc 'Create cookie secret'
task :session_secret => :load_lib do
puts "New SESSION_SECRET (base64): #{SecureSession.generate_secret}"
end
end
namespace :session do
desc 'Wipe all sessions stored in Redis'
task :wipe => :load_lib do
require 'redis'
puts 'Deleting all sessions from Redis session store'
wiped = SecureSession.wipe_redis_sessions
puts "#{wiped.count} sessions deleted"
end
end
# rubocop:enable Style/HashSyntax