-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
51 lines (41 loc) · 1.44 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
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
%w(rubygems rake rake/clean rake/rdoctask fileutils pp logger rack/mock halcyon).each{|dep|require dep}
include FileUtils
# Halcyon.root => the root application directory
# Halcyon.app => the application name
desc "Start the application on port 4647"
task :start do
sh "halcyon start -p 4647"
end
desc "Generate RDoc documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers' << '--inline-source' <<
'--main' << 'README' <<
'--title' << "#{Halcyon.app} Documentation" <<
'--charset' << 'utf-8'
rdoc.rdoc_dir = "doc"
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('app/**/*.rb')
rdoc.rdoc_files.include('lib/**/*.rb')
end
# = Custom Rake Tasks
#
# Add your custom rake tasks here.
desc "Load up the application environment"
task :env do
$log = ''
$logger = Logger.new(StringIO.new($log))
Halcyon.config = {:logger => $logger}
Halcyon::Runner.new
end
namespace(:db) do
desc "Migrate the database to the latest version"
task :migrate => :env do
current_version = Sequel::Migrator.get_current_migration_version(WeeDB::DB)
latest_version = Sequel::Migrator.apply(WeeDB::DB, Halcyon.paths[:lib]/'migrations')
puts "Database successfully migrated to latest version (#{latest_version})." if current_version < latest_version
puts "Migrations finished successfully."
end
end
# = Default Task
task :default => Rake::Task['start']