Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 55 lines (45 sloc) 1.357 kB
64110ca @czarneckid Initial commit to leaderboard.
czarneckid authored
1 require 'bundler'
52ecdf2 @czarneckid Simplify
czarneckid authored
2 Bundler::GemHelper.install_tasks
64110ca @czarneckid Initial commit to leaderboard.
czarneckid authored
3
52ecdf2 @czarneckid Simplify
czarneckid authored
4 require 'rake'
64110ca @czarneckid Initial commit to leaderboard.
czarneckid authored
5 require 'rake/testtask'
6 Rake::TestTask.new(:test) do |test|
7 test.libs << 'lib' << 'test'
8 test.pattern = 'test/**/test_*.rb'
9 test.verbose = true
10 end
11
7dbf0e1 @czarneckid Added test Redis configuration file. Ignoring test/db/*. Added Rakefi…
czarneckid authored
12 REDIS_DIR = File.expand_path(File.join("..", "test"), __FILE__)
13 REDIS_CNF = File.join(REDIS_DIR, "test.conf")
14 REDIS_PID = File.join(REDIS_DIR, "db", "redis.pid")
15 REDIS_LOCATION = ENV['REDIS_LOCATION']
16
17 task :default => :run
18
19 desc "Run tests and manage server start/stop"
a4dfdb4 @czarneckid Run the test task by default instead of testing all the rubies
czarneckid authored
20 task :run => [:start, :test, :stop]
7dbf0e1 @czarneckid Added test Redis configuration file. Ignoring test/db/*. Added Rakefi…
czarneckid authored
21
888c18d @czarneckid Added leaders method and tests.
czarneckid authored
22 desc "Run rcov and manage server start/stop"
23 task :rcoverage => [:start, :rcov, :stop]
24
7dbf0e1 @czarneckid Added test Redis configuration file. Ignoring test/db/*. Added Rakefi…
czarneckid authored
25 desc "Start the Redis server"
26 task :start do
27 redis_running = \
28 begin
29 File.exists?(REDIS_PID) && Process.kill(0, File.read(REDIS_PID).to_i)
30 rescue Errno::ESRCH
31 FileUtils.rm REDIS_PID
32 false
33 end
34
35 if REDIS_LOCATION
36 system "#{REDIS_LOCATION}/redis-server #{REDIS_CNF}" unless redis_running
37 else
38 system "redis-server #{REDIS_CNF}" unless redis_running
39 end
40 end
41
42 desc "Stop the Redis server"
43 task :stop do
44 if File.exists?(REDIS_PID)
45 Process.kill "INT", File.read(REDIS_PID).to_i
46 FileUtils.rm REDIS_PID
47 end
48 end
22419f9 @czarneckid Run tests under Ruby 1.8.7 and 1.9.2 to ensure compatibility
czarneckid authored
49
50 task :test_rubies do
a4dfdb4 @czarneckid Run the test task by default instead of testing all the rubies
czarneckid authored
51 Rake::Task['start'].execute
8aa2c5d Ruby 1.9.3-p0 support. Use SystemTimer gem as development dependency …
David Czarnecki authored
52 system "rvm 1.8.7@leaderboard_gem,1.9.2@leaderboard_gem,1.9.3@leaderboard_gem do rake test"
a4dfdb4 @czarneckid Run the test task by default instead of testing all the rubies
czarneckid authored
53 Rake::Task['stop'].execute
16935ad @czarneckid Specify the gemset when running the tests.
czarneckid authored
54 end
Something went wrong with that request. Please try again.