-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
58 lines (48 loc) · 1.33 KB
/
Rakefile
File metadata and controls
58 lines (48 loc) · 1.33 KB
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
Dir.glob('./{config,lib,models,services,controllers}/init.rb').each do |file|
require file
end
require 'rake/testtask'
task :default => [:spec]
namespace :deploy do
task :config do
require 'config_env/rake_tasks'
ConfigEnv.path_to_config("#{__dir__}/config/config_env.rb")
Rake::Task['deploy:config_env:heroku'].invoke
end
end
namespace :db do
require 'sequel'
Sequel.extension :migration
desc 'Run migrations'
task :migrate do
puts "Environment: #{ENV['RACK_ENV'] || 'development'}"
puts 'Migrating to latest'
Sequel::Migrator.run(DB, 'db/migrations')
end
desc 'Perform migration reset (full rollback and migration)'
task :reset do
Sequel::Migrator.run(DB, 'db/migrations', target: 0)
Sequel::Migrator.run(DB, 'db/migrations')
end
desc 'Populate the database with test values'
task :seed do
load './db/seeds/user_secret_sharing.rb'
end
desc 'Reset and repopulate database'
task :reseed => [:reset, :seed]
end
desc 'Run all the tests'
Rake::TestTask.new(name=:spec) do |t|
t.pattern = 'specs/*_spec.rb'
end
namespace :key do
require 'rbnacl/libsodium'
require 'base64'
namespace :symmetric do
desc 'Create rbnacl key'
task :generate do
key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)
puts "KEY: #{Base64.strict_encode64 key}"
end
end
end