forked from braintree/braintree_java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (50 loc) · 1.48 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
mvn = "MAVEN_OPTS='-Dhttps.protocols=TLSv1.2' mvn"
task :default => :jar
task :clean do
sh "#{mvn} clean"
sh "rm *jar || true"
sh "rm -rf doc"
end
task :compile do
sh "#{mvn} compile"
end
namespace :test do
# Usage:
# rake test:unit
# rake test:unit[ConfigurationTest]
# rake test:unit[ConfigurationTest,testStringEnvironmentConstructor]
desc "run unit tests"
task :unit, [:file_name, :test_name] do |task, args|
if args.file_name.nil?
sh "#{mvn} test"
elsif args.test_name.nil?
sh "#{mvn} test -Dtest=com.braintreegateway.unittest.#{args.file_name}"
else
sh "#{mvn} test -Dtest=com.braintreegateway.unittest.#{args.file_name}##{args.test_name}"
end
end
# Usage:
# rake test:integration
# rake test:integration[PlanIT]
# rake test:integration[PlanIT,returnsAllPlans]
desc "run integration tests"
task :integration, [:file_name, :test_name] do |task, args|
if args.file_name.nil?
sh "#{mvn} verify -DskipUTs"
elsif args.test_name.nil?
sh "#{mvn} verify -DskipUTs -Dit.test=com.braintreegateway.integrationtest.#{args.file_name}"
else
sh "#{mvn} verify -DskipUTs -Dit.test=com.braintreegateway.integrationtest.#{args.file_name}##{args.test_name}"
end
end
desc "run unit and integration tests"
task :all do
sh "#{mvn} verify"
end
end
task :test => "test:all"
desc "compile, test, build a jar"
task :jar do
sh "#{mvn} verify package"
sh "cp target/braintree-java-*.jar ./"
end