/
Rakefile
92 lines (73 loc) · 2.35 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
$:.unshift File.dirname(__FILE__)
require 'rubygems'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
require 'rake/clean'
require 'rake/rdoctask'
require 'rake/testtask'
require 'spec'
# Load other build files
Dir.glob("build/*.rake").each {|x| load x}
### Constants
PKG_NAME = "estelle"
PKG_VERSION = "0.1"
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
# Fixed up clean section to pick up extensions
CLEAN = FileList["**/*~", "**/*.bak", "**/core", 'ext/taglib/**/*.o', 'ext/**/*.dll', 'ext/**/*.so', 'ext/**/*.dylib', 'bin/*', 'data/*']
CLOBBER = FileList['ext/**/Makefile', 'ext/**/CMakeCache.txt']
########################
## Tasks
########################
desc "Process .in files"
task :expandify do |f|
Dir.glob("{lib,bin}/**/*.in").each() do |ex|
expand_file(ex, ex.gsub(/\.in$/, ''))
end
end
# Taglib
desc "Build the Taglib library"
task :taglib do |t|
sh "cd ext/taglib && cmake ."
sh "cd ext/taglib && make"
sh "mkdir -p bin"
Dir.glob("ext/**/*.{dll,so,dylib}").each {|x| sh "cp #{x} bin/"}
end
desc "Update missing tests"
task :buildtests do |t|
Dir.glob("{lib}/**/*.rb").each {|x| sh "./build_unit_test #{x}"}
end
desc "Run unit tests"
Rake::TestTask.new("test") do |t|
t.pattern = 'test/**/*.rb'
t.verbose = true
t.warning = true
end
desc "Run code coverage"
task :coverage do |t|
sh "rcov -xrefs " + Dir.glob("test/**/*.rb").join(' ') + " 2>/dev/null"
end
# Default Action
task :default => [
:taglib,
:updatepo,
:makemo,
:expandify,
]
task :alltests => [
:test,
:coverage
]
#######################
## Gettext section
#######################
require 'gettext/utils'
desc "Create mo-files for l10n"
task :makemo do
GetText.create_mofiles(true, "./po", "./data/locale")
end
desc "Update pot/po files to match new version."
task :updatepo do
GetText.update_pofiles(PKG_NAME,
Dir.glob("{app,lib}/**/*.{rb,rhtml}"),
"#{PKG_NAME} #{PKG_VERSION}")
end