-
Notifications
You must be signed in to change notification settings - Fork 84
/
Rakefile
78 lines (64 loc) · 1.61 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
76
77
78
require './init'
require 'yard'
task default: ['spec:setup', 'db:delete', :spec]
module TempFixForRakeLastComment
def last_comment
last_description
end
end
Rake::Application.include(TempFixForRakeLastComment)
desc 'Migrate the Lokka database'
task 'db:migrate' do
puts 'Upgrading Database...'
Lokka::Database.new.connect.migrate
end
desc 'Execute seed script'
task 'db:seed' do
puts 'Initializing Database...'
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.logger.set_log STDERR, :debug, 'SQL: ', true
Lokka::Database.new.connect.seed
end
desc 'Delete database'
task 'db:delete' do
puts 'Delete Database...'
Lokka::Database.new.connect.migrate!
end
desc 'Reset database'
task 'db:reset' => %w[db:delete db:seed]
desc 'Set up database'
task 'db:setup' => %w[db:migrate db:seed]
desc 'Install gems'
task :bundle do
`bundle install --path vendor/bundle --without production test`
end
desc 'Install'
task install: %w[bundle db:setup]
desc 'Generate documentation for Lokka'
task :doc do
YARD::CLI::Yardoc.new.run
end
desc 'set ENV'
task 'spec:setup' do
ENV['RACK_ENV'] = ENV['LOKKA_ENV'] = 'test'
end
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(spec: 'spec:setup') do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rspec_opts = ['-cfs']
end
rescue LoadError => e
puts e.message
puts e.backtrace
end
namespace :admin do
desc 'Install dependencies for admin JavaScript'
task :install_deps do
system('cd public/admin && npm install')
end
desc 'Build admin js'
task :build_js => [:install_deps] do
system('cd public/admin && npm run build')
end
end