-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rakefile
65 lines (55 loc) · 1.62 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
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'echoe'
require 'yaml'
APP_NAME = "yahoo_currency"
APP_URL = "http://github.com/scottbarr/yahoo_currency/tree/master"
APP_DESCRIPTION = "Fetch currency exchange rates from Yahoo! Finance"
AUTHOR_NAME = "Scott Barr"
AUTHOR_EMAIL = "[email protected]"
#
# Create a version for this build from the config.yml and the BUILD_NUMBER
# environment variable.
#
def get_version
# read the config file
config = open("config.yml") {|f| YAML.load(f)}
# build the version number
version_major = config["version"]["major"]
version_minor = config["version"]["minor"]
version_build = ENV["BUILD_NUMBER"] ||= "0"
"#{version_major}.#{version_minor}.#{version_build}"
end
Rake::TestTask.new("test:units") { |t|
t.pattern = 'test/unit/*_test.rb'
t.verbose = true
t.warning = false
}
Rake::TestTask.new("test:integration") { |t|
t.pattern = 'test/integration/*_test.rb'
t.verbose = true
t.warning = false
}
# setup the gem
Echoe.new(APP_NAME, get_version) do |p|
p.description = APP_DESCRIPTION
p.url = APP_URL
p.author = AUTHOR_NAME
p.email = AUTHOR_EMAIL
p.ignore_pattern = ["tmp/*", "script/*"]
p.development_dependencies = []
end
# define a remove task method so the "test" task isn't breaking my stuff
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
# helper method to remove a task
def remove_task(task_name)
Rake.application.remove_task(task_name)
end
# remove the original test task
remove_task :test
task :test => ["test:units", "test:integration"]