This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
forked from kontera-technologies/graphite-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
63 lines (49 loc) · 1.54 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
$:.unshift File.join(File.dirname(__FILE__), 'lib')
Dir.chdir File.dirname __FILE__
require 'graphite-api'
require "rake/testtask"
require 'rubygems/package_task'
def message msg
puts "*** #{msg} ***"
end
task(:test => :functional) { ENV['with_coverage'] = "true" }
Rake::TestTask.new do |t|
t.libs << "tests"
t.pattern = "tests/**/*_test.rb"
end
task :functional do
some_failed = false
next unless ENV['SKIP_FUNC'].nil?
unless RUBY_COPYRIGHT.end_with?("Matsumoto")
puts("Functional tests are enabled only on MRI...")
next
end
message "Executing GraphiteAPI Functional Tests"
message "( You can skip them by passing SKIP_FUNC=true )"
Dir[File.expand_path("../tests/functional/*",__FILE__)].each do |file|
next unless file.end_with?(".rb")
now = Time.now.to_i
name = File.basename(file)
message "Executing #{name}"
Process.waitpid(Process.spawn("ruby", File.expand_path(file)))
took = "took #{Time.now.to_i - now} seconds"
if $?.success?
message "[PASS] #{name}, #{took}"
else
message "[FAIL] #{name}, #{took}"
some_failed = true
end
end
message "Done Executing GraphiteAPI Functional Tests"
abort "Some functional tests failed..." if some_failed
end
task :default => :test
task :gem => [:test,:clobber_package]
GraphiteAPI::GemSpec = eval File.read 'graphite-api.gemspec'
Gem::PackageTask.new(GraphiteAPI::GemSpec) do |p|
p.gem_spec = GraphiteAPI::GemSpec
end
task :install => [:gem] do
sh "gem install pkg/graphite-api"
Rake::Task['clobber_package'].execute
end