-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
53 lines (45 loc) · 1.23 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
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
desc "git ci, git tag and git push"
task :release do
sh "git diff HEAD"
v = File.read('CHANGELOG.md')[/v[\d\.]+/]
puts "release as #{v}? [y/N]"
if $stdin.gets.chomp == "y"
sh "git ci -am '#{v}'"
sh "git tag '#{v}'"
sh "git push origin master --tags"
sh "bundle exec cap production deploy"
end
end
task default: :test