forked from zeroX-tj/rbrainz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
122 lines (103 loc) · 3.46 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -*- coding: utf-8 -*-
# $Id: Rakefile 291 2009-08-04 16:43:22Z phw $
# Copyright (c) 2007, Philipp Wolfer
# All rights reserved.
# See LICENSE for permissions.
# Rakefile for RBrainz
require 'rake/gempackagetask'
require 'rake/testtask'
require 'rake/rdoctask'
require './lib/rbrainz/version'
task :default do
puts "Please see 'rake --tasks' for an overview of the available tasks."
end
# Packaging tasks: -------------------------------------------------------
PKG_NAME = 'rbrainz'
PKG_VERSION = MusicBrainz::RBRAINZ_VERSION
PKG_FILES = FileList[
"Rakefile", "LICENSE", "README", "TODO", "CHANGES", "setup.rb",
"doc/README.rdoc",
"examples/**/*.rb",
"lib/**/*.rb",
"test/**/*.rb",
"test/test-data/**/*"
]
PKG_EXTRA_RDOC_FILES = ['doc/README.rdoc', 'LICENSE', 'TODO', 'CHANGES']
spec = Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.summary = 'Ruby library for the MusicBrainz XML web service.'
spec.name = PKG_NAME
spec.version = PKG_VERSION
spec.requirements << 'Optional: mb-discid >= 0.1.2 (for calculating disc IDs)'
spec.files = PKG_FILES
spec.description = <<EOF
RBrainz is a Ruby client library to access the MusicBrainz XML
web service. RBrainz supports the MusicBrainz XML Metadata Version 1.2,
including support for labels and extended release events.
RBrainz follows the design of python-musicbrainz2, the reference
implementation for a MusicBrainz client library. Developers used to
python-musicbrainz2 should already know most of RBrainz' interface.
However, RBrainz differs from python-musicbrainz2 wherever it makes
the library more Ruby like or easier to use.
EOF
spec.authors = ['Philipp Wolfer', 'Nigel Graham']
spec.email = '[email protected]'
spec.homepage = 'http://rbrainz.rubyforge.org'
spec.rubyforge_project = 'rbrainz'
spec.has_rdoc = true
spec.extra_rdoc_files = PKG_EXTRA_RDOC_FILES
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar_gz= true
end
# Build the RBrainz gem and install it"
task :install => [:test] do
sh %{ruby setup.rb}
end
# Test tasks: ------------------------------------------------------------
desc "Run the unit and functional tests"
task :test => [:test_units, :test_functional]
desc "Run just the unit tests"
Rake::TestTask.new(:test_units) do |test|
test.test_files = FileList['test/test*.rb']
test.libs = ['lib', 'test/lib']
test.warning = true
end
desc "Run just the functional tests"
Rake::TestTask.new(:test_functional) do |test|
test.test_files = FileList['test/functional*.rb']
test.libs = ['lib', 'test/lib']
test.warning = true
end
# Documentation tasks: ---------------------------------------------------
Rake::RDocTask.new do |rdoc|
rdoc.title = "RBrainz %s" % PKG_VERSION
rdoc.main = 'doc/README.rdoc'
rdoc.rdoc_dir = 'doc/api'
rdoc.rdoc_files.include('lib/**/*.rb', PKG_EXTRA_RDOC_FILES)
rdoc.options << '--inline-source' << '--line-numbers' \
<< '--charset=UTF-8' #<< '--diagram'
end
# Other tasks: -----------------------------------------------------------
def egrep(pattern)
Dir['**/*.rb'].each do |fn|
count = 0
open(fn) do |f|
while line = f.gets
count += 1
if line =~ pattern
puts "#{fn}:#{count}:#{line}"
end
end
end
end
end
desc "Look for TODO and FIXME tags in the code"
task :todo do
egrep(/#.*(FIXME|TODO)/)
end
desc "Print version information"
task :version do
puts "%s %s" % [PKG_NAME, PKG_VERSION]
end