forked from lokka/lokka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
58 lines (47 loc) · 1.22 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
require './init'
require 'yard'
include Rake::DSL if defined? Rake::DSL
task :default => ['spec:setup', 'db:delete', :spec]
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
end