-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
40 lines (33 loc) · 938 Bytes
/
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
require "sinatra/activerecord/rake"
require 'irb'
require 'securerandom'
require 'bcrypt'
require 'io/console'
require_relative 'app/nlog2.rb'
$config = YAML.load_file("config/nlog2.yml")
desc "Open irb with ActiveRecord"
task :console do
ARGV.clear # To prevent `Errno::ENOENT: No such file or directory @ rb_sysopen - console`
IRB.start
end
desc "Run test"
task :test do
sh "bundle exec rspec"
end
namespace :config do
desc "Generate config[:auth][:password_hash]"
task :hash_password do
puts "Type password"
pass1 = $stdin.noecho(&:gets).chomp
puts "Type password again"
pass2 = $stdin.noecho(&:gets).chomp
raise "Password mismatch" unless pass1 == pass2
puts "Add this to config[:auth][:password_hash]"
puts BCrypt::Password.create(pass1)
end
desc "Show list of supported time zone name"
task :zones do
puts ActiveSupport::TimeZone::MAPPING.keys
end
end
task default: :test