-
Notifications
You must be signed in to change notification settings - Fork 13
/
Rakefile
70 lines (55 loc) · 1.77 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
require 'rake'
require 'rspec/core/rake_task'
desc "Run all rspecs"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = Dir.glob('spec/**/*_spec.rb')
t.rspec_opts = '--format documentation'
# t.rspec_opts << ' more options'
end
desc "Run the integration tests"
RSpec::Core::RakeTask.new(:int) do |t|
t.pattern = Dir.glob('spec/**/integration_tests.rb')
t.rspec_opts = '--format documentation'
# t.rspec_opts << ' more options'
end
FFF_PLUGIN_DIR = "build/integration_test/vendor/ceedling/plugins/fake_function_framework"
def run_integration_test
sh "ceedling version"
chdir "build" do
# Create a new Ceedling project.
sh "ceedling new integration_test"
end
# Copy over the example project files.
cp_r "examples/fff_example/src/.", "build/integration_test/src"
cp_r "examples/fff_example/test/.", "build/integration_test/test"
cp_r "examples/fff_example/options/.", "build/integration_test/options"
cp "examples/fff_example/project.yml", "build/integration_test"
# Remove the fake_function_framework plugin folder (if it exists) from the new
# projet.
rm_rf FFF_PLUGIN_DIR
# Recreate the plugin folder.
mkdir_p FFF_PLUGIN_DIR
# Copy over the source from this fff plugin instance.
cp_r "lib", FFF_PLUGIN_DIR
cp_r "src", FFF_PLUGIN_DIR
cp_r "vendor", FFF_PLUGIN_DIR
chdir("build/integration_test") do
sh "ceedling clobber"
end
end
# Prepare to execute the integration tests.
task :int_test_prep do
# Remove any exsiting build files.
rm_rf "build"
# Create a new build folder.
mkdir_p "build"
run_integration_test
end
desc "Clean build"
task :clean do
rm_rf "build"
end
# The integration tests require the test environment to be set up.
task :int => [:int_test_prep]
# Run all the tests by default.
task :default => [:spec, :int]