forked from cloudfoundry-attic/vcap-yeti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
74 lines (63 loc) · 2.09 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
$:.unshift(File.join(File.dirname(__FILE__), "lib"))
require "rspec/core/rake_task"
require "harness"
include BVT::Harness
desc "Prepare for running parallel specs"
task :prepare => [:build_test_apps, "users:create"]
namespace :users do
desc "Create 16 non-admin users (saved to #{VCAP_BVT_CONFIG_FILE})"
task :create do
RakeHelper.prepare_all(16)
end
end
namespace :orgs do
desc "Delete yeti-like organizations"
task :delete do
exec "./scripts/yeti-hunter.rb"
end
end
namespace :config do
desc "Clear current BVT config file"
task :clear_bvt do
require 'fileutils'
puts "Removing #{VCAP_BVT_CONFIG_FILE}"
FileUtils.rm_rf(VCAP_BVT_CONFIG_FILE)
end
end
TESTS_PATH = File.join(Dir.pwd, "assets")
VCAP_BVT_ASSETS_PACKAGES_HOME = File.join(File.dirname(__FILE__), ".assets-binaries")
TESTS_TO_BUILD = [
"#{TESTS_PATH}/java_web/app_with_startup_delay",
"#{TESTS_PATH}/java_web/java_tiny_app",
"#{TESTS_PATH}/java_web/tomcat-version-check-app",
"#{TESTS_PATH}/spring/spring_imagemagick"
]
desc "Build java test apps"
task :build_test_apps do
`mvn -v 2>&1`
error_message = "\nBVT need java development environment to build java-base apps.\n"+
"Please run 'sudo aptitude install maven2 default-jdk' on your Linux box"
raise error_message if $?.exitstatus != 0
ENV['MAVEN_OPTS'] = "-XX:MaxPermSize=256M"
TESTS_TO_BUILD.each do |test|
puts "\tBuilding '#{test}'"
Dir.chdir test do
sh('mvn clean package -DskipTests') do |success, _|
if success
binaryname = File.join("target", "*.{war,zip}")
binary_file = Dir.glob(binaryname).first
app_name = test.split('/')[-1]
file_type = '.' + binary_file.split('.')[-1]
file_name = app_name + file_type
target_file = File.join(VCAP_BVT_ASSETS_PACKAGES_HOME, file_name)
FileUtils.mkdir_p VCAP_BVT_ASSETS_PACKAGES_HOME
FileUtils.cp binary_file, target_file
else
sh("mvn clean -q")
fail "\tFailed to build #{test} - aborting build"
end
end
end
puts "\tCompleted building '#{test}'"
end
end